From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: [PATCH] Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- Minecraft.Client/AbstractContainerScreen.cpp | 14 +- Minecraft.Client/AbstractTexturePack.cpp | 49 +- Minecraft.Client/AbstractTexturePack.h | 2 +- Minecraft.Client/AchievementPopup.cpp | 6 +- Minecraft.Client/AchievementScreen.cpp | 8 +- Minecraft.Client/ArchiveFile.cpp | 20 +- Minecraft.Client/ArrowRenderer.cpp | 26 +- Minecraft.Client/BatRenderer.cpp | 2 +- Minecraft.Client/BlazeRenderer.cpp | 4 +- Minecraft.Client/BoatModel.cpp | 20 +- Minecraft.Client/BoatRenderer.cpp | 2 +- Minecraft.Client/BreakingItemParticle.cpp | 8 +- Minecraft.Client/BubbleParticle.cpp | 8 +- Minecraft.Client/BufferedImage.cpp | 22 +- Minecraft.Client/BufferedImage.h | 2 +- Minecraft.Client/ChatScreen.cpp | 6 +- Minecraft.Client/ChestRenderer.cpp | 18 +- Minecraft.Client/ChickenModel.cpp | 16 +- Minecraft.Client/Chunk.cpp | 32 +- Minecraft.Client/ClientConnection.cpp | 365 +- Minecraft.Client/ClockTexture.cpp | 16 +- Minecraft.Client/Common/Audio/SoundEngine.cpp | 32 +- Minecraft.Client/Common/Audio/SoundEngine.h | 31 +- Minecraft.Client/Common/Audio/stb_vorbis.h | 148 +- .../Common/Colours/ColourTable.cpp | 6 +- Minecraft.Client/Common/Consoles_App.cpp | 550 +-- Minecraft.Client/Common/Consoles_App.h | 12 +- Minecraft.Client/Common/DLC/DLCAudioFile.cpp | 18 +- Minecraft.Client/Common/DLC/DLCAudioFile.h | 10 +- Minecraft.Client/Common/DLC/DLCCapeFile.h | 2 +- .../Common/DLC/DLCColourTableFile.cpp | 4 +- .../Common/DLC/DLCColourTableFile.h | 6 +- Minecraft.Client/Common/DLC/DLCFile.h | 6 +- .../Common/DLC/DLCGameRulesFile.cpp | 2 +- .../Common/DLC/DLCGameRulesFile.h | 4 +- .../Common/DLC/DLCGameRulesHeader.cpp | 4 +- .../Common/DLC/DLCGameRulesHeader.h | 53 +- .../Common/DLC/DLCLocalisationFile.cpp | 2 +- .../Common/DLC/DLCLocalisationFile.h | 2 +- Minecraft.Client/Common/DLC/DLCManager.cpp | 101 +- Minecraft.Client/Common/DLC/DLCPack.cpp | 46 +- Minecraft.Client/Common/DLC/DLCPack.h | 4 +- Minecraft.Client/Common/DLC/DLCSkinFile.cpp | 6 +- Minecraft.Client/Common/DLC/DLCSkinFile.h | 8 +- .../Common/DLC/DLCTextureFile.cpp | 2 +- Minecraft.Client/Common/DLC/DLCTextureFile.h | 10 +- Minecraft.Client/Common/DLC/DLCUIDataFile.cpp | 4 +- Minecraft.Client/Common/DLC/DLCUIDataFile.h | 4 +- .../AddEnchantmentRuleDefinition.cpp | 4 +- .../GameRules/AddItemRuleDefinition.cpp | 10 +- .../ApplySchematicRuleDefinition.cpp | 32 +- .../GameRules/CollectItemRuleDefinition.cpp | 24 +- .../GameRules/CompleteAllRuleDefinition.cpp | 10 +- .../GameRules/CompoundGameRuleDefinition.cpp | 8 +- .../GameRules/ConsoleGenerateStructure.cpp | 22 +- .../GameRules/ConsoleGenerateStructure.h | 2 +- .../Common/GameRules/ConsoleSchematicFile.cpp | 78 +- Minecraft.Client/Common/GameRules/GameRule.h | 2 +- .../Common/GameRules/GameRuleDefinition.cpp | 2 +- .../Common/GameRules/GameRuleDefinition.h | 2 +- .../Common/GameRules/GameRuleManager.cpp | 68 +- .../GameRules/LevelGenerationOptions.cpp | 68 +- .../Common/GameRules/LevelGenerationOptions.h | 4 +- .../Common/GameRules/LevelRuleset.cpp | 8 +- .../Common/GameRules/StartFeature.cpp | 4 +- .../GameRules/UpdatePlayerRuleDefinition.cpp | 16 +- .../XboxStructureActionPlaceContainer.cpp | 8 +- .../XboxStructureActionPlaceSpawner.cpp | 4 +- .../Leaderboards/LeaderboardInterface.cpp | 4 +- .../Leaderboards/LeaderboardManager.cpp | 4 +- .../Leaderboards/SonyLeaderboardManager.cpp | 60 +- .../Common/Network/GameNetworkManager.cpp | 142 +- .../Common/Network/GameNetworkManager.h | 12 +- .../Network/PlatformNetworkManagerInterface.h | 2 +- .../Network/PlatformNetworkManagerStub.cpp | 75 +- .../Network/PlatformNetworkManagerStub.h | 2 +- Minecraft.Client/Common/Network/SessionInfo.h | 4 +- .../Common/Network/Sony/NetworkPlayerSony.cpp | 8 +- .../Sony/PlatformNetworkManagerSony.cpp | 76 +- .../Network/Sony/PlatformNetworkManagerSony.h | 2 +- .../Common/Network/Sony/SQRNetworkManager.cpp | 4 +- .../Common/Network/Sony/SQRNetworkPlayer.cpp | 18 +- .../Common/Network/Sony/SQRNetworkPlayer.h | 2 +- .../Common/Network/Sony/SonyRemoteStorage.cpp | 43 +- .../Common/Network/Sony/SonyRemoteStorage.h | 2 +- .../Common/Telemetry/TelemetryManager.cpp | 52 +- .../Common/Tutorial/ChangeStateConstraint.cpp | 14 +- .../Common/Tutorial/ChangeStateConstraint.h | 2 +- .../Common/Tutorial/ChoiceTask.cpp | 7 +- .../Common/Tutorial/CompleteUsingItemTask.cpp | 2 +- .../Common/Tutorial/ControllerTask.cpp | 2 +- .../Common/Tutorial/ControllerTask.h | 2 +- .../Common/Tutorial/CraftTask.cpp | 4 +- Minecraft.Client/Common/Tutorial/CraftTask.h | 4 +- .../Common/Tutorial/DiggerItemHint.cpp | 4 +- .../Common/Tutorial/EffectChangedTask.cpp | 2 +- .../Common/Tutorial/FullTutorial.cpp | 78 +- .../Tutorial/FullTutorialActiveTask.cpp | 2 +- Minecraft.Client/Common/Tutorial/InfoTask.cpp | 5 +- Minecraft.Client/Common/Tutorial/PickupTask.h | 2 +- .../Common/Tutorial/ProcedureCompoundTask.cpp | 2 +- .../Common/Tutorial/ProcedureCompoundTask.h | 2 +- .../Common/Tutorial/ProgressFlagTask.h | 2 +- .../Common/Tutorial/RideEntityTask.cpp | 2 +- .../Common/Tutorial/RideEntityTask.h | 2 +- Minecraft.Client/Common/Tutorial/StatTask.cpp | 4 +- .../Common/Tutorial/StateChangeTask.h | 2 +- .../Common/Tutorial/TakeItemHint.cpp | 2 +- Minecraft.Client/Common/Tutorial/Tutorial.cpp | 97 +- Minecraft.Client/Common/Tutorial/Tutorial.h | 4 +- .../Common/Tutorial/TutorialHint.cpp | 2 +- .../Common/Tutorial/TutorialMode.cpp | 8 +- .../Common/Tutorial/TutorialMode.h | 2 +- .../Common/Tutorial/TutorialTask.cpp | 2 +- .../Common/Tutorial/UseItemTask.h | 2 +- .../Common/Tutorial/UseTileTask.h | 4 +- .../Common/Tutorial/XuiCraftingTask.cpp | 4 +- .../Common/Tutorial/XuiCraftingTask.h | 4 +- Minecraft.Client/Common/UI/IUIController.h | 2 +- .../UI/IUIScene_AbstractContainerMenu.cpp | 73 +- .../Common/UI/IUIScene_AnvilMenu.cpp | 12 +- .../Common/UI/IUIScene_BeaconMenu.cpp | 12 +- .../Common/UI/IUIScene_CommandBlockMenu.cpp | 2 +- .../Common/UI/IUIScene_CraftingMenu.cpp | 34 +- .../Common/UI/IUIScene_CreativeMenu.cpp | 58 +- .../Common/UI/IUIScene_CreativeMenu.h | 2 +- .../Common/UI/IUIScene_EnchantingMenu.cpp | 2 +- Minecraft.Client/Common/UI/IUIScene_HUD.cpp | 24 +- .../Common/UI/IUIScene_PauseMenu.cpp | 30 +- .../Common/UI/IUIScene_StartGame.cpp | 32 +- .../Common/UI/IUIScene_TradingMenu.cpp | 38 +- Minecraft.Client/Common/UI/UI.h | 4 +- Minecraft.Client/Common/UI/UIBitmapFont.cpp | 20 +- .../Common/UI/UIComponent_Chat.cpp | 16 +- .../UI/UIComponent_DebugUIMarketingGuide.cpp | 4 +- .../Common/UI/UIComponent_MenuBackground.cpp | 14 +- .../Common/UI/UIComponent_Panorama.cpp | 8 +- .../Common/UI/UIComponent_Tooltips.cpp | 24 +- .../Common/UI/UIComponent_TutorialPopup.cpp | 86 +- Minecraft.Client/Common/UI/UIControl.cpp | 40 +- Minecraft.Client/Common/UI/UIControl_Base.cpp | 4 +- .../Common/UI/UIControl_ButtonList.cpp | 4 +- .../Common/UI/UIControl_CheckBox.cpp | 2 +- .../Common/UI/UIControl_DLCList.cpp | 4 +- .../Common/UI/UIControl_DynamicLabel.cpp | 8 +- .../Common/UI/UIControl_EnchantmentBook.cpp | 10 +- .../Common/UI/UIControl_EnchantmentButton.cpp | 10 +- .../Common/UI/UIControl_HTMLLabel.cpp | 10 +- .../Common/UI/UIControl_LeaderboardList.cpp | 2 +- .../Common/UI/UIControl_MinecraftHorse.cpp | 10 +- .../Common/UI/UIControl_MinecraftPlayer.cpp | 10 +- .../Common/UI/UIControl_PlayerList.cpp | 2 +- .../Common/UI/UIControl_PlayerSkinPreview.cpp | 36 +- .../Common/UI/UIControl_Progress.cpp | 2 +- .../Common/UI/UIControl_SaveList.cpp | 4 +- .../Common/UI/UIControl_Slider.cpp | 4 +- .../Common/UI/UIControl_SpaceIndicatorBar.cpp | 6 +- .../Common/UI/UIControl_TexturePackList.cpp | 8 +- Minecraft.Client/Common/UI/UIController.cpp | 386 +- Minecraft.Client/Common/UI/UIController.h | 12 +- Minecraft.Client/Common/UI/UIFontData.cpp | 6 +- Minecraft.Client/Common/UI/UIGroup.cpp | 38 +- Minecraft.Client/Common/UI/UILayer.cpp | 30 +- Minecraft.Client/Common/UI/UILayer.h | 2 +- Minecraft.Client/Common/UI/UIScene.cpp | 87 +- Minecraft.Client/Common/UI/UIScene.h | 2 +- .../UI/UIScene_AbstractContainerMenu.cpp | 28 +- .../Common/UI/UIScene_AbstractContainerMenu.h | 2 +- .../Common/UI/UIScene_AnvilMenu.cpp | 18 +- .../Common/UI/UIScene_BeaconMenu.cpp | 24 +- .../Common/UI/UIScene_BrewingStandMenu.cpp | 10 +- .../Common/UI/UIScene_ConnectingProgress.cpp | 6 +- .../Common/UI/UIScene_ContainerMenu.cpp | 10 +- .../Common/UI/UIScene_ControlsMenu.cpp | 14 +- .../Common/UI/UIScene_CraftingMenu.cpp | 36 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 59 +- .../Common/UI/UIScene_CreativeMenu.cpp | 24 +- .../Common/UI/UIScene_Credits.cpp | 8 +- .../Common/UI/UIScene_DLCMainMenu.cpp | 8 +- .../Common/UI/UIScene_DLCOffersMenu.cpp | 30 +- .../Common/UI/UIScene_DeathMenu.cpp | 14 +- .../UI/UIScene_DebugCreateSchematic.cpp | 146 +- .../Common/UI/UIScene_DebugOverlay.cpp | 56 +- .../Common/UI/UIScene_DebugSetCamera.cpp | 14 +- .../Common/UI/UIScene_DispenserMenu.cpp | 10 +- Minecraft.Client/Common/UI/UIScene_EULA.cpp | 6 +- .../Common/UI/UIScene_EnchantingMenu.cpp | 14 +- .../Common/UI/UIScene_EndPoem.cpp | 12 +- .../Common/UI/UIScene_FireworksMenu.cpp | 10 +- .../Common/UI/UIScene_FullscreenProgress.cpp | 11 +- .../Common/UI/UIScene_FurnaceMenu.cpp | 10 +- Minecraft.Client/Common/UI/UIScene_HUD.cpp | 42 +- .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 10 +- .../Common/UI/UIScene_HopperMenu.cpp | 10 +- .../Common/UI/UIScene_HorseInventoryMenu.cpp | 12 +- .../Common/UI/UIScene_HowToPlay.cpp | 16 +- .../Common/UI/UIScene_HowToPlayMenu.cpp | 6 +- .../UI/UIScene_InGameHostOptionsMenu.cpp | 4 +- .../Common/UI/UIScene_InGameInfoMenu.cpp | 36 +- .../UI/UIScene_InGamePlayerOptionsMenu.cpp | 29 +- .../UI/UIScene_InGameSaveManagementMenu.cpp | 30 +- .../Common/UI/UIScene_InventoryMenu.cpp | 16 +- .../Common/UI/UIScene_JoinMenu.cpp | 28 +- .../Common/UI/UIScene_Keyboard.cpp | 28 +- .../Common/UI/UIScene_LanguageSelector.cpp | 8 +- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 26 +- .../Common/UI/UIScene_LeaderboardsMenu.cpp | 40 +- .../Common/UI/UIScene_LoadMenu.cpp | 74 +- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 164 +- .../Common/UI/UIScene_MainMenu.cpp | 84 +- .../Common/UI/UIScene_MessageBox.cpp | 10 +- .../Common/UI/UIScene_NewUpdateMessage.cpp | 6 +- .../Common/UI/UIScene_PauseMenu.cpp | 48 +- .../Common/UI/UIScene_QuadrantSignin.cpp | 10 +- .../Common/UI/UIScene_ReinstallMenu.cpp | 2 +- .../Common/UI/UIScene_SaveMessage.cpp | 4 +- .../Common/UI/UIScene_SettingsAudioMenu.cpp | 6 +- .../Common/UI/UIScene_SettingsControlMenu.cpp | 6 +- .../UI/UIScene_SettingsGraphicsMenu.cpp | 61 +- .../Common/UI/UIScene_SettingsMenu.cpp | 10 +- .../Common/UI/UIScene_SettingsOptionsMenu.cpp | 14 +- .../Common/UI/UIScene_SettingsUIMenu.cpp | 10 +- .../Common/UI/UIScene_SignEntryMenu.cpp | 16 +- .../Common/UI/UIScene_SkinSelectMenu.cpp | 80 +- .../Common/UI/UIScene_TeleportMenu.cpp | 22 +- .../Common/UI/UIScene_TradingMenu.cpp | 20 +- .../Common/UI/UIScene_TrialExitUpsell.cpp | 2 +- Minecraft.Client/Common/UI/UIString.cpp | 8 +- Minecraft.Client/Common/UI/UIStructs.h | 24 +- Minecraft.Client/Common/UI/UITTFFont.cpp | 6 +- Minecraft.Client/Common/XUI/XUI_Chat.cpp | 4 +- .../Common/XUI/XUI_ConnectingProgress.cpp | 4 +- .../Common/XUI/XUI_Ctrl_4JEdit.cpp | 10 +- .../Common/XUI/XUI_Ctrl_4JIcon.cpp | 2 +- .../Common/XUI/XUI_Ctrl_4JList.cpp | 16 +- .../Common/XUI/XUI_Ctrl_BrewProgress.cpp | 4 +- .../Common/XUI/XUI_Ctrl_BubblesProgress.cpp | 4 +- .../Common/XUI/XUI_Ctrl_BurnProgress.cpp | 4 +- .../XUI/XUI_Ctrl_CraftIngredientSlot.cpp | 8 +- .../Common/XUI/XUI_Ctrl_EnchantButton.cpp | 14 +- .../Common/XUI/XUI_Ctrl_EnchantmentBook.cpp | 26 +- .../XUI/XUI_Ctrl_EnchantmentButtonText.cpp | 22 +- .../Common/XUI/XUI_Ctrl_FireProgress.cpp | 4 +- .../Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp | 16 +- .../XUI/XUI_Ctrl_MinecraftSkinPreview.cpp | 36 +- .../Common/XUI/XUI_Ctrl_MinecraftSlot.cpp | 58 +- .../Common/XUI/XUI_Ctrl_MobEffect.cpp | 4 +- .../Common/XUI/XUI_Ctrl_SliderWrapper.cpp | 10 +- .../Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp | 64 +- .../Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h | 2 +- .../Common/XUI/XUI_Ctrl_SlotList.cpp | 4 +- .../Common/XUI/XUI_Ctrl_SplashPulser.cpp | 8 +- .../Common/XUI/XUI_CustomMessages.h | 6 +- Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp | 76 +- Minecraft.Client/Common/XUI/XUI_Death.cpp | 8 +- .../Common/XUI/XUI_DebugItemEditor.cpp | 14 +- .../Common/XUI/XUI_DebugOverlay.cpp | 42 +- .../Common/XUI/XUI_DebugSetCamera.cpp | 14 +- Minecraft.Client/Common/XUI/XUI_DebugTips.cpp | 2 +- .../Common/XUI/XUI_FullscreenProgress.cpp | 14 +- Minecraft.Client/Common/XUI/XUI_HUD.cpp | 68 +- .../Common/XUI/XUI_HelpAndOptions.cpp | 12 +- .../Common/XUI/XUI_HelpControls.cpp | 24 +- .../Common/XUI/XUI_HelpCredits.cpp | 6 +- .../Common/XUI/XUI_HelpHowToPlay.cpp | 18 +- .../Common/XUI/XUI_HowToPlayMenu.cpp | 12 +- .../Common/XUI/XUI_InGameHostOptions.cpp | 6 +- .../Common/XUI/XUI_InGameInfo.cpp | 28 +- .../Common/XUI/XUI_InGamePlayerOptions.cpp | 64 +- .../Common/XUI/XUI_Leaderboards.cpp | 116 +- .../Common/XUI/XUI_LoadSettings.cpp | 104 +- Minecraft.Client/Common/XUI/XUI_MainMenu.cpp | 34 +- .../Common/XUI/XUI_MultiGameCreate.cpp | 82 +- .../Common/XUI/XUI_MultiGameInfo.cpp | 20 +- .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 138 +- .../XUI/XUI_MultiGameLaunchMoreOptions.cpp | 4 +- .../Common/XUI/XUI_NewUpdateMessage.cpp | 2 +- Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp | 68 +- Minecraft.Client/Common/XUI/XUI_Reinstall.cpp | 10 +- .../XUI/XUI_Scene_AbstractContainer.cpp | 8 +- .../Common/XUI/XUI_Scene_Anvil.cpp | 24 +- .../Common/XUI/XUI_Scene_Base.cpp | 131 +- .../Common/XUI/XUI_Scene_BrewingStand.cpp | 14 +- .../Common/XUI/XUI_Scene_Container.cpp | 18 +- .../Common/XUI/XUI_Scene_CraftingPanel.cpp | 40 +- .../Common/XUI/XUI_Scene_Enchant.cpp | 14 +- .../Common/XUI/XUI_Scene_Furnace.cpp | 14 +- .../Common/XUI/XUI_Scene_Inventory.cpp | 20 +- .../XUI/XUI_Scene_Inventory_Creative.cpp | 22 +- .../Common/XUI/XUI_Scene_Trading.cpp | 16 +- .../Common/XUI/XUI_Scene_Trap.cpp | 14 +- Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp | 16 +- .../Common/XUI/XUI_SettingsAll.cpp | 8 +- .../Common/XUI/XUI_SettingsAudio.cpp | 12 +- .../Common/XUI/XUI_SettingsControl.cpp | 12 +- .../Common/XUI/XUI_SettingsGraphics.cpp | 12 +- .../Common/XUI/XUI_SettingsOptions.cpp | 12 +- .../Common/XUI/XUI_SettingsUI.cpp | 12 +- Minecraft.Client/Common/XUI/XUI_SignEntry.cpp | 6 +- .../Common/XUI/XUI_SkinSelect.cpp | 68 +- .../Common/XUI/XUI_SocialPost.cpp | 8 +- Minecraft.Client/Common/XUI/XUI_Teleport.cpp | 10 +- Minecraft.Client/Common/XUI/XUI_TextEntry.cpp | 2 +- .../Common/XUI/XUI_TransferToXboxOne.cpp | 38 +- .../Common/XUI/XUI_TrialExitUpsell.cpp | 2 +- .../Common/XUI/XUI_TutorialPopup.cpp | 44 +- Minecraft.Client/Common/XUI/XUI_debug.cpp | 10 +- Minecraft.Client/Common/zlib/crc32.c | 1966 ++++---- Minecraft.Client/Common/zlib/trees.c | 2238 ++++----- Minecraft.Client/Common/zlib/zlib.h | 4114 ++++++++--------- Minecraft.Client/Common/zlib/zutil.c | 624 +-- Minecraft.Client/Common/zlib/zutil.h | 662 +-- Minecraft.Client/CompassTexture.cpp | 24 +- Minecraft.Client/ConnectScreen.cpp | 10 +- Minecraft.Client/CreateWorldScreen.cpp | 6 +- Minecraft.Client/CreeperRenderer.cpp | 4 +- Minecraft.Client/CritParticle2.cpp | 4 +- Minecraft.Client/DLCTexturePack.cpp | 91 +- Minecraft.Client/DLCTexturePack.h | 2 +- Minecraft.Client/DeathScreen.cpp | 6 +- Minecraft.Client/DefaultRenderer.h | 2 +- Minecraft.Client/DefaultTexturePack.cpp | 6 +- Minecraft.Client/DefaultTexturePack.h | 2 +- Minecraft.Client/DerivedServerLevel.cpp | 4 +- Minecraft.Client/DisconnectedScreen.cpp | 2 +- Minecraft.Client/DragonBreathParticle.cpp | 4 +- Minecraft.Client/DragonModel.cpp | 8 +- Minecraft.Client/DripParticle.cpp | 2 +- .../Durango/4JLibs/inc/4J_Input.h | 8 +- .../Durango/4JLibs/inc/4J_Profile.h | 2 +- .../Durango/4JLibs/inc/4J_Render.h | 6 +- .../Durango/4JLibs/inc/4J_Storage.h | 10 +- Minecraft.Client/Durango/ApplicationView.cpp | 6 +- .../Durango/DurangoExtras/DurangoStubs.cpp | 2 +- Minecraft.Client/Durango/Durango_App.cpp | 59 +- Minecraft.Client/Durango/Durango_App.h | 4 +- .../Durango/Durango_Minecraft.cpp | 22 +- .../Durango/Durango_UIController.cpp | 6 +- .../Iggy/gdraw/gdraw_d3d10_shaders.inl | 22 +- .../Durango/Iggy/gdraw/gdraw_d3d11.cpp | 16 +- .../Durango/Iggy/gdraw/gdraw_d3d11.h | 4 +- .../Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl | 146 +- .../Durango/Iggy/gdraw/gdraw_shared.inl | 86 +- Minecraft.Client/Durango/Iggy/include/gdraw.h | 8 +- .../Durango/Iggy/include/iggyexpruntime.h | 4 +- .../DurangoLeaderboardManager.cpp | 26 +- .../Leaderboards/DurangoStatsDebugger.cpp | 4 +- .../Durango/Leaderboards/GameProgress.cpp | 8 +- .../Durango/Network/ChatIntegrationLayer.h | 2 +- .../Durango/Network/DQRNetworkManager.cpp | 90 +- .../Durango/Network/DQRNetworkManager.h | 2 +- .../DQRNetworkManager_FriendSessions.cpp | 12 +- .../Network/DQRNetworkManager_SendReceive.cpp | 16 +- .../Network/DQRNetworkManager_XRNSEvent.cpp | 14 +- .../Durango/Network/DQRNetworkPlayer.cpp | 2 +- .../Durango/Network/NetworkPlayerDurango.cpp | 6 +- .../Durango/Network/PartyController.cpp | 14 +- .../Network/PlatformNetworkManagerDurango.cpp | 60 +- .../Network/PlatformNetworkManagerDurango.h | 2 +- Minecraft.Client/Durango/Network/base64.cpp | 6 +- .../Durango/Sentient/DurangoTelemetry.cpp | 6 +- .../Events-XBLA.8-149E11AEEvents.h | 96 +- Minecraft.Client/Durango/XML/ATGXmlParser.cpp | 61 +- Minecraft.Client/Durango/XML/ATGXmlParser.h | 2 +- .../Durango/XML/xmlFilesCallback.h | 8 +- Minecraft.Client/EchantmentTableParticle.cpp | 12 +- Minecraft.Client/EnchantTableRenderer.cpp | 2 +- Minecraft.Client/EnderChestRenderer.cpp | 2 +- Minecraft.Client/EnderCrystalRenderer.cpp | 2 +- Minecraft.Client/EnderDragonRenderer.cpp | 14 +- Minecraft.Client/EnderParticle.cpp | 14 +- Minecraft.Client/EndermanRenderer.cpp | 2 +- Minecraft.Client/EntityRenderDispatcher.cpp | 6 +- Minecraft.Client/EntityRenderer.cpp | 130 +- Minecraft.Client/EntityTileRenderer.cpp | 6 +- Minecraft.Client/EntityTracker.cpp | 14 +- Minecraft.Client/ExperienceOrbRenderer.cpp | 8 +- Minecraft.Client/ExplodeParticle.cpp | 14 +- Minecraft.Client/Extrax64Stubs.cpp | 42 +- Minecraft.Client/FallingTileRenderer.cpp | 6 +- Minecraft.Client/FileTexturePack.cpp | 2 +- Minecraft.Client/FireballRenderer.cpp | 22 +- Minecraft.Client/FireworksParticles.cpp | 54 +- Minecraft.Client/FishingHookRenderer.cpp | 22 +- Minecraft.Client/FlameParticle.cpp | 6 +- Minecraft.Client/FolderTexturePack.cpp | 4 +- Minecraft.Client/FolderTexturePack.h | 2 +- Minecraft.Client/Font.cpp | 6 +- Minecraft.Client/Font.h | 2 +- Minecraft.Client/FootstepParticle.cpp | 14 +- Minecraft.Client/GameRenderer.cpp | 232 +- Minecraft.Client/GhastModel.cpp | 2 +- Minecraft.Client/Gui.cpp | 85 +- Minecraft.Client/Gui.h | 2 +- Minecraft.Client/GuiParticle.cpp | 4 +- Minecraft.Client/HugeExplosionParticle.cpp | 10 +- .../HugeExplosionSeedParticle.cpp | 4 +- Minecraft.Client/HumanoidMobRenderer.cpp | 28 +- Minecraft.Client/HumanoidModel.cpp | 12 +- Minecraft.Client/Input.cpp | 8 +- Minecraft.Client/InventoryScreen.cpp | 4 +- Minecraft.Client/ItemFrameRenderer.cpp | 16 +- Minecraft.Client/ItemInHandRenderer.cpp | 40 +- Minecraft.Client/ItemRenderer.cpp | 66 +- Minecraft.Client/ItemSpriteRenderer.cpp | 12 +- Minecraft.Client/JoinMultiplayerScreen.cpp | 4 +- Minecraft.Client/LavaParticle.cpp | 6 +- Minecraft.Client/LavaSlimeModel.cpp | 2 +- Minecraft.Client/LavaSlimeRenderer.cpp | 2 +- Minecraft.Client/LeashKnotRenderer.cpp | 2 +- Minecraft.Client/LevelRenderer.cpp | 400 +- Minecraft.Client/Lighting.cpp | 2 +- Minecraft.Client/LightningBoltRenderer.cpp | 4 +- Minecraft.Client/LivingEntityRenderer.cpp | 44 +- Minecraft.Client/LocalPlayer.cpp | 106 +- Minecraft.Client/MemTexture.cpp | 2 +- Minecraft.Client/MinecartModel.cpp | 24 +- Minecraft.Client/MinecartRenderer.cpp | 14 +- Minecraft.Client/Minecraft.cpp | 516 +-- Minecraft.Client/Minecraft.h | 2 +- Minecraft.Client/MinecraftServer.cpp | 184 +- Minecraft.Client/MinecraftServer.h | 7 +- Minecraft.Client/Minimap.cpp | 38 +- Minecraft.Client/MobRenderer.cpp | 20 +- .../MobSkinMemTextureProcessor.cpp | 4 +- Minecraft.Client/MobSkinTextureProcessor.cpp | 4 +- Minecraft.Client/MobSpawnerRenderer.cpp | 6 +- Minecraft.Client/Model.h | 4 +- Minecraft.Client/ModelHorse.cpp | 4 +- Minecraft.Client/ModelPart.cpp | 16 +- Minecraft.Client/MultiPlayerChunkCache.cpp | 22 +- Minecraft.Client/MultiPlayerGameMode.cpp | 72 +- Minecraft.Client/MultiPlayerGameMode.h | 4 +- Minecraft.Client/MultiPlayerLevel.cpp | 30 +- Minecraft.Client/MultiPlayerLocalPlayer.cpp | 80 +- Minecraft.Client/MushroomCowRenderer.cpp | 2 +- Minecraft.Client/NameEntryScreen.cpp | 2 +- Minecraft.Client/NetherPortalParticle.cpp | 14 +- Minecraft.Client/NoteParticle.cpp | 4 +- Minecraft.Client/OffsettedRenderList.cpp | 6 +- Minecraft.Client/Options.cpp | 10 +- Minecraft.Client/OptionsScreen.cpp | 4 +- .../Orbis/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h | 6 +- .../Orbis/4JLibs/inc/4J_Storage.h | 8 +- .../Orbis/Iggy/gdraw/gdraw_orbis.cpp | 100 +- .../Orbis/Iggy/gdraw/gdraw_orbis.h | 6 +- .../Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl | 160 +- .../Orbis/Iggy/gdraw/gdraw_shared.inl | 86 +- Minecraft.Client/Orbis/Iggy/include/gdraw.h | 8 +- .../Orbis/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/OrbisLeaderboardManager.cpp | 60 +- .../Orbis/Network/Orbis_NPToolkit.cpp | 4 +- .../Orbis/Network/SQRNetworkManager_Orbis.cpp | 132 +- .../Orbis/Network/SQRNetworkManager_Orbis.h | 2 +- .../Orbis/Network/SonyCommerce_Orbis.cpp | 56 +- .../Orbis/Network/SonyCommerce_Orbis.h | 4 +- .../Orbis/Network/SonyHttp_Orbis.cpp | 16 +- .../Orbis/Network/SonyRemoteStorage_Orbis.cpp | 6 +- .../Orbis/Network/SonyVoiceChat_Orbis.cpp | 14 +- .../Orbis/OrbisExtras/OrbisStubs.cpp | 44 +- .../Orbis/OrbisExtras/TLSStorage.cpp | 10 +- Minecraft.Client/Orbis/OrbisExtras/winerror.h | 2 +- Minecraft.Client/Orbis/Orbis_App.cpp | 68 +- Minecraft.Client/Orbis/Orbis_App.h | 2 +- Minecraft.Client/Orbis/Orbis_Minecraft.cpp | 46 +- Minecraft.Client/Orbis/Orbis_UIController.cpp | 4 +- Minecraft.Client/Orbis/XML/ATGXmlParser.h | 2 +- Minecraft.Client/Orbis/user_malloc.cpp | 6 +- .../Orbis/user_malloc_for_tls.cpp | 6 +- Minecraft.Client/Orbis/user_new.cpp | 28 +- .../PS3/4JLibs/STO_TitleSmallStorage.cpp | 16 +- Minecraft.Client/PS3/4JLibs/inc/4J_Input.h | 4 +- Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/PS3/4JLibs/inc/4J_Render.h | 6 +- Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h | 10 +- .../PS3/Audio/PS3_SoundEngine.cpp | 8 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm.cpp | 84 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm.h | 2 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl | 154 +- .../PS3/Iggy/gdraw/gdraw_shared.inl | 86 +- Minecraft.Client/PS3/Iggy/include/gdraw.h | 8 +- .../PS3/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/PS3LeaderboardManager.cpp | 52 +- .../PS3/Network/SQRNetworkManager_PS3.cpp | 128 +- .../PS3/Network/SQRNetworkManager_PS3.h | 2 +- .../PS3/Network/SonyCommerce_PS3.cpp | 52 +- .../PS3/Network/SonyCommerce_PS3.h | 4 +- Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp | 54 +- .../PS3/Network/SonyRemoteStorage_PS3.cpp | 22 +- .../PS3/Network/SonyVoiceChat.cpp | 14 +- .../PS3/PS3Extras/C4JSpursJob.cpp | 14 +- Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h | 4 +- .../PS3/PS3Extras/C4JThread_SPU.cpp | 2 +- Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp | 8 +- Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp | 18 +- .../PS3/PS3Extras/ShutdownManager.cpp | 4 +- Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/winerror.h | 2 +- Minecraft.Client/PS3/PS3_App.cpp | 60 +- Minecraft.Client/PS3/PS3_App.h | 2 +- Minecraft.Client/PS3/PS3_Minecraft.cpp | 34 +- .../PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h | 4 +- .../SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h | 2 +- .../ChunkUpdate/ChunkRebuildData.cpp | 130 +- .../PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h | 2 +- .../ChunkUpdate/HalfSlabTile_SPU.cpp | 2 +- .../SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h | 20 +- .../SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp | 4 +- .../ChunkUpdate/PistonBaseTile_SPU.h | 2 +- .../ChunkUpdate/PistonExtensionTile_SPU.h | 2 +- .../ChunkUpdate/PistonMovingPiece_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/PortalTile_SPU.h | 2 +- .../ChunkUpdate/PressurePlateTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h | 2 +- .../ChunkUpdate/RedStoneDustTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp | 44 +- .../ChunkUpdate/TheEndPortalFrameTile_SPU.h | 2 +- .../ChunkUpdate/ThinFenceTile_SPU.cpp | 2 +- .../SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h | 2 +- .../ChunkUpdate/TileRenderer_SPU.cpp | 306 +- .../SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp | 36 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h | 4 +- .../SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h | 6 +- .../CompressedTileStorage_SPU.cpp | 8 +- Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h | 4 +- .../PSVita/4JLibs/inc/4J_Profile.h | 2 +- .../PSVita/4JLibs/inc/4J_Render.h | 6 +- .../PSVita/4JLibs/inc/4J_Storage.h | 6 +- .../PSVita/Iggy/gdraw/gdraw_psp2.cpp | 108 +- .../PSVita/Iggy/gdraw/gdraw_psp2.h | 4 +- .../PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl | 46 +- .../PSVita/Iggy/gdraw/gdraw_shared.inl | 86 +- Minecraft.Client/PSVita/Iggy/include/gdraw.h | 8 +- .../PSVita/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/PSVitaLeaderboardManager.cpp | 2 +- .../PSVita/Network/PSVita_NPToolkit.cpp | 6 +- .../Network/SQRNetworkManager_AdHoc_Vita.cpp | 112 +- .../Network/SQRNetworkManager_AdHoc_Vita.h | 2 +- .../PSVita/Network/SQRNetworkManager_Vita.cpp | 140 +- .../PSVita/Network/SQRNetworkManager_Vita.h | 2 +- .../PSVita/Network/SonyCommerce_Vita.cpp | 60 +- .../PSVita/Network/SonyCommerce_Vita.h | 4 +- .../PSVita/Network/SonyHttp_Vita.cpp | 8 +- .../PSVita/Network/SonyRemoteStorage_Vita.cpp | 8 +- .../PSVita/Network/SonyVoiceChat_Vita.cpp | 22 +- .../PSVita/PSVitaExtras/CustomMap.cpp | 12 +- .../PSVita/PSVitaExtras/CustomSet.cpp | 12 +- .../PSVita/PSVitaExtras/PSVitaStrings.cpp | 4 +- .../PSVita/PSVitaExtras/PSVitaTLSStorage.cpp | 14 +- .../PSVita/PSVitaExtras/PsVitaStubs.cpp | 34 +- .../PSVita/PSVitaExtras/ShutdownManager.cpp | 4 +- .../PSVita/PSVitaExtras/libdivide.h | 64 +- .../PSVita/PSVitaExtras/user_malloc.c | 26 +- .../PSVita/PSVitaExtras/user_malloc_for_tls.c | 6 +- .../PSVita/PSVitaExtras/user_new.cpp | 26 +- Minecraft.Client/PSVita/PSVitaExtras/zlib.h | 10 +- Minecraft.Client/PSVita/PSVita_App.cpp | 86 +- Minecraft.Client/PSVita/PSVita_App.h | 2 +- Minecraft.Client/PSVita/PSVita_Minecraft.cpp | 18 +- .../PSVita/PSVita_UIController.cpp | 2 +- Minecraft.Client/PSVita/XML/ATGXmlParser.h | 2 +- Minecraft.Client/PaintingRenderer.cpp | 2 +- Minecraft.Client/Particle.cpp | 20 +- Minecraft.Client/ParticleEngine.cpp | 10 +- Minecraft.Client/PauseScreen.cpp | 6 +- Minecraft.Client/PendingConnection.cpp | 18 +- Minecraft.Client/PistonPieceRenderer.cpp | 10 +- Minecraft.Client/PlayerChunkMap.cpp | 76 +- Minecraft.Client/PlayerCloudParticle.cpp | 6 +- Minecraft.Client/PlayerConnection.cpp | 188 +- Minecraft.Client/PlayerList.cpp | 224 +- Minecraft.Client/PlayerRenderer.cpp | 48 +- Minecraft.Client/Polygon.cpp | 6 +- Minecraft.Client/PreStitchedTextureMap.cpp | 22 +- Minecraft.Client/QuadrupedModel.cpp | 12 +- Minecraft.Client/ReceivingLevelScreen.cpp | 4 +- Minecraft.Client/RedDustParticle.cpp | 12 +- Minecraft.Client/RemotePlayer.cpp | 8 +- Minecraft.Client/RenameWorldScreen.cpp | 2 +- Minecraft.Client/ResourceLocation.h | 2 +- Minecraft.Client/Screen.cpp | 22 +- Minecraft.Client/ScreenSizeCalculator.cpp | 8 +- Minecraft.Client/ScrolledSelectionList.cpp | 4 +- Minecraft.Client/SelectWorldScreen.cpp | 24 +- Minecraft.Client/ServerChunkCache.cpp | 80 +- Minecraft.Client/ServerConnection.cpp | 4 +- Minecraft.Client/ServerLevel.cpp | 62 +- Minecraft.Client/ServerLevelListener.cpp | 6 +- Minecraft.Client/ServerPlayer.cpp | 208 +- Minecraft.Client/ServerPlayerGameMode.cpp | 32 +- Minecraft.Client/ServerPlayerGameMode.h | 2 +- Minecraft.Client/ServerScoreboard.cpp | 10 +- Minecraft.Client/Settings.cpp | 8 +- Minecraft.Client/SheepRenderer.cpp | 2 +- Minecraft.Client/SignRenderer.cpp | 4 +- Minecraft.Client/SilverfishModel.cpp | 6 +- Minecraft.Client/SkullTileRenderer.cpp | 4 +- Minecraft.Client/SlideButton.cpp | 8 +- Minecraft.Client/SlimeModel.cpp | 8 +- Minecraft.Client/SlimeRenderer.cpp | 2 +- Minecraft.Client/SmallButton.cpp | 4 +- Minecraft.Client/SmokeParticle.cpp | 4 +- Minecraft.Client/SnowManRenderer.cpp | 6 +- Minecraft.Client/SnowShovelParticle.cpp | 6 +- Minecraft.Client/SpellParticle.cpp | 2 +- Minecraft.Client/SpiderModel.cpp | 22 +- Minecraft.Client/SquidModel.cpp | 12 +- Minecraft.Client/StatsCounter.cpp | 52 +- Minecraft.Client/StatsScreen.cpp | 24 +- Minecraft.Client/StitchSlot.cpp | 10 +- Minecraft.Client/StitchedTexture.cpp | 32 +- Minecraft.Client/Stitcher.cpp | 6 +- Minecraft.Client/SuspendedParticle.cpp | 2 +- Minecraft.Client/SuspendedTownParticle.cpp | 2 +- Minecraft.Client/TakeAnimationParticle.cpp | 2 +- Minecraft.Client/TeleportCommand.cpp | 4 +- Minecraft.Client/TerrainParticle.cpp | 8 +- Minecraft.Client/Tesselator.cpp | 32 +- Minecraft.Client/TextEditScreen.cpp | 6 +- Minecraft.Client/Texture.cpp | 64 +- Minecraft.Client/Texture.h | 2 +- Minecraft.Client/TextureHolder.cpp | 6 +- Minecraft.Client/TextureManager.cpp | 12 +- Minecraft.Client/TextureMap.cpp | 20 +- Minecraft.Client/TexturePack.cpp | 6 +- Minecraft.Client/TexturePack.h | 4 +- Minecraft.Client/TexturePackRepository.cpp | 37 +- Minecraft.Client/Textures.cpp | 104 +- Minecraft.Client/TheEndPortalRenderer.cpp | 10 +- .../TileEntityRenderDispatcher.cpp | 20 +- Minecraft.Client/TileEntityRenderer.cpp | 4 +- Minecraft.Client/TileRenderer.cpp | 530 +-- Minecraft.Client/Timer.cpp | 24 +- Minecraft.Client/TitleScreen.cpp | 4 +- Minecraft.Client/TntRenderer.cpp | 2 +- Minecraft.Client/TrackedEntity.cpp | 144 +- Minecraft.Client/VideoSettingsScreen.cpp | 4 +- Minecraft.Client/VillagerGolemRenderer.cpp | 2 +- Minecraft.Client/VillagerRenderer.cpp | 2 +- Minecraft.Client/WaterDropParticle.cpp | 4 +- .../Windows64/4JLibs/inc/4J_Input.h | 4 +- .../Windows64/4JLibs/inc/4J_Profile.h | 2 +- .../Windows64/4JLibs/inc/4J_Render.h | 6 +- .../Windows64/4JLibs/inc/4J_Storage.h | 18 +- .../Iggy/gdraw/gdraw_d3d10_shaders.inl | 22 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.cpp | 16 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.h | 4 +- .../Iggy/gdraw/gdraw_d3d1x_shared.inl | 238 +- .../Windows64/Iggy/gdraw/gdraw_gl_shaders.inl | 40 +- .../Windows64/Iggy/gdraw/gdraw_gl_shared.inl | 96 +- .../Windows64/Iggy/gdraw/gdraw_shared.inl | 86 +- .../Windows64/Iggy/include/gdraw.h | 8 +- .../Windows64/Iggy/include/iggyexpruntime.h | 4 +- .../Windows64/KeyboardMouseInput.cpp | 8 +- .../Windows64/Network/WinsockNetLayer.cpp | 100 +- .../Windows64/Network/WinsockNetLayer.h | 2 +- Minecraft.Client/Windows64/Windows64_App.cpp | 10 +- Minecraft.Client/Windows64/Windows64_App.h | 4 +- .../Windows64/Windows64_Minecraft.cpp | 116 +- .../Windows64/Windows64_UIController.cpp | 6 +- .../Windows64/Windows64_UIController.h | 2 + Minecraft.Client/Windows64/XML/ATGXmlParser.h | 2 +- Minecraft.Client/WitchRenderer.cpp | 4 +- Minecraft.Client/WitherBossRenderer.cpp | 2 +- Minecraft.Client/WitherSkullRenderer.cpp | 2 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h | 4 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h | 2 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h | 24 +- Minecraft.Client/Xbox/Audio/SoundEngine.cpp | 122 +- Minecraft.Client/Xbox/Audio/SoundEngine.h | 31 +- Minecraft.Client/Xbox/Font/XUI_Font.cpp | 32 +- Minecraft.Client/Xbox/Font/XUI_FontData.cpp | 16 +- .../Xbox/Font/XUI_FontRenderer.cpp | 34 +- .../Leaderboards/XboxLeaderboardManager.cpp | 114 +- .../Xbox/Network/NetworkPlayerXbox.cpp | 14 +- .../Network/PlatformNetworkManagerXbox.cpp | 140 +- .../Xbox/Network/PlatformNetworkManagerXbox.h | 2 +- .../Xbox/Sentient/DynamicConfigurations.cpp | 16 +- .../Xbox/Sentient/Include/SenClientAvatar.h | 18 +- .../Xbox/Sentient/Include/SenClientBoxArt.h | 38 +- .../Xbox/Sentient/Include/SenClientConfig.h | 4 +- .../Xbox/Sentient/Include/SenClientCore.h | 2 +- .../SenClientCultureBackCompat_SenClientUGC.h | 4 +- .../Sentient/Include/SenClientDynamicConfig.h | 8 +- .../Xbox/Sentient/Include/SenClientFame.h | 24 +- .../Xbox/Sentient/Include/SenClientResource.h | 10 +- .../Xbox/Sentient/Include/SenClientUGC.h | 10 +- .../Xbox/Sentient/Include/SenClientUser.h | 4 +- .../Xbox/Sentient/SentientManager.cpp | 64 +- .../Xbox/Sentient/SentientStats.cpp | 72 +- .../Xbox/Social/SocialManager.cpp | 28 +- Minecraft.Client/Xbox/XML/ATGXmlParser.cpp | 70 +- Minecraft.Client/Xbox/XML/ATGXmlParser.h | 2 +- Minecraft.Client/Xbox/XML/xmlFilesCallback.h | 12 +- Minecraft.Client/Xbox/Xbox_App.cpp | 346 +- Minecraft.Client/Xbox/Xbox_App.h | 6 +- Minecraft.Client/Xbox/Xbox_Minecraft.cpp | 6 +- Minecraft.Client/Xbox/Xbox_UIController.cpp | 10 +- Minecraft.Client/Xbox/Xbox_UIController.h | 6 +- Minecraft.Client/ZombieRenderer.cpp | 12 +- Minecraft.Client/glWrapper.cpp | 2 +- Minecraft.Client/stubs.h | 6 +- Minecraft.World/AABB.cpp | 42 +- Minecraft.World/AbstractContainerMenu.cpp | 80 +- Minecraft.World/AbstractContainerMenu.h | 4 +- Minecraft.World/Achievement.cpp | 2 +- Minecraft.World/Achievements.cpp | 158 +- Minecraft.World/AddEntityPacket.cpp | 6 +- Minecraft.World/AddEntityPacket.h | 2 +- Minecraft.World/AddExperienceOrbPacket.h | 2 +- Minecraft.World/AddGlobalEntityPacket.h | 2 +- Minecraft.World/AddMobPacket.cpp | 18 +- Minecraft.World/AddMobPacket.h | 2 +- Minecraft.World/AddPaintingPacket.h | 2 +- Minecraft.World/AddPlayerPacket.cpp | 16 +- Minecraft.World/AddPlayerPacket.h | 2 +- Minecraft.World/AgableMob.cpp | 6 +- Minecraft.World/Animal.cpp | 24 +- Minecraft.World/AnimatePacket.h | 2 +- Minecraft.World/AnvilMenu.cpp | 20 +- Minecraft.World/AnvilTile.cpp | 2 +- Minecraft.World/ArmorDyeRecipe.cpp | 42 +- Minecraft.World/ArmorItem.cpp | 10 +- Minecraft.World/ArmorSlot.cpp | 8 +- Minecraft.World/ArrayWithLength.h | 6 +- Minecraft.World/Arrow.cpp | 88 +- Minecraft.World/AttributeModifier.cpp | 4 +- Minecraft.World/AvoidPlayerGoal.cpp | 16 +- Minecraft.World/AwardStatPacket.cpp | 8 +- Minecraft.World/AwardStatPacket.h | 2 +- Minecraft.World/BaseAttributeMap.cpp | 6 +- Minecraft.World/BaseEntityTile.cpp | 2 +- Minecraft.World/BaseMobSpawner.cpp | 66 +- Minecraft.World/BasePressurePlateTile.cpp | 2 +- Minecraft.World/BaseRailTile.cpp | 20 +- Minecraft.World/BasicTree.cpp | 42 +- Minecraft.World/BasicTypeContainers.cpp | 2 +- Minecraft.World/Bat.cpp | 26 +- Minecraft.World/BeachBiome.cpp | 4 +- Minecraft.World/BeaconMenu.cpp | 4 +- Minecraft.World/BeaconTile.cpp | 4 +- Minecraft.World/BeaconTileEntity.cpp | 22 +- Minecraft.World/BedItem.cpp | 2 +- Minecraft.World/BedTile.cpp | 10 +- Minecraft.World/BegGoal.cpp | 6 +- Minecraft.World/BinaryHeap.cpp | 6 +- Minecraft.World/Biome.cpp | 60 +- Minecraft.World/BiomeCache.cpp | 26 +- Minecraft.World/BiomeDecorator.cpp | 14 +- Minecraft.World/BiomeOverrideLayer.cpp | 8 +- Minecraft.World/BiomeSource.cpp | 40 +- Minecraft.World/BirchFeature.cpp | 2 +- Minecraft.World/Blaze.cpp | 12 +- Minecraft.World/BlockRegionUpdatePacket.h | 2 +- Minecraft.World/BlockReplacements.cpp | 4 +- Minecraft.World/Boat.cpp | 115 +- Minecraft.World/BoatItem.cpp | 6 +- Minecraft.World/BonusChestFeature.cpp | 2 +- Minecraft.World/BottleItem.cpp | 10 +- Minecraft.World/BoundingBox.cpp | 2 +- Minecraft.World/BowItem.cpp | 8 +- Minecraft.World/BowlFoodItem.cpp | 2 +- Minecraft.World/BreakDoorGoal.cpp | 2 +- Minecraft.World/BreedGoal.cpp | 14 +- Minecraft.World/BrewingStandMenu.cpp | 6 +- Minecraft.World/BrewingStandTile.cpp | 20 +- Minecraft.World/BrewingStandTileEntity.cpp | 42 +- Minecraft.World/BucketItem.cpp | 24 +- Minecraft.World/BufferedOutputStream.cpp | 2 +- Minecraft.World/Bush.cpp | 2 +- Minecraft.World/ButtonTile.cpp | 4 +- Minecraft.World/ByteArrayInputStream.cpp | 2 +- Minecraft.World/ByteArrayOutputStream.cpp | 4 +- Minecraft.World/ByteArrayTag.h | 4 +- Minecraft.World/ByteTag.h | 2 +- Minecraft.World/C4JThread.cpp | 80 +- Minecraft.World/CactusTile.cpp | 4 +- Minecraft.World/CakeTile.cpp | 6 +- Minecraft.World/CanyonFeature.cpp | 6 +- Minecraft.World/CarrotOnAStickItem.cpp | 2 +- Minecraft.World/CauldronTile.cpp | 16 +- Minecraft.World/CaveFeature.cpp | 8 +- Minecraft.World/ChatPacket.cpp | 8 +- Minecraft.World/ChatPacket.h | 2 +- Minecraft.World/ChestTile.cpp | 32 +- Minecraft.World/ChestTileEntity.cpp | 46 +- Minecraft.World/Chicken.cpp | 2 +- Minecraft.World/ChunkPos.cpp | 4 +- Minecraft.World/ChunkSource.h | 2 +- .../ChunkStorageProfileDecorator.cpp | 4 +- Minecraft.World/ChunkTilesUpdatePacket.cpp | 4 +- Minecraft.World/ChunkTilesUpdatePacket.h | 2 +- Minecraft.World/ChunkVisibilityAreaPacket.h | 2 +- Minecraft.World/ChunkVisibilityPacket.h | 2 +- Minecraft.World/ClientCommandPacket.h | 2 +- Minecraft.World/ClientSideMerchant.cpp | 4 +- Minecraft.World/ClockItem.cpp | 4 +- Minecraft.World/CocoaTile.cpp | 2 +- Minecraft.World/Color.cpp | 42 +- Minecraft.World/ColoredTileItem.cpp | 6 +- Minecraft.World/CombatEntry.cpp | 6 +- Minecraft.World/CombatTracker.cpp | 48 +- Minecraft.World/Command.cpp | 4 +- Minecraft.World/CommandBlock.cpp | 8 +- Minecraft.World/CommandBlockEntity.cpp | 6 +- Minecraft.World/CommonStats.cpp | 24 +- Minecraft.World/ComparatorTile.cpp | 4 +- Minecraft.World/ComparatorTileEntity.cpp | 2 +- Minecraft.World/CompassItem.cpp | 4 +- Minecraft.World/ComplexItemDataPacket.h | 2 +- Minecraft.World/CompoundContainer.cpp | 4 +- Minecraft.World/CompoundTag.h | 28 +- Minecraft.World/CompressedTileStorage.cpp | 48 +- Minecraft.World/Connection.cpp | 62 +- Minecraft.World/ConsoleSaveFile.h | 4 +- Minecraft.World/ConsoleSaveFileConverter.cpp | 2 +- .../ConsoleSaveFileInputStream.cpp | 8 +- Minecraft.World/ConsoleSaveFileOriginal.cpp | 116 +- Minecraft.World/ConsoleSaveFileOriginal.h | 4 +- .../ConsoleSaveFileOutputStream.cpp | 10 +- Minecraft.World/ContainerAckPacket.h | 2 +- Minecraft.World/ContainerButtonClickPacket.h | 2 +- Minecraft.World/ContainerClickPacket.h | 2 +- Minecraft.World/ContainerClosePacket.h | 2 +- Minecraft.World/ContainerMenu.cpp | 6 +- Minecraft.World/ContainerOpenPacket.h | 2 +- Minecraft.World/ContainerSetContentPacket.cpp | 4 +- Minecraft.World/ContainerSetContentPacket.h | 2 +- Minecraft.World/ContainerSetDataPacket.h | 2 +- Minecraft.World/ContainerSetSlotPacket.cpp | 2 +- Minecraft.World/ContainerSetSlotPacket.h | 2 +- Minecraft.World/ControlledByPlayerGoal.cpp | 12 +- Minecraft.World/Cow.cpp | 10 +- Minecraft.World/CraftItemPacket.h | 2 +- Minecraft.World/CraftingContainer.cpp | 4 +- Minecraft.World/CraftingMenu.cpp | 8 +- Minecraft.World/Creeper.cpp | 24 +- Minecraft.World/CropTile.cpp | 6 +- Minecraft.World/CustomLevelSource.cpp | 58 +- Minecraft.World/CustomPayloadPacket.cpp | 8 +- Minecraft.World/CustomPayloadPacket.h | 2 +- Minecraft.World/DamageEnchantment.cpp | 2 +- Minecraft.World/DamageSource.cpp | 10 +- Minecraft.World/DataInputStream.cpp | 18 +- Minecraft.World/DataLayer.cpp | 8 +- Minecraft.World/DataOutputStream.cpp | 22 +- Minecraft.World/DaylightDetectorTile.cpp | 4 +- .../DaylightDetectorTileEntity.cpp | 8 +- Minecraft.World/DeadBushTile.cpp | 4 +- Minecraft.World/DebugOptionsPacket.cpp | 4 +- Minecraft.World/DebugOptionsPacket.h | 2 +- .../DefaultDispenseItemBehavior.cpp | 2 +- Minecraft.World/DefendVillageTargetGoal.cpp | 2 +- Minecraft.World/DesertBiome.cpp | 4 +- Minecraft.World/DetectorRailTile.cpp | 2 +- Minecraft.World/Dimension.cpp | 16 +- Minecraft.World/DiodeTile.cpp | 2 +- Minecraft.World/Direction.cpp | 2 +- Minecraft.World/DirectoryLevelStorage.cpp | 96 +- .../DirectoryLevelStorageSource.cpp | 6 +- Minecraft.World/DisconnectPacket.cpp | 2 +- Minecraft.World/DisconnectPacket.h | 2 +- Minecraft.World/DispenserTile.cpp | 26 +- Minecraft.World/DispenserTileEntity.cpp | 26 +- Minecraft.World/DoorInfo.cpp | 2 +- Minecraft.World/DoorInteractGoal.cpp | 20 +- Minecraft.World/DoubleTag.h | 2 +- Minecraft.World/DragonFireball.cpp | 2 +- Minecraft.World/DropperTile.cpp | 10 +- Minecraft.World/DropperTileEntity.cpp | 2 +- Minecraft.World/DungeonFeature.cpp | 6 +- Minecraft.World/DurangoStats.cpp | 32 +- Minecraft.World/DurangoStats.h | 2 +- Minecraft.World/DyePowderItem.cpp | 18 +- Minecraft.World/EggItem.cpp | 2 +- Minecraft.World/EggTile.cpp | 2 +- Minecraft.World/EmptyMapItem.cpp | 2 +- Minecraft.World/EnchantItemCommand.cpp | 14 +- Minecraft.World/EnchantedBookItem.cpp | 20 +- Minecraft.World/Enchantment.cpp | 48 +- Minecraft.World/EnchantmentCategory.cpp | 10 +- Minecraft.World/EnchantmentHelper.cpp | 36 +- Minecraft.World/EnchantmentInstance.cpp | 2 +- Minecraft.World/EnchantmentMenu.cpp | 14 +- Minecraft.World/EnchantmentTableEntity.cpp | 6 +- Minecraft.World/EnchantmentTableTile.cpp | 6 +- Minecraft.World/EnderChestTile.cpp | 4 +- Minecraft.World/EnderChestTileEntity.cpp | 2 +- Minecraft.World/EnderCrystal.cpp | 2 +- Minecraft.World/EnderDragon.cpp | 134 +- Minecraft.World/EnderDragon.h | 2 +- Minecraft.World/EnderEyeItem.cpp | 14 +- Minecraft.World/EnderMan.cpp | 32 +- Minecraft.World/EnderpearlItem.cpp | 4 +- Minecraft.World/Enemy.cpp | 2 +- Minecraft.World/Entity.cpp | 74 +- .../EntityActionAtPositionPacket.h | 2 +- Minecraft.World/EntityDamageSource.cpp | 10 +- Minecraft.World/EntityEventPacket.h | 2 +- Minecraft.World/EntityHorse.cpp | 88 +- Minecraft.World/EntityIO.cpp | 20 +- Minecraft.World/EntityPos.cpp | 2 +- Minecraft.World/EntitySelector.cpp | 4 +- Minecraft.World/ExperienceItem.cpp | 2 +- Minecraft.World/ExperienceOrb.cpp | 20 +- Minecraft.World/ExplodePacket.cpp | 28 +- Minecraft.World/ExplodePacket.h | 2 +- Minecraft.World/Explosion.cpp | 14 +- Minecraft.World/Explosion.h | 2 +- Minecraft.World/EyeOfEnderSignal.cpp | 20 +- Minecraft.World/FallingTile.cpp | 18 +- Minecraft.World/FarmTile.cpp | 4 +- Minecraft.World/FastNoise.cpp | 14 +- Minecraft.World/FenceGateTile.cpp | 4 +- Minecraft.World/FenceTile.cpp | 2 +- Minecraft.World/File.cpp | 40 +- Minecraft.World/FileHeader.cpp | 52 +- Minecraft.World/FileInputStream.cpp | 14 +- Minecraft.World/FileOutputStream.cpp | 16 +- Minecraft.World/FireChargeItem.cpp | 2 +- Minecraft.World/FireTile.cpp | 4 +- Minecraft.World/Fireball.cpp | 30 +- Minecraft.World/FireworksChargeItem.cpp | 10 +- Minecraft.World/FireworksItem.cpp | 8 +- Minecraft.World/FireworksMenu.cpp | 10 +- Minecraft.World/FireworksRecipe.cpp | 42 +- Minecraft.World/FireworksRocketEntity.cpp | 24 +- Minecraft.World/FishingHook.cpp | 50 +- Minecraft.World/FishingRodItem.cpp | 6 +- Minecraft.World/FixedBiomeSource.cpp | 16 +- Minecraft.World/FlatGeneratorInfo.cpp | 12 +- Minecraft.World/FlatLevelSource.cpp | 10 +- Minecraft.World/FleeSunGoal.cpp | 6 +- Minecraft.World/FlippedIcon.cpp | 4 +- Minecraft.World/FloatTag.h | 2 +- Minecraft.World/FlowerFeature.cpp | 2 +- Minecraft.World/FlowerPotTile.cpp | 30 +- Minecraft.World/FlyingMob.cpp | 2 +- Minecraft.World/FollowOwnerGoal.cpp | 4 +- Minecraft.World/FollowParentGoal.cpp | 4 +- Minecraft.World/FoodConstants.cpp | 4 +- Minecraft.World/FoodItem.h | 2 +- Minecraft.World/FurnaceMenu.cpp | 4 +- Minecraft.World/FurnaceRecipes.cpp | 4 +- Minecraft.World/FurnaceResultSlot.cpp | 6 +- Minecraft.World/FurnaceTile.cpp | 26 +- Minecraft.World/FurnaceTileEntity.cpp | 42 +- Minecraft.World/FuzzyZoomLayer.cpp | 2 +- Minecraft.World/GameCommandPacket.cpp | 10 +- Minecraft.World/GameCommandPacket.h | 2 +- Minecraft.World/GameEventPacket.h | 2 +- Minecraft.World/GameModeCommand.cpp | 2 +- Minecraft.World/GenericStats.cpp | 142 +- Minecraft.World/GetInfoPacket.h | 2 +- Minecraft.World/Ghast.cpp | 24 +- Minecraft.World/GiveItemCommand.cpp | 8 +- Minecraft.World/GrassTile.cpp | 6 +- Minecraft.World/HangingEntity.cpp | 22 +- Minecraft.World/HangingEntityItem.cpp | 6 +- Minecraft.World/HatchetItem.cpp | 4 +- Minecraft.World/HeavyTile.cpp | 2 +- Minecraft.World/HellDimension.cpp | 10 +- Minecraft.World/HellFlatLevelSource.cpp | 24 +- Minecraft.World/HellRandomLevelSource.cpp | 54 +- Minecraft.World/HopperMenu.cpp | 2 +- Minecraft.World/HopperTile.cpp | 20 +- Minecraft.World/HopperTileEntity.cpp | 68 +- Minecraft.World/HorseInventoryMenu.cpp | 2 +- Minecraft.World/HouseFeature.cpp | 2 +- Minecraft.World/HtmlString.cpp | 2 +- Minecraft.World/HugeMushroomTile.cpp | 6 +- Minecraft.World/HurtByTargetGoal.cpp | 2 +- Minecraft.World/IceTile.cpp | 2 +- Minecraft.World/ImprovedNoise.cpp | 16 +- .../IndirectEntityDamageSource.cpp | 10 +- Minecraft.World/InputStream.cpp | 2 +- Minecraft.World/InputStreamReader.cpp | 2 +- Minecraft.World/IntArrayTag.h | 4 +- Minecraft.World/IntCache.cpp | 26 +- Minecraft.World/IntTag.h | 2 +- Minecraft.World/InteractPacket.h | 2 +- Minecraft.World/Inventory.cpp | 100 +- Minecraft.World/InventoryMenu.cpp | 10 +- Minecraft.World/Item.cpp | 404 +- Minecraft.World/ItemDispenseBehaviors.cpp | 26 +- Minecraft.World/ItemEntity.cpp | 28 +- Minecraft.World/ItemFrame.cpp | 26 +- Minecraft.World/ItemInstance.cpp | 114 +- Minecraft.World/JavaIntHash.h | 4 +- Minecraft.World/JavaMath.cpp | 2 +- Minecraft.World/JukeboxTile.cpp | 18 +- Minecraft.World/KeepAlivePacket.h | 2 +- Minecraft.World/KickPlayerPacket.h | 2 +- Minecraft.World/LakeFeature.cpp | 4 +- Minecraft.World/LargeCaveFeature.cpp | 4 +- Minecraft.World/LargeFireball.cpp | 2 +- Minecraft.World/LargeHellCaveFeature.cpp | 2 +- Minecraft.World/LavaSlime.cpp | 2 +- Minecraft.World/Layer.cpp | 54 +- Minecraft.World/LeafTile.cpp | 14 +- Minecraft.World/LeapAtTargetGoal.cpp | 4 +- Minecraft.World/LeashFenceKnotEntity.cpp | 12 +- Minecraft.World/LeashItem.cpp | 8 +- Minecraft.World/Level.cpp | 235 +- Minecraft.World/Level.h | 2 +- Minecraft.World/LevelChunk.cpp | 146 +- Minecraft.World/LevelData.cpp | 13 +- Minecraft.World/LevelEventPacket.h | 2 +- Minecraft.World/LevelParticlesPacket.h | 2 +- Minecraft.World/LevelSettings.cpp | 8 +- Minecraft.World/LevelSoundPacket.cpp | 6 +- Minecraft.World/LevelSoundPacket.h | 2 +- Minecraft.World/LevelStorage.h | 2 +- Minecraft.World/LevelType.cpp | 14 +- Minecraft.World/LeverTile.cpp | 2 +- Minecraft.World/LightningBolt.cpp | 8 +- Minecraft.World/LiquidTile.cpp | 8 +- Minecraft.World/ListTag.h | 10 +- Minecraft.World/LivingEntity.cpp | 162 +- Minecraft.World/LivingEntity.h | 2 +- Minecraft.World/LoginPacket.cpp | 14 +- Minecraft.World/LoginPacket.h | 2 +- Minecraft.World/LongTag.h | 2 +- Minecraft.World/LookAtPlayerGoal.cpp | 6 +- Minecraft.World/LookAtTradingPlayerGoal.cpp | 2 +- Minecraft.World/LookControl.cpp | 4 +- Minecraft.World/MakeLoveGoal.cpp | 10 +- Minecraft.World/MapItem.cpp | 30 +- Minecraft.World/MapItemSavedData.cpp | 86 +- Minecraft.World/Material.cpp | 66 +- Minecraft.World/MaterialColor.cpp | 28 +- Minecraft.World/McRegionChunkStorage.cpp | 24 +- Minecraft.World/McRegionLevelStorage.cpp | 8 +- .../McRegionLevelStorageSource.cpp | 12 +- Minecraft.World/MegaTreeFeature.cpp | 10 +- Minecraft.World/MeleeAttackGoal.cpp | 16 +- Minecraft.World/MelonTile.cpp | 2 +- Minecraft.World/MemoryChunkStorage.cpp | 2 +- Minecraft.World/MemoryLevelStorage.cpp | 4 +- Minecraft.World/MemoryLevelStorageSource.cpp | 2 +- Minecraft.World/MenuBackup.cpp | 2 +- Minecraft.World/MerchantContainer.cpp | 22 +- Minecraft.World/MerchantMenu.cpp | 8 +- Minecraft.World/MerchantRecipe.cpp | 12 +- Minecraft.World/MerchantRecipeList.cpp | 28 +- Minecraft.World/MerchantResultSlot.cpp | 8 +- Minecraft.World/MilkBucketItem.cpp | 2 +- Minecraft.World/MilkBucketItem.h | 2 +- Minecraft.World/MineShaftFeature.cpp | 2 +- Minecraft.World/MineShaftPieces.cpp | 38 +- Minecraft.World/Minecart.cpp | 86 +- Minecraft.World/MinecartContainer.cpp | 32 +- Minecraft.World/MinecartFurnace.cpp | 12 +- Minecraft.World/MinecartItem.cpp | 2 +- Minecraft.World/MinecartRideable.cpp | 4 +- Minecraft.World/MinecartSpawner.cpp | 2 +- Minecraft.World/MinecartTNT.cpp | 4 +- Minecraft.World/Mob.cpp | 100 +- Minecraft.World/Mob.h | 2 +- Minecraft.World/MobCategory.cpp | 14 +- Minecraft.World/MobEffect.cpp | 28 +- Minecraft.World/MobEffectInstance.cpp | 4 +- Minecraft.World/MobSpawner.cpp | 16 +- Minecraft.World/MobSpawnerTile.cpp | 2 +- Minecraft.World/MobSpawnerTileEntity.cpp | 6 +- Minecraft.World/MockedLevelStorage.cpp | 6 +- Minecraft.World/MockedLevelStorage.h | 2 +- .../ModifiableAttributeInstance.cpp | 6 +- Minecraft.World/Monster.cpp | 4 +- Minecraft.World/Monster.h | 2 +- Minecraft.World/MonsterRoomFeature.cpp | 4 +- Minecraft.World/MoveControl.cpp | 4 +- Minecraft.World/MoveEntityPacket.cpp | 4 +- Minecraft.World/MoveEntityPacket.h | 8 +- Minecraft.World/MoveEntityPacketSmall.cpp | 6 +- Minecraft.World/MoveEntityPacketSmall.h | 8 +- Minecraft.World/MoveIndoorsGoal.cpp | 10 +- Minecraft.World/MovePlayerPacket.h | 8 +- Minecraft.World/MoveThroughVillageGoal.cpp | 20 +- .../MoveTowardsRestrictionGoal.cpp | 2 +- Minecraft.World/MoveTowardsTargetGoal.cpp | 6 +- Minecraft.World/Mth.cpp | 24 +- Minecraft.World/Mushroom.cpp | 8 +- Minecraft.World/MushroomCow.cpp | 14 +- Minecraft.World/MushroomIslandBiome.cpp | 2 +- Minecraft.World/MusicTileEntity.cpp | 4 +- Minecraft.World/MycelTile.cpp | 4 +- Minecraft.World/NameTagItem.cpp | 2 +- Minecraft.World/NbtIo.cpp | 6 +- Minecraft.World/NbtSlotFile.cpp | 40 +- .../NearestAttackableTargetGoal.cpp | 6 +- Minecraft.World/NearestAttackableTargetGoal.h | 2 +- Minecraft.World/NetherBridgeFeature.cpp | 8 +- Minecraft.World/NetherBridgePieces.cpp | 172 +- Minecraft.World/NetherWartTile.cpp | 2 +- Minecraft.World/Node.cpp | 10 +- Minecraft.World/NotGateTile.cpp | 2 +- Minecraft.World/NoteBlockTile.cpp | 10 +- Minecraft.World/Ocelot.cpp | 16 +- Minecraft.World/OcelotAttackGoal.cpp | 4 +- Minecraft.World/OcelotSitOnTileGoal.cpp | 10 +- Minecraft.World/OfferFlowerGoal.cpp | 4 +- Minecraft.World/OldChunkStorage.cpp | 36 +- Minecraft.World/OreFeature.cpp | 6 +- Minecraft.World/OwnerHurtByTargetGoal.cpp | 4 +- Minecraft.World/OwnerHurtTargetGoal.cpp | 4 +- Minecraft.World/Packet.cpp | 18 +- Minecraft.World/Painting.cpp | 10 +- Minecraft.World/Path.cpp | 16 +- Minecraft.World/PathFinder.cpp | 36 +- Minecraft.World/PathNavigation.cpp | 52 +- Minecraft.World/PathfinderMob.cpp | 42 +- Minecraft.World/PerformanceTimer.cpp | 4 +- Minecraft.World/PerlinNoise.cpp | 2 +- Minecraft.World/PerlinSimplexNoise.cpp | 4 +- Minecraft.World/PickaxeItem.cpp | 2 +- Minecraft.World/Pig.cpp | 18 +- Minecraft.World/PigZombie.cpp | 8 +- Minecraft.World/PineFeature.cpp | 2 +- Minecraft.World/PistonBaseTile.cpp | 20 +- Minecraft.World/PistonExtensionTile.cpp | 6 +- Minecraft.World/PistonMovingPiece.cpp | 30 +- Minecraft.World/PistonPieceEntity.cpp | 6 +- Minecraft.World/PlayGoal.cpp | 12 +- Minecraft.World/Player.cpp | 182 +- Minecraft.World/PlayerAbilitiesPacket.h | 2 +- Minecraft.World/PlayerActionPacket.h | 2 +- Minecraft.World/PlayerCommandPacket.h | 2 +- Minecraft.World/PlayerEnderChestContainer.cpp | 8 +- Minecraft.World/PlayerInfoPacket.cpp | 2 +- Minecraft.World/PlayerInfoPacket.h | 2 +- Minecraft.World/PlayerInputPacket.h | 2 +- Minecraft.World/PlayerTeam.cpp | 2 +- Minecraft.World/PortalForcer.cpp | 2 +- Minecraft.World/PortalTile.cpp | 6 +- Minecraft.World/Pos.cpp | 6 +- Minecraft.World/PotatoTile.cpp | 2 +- Minecraft.World/PotionBrewing.cpp | 50 +- Minecraft.World/PotionItem.cpp | 40 +- Minecraft.World/PotionItem.h | 2 +- Minecraft.World/PreLoginPacket.cpp | 10 +- Minecraft.World/PreLoginPacket.h | 2 +- Minecraft.World/PressurePlateTile.cpp | 4 +- Minecraft.World/PrimedTnt.cpp | 4 +- Minecraft.World/ProtectionEnchantment.cpp | 2 +- Minecraft.World/PumpkinTile.cpp | 8 +- Minecraft.World/QuartzBlockTile.cpp | 2 +- Minecraft.World/Random.cpp | 14 +- Minecraft.World/RandomLevelSource.cpp | 56 +- Minecraft.World/RandomPos.cpp | 6 +- .../RandomScatteredLargeFeature.cpp | 8 +- Minecraft.World/RandomStrollGoal.cpp | 4 +- Minecraft.World/RangedAttackGoal.cpp | 4 +- Minecraft.World/ReadOnlyChunkCache.cpp | 8 +- Minecraft.World/Recipes.cpp | 42 +- Minecraft.World/Recipes.h | 2 +- Minecraft.World/RecordingItem.cpp | 4 +- Minecraft.World/RedStoneDustTile.cpp | 12 +- Minecraft.World/RedStoneOreTile.cpp | 2 +- Minecraft.World/ReedTile.cpp | 2 +- Minecraft.World/ReedsFeature.cpp | 2 +- Minecraft.World/Region.cpp | 28 +- Minecraft.World/RegionFile.cpp | 43 +- Minecraft.World/RegionFileCache.cpp | 6 +- Minecraft.World/RemoveEntitiesPacket.h | 2 +- Minecraft.World/RemoveMobEffectPacket.cpp | 2 +- Minecraft.World/RemoveMobEffectPacket.h | 2 +- Minecraft.World/RepairResultSlot.cpp | 2 +- Minecraft.World/RespawnPacket.cpp | 12 +- Minecraft.World/RespawnPacket.h | 2 +- Minecraft.World/RestrictOpenDoorGoal.cpp | 6 +- Minecraft.World/ResultContainer.cpp | 4 +- Minecraft.World/ResultSlot.cpp | 6 +- Minecraft.World/RotateHeadPacket.h | 2 +- Minecraft.World/RotatedPillarTile.cpp | 2 +- Minecraft.World/RunAroundLikeCrazyGoal.cpp | 6 +- Minecraft.World/SaddleItem.cpp | 2 +- Minecraft.World/SandFeature.cpp | 2 +- Minecraft.World/SandStoneTile.cpp | 6 +- Minecraft.World/Sapling.cpp | 10 +- Minecraft.World/SavedDataStorage.cpp | 20 +- Minecraft.World/ScatteredFeaturePieces.cpp | 6 +- Minecraft.World/Scoreboard.cpp | 44 +- Minecraft.World/ServerSettingsChangedPacket.h | 2 +- Minecraft.World/ServersideAttributeMap.cpp | 6 +- Minecraft.World/SetCarriedItemPacket.h | 2 +- Minecraft.World/SetCreativeModeSlotPacket.h | 2 +- Minecraft.World/SetDisplayObjectivePacket.cpp | 2 +- Minecraft.World/SetDisplayObjectivePacket.h | 2 +- Minecraft.World/SetEntityDataPacket.cpp | 2 +- Minecraft.World/SetEntityDataPacket.h | 2 +- Minecraft.World/SetEntityLinkPacket.cpp | 2 +- Minecraft.World/SetEntityLinkPacket.h | 2 +- Minecraft.World/SetEntityMotionPacket.cpp | 12 +- Minecraft.World/SetEntityMotionPacket.h | 2 +- Minecraft.World/SetEquippedItemPacket.cpp | 2 +- Minecraft.World/SetEquippedItemPacket.h | 2 +- Minecraft.World/SetExperiencePacket.h | 2 +- Minecraft.World/SetHealthPacket.cpp | 2 +- Minecraft.World/SetHealthPacket.h | 2 +- Minecraft.World/SetObjectivePacket.h | 2 +- Minecraft.World/SetPlayerTeamPacket.cpp | 2 +- Minecraft.World/SetPlayerTeamPacket.h | 2 +- Minecraft.World/SetScorePacket.h | 2 +- Minecraft.World/SetSpawnPositionPacket.h | 2 +- Minecraft.World/SetTimePacket.h | 2 +- Minecraft.World/ShapedRecipy.cpp | 16 +- Minecraft.World/ShapelessRecipy.cpp | 2 +- Minecraft.World/SharedMonsterAttributes.cpp | 6 +- Minecraft.World/Sheep.cpp | 32 +- Minecraft.World/ShortTag.h | 2 +- Minecraft.World/ShovelItem.cpp | 2 +- Minecraft.World/SignItem.cpp | 2 +- Minecraft.World/SignTile.cpp | 4 +- Minecraft.World/SignTileEntity.cpp | 8 +- Minecraft.World/SignUpdatePacket.cpp | 2 +- Minecraft.World/SignUpdatePacket.h | 2 +- Minecraft.World/Silverfish.cpp | 8 +- Minecraft.World/SimpleContainer.cpp | 12 +- Minecraft.World/SimplexNoise.cpp | 2 +- Minecraft.World/SitGoal.cpp | 4 +- Minecraft.World/Skeleton.cpp | 34 +- Minecraft.World/SkullItem.cpp | 4 +- Minecraft.World/SkullTile.cpp | 20 +- Minecraft.World/SkullTileEntity.cpp | 8 +- Minecraft.World/SkyIslandDimension.cpp | 2 +- Minecraft.World/Slime.cpp | 12 +- Minecraft.World/Slot.cpp | 22 +- Minecraft.World/SmallFireball.cpp | 2 +- Minecraft.World/SmoothStoneBrickTile.cpp | 2 +- Minecraft.World/SmoothZoomLayer.cpp | 2 +- Minecraft.World/SnowMan.cpp | 2 +- Minecraft.World/Snowball.cpp | 2 +- Minecraft.World/SnowballItem.cpp | 2 +- Minecraft.World/Socket.cpp | 30 +- Minecraft.World/SparseDataStorage.cpp | 134 +- Minecraft.World/SparseLightStorage.cpp | 36 +- Minecraft.World/SpawnEggItem.cpp | 20 +- Minecraft.World/Spider.cpp | 18 +- Minecraft.World/SpikeFeature.cpp | 4 +- Minecraft.World/SpringFeature.cpp | 2 +- Minecraft.World/SpruceFeature.cpp | 2 +- Minecraft.World/Squid.cpp | 6 +- Minecraft.World/StairTile.cpp | 10 +- Minecraft.World/Stats.cpp | 64 +- Minecraft.World/StemTile.cpp | 14 +- Minecraft.World/StoneMonsterTile.cpp | 4 +- Minecraft.World/StoneSlabTile.cpp | 2 +- Minecraft.World/StringHelpers.cpp | 10 +- Minecraft.World/StringTag.h | 2 +- Minecraft.World/StrongholdFeature.cpp | 20 +- Minecraft.World/StrongholdPieces.cpp | 174 +- Minecraft.World/StructureFeature.cpp | 18 +- Minecraft.World/StructureFeatureIO.cpp | 8 +- Minecraft.World/StructurePiece.cpp | 22 +- Minecraft.World/StructureRecipies.cpp | 2 +- Minecraft.World/StructureStart.cpp | 4 +- Minecraft.World/SwampTreeFeature.cpp | 2 +- Minecraft.World/SwellGoal.cpp | 4 +- Minecraft.World/SynchedEntityData.cpp | 52 +- Minecraft.World/Tag.cpp | 4 +- Minecraft.World/TakeFlowerGoal.cpp | 4 +- Minecraft.World/TakeItemEntityPacket.h | 2 +- Minecraft.World/TallGrass.cpp | 4 +- Minecraft.World/TamableAnimal.cpp | 16 +- Minecraft.World/TargetGoal.cpp | 14 +- Minecraft.World/Team.cpp | 2 +- Minecraft.World/TeleportEntityPacket.cpp | 4 +- Minecraft.World/TeleportEntityPacket.h | 2 +- Minecraft.World/TemptGoal.cpp | 6 +- .../TextureAndGeometryChangePacket.cpp | 2 +- .../TextureAndGeometryChangePacket.h | 2 +- Minecraft.World/TextureAndGeometryPacket.cpp | 32 +- Minecraft.World/TextureChangePacket.cpp | 4 +- Minecraft.World/TextureChangePacket.h | 2 +- Minecraft.World/TexturePacket.cpp | 8 +- Minecraft.World/TheEndBiome.cpp | 4 +- Minecraft.World/TheEndBiomeDecorator.cpp | 2 +- Minecraft.World/TheEndDimension.cpp | 2 +- .../TheEndLevelRandomLevelSource.cpp | 20 +- Minecraft.World/TheEndPortal.cpp | 6 +- Minecraft.World/TheEndPortalFrameTile.cpp | 4 +- Minecraft.World/TheEndPortalTileEntity.cpp | 2 +- Minecraft.World/ThinFenceTile.cpp | 4 +- Minecraft.World/ThornsEnchantment.cpp | 4 +- Minecraft.World/Throwable.cpp | 44 +- Minecraft.World/ThrownEgg.cpp | 4 +- Minecraft.World/ThrownEnderpearl.cpp | 4 +- Minecraft.World/ThrownExpBottle.cpp | 4 +- Minecraft.World/ThrownPotion.cpp | 20 +- Minecraft.World/TickNextTickData.cpp | 2 +- Minecraft.World/Tile.cpp | 512 +- Minecraft.World/TileDestructionPacket.h | 2 +- Minecraft.World/TileEditorOpenPacket.h | 2 +- Minecraft.World/TileEntity.cpp | 16 +- Minecraft.World/TileEntityDataPacket.cpp | 4 +- Minecraft.World/TileEntityDataPacket.h | 2 +- Minecraft.World/TileEventPacket.h | 2 +- Minecraft.World/TileItem.cpp | 8 +- Minecraft.World/TileUpdatePacket.cpp | 2 +- Minecraft.World/TileUpdatePacket.h | 2 +- Minecraft.World/TimeCommand.cpp | 2 +- Minecraft.World/TntTile.cpp | 10 +- Minecraft.World/ToggleDownfallCommand.cpp | 2 +- Minecraft.World/ToolRecipies.cpp | 2 +- Minecraft.World/TopSnowTile.cpp | 4 +- Minecraft.World/TorchTile.cpp | 2 +- Minecraft.World/TradeItemPacket.h | 2 +- Minecraft.World/TradeWithPlayerGoal.cpp | 2 +- Minecraft.World/TrapDoorTile.cpp | 2 +- Minecraft.World/TrapMenu.cpp | 2 +- Minecraft.World/TreeFeature.cpp | 2 +- Minecraft.World/TreeTile.cpp | 2 +- Minecraft.World/TripWireSourceTile.cpp | 2 +- Minecraft.World/TripWireTile.cpp | 6 +- Minecraft.World/UpdateAttributesPacket.h | 2 +- .../UpdateGameRuleProgressPacket.cpp | 12 +- Minecraft.World/UpdateMobEffectPacket.cpp | 6 +- Minecraft.World/UpdateMobEffectPacket.h | 2 +- Minecraft.World/UpdateProgressPacket.h | 2 +- Minecraft.World/UseItemPacket.cpp | 6 +- Minecraft.World/UseItemPacket.h | 2 +- Minecraft.World/Vec3.cpp | 20 +- Minecraft.World/Village.cpp | 18 +- Minecraft.World/VillageFeature.cpp | 6 +- Minecraft.World/VillagePieces.cpp | 120 +- Minecraft.World/VillageSiege.cpp | 22 +- Minecraft.World/Villager.cpp | 56 +- Minecraft.World/VillagerGolem.cpp | 14 +- Minecraft.World/Villages.cpp | 16 +- Minecraft.World/VineTile.cpp | 8 +- Minecraft.World/WallTile.cpp | 2 +- Minecraft.World/WaterLevelChunk.cpp | 2 +- Minecraft.World/WaterLilyTile.cpp | 4 +- Minecraft.World/WaterLilyTileItem.cpp | 4 +- Minecraft.World/WebTile.cpp | 2 +- Minecraft.World/WeighedRandom.cpp | 4 +- Minecraft.World/WeighedTreasure.cpp | 6 +- Minecraft.World/WeightedPressurePlateTile.cpp | 2 +- Minecraft.World/Witch.cpp | 16 +- Minecraft.World/WitherBoss.cpp | 26 +- Minecraft.World/WitherSkull.cpp | 8 +- Minecraft.World/Wolf.cpp | 48 +- Minecraft.World/WoodSlabTile.cpp | 2 +- Minecraft.World/WoodTile.cpp | 2 +- Minecraft.World/WoolCarpetTile.cpp | 2 +- Minecraft.World/WorkbenchTile.cpp | 4 +- Minecraft.World/XZPacket.h | 2 +- Minecraft.World/Zombie.cpp | 68 +- Minecraft.World/ZoneFile.cpp | 2 +- Minecraft.World/ZoneIo.cpp | 8 +- Minecraft.World/ZonedChunkStorage.cpp | 10 +- Minecraft.World/ZoomLayer.cpp | 2 +- Minecraft.World/compression.cpp | 62 +- Minecraft.World/system.cpp | 2 +- Minecraft.World/x64headers/extraX64.h | 10 +- tall cloc | 324 -- 1373 files changed, 19449 insertions(+), 19903 deletions(-) delete mode 100644 tall cloc diff --git a/Minecraft.Client/AbstractContainerScreen.cpp b/Minecraft.Client/AbstractContainerScreen.cpp index c2de6dc9..fbf1331d 100644 --- a/Minecraft.Client/AbstractContainerScreen.cpp +++ b/Minecraft.Client/AbstractContainerScreen.cpp @@ -51,7 +51,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) glColor4f(1, 1, 1, 1); glEnable(GL_RESCALE_NORMAL); - Slot *hoveredSlot = nullptr; + Slot *hoveredSlot = NULL; for ( Slot *slot : *menu->slots ) { @@ -73,7 +73,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) } shared_ptr inventory = minecraft->player->inventory; - if (inventory->getCarried() != nullptr) + if (inventory->getCarried() != NULL) { glTranslatef(0, 0, 32); // Slot old = carriedSlot; @@ -90,7 +90,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) renderLabels(); - if (inventory->getCarried() == nullptr && hoveredSlot != nullptr && hoveredSlot->hasItem()) + if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem()) { wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId())); @@ -127,7 +127,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot) int y = slot->y; shared_ptr item = slot->getItem(); - if (item == nullptr) + if (item == NULL) { int icon = slot->getNoItemIcon(); if (icon >= 0) @@ -151,7 +151,7 @@ Slot *AbstractContainerScreen::findSlot(int x, int y) { if (isHovering(slot, x, y)) return slot; } - return nullptr; + return NULL; } bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym) @@ -177,7 +177,7 @@ void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum) bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight); int slotId = -1; - if (slot != nullptr) slotId = slot->index; + if (slot != NULL) slotId = slot->index; if (clickedOutside) { @@ -210,7 +210,7 @@ void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey) void AbstractContainerScreen::removed() { - if (minecraft->player == nullptr) return; + if (minecraft->player == NULL) return; } void AbstractContainerScreen::slotsChanged(shared_ptr container) diff --git a/Minecraft.Client/AbstractTexturePack.cpp b/Minecraft.Client/AbstractTexturePack.cpp index a3c67727..80799a4c 100644 --- a/Minecraft.Client/AbstractTexturePack.cpp +++ b/Minecraft.Client/AbstractTexturePack.cpp @@ -3,22 +3,21 @@ #include "AbstractTexturePack.h" #include "..\Minecraft.World\InputOutputStream.h" #include "..\Minecraft.World\StringHelpers.h" -#include "Common/UI/UI.h" AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name) { // 4J init textureId = -1; - m_colourTable = nullptr; + m_colourTable = NULL; this->file = file; this->fallback = fallback; - m_iconData = nullptr; + m_iconData = NULL; m_iconSize = 0; - m_comparisonData = nullptr; + m_comparisonData = NULL; m_comparisonSize = 0; // 4J Stu - These calls need to be in the most derived version of the class @@ -42,7 +41,7 @@ void AbstractTexturePack::loadIcon() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); UINT size = 0; @@ -58,7 +57,7 @@ void AbstractTexturePack::loadComparison() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png"); UINT size = 0; @@ -71,8 +70,8 @@ void AbstractTexturePack::loadDescription() { // 4J Unused currently #if 0 - InputStream *inputStream = nullptr; - BufferedReader *br = nullptr; + InputStream *inputStream = NULL; + BufferedReader *br = NULL; //try { inputStream = getResourceImplementation(L"/pack.txt"); br = new BufferedReader(new InputStreamReader(inputStream)); @@ -82,12 +81,12 @@ void AbstractTexturePack::loadDescription() //} finally { // TODO [EB]: use IOUtils.closeSilently() // try { - if (br != nullptr) + if (br != NULL) { br->close(); delete br; } - if (inputStream != nullptr) + if (inputStream != NULL) { inputStream->close(); delete inputStream; @@ -106,7 +105,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal { app.DebugPrintf("texture - %ls\n",name.c_str()); InputStream *is = getResourceImplementation(name); - if (is == nullptr && fallback != nullptr && allowFallback) + if (is == NULL && fallback != NULL && allowFallback) { is = fallback->getResource(name, true); } @@ -122,7 +121,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal void AbstractTexturePack::unload(Textures *textures) { - if (iconImage != nullptr && textureId != -1) + if (iconImage != NULL && textureId != -1) { textures->releaseTexture(textureId); } @@ -130,7 +129,7 @@ void AbstractTexturePack::unload(Textures *textures) void AbstractTexturePack::load(Textures *textures) { - if (iconImage != nullptr) + if (iconImage != NULL) { if (textureId == -1) { @@ -150,7 +149,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback) { bool hasFile = this->hasFile(name); - return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile; + return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile; } DWORD AbstractTexturePack::getId() @@ -232,7 +231,7 @@ void AbstractTexturePack::loadDefaultUI() { #ifdef _XBOX // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -241,7 +240,7 @@ void AbstractTexturePack::loadDefaultUI() swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); XuiFreeVisuals(L""); - app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); + app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack"); CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj); #else @@ -260,7 +259,7 @@ void AbstractTexturePack::loadDefaultColourTable() // Load the file #ifdef __PS3__ // need to check if it's a BD build, so pass in the name - File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col")); + File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col")); #else File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col")); @@ -270,12 +269,12 @@ void AbstractTexturePack::loadDefaultColourTable() if(coloursFile.exists()) { DWORD dwLength = coloursFile.length(); - byteArray data(static_cast(dwLength)); + byteArray data(dwLength); FileInputStream fis(coloursFile); fis.read(data,0,dwLength); fis.close(); - if(m_colourTable != nullptr) delete m_colourTable; + if(m_colourTable != NULL) delete m_colourTable; m_colourTable = new ColourTable(data.data, dwLength); delete [] data.data; @@ -291,7 +290,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() { #ifdef _XBOX // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -310,7 +309,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() { wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); HXUIOBJ hScene; - HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene); + HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene); if(HRESULT_SUCCEEDED(hr)) { @@ -334,7 +333,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj) HXUIOBJ child; HRESULT hr = XuiElementGetFirstChild(hObj, &child); - while(HRESULT_SUCCEEDED(hr) && child != nullptr) + while(HRESULT_SUCCEEDED(hr) && child != NULL) { LPCWSTR childName; XuiElementGetId(child,&childName); @@ -375,7 +374,7 @@ void AbstractTexturePack::unloadUI() wstring AbstractTexturePack::getXuiRootPath() { - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); // Load new skin const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -387,14 +386,14 @@ wstring AbstractTexturePack::getXuiRootPath() PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes) { - if(m_iconSize == 0 || m_iconData == nullptr) loadIcon(); + if(m_iconSize == 0 || m_iconData == NULL) loadIcon(); dwImageBytes = m_iconSize; return m_iconData; } PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes) { - if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison(); + if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison(); dwImageBytes = m_comparisonSize; return m_comparisonData; diff --git a/Minecraft.Client/AbstractTexturePack.h b/Minecraft.Client/AbstractTexturePack.h index 6386ecf1..e6410c19 100644 --- a/Minecraft.Client/AbstractTexturePack.h +++ b/Minecraft.Client/AbstractTexturePack.h @@ -89,5 +89,5 @@ public: virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } - virtual ArchiveFile *getArchiveFile() { return nullptr; } + virtual ArchiveFile *getArchiveFile() { return NULL; } }; diff --git a/Minecraft.Client/AchievementPopup.cpp b/Minecraft.Client/AchievementPopup.cpp index 4e08f3b8..04f822ab 100644 --- a/Minecraft.Client/AchievementPopup.cpp +++ b/Minecraft.Client/AchievementPopup.cpp @@ -14,7 +14,7 @@ AchievementPopup::AchievementPopup(Minecraft *mc) // 4J - added initialisers width = 0; height = 0; - ach = nullptr; + ach = NULL; startTime = 0; isHelper = false; @@ -59,7 +59,7 @@ void AchievementPopup::prepareWindow() glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, static_cast(width), static_cast(height), 0, 1000, 3000); + glOrtho(0, (float)width, (float)height, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -88,7 +88,7 @@ void AchievementPopup::render() glDepthMask(true); glEnable(GL_DEPTH_TEST); } - if (ach == nullptr || startTime == 0) return; + if (ach == NULL || startTime == 0) return; double time = (System::currentTimeMillis() - startTime) / 3000.0; if (isHelper) diff --git a/Minecraft.Client/AchievementScreen.cpp b/Minecraft.Client/AchievementScreen.cpp index baafce30..902aed17 100644 --- a/Minecraft.Client/AchievementScreen.cpp +++ b/Minecraft.Client/AchievementScreen.cpp @@ -52,7 +52,7 @@ void AchievementScreen::buttonClicked(Button *button) { if (button->id == 1) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft->grabMouse(); // 4J removed } Screen::buttonClicked(button); @@ -62,7 +62,7 @@ void AchievementScreen::keyPressed(char eventCharacter, int eventKey) { if (eventKey == minecraft->options->keyBuild->key) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft->grabMouse(); // 4J removed } else @@ -286,7 +286,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) vLine(x2, y1, y2, color); } - Achievement *hoveredAchievement = nullptr; + Achievement *hoveredAchievement = NULL; ItemRenderer *ir = new ItemRenderer(); glPushMatrix(); @@ -372,7 +372,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glEnable(GL_TEXTURE_2D); Screen::render(xm, ym, a); - if (hoveredAchievement != nullptr) + if (hoveredAchievement != NULL) { Achievement *ach = hoveredAchievement; wstring name = ach->name; diff --git a/Minecraft.Client/ArchiveFile.cpp b/Minecraft.Client/ArchiveFile.cpp index 608428b6..2e57a5bb 100644 --- a/Minecraft.Client/ArchiveFile.cpp +++ b/Minecraft.Client/ArchiveFile.cpp @@ -30,7 +30,7 @@ void ArchiveFile::_readHeader(DataInputStream *dis) ArchiveFile::ArchiveFile(File file) { - m_cachedData = nullptr; + m_cachedData = NULL; m_sourcefile = file; app.DebugPrintf("Loading archive file...\n"); #ifndef _CONTENT_PACKAGE @@ -48,7 +48,7 @@ ArchiveFile::ArchiveFile(File file) FileInputStream fis(file); #if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 - byteArray readArray(static_cast(file.length())); + byteArray readArray(file.length()); fis.read(readArray,0,file.length()); ByteArrayInputStream bais(readArray); @@ -122,20 +122,20 @@ byteArray ArchiveFile::getFile(const wstring &filename) HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(), GENERIC_READ, 0, - nullptr, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, - nullptr + NULL ); #else app.DebugPrintf("Createfile archive\n"); HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()), GENERIC_READ, 0, - nullptr, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, - nullptr + NULL ); #endif @@ -144,7 +144,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) app.DebugPrintf("hfile ok\n"); DWORD ok = SetFilePointer( hfile, data->ptr, - nullptr, + NULL, FILE_BEGIN ); @@ -157,7 +157,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) (LPVOID) pbData, data->filesize, &bytesRead, - nullptr + NULL ); if(bSuccess==FALSE) @@ -182,7 +182,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) #endif // Compressed filenames are preceeded with an asterisk. - if ( data->isCompressed && out.data != nullptr ) + if ( data->isCompressed && out.data != NULL ) { /* 4J-JEV: * If a compressed file is accessed before compression object is @@ -204,7 +204,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) out.length = decompressedSize; } - assert(out.data != nullptr); // THERE IS NO FILE WITH THIS NAME! + assert(out.data != NULL); // THERE IS NO FILE WITH THIS NAME! } diff --git a/Minecraft.Client/ArrowRenderer.cpp b/Minecraft.Client/ArrowRenderer.cpp index a7dd6efd..4698cd6e 100644 --- a/Minecraft.Client/ArrowRenderer.cpp +++ b/Minecraft.Client/ArrowRenderer.cpp @@ -23,7 +23,7 @@ void ArrowRenderer::render(shared_ptr _arrow, double x, double y, double if( ( xRot - xRotO ) > 180.0f ) xRot -= 360.0f; else if( ( xRot - xRotO ) < -180.0f ) xRot += 360.0f; - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float)x, (float)y, (float)z); glRotatef(yRotO + (yRot - yRotO) * a - 90, 0, 1, 0); glRotatef(xRotO + (xRot - xRotO) * a, 0, 0, 1); @@ -55,19 +55,19 @@ void ArrowRenderer::render(shared_ptr _arrow, double x, double y, double // glNormal3f(ss, 0, 0); // 4J - changed to use tesselator t->begin(); t->normal(1,0,0); - t->vertexUV(static_cast(-7), static_cast(-2), static_cast(-2), (float)( u02), (float)( v02)); - t->vertexUV(static_cast(-7), static_cast(-2), static_cast(+2), (float)( u12), (float)( v02)); - t->vertexUV(static_cast(-7), static_cast(+2), static_cast(+2), (float)( u12), (float)( v12)); - t->vertexUV(static_cast(-7), static_cast(+2), static_cast(-2), (float)( u02), (float)( v12)); + t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v02)); + t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v02)); + t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v12)); + t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v12)); t->end(); // glNormal3f(-ss, 0, 0); // 4J - changed to use tesselator t->begin(); t->normal(-1,0,0); - t->vertexUV(static_cast(-7), static_cast(+2), static_cast(-2), (float)( u02), (float)( v02)); - t->vertexUV(static_cast(-7), static_cast(+2), static_cast(+2), (float)( u12), (float)( v02)); - t->vertexUV(static_cast(-7), static_cast(-2), static_cast(+2), (float)( u12), (float)( v12)); - t->vertexUV(static_cast(-7), static_cast(-2), static_cast(-2), (float)( u02), (float)( v12)); + t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v02)); + t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v02)); + t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v12)); + t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v12)); t->end(); for (int i = 0; i < 4; i++) @@ -77,10 +77,10 @@ void ArrowRenderer::render(shared_ptr _arrow, double x, double y, double // glNormal3f(0, 0, ss); // 4J - changed to use tesselator t->begin(); t->normal(0,0,1); - t->vertexUV(static_cast(-8), static_cast(-2), static_cast(0), (float)( u0), (float)( v0)); - t->vertexUV(static_cast(+8), static_cast(-2), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV(static_cast(+8), static_cast(+2), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV(static_cast(-8), static_cast(+2), static_cast(0), (float)( u0), (float)( v1)); + t->vertexUV((float)(-8), (float)( -2), (float)( 0), (float)( u0), (float)( v0)); + t->vertexUV((float)(+8), (float)( -2), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(+8), (float)( +2), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(-8), (float)( +2), (float)( 0), (float)( u0), (float)( v1)); t->end(); } glDisable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/BatRenderer.cpp b/Minecraft.Client/BatRenderer.cpp index 97c6412d..629fe014 100644 --- a/Minecraft.Client/BatRenderer.cpp +++ b/Minecraft.Client/BatRenderer.cpp @@ -7,7 +7,7 @@ ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT); BatRenderer::BatRenderer() : MobRenderer(new BatModel(), 0.25f) { - modelVersion = static_cast(model)->modelVersion(); + modelVersion = ((BatModel *)model)->modelVersion(); } void BatRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) diff --git a/Minecraft.Client/BlazeRenderer.cpp b/Minecraft.Client/BlazeRenderer.cpp index f8426a2f..8e0da036 100644 --- a/Minecraft.Client/BlazeRenderer.cpp +++ b/Minecraft.Client/BlazeRenderer.cpp @@ -7,7 +7,7 @@ ResourceLocation BlazeRenderer::BLAZE_LOCATION = ResourceLocation(TN_MOB_BLAZE); BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f) { - modelVersion = static_cast(model)->modelVersion(); + modelVersion = ((BlazeModel *) model)->modelVersion(); } void BlazeRenderer::render(shared_ptr _mob, double x, double y, double z, float rot, float a) @@ -16,7 +16,7 @@ void BlazeRenderer::render(shared_ptr _mob, double x, double y, double z // do some casting around instead shared_ptr mob = dynamic_pointer_cast(_mob); - int modelVersion = static_cast(model)->modelVersion(); + int modelVersion = ((BlazeModel *) model)->modelVersion(); if (modelVersion != this->modelVersion) { this->modelVersion = modelVersion; diff --git a/Minecraft.Client/BoatModel.cpp b/Minecraft.Client/BoatModel.cpp index 5a55e7e8..d0d465e5 100644 --- a/Minecraft.Client/BoatModel.cpp +++ b/Minecraft.Client/BoatModel.cpp @@ -14,20 +14,20 @@ BoatModel::BoatModel() : Model() int h = 20; int yOff = 4; - cubes[0]->addBox(static_cast(-w / 2), static_cast(-h / 2 + 2), -3, w, h - 4, 4, 0); - cubes[0]->setPos(0, static_cast(0 + yOff), 0); + cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0); + cubes[0]->setPos(0, (float)(0 + yOff), 0); - cubes[1]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[1]->setPos(static_cast(-w / 2 + 1), static_cast(0 + yOff), 0); + cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0); - cubes[2]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[2]->setPos(static_cast(+w / 2 - 1), static_cast(0 + yOff), 0); + cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0); - cubes[3]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[3]->setPos(0, static_cast(0 + yOff), static_cast(-h / 2 + 1)); + cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1)); - cubes[4]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[4]->setPos(0, static_cast(0 + yOff), static_cast(+h / 2 - 1)); + cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1)); cubes[0]->xRot = PI / 2; cubes[1]->yRot = PI / 2 * 3; diff --git a/Minecraft.Client/BoatRenderer.cpp b/Minecraft.Client/BoatRenderer.cpp index c012168a..4c2e9baf 100644 --- a/Minecraft.Client/BoatRenderer.cpp +++ b/Minecraft.Client/BoatRenderer.cpp @@ -20,7 +20,7 @@ void BoatRenderer::render(shared_ptr _boat, double x, double y, double z glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); glRotatef(180-rot, 0, 1, 0); float hurt = boat->getHurtTime() - a; diff --git a/Minecraft.Client/BreakingItemParticle.cpp b/Minecraft.Client/BreakingItemParticle.cpp index 8842209b..51b721f5 100644 --- a/Minecraft.Client/BreakingItemParticle.cpp +++ b/Minecraft.Client/BreakingItemParticle.cpp @@ -42,7 +42,7 @@ void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, fl float v1 = v0 + 0.999f / 16.0f / 4; float r = 0.1f * size; - if (tex != nullptr) + if (tex != NULL) { u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION); u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); @@ -50,9 +50,9 @@ void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, fl v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); } - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); float br = SharedConstants::TEXTURE_LIGHTING ? 1 : getBrightness(a); // 4J - change brought forward from 1.8.2 t->color(br * rCol, br * gCol, br * bCol); diff --git a/Minecraft.Client/BubbleParticle.cpp b/Minecraft.Client/BubbleParticle.cpp index 29dd1202..2d1380eb 100644 --- a/Minecraft.Client/BubbleParticle.cpp +++ b/Minecraft.Client/BubbleParticle.cpp @@ -16,11 +16,11 @@ BubbleParticle::BubbleParticle(Level *level, double x, double y, double z, doubl size = size*(random->nextFloat()*0.6f+0.2f); - xd = xa*0.2f+static_cast(Math::random() * 2 - 1)*0.02f; - yd = ya*0.2f+static_cast(Math::random() * 2 - 1)*0.02f; - zd = za*0.2f+static_cast(Math::random() * 2 - 1)*0.02f; + xd = xa*0.2f+(float)(Math::random()*2-1)*0.02f; + yd = ya*0.2f+(float)(Math::random()*2-1)*0.02f; + zd = za*0.2f+(float)(Math::random()*2-1)*0.02f; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); } void BubbleParticle::tick() diff --git a/Minecraft.Client/BufferedImage.cpp b/Minecraft.Client/BufferedImage.cpp index 8777d307..89e37e4f 100644 --- a/Minecraft.Client/BufferedImage.cpp +++ b/Minecraft.Client/BufferedImage.cpp @@ -31,7 +31,7 @@ BufferedImage::BufferedImage(int width,int height,int type) for( int i = 1 ; i < 10; i++ ) { - data[i] = nullptr; + data[i] = NULL; } this->width = width; this->height = height; @@ -140,7 +140,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f for( int l = 0 ; l < 10; l++ ) { - data[l] = nullptr; + data[l] = NULL; } for( int l = 0; l < 10; l++ ) @@ -193,12 +193,12 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam { HRESULT hr; wstring filePath = File; - BYTE *pbData = nullptr; + BYTE *pbData = NULL; DWORD dwBytes = 0; for( int l = 0 ; l < 10; l++ ) { - data[l] = nullptr; + data[l] = NULL; } for( int l = 0; l < 10; l++ ) @@ -230,7 +230,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); pbData = dlcFile->getData(dwBytes); - if(pbData == nullptr || dwBytes == 0) + if(pbData == NULL || dwBytes == 0) { // 4J - If we haven't loaded the non-mipmap version then exit the game if( l == 0 ) @@ -269,7 +269,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes) int iCurrentByte=0; for( int l = 0 ; l < 10; l++ ) { - data[l] = nullptr; + data[l] = NULL; } D3DXIMAGE_INFO ImageInfo; @@ -329,7 +329,7 @@ int *BufferedImage::getData(int level) Graphics *BufferedImage::getGraphics() { - return nullptr; + return NULL; } //Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT. @@ -359,7 +359,7 @@ BufferedImage *BufferedImage::getSubimage(int x ,int y, int w, int h) this->getRGB(x, y, w, h, arrayWrapper,0,w); int level = 1; - while(getData(level) != nullptr) + while(getData(level) != NULL) { int ww = w >> level; int hh = h >> level; @@ -391,9 +391,9 @@ void BufferedImage::preMultiplyAlpha() { cur = curData[i]; alpha = (cur >> 24) & 0xff; - r = ((cur >> 16) & 0xff) * static_cast(alpha)/255; - g = ((cur >> 8) & 0xff) * static_cast(alpha)/255; - b = (cur & 0xff) * static_cast(alpha)/255; + r = ((cur >> 16) & 0xff) * (float)alpha/255; + g = ((cur >> 8) & 0xff) * (float)alpha/255; + b = (cur & 0xff) * (float)alpha/255; curData[i] = (r << 16) | (g << 8) | (b ) | (alpha << 24); } diff --git a/Minecraft.Client/BufferedImage.h b/Minecraft.Client/BufferedImage.h index 3a08383f..a0227fe2 100644 --- a/Minecraft.Client/BufferedImage.h +++ b/Minecraft.Client/BufferedImage.h @@ -7,7 +7,7 @@ class DLCPack; class BufferedImage { private: - int *data[10]; // Arrays for mipmaps - nullptr if not used + int *data[10]; // Arrays for mipmaps - NULL if not used int width; int height; void ByteFlip4(unsigned int &data); // 4J added diff --git a/Minecraft.Client/ChatScreen.cpp b/Minecraft.Client/ChatScreen.cpp index 53c90722..543cab76 100644 --- a/Minecraft.Client/ChatScreen.cpp +++ b/Minecraft.Client/ChatScreen.cpp @@ -87,7 +87,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) { if (eventKey == Keyboard::KEY_ESCAPE) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); return; } if (eventKey == Keyboard::KEY_RETURN) @@ -108,7 +108,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) s_chatHistory.erase(s_chatHistory.begin()); } } - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); return; } if (eventKey == Keyboard::KEY_UP) { handleHistoryUp(); return; } @@ -160,7 +160,7 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum) { if (buttonNum == 0) { - if (minecraft->gui->selectedName != L"") // 4J - was nullptr comparison + if (minecraft->gui->selectedName != L"") // 4J - was NULL comparison { if (message.length() > 0 && message[message.length()-1]!=L' ') { diff --git a/Minecraft.Client/ChestRenderer.cpp b/Minecraft.Client/ChestRenderer.cpp index 7d306f45..97954b55 100644 --- a/Minecraft.Client/ChestRenderer.cpp +++ b/Minecraft.Client/ChestRenderer.cpp @@ -52,19 +52,19 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d Tile *tile = chest->getTile(); data = chest->getData(); - if (dynamic_cast(tile) != nullptr && data == 0) + if (dynamic_cast(tile) != NULL && data == 0) { - static_cast(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z); + ((ChestTile *) tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z); data = chest->getData(); } chest->checkNeighbors(); } - if (chest->n.lock() != nullptr || chest->w.lock() != nullptr) return; + if (chest->n.lock() != NULL || chest->w.lock() != NULL) return; ChestModel *model; - if (chest->e.lock() != nullptr || chest->s.lock() != nullptr) + if (chest->e.lock() != NULL || chest->s.lock() != NULL) { model = largeChestModel; @@ -102,7 +102,7 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d glEnable(GL_RESCALE_NORMAL); //if( setColor ) glColor4f(1, 1, 1, 1); if( setColor ) glColor4f(1, 1, 1, alpha); - glTranslatef(static_cast(x), static_cast(y) + 1, static_cast(z) + 1); + glTranslatef((float) x, (float) y + 1, (float) z + 1); glScalef(1, -1, -1); glTranslatef(0.5f, 0.5f, 0.5f); @@ -112,11 +112,11 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d if (data == 4) rot = 90; if (data == 5) rot = -90; - if (data == 2 && chest->e.lock() != nullptr) + if (data == 2 && chest->e.lock() != NULL) { glTranslatef(1, 0, 0); } - if (data == 5 && chest->s.lock() != nullptr) + if (data == 5 && chest->s.lock() != NULL) { glTranslatef(0, 0, -1); } @@ -124,12 +124,12 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d glTranslatef(-0.5f, -0.5f, -0.5f); float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a; - if (chest->n.lock() != nullptr) + if (chest->n.lock() != NULL) { float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a; if (open2 > open) open = open2; } - if (chest->w.lock() != nullptr) + if (chest->w.lock() != NULL) { float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a; if (open2 > open) open = open2; diff --git a/Minecraft.Client/ChickenModel.cpp b/Minecraft.Client/ChickenModel.cpp index 14eb6127..98ef9358 100644 --- a/Minecraft.Client/ChickenModel.cpp +++ b/Minecraft.Client/ChickenModel.cpp @@ -8,35 +8,35 @@ ChickenModel::ChickenModel() : Model() int yo = 16; head = new ModelPart(this, 0, 0); head->addBox(-2.0f, -6.0f, -2.0f, 4, 6, 3, 0.0f); // Head - head->setPos(0, static_cast(-1 + yo), -4); + head->setPos(0, (float)(-1 + yo), -4); beak = new ModelPart(this, 14, 0); beak->addBox(-2.0f, -4.0f, -4.0f, 4, 2, 2, 0.0f); // Beak - beak->setPos(0, static_cast(-1 + yo), -4); + beak->setPos(0, (float)(-1 + yo), -4); redThing = new ModelPart(this, 14, 4); redThing->addBox(-1.0f, -2.0f, -3.0f, 2, 2, 2, 0.0f); // Beak - redThing->setPos(0, static_cast(-1 + yo), -4); + redThing->setPos(0, (float)(-1 + yo), -4); body = new ModelPart(this, 0, 9); body->addBox(-3.0f, -4.0f, -3.0f, 6, 8, 6, 0.0f); // Body - body->setPos(0, static_cast(0 + yo), 0); + body->setPos(0, (float)(0 + yo), 0); leg0 = new ModelPart(this, 26, 0); leg0->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg0 - leg0->setPos(-2, static_cast(3 + yo), 1); + leg0->setPos(-2, (float)(3 + yo), 1); leg1 = new ModelPart(this, 26, 0); leg1->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg1 - leg1->setPos(1, static_cast(3 + yo), 1); + leg1->setPos(1, (float)(3 + yo), 1); wing0 = new ModelPart(this, 24, 13); wing0->addBox(0.0f, 0.0f, -3.0f, 1, 4, 6); // Wing0 - wing0->setPos(-4, static_cast(-3 + yo), 0); + wing0->setPos(-4, (float)(-3 + yo), 0); wing1 = new ModelPart(this, 24, 13); wing1->addBox(-1.0f, 0.0f, -3.0f, 1, 4, 6); // Wing1 - wing1->setPos(4, static_cast(-3 + yo), 0); + wing1->setPos(4, (float)(-3 + yo), 0); // 4J added - compile now to avoid random performance hit first time cubes are rendered head->compile(1.0f/16.0f); diff --git a/Minecraft.Client/Chunk.cpp b/Minecraft.Client/Chunk.cpp index 6f0ad736..850b79fb 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -32,13 +32,13 @@ void Chunk::CreateNewThreadStorage() void Chunk::ReleaseThreadStorage() { - unsigned char *tileIds = static_cast(TlsGetValue(tlsIdx)); + unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx); delete tileIds; } unsigned char *Chunk::GetTileIdsStorage() { - unsigned char *tileIds = static_cast(TlsGetValue(tlsIdx)); + unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx); return tileIds; } #else @@ -148,7 +148,7 @@ void Chunk::setPos(int x, int y, int z) void Chunk::translateToPos() { - glTranslatef(static_cast(xRenderOffs), static_cast(yRenderOffs), static_cast(zRenderOffs)); + glTranslatef((float)xRenderOffs, (float)yRenderOffs, (float)zRenderOffs); } @@ -173,7 +173,7 @@ void Chunk::makeCopyForRebuild(Chunk *source) this->ym = source->ym; this->zm = source->zm; this->bb = source->bb; - this->clipChunk = nullptr; + this->clipChunk = NULL; this->id = source->id; this->globalRenderableTileEntities = source->globalRenderableTileEntities; this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs; @@ -399,7 +399,7 @@ void Chunk::rebuild() glTranslatef(zs / 2.0f, ys / 2.0f, zs / 2.0f); #endif t->begin(); - t->offset(static_cast(-this->x), static_cast(-this->y), static_cast(-this->z)); + t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z)); } Tile *tile = Tile::tiles[tileId]; @@ -521,7 +521,7 @@ void Chunk::rebuild() else { // Easy case - nothing already existing for this chunk. Add them all in. - for( size_t i = 0; i < renderableTileEntities.size(); i++ ) + for( int i = 0; i < renderableTileEntities.size(); i++ ) { (*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]); } @@ -680,7 +680,7 @@ void Chunk::rebuild_SPU() // render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently // it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into // the cache anyway. - ChunkRebuildData* pOutData = nullptr; + ChunkRebuildData* pOutData = NULL; g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0); Tesselator::Bounds bounds; @@ -826,7 +826,7 @@ void Chunk::rebuild_SPU() } // Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add - for( size_t i = 0; i < renderableTileEntities.size(); i++ ) + for( int i = 0; i < renderableTileEntities.size(); i++ ) { auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] ); if( it2 == it->second.end() ) @@ -842,7 +842,7 @@ void Chunk::rebuild_SPU() else { // Easy case - nothing already existing for this chunk. Add them all in. - for( size_t i = 0; i < renderableTileEntities.size(); i++ ) + for( int i = 0; i < renderableTileEntities.size(); i++ ) { (*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]); } @@ -936,17 +936,17 @@ void Chunk::rebuild_SPU() float Chunk::distanceToSqr(shared_ptr player) const { - float xd = static_cast(player->x - xm); - float yd = static_cast(player->y - ym); - float zd = static_cast(player->z - zm); + float xd = (float) (player->x - xm); + float yd = (float) (player->y - ym); + float zd = (float) (player->z - zm); return xd * xd + yd * yd + zd * zd; } float Chunk::squishedDistanceToSqr(shared_ptr player) { - float xd = static_cast(player->x - xm); - float yd = static_cast(player->y - ym) * 2; - float zd = static_cast(player->z - zm); + float xd = (float) (player->x - xm); + float yd = (float) (player->y - ym) * 2; + float zd = (float) (player->z - zm); return xd * xd + yd * yd + zd * zd; } @@ -981,7 +981,7 @@ void Chunk::reset() void Chunk::_delete() { reset(); - level = nullptr; + level = NULL; } int Chunk::getList(int layer) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 63ee763a..9b955cae 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -95,7 +95,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, const wstring& ip, int } else { - connection = nullptr; + connection = NULL; delete socket; } #endif @@ -106,9 +106,9 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs // 4J - added initiliasers random = new Random(); done = false; - level = nullptr; + level = NULL; started = false; - savedDataStorage = new SavedDataStorage(nullptr); + savedDataStorage = new SavedDataStorage(NULL); maxPlayers = 20; this->minecraft = minecraft; @@ -122,7 +122,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs m_userIndex = iUserIndex; } - if( socket == nullptr ) + if( socket == NULL ) { socket = new Socket(); // 4J - Local connection } @@ -134,7 +134,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs } else { - connection = nullptr; + connection = NULL; // TODO 4J Stu - This will cause issues since the session player owns the socket //delete socket; } @@ -157,8 +157,8 @@ void ClientConnection::tick() INetworkPlayer *ClientConnection::getNetworkPlayer() { - if( connection != nullptr && connection->getSocket() != nullptr) return connection->getSocket()->getPlayer(); - else return nullptr; + if( connection != NULL && connection->getSocket() != NULL) return connection->getSocket()->getPlayer(); + else return NULL; } void ClientConnection::handleLogin(shared_ptr packet) @@ -167,7 +167,7 @@ void ClientConnection::handleLogin(shared_ptr packet) PlayerUID OnlineXuid; ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid - MOJANG_DATA *pMojangData = nullptr; + MOJANG_DATA *pMojangData = NULL; if(!g_NetworkManager.IsLocalGame()) { @@ -208,7 +208,7 @@ void ClientConnection::handleLogin(shared_ptr packet) if(iUserID!=-1) { - BYTE *pBuffer=nullptr; + BYTE *pBuffer=NULL; DWORD dwSize=0; bool bRes; @@ -285,17 +285,17 @@ void ClientConnection::handleLogin(shared_ptr packet) Level *dimensionLevel = minecraft->getLevel( packet->dimension ); - if( dimensionLevel == nullptr ) + if( dimensionLevel == NULL ) { level = new MultiPlayerLevel(this, new LevelSettings(packet->seed, GameType::byId(packet->gameType), false, false, packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty); // 4J Stu - We want to share the SavedDataStorage between levels int otherDimensionId = packet->dimension == 0 ? -1 : 0; Level *activeLevel = minecraft->getLevel(otherDimensionId); - if( activeLevel != nullptr ) + if( activeLevel != NULL ) { // Don't need to delete it here as it belongs to a client connection while will delete it when it's done - //if( level->savedDataStorage != nullptr ) delete level->savedDataStorage; + //if( level->savedDataStorage != NULL ) delete level->savedDataStorage; level->savedDataStorage = activeLevel->savedDataStorage; } @@ -341,12 +341,12 @@ void ClientConnection::handleLogin(shared_ptr packet) level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); shared_ptr player; - if(level==nullptr) + if(level==NULL) { int otherDimensionId = packet->dimension == 0 ? -1 : 0; MultiPlayerLevel *activeLevel = minecraft->getLevel(otherDimensionId); - if(activeLevel == nullptr) + if(activeLevel == NULL) { otherDimensionId = packet->dimension == 0 ? 1 : (packet->dimension == -1 ? 1 : -1); activeLevel = minecraft->getLevel(otherDimensionId); @@ -433,7 +433,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == nullptr ) + if( owner == NULL ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -449,10 +449,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } - if (owner != nullptr && owner->instanceof(eTYPE_PLAYER)) + if (owner != NULL && owner->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(owner); - shared_ptr hook = std::make_shared(level, x, y, z, player); + shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' player->fishing = hook; @@ -461,10 +461,10 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } break; case AddEntityPacket::ARROW: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new Arrow(level, x, y, z) ); break; case AddEntityPacket::SNOWBALL: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new Snowball(level, x, y, z) ); break; case AddEntityPacket::ITEM_FRAME: { @@ -473,64 +473,64 @@ void ClientConnection::handleAddEntity(shared_ptr packet) int iz = (int) z; app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - e = std::make_shared(level, (int)x, (int)y, (int)z, packet->data); + e = shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); packet->data = 0; setRot = false; break; case AddEntityPacket::THROWN_ENDERPEARL: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new ThrownEnderpearl(level, x, y, z) ); break; case AddEntityPacket::EYEOFENDERSIGNAL: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new EyeOfEnderSignal(level, x, y, z) ); break; case AddEntityPacket::FIREBALL: - e = std::make_shared(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); + e = shared_ptr( new LargeFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::SMALL_FIREBALL: - e = std::make_shared(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); + e = shared_ptr( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::DRAGON_FIRE_BALL: - e = std::make_shared(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); + e = shared_ptr( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) ); packet->data = 0; break; case AddEntityPacket::EGG: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new ThrownEgg(level, x, y, z) ); break; case AddEntityPacket::THROWN_POTION: - e = std::make_shared(level, x, y, z, packet->data); + e = shared_ptr( new ThrownPotion(level, x, y, z, packet->data) ); packet->data = 0; break; case AddEntityPacket::THROWN_EXPBOTTLE: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new ThrownExpBottle(level, x, y, z) ); packet->data = 0; break; case AddEntityPacket::BOAT: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new Boat(level, x, y, z) ); break; case AddEntityPacket::PRIMED_TNT: - e = std::make_shared(level, x, y, z, std::shared_ptr()); + e = shared_ptr( new PrimedTnt(level, x, y, z, nullptr) ); break; case AddEntityPacket::ENDER_CRYSTAL: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new EnderCrystal(level, x, y, z) ); break; case AddEntityPacket::ITEM: - e = std::make_shared(level, x, y, z); + e = shared_ptr( new ItemEntity(level, x, y, z) ); break; case AddEntityPacket::FALLING: - e = std::make_shared(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16); + e = shared_ptr( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) ); packet->data = 0; break; case AddEntityPacket::WITHER_SKULL: - e = std::make_shared(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); + e = shared_ptr(new WitherSkull(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0)); packet->data = 0; break; case AddEntityPacket::FIREWORKS: - e = std::make_shared(level, x, y, z, std::shared_ptr()); + e = shared_ptr(new FireworksRocketEntity(level, x, y, z, nullptr)); break; case AddEntityPacket::LEASH_KNOT: - e = std::make_shared(level, (int)x, (int)y, (int)z); + e = shared_ptr(new LeashFenceKnotEntity(level, (int) x, (int) y, (int) z)); packet->data = 0; break; #ifndef _FINAL_BUILD @@ -549,7 +549,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == nullptr ) + if( owner == NULL ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -565,7 +565,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } shared_ptr player = dynamic_pointer_cast(owner); - if (player != nullptr) + if (player != NULL) { shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; @@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) */ - if (e != nullptr) + if (e != NULL) { e->xp = packet->x; e->yp = packet->y; @@ -661,7 +661,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == nullptr ) + if( owner == NULL ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -676,7 +676,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } - if ( owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY) ) + if ( owner != NULL && owner->instanceof(eTYPE_LIVINGENTITY) ) { dynamic_pointer_cast(e)->owner = dynamic_pointer_cast(owner); } @@ -692,7 +692,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) void ClientConnection::handleAddExperienceOrb(shared_ptr packet) { - shared_ptr e = std::make_shared(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value); + shared_ptr e = shared_ptr( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) ); e->xp = packet->x; e->yp = packet->y; e->zp = packet->z; @@ -708,8 +708,8 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr p double y = packet->y / 32.0; double z = packet->z / 32.0; shared_ptr e;// = nullptr; - if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = std::make_shared(level, x, y, z); - if (e != nullptr) + if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr( new LightningBolt(level, x, y, z) ); + if (e != NULL) { e->xp = packet->x; e->yp = packet->y; @@ -723,21 +723,21 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr p void ClientConnection::handleAddPainting(shared_ptr packet) { - shared_ptr painting = std::make_shared(level, packet->x, packet->y, packet->z, packet->dir, packet->motive); + shared_ptr painting = shared_ptr( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) ); level->putEntity(packet->id, painting); } void ClientConnection::handleSetEntityMotion(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); } void ClientConnection::handleSetEntityData(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e != nullptr && packet->getUnpackedData() != nullptr) + if (e != NULL && packet->getUnpackedData() != NULL) { e->getEntityData()->assignValues(packet->getUnpackedData()); } @@ -764,7 +764,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) // a duplicate remote player for a local slot by checking the username directly. for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (minecraft->localplayers[idx] != nullptr && minecraft->localplayers[idx]->name == packet->name) + if (minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->name == packet->name) { app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str()); return; @@ -778,7 +778,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) // their stored server index rather than using it directly as an array subscript. for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(minecraft->localplayers[idx] != nullptr && + if(minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->getPlayerIndex() == packet->m_playerIndex) { app.DebugPrintf("AddPlayerPacket received for local player (controller %d, server index %d), skipping RemotePlayer creation\n", idx, packet->m_playerIndex); @@ -792,7 +792,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) double z = packet->z / 32.0; float yRot = packet->yRot * 360 / 256.0f; float xRot = packet->xRot * 360 / 256.0f; - shared_ptr player = std::make_shared(minecraft->level, packet->name); + shared_ptr player = shared_ptr( new RemotePlayer(minecraft->level, packet->name) ); player->xo = player->xOld = player->xp = packet->x; player->yo = player->yOld = player->yp = packet->y; player->zo = player->zOld = player->zp = packet->z; @@ -804,7 +804,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) #ifdef _DURANGO // On Durango request player display name from network manager INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerByXuid(player->getXuid()); - if (networkPlayer != nullptr) player->m_displayName = networkPlayer->GetDisplayName(); + if (networkPlayer != NULL) player->m_displayName = networkPlayer->GetDisplayName(); #else // On all other platforms display name is just gamertag so don't check with the network manager player->m_displayName = player->getName(); @@ -812,7 +812,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) #ifdef _WINDOWS64 { - IQNetPlayer* matchedQNetPlayer = nullptr; + IQNetPlayer* matchedQNetPlayer = NULL; PlayerUID pktXuid = player->getXuid(); const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e; // Legacy compatibility path for peers still using embedded smallId XUIDs. @@ -820,7 +820,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) { BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE); INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId); - if (np != nullptr) + if (np != NULL) { NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; matchedQNetPlayer = npx->GetQNetPlayer(); @@ -828,18 +828,18 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } // Current Win64 path: identify QNet player by name and attach packet XUID. - if (matchedQNetPlayer == nullptr) + if (matchedQNetPlayer == NULL) { for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { BYTE smallId = static_cast(i); INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId); - if (np == nullptr) + if (np == NULL) continue; NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; IQNetPlayer* qp = npx->GetQNetPlayer(); - if (qp != nullptr && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0) + if (qp != NULL && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0) { matchedQNetPlayer = qp; break; @@ -847,7 +847,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } } - if (matchedQNetPlayer != nullptr) + if (matchedQNetPlayer != NULL) { // Store packet-authoritative XUID on this network slot so later lookups by XUID // (e.g. remove player, display mapping) work for both legacy and uid.dat clients. @@ -865,11 +865,11 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) int item = packet->carriedItem; if (item == 0) { - player->inventory->items[player->inventory->selected] = shared_ptr(); // nullptr; + player->inventory->items[player->inventory->selected] = shared_ptr(); // NULL; } else { - player->inventory->items[player->inventory->selected] = std::make_shared(item, 1, 0); + player->inventory->items[player->inventory->selected] = shared_ptr( new ItemInstance(item, 1, 0) ); } player->absMoveTo(x, y, z, yRot, xRot); @@ -878,22 +878,19 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) player->setCustomCape( packet->m_capeId ); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); - if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl)) - { - if (minecraft->addPendingClientTextureRequest(player->customTextureUrl)) - { - app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n", player->customTextureUrl.c_str(), player->name.c_str()); + if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl)) + { + if( minecraft->addPendingClientTextureRequest(player->customTextureUrl) ) + { + app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); - send(std::make_shared( - player->customTextureUrl, - nullptr, - static_cast(0))); - } - } + send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); + } + } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl,nullptr,0); + app.AddMemoryTextureFile(player->customTextureUrl,NULL,0); } app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str()); @@ -903,17 +900,13 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) ) { app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); - send(std::make_shared( - player->customTextureUrl2, - nullptr, - static_cast(0) - )); + send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2,nullptr,0); + app.AddMemoryTextureFile(player->customTextureUrl2,NULL,0); } app.DebugPrintf("Custom cape for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl2.c_str()); @@ -921,7 +914,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) level->putEntity(packet->id, player); vector > *unpackedData = packet->getUnpackedData(); - if (unpackedData != nullptr) + if (unpackedData != NULL) { player->getEntityData()->assignValues(unpackedData); } @@ -931,7 +924,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) void ClientConnection::handleTeleportEntity(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; e->xp = packet->x; e->yp = packet->y; e->zp = packet->z; @@ -960,7 +953,7 @@ void ClientConnection::handleSetCarriedItem(shared_ptr pac void ClientConnection::handleMoveEntity(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; e->zp += packet->za; @@ -981,7 +974,7 @@ void ClientConnection::handleMoveEntity(shared_ptr packet) void ClientConnection::handleRotateMob(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; float yHeadRot = packet->yHeadRot * 360 / 256.f; e->setYHeadRot(yHeadRot); } @@ -989,7 +982,7 @@ void ClientConnection::handleRotateMob(shared_ptr packet) void ClientConnection::handleMoveEntitySmall(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; e->xp += packet->xa; e->yp += packet->ya; e->zp += packet->za; @@ -1015,18 +1008,18 @@ void ClientConnection::handleRemoveEntity(shared_ptr packe for (int i = 0; i < packet->ids.length; i++) { shared_ptr entity = getEntity(packet->ids[i]); - if (entity != nullptr && entity->GetType() == eTYPE_PLAYER) + if (entity != NULL && entity->GetType() == eTYPE_PLAYER) { shared_ptr player = dynamic_pointer_cast(entity); - if (player != nullptr) + if (player != NULL) { PlayerUID xuid = player->getXuid(); INetworkPlayer* np = g_NetworkManager.GetPlayerByXuid(xuid); - if (np != nullptr) + if (np != NULL) { NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; IQNetPlayer* qp = npx->GetQNetPlayer(); - if (qp != nullptr) + if (qp != NULL) { extern CPlatformNetworkManagerStub* g_pPlatformNetworkManager; g_pPlatformNetworkManager->NotifyPlayerLeaving(qp); @@ -1096,7 +1089,7 @@ void ClientConnection::handleMovePlayer(shared_ptr packet) player->zOld = player->z; started = true; - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World". // Move this check from Minecraft::createExtraLocalPlayer @@ -1306,7 +1299,7 @@ void ClientConnection::handleDisconnect(shared_ptr packet) app.SetDisconnectReason( packet->reason ); app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE); - //minecraft->setLevel(nullptr); + //minecraft->setLevel(NULL); //minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected", L"disconnect.genericReason", &packet->reason)); } @@ -1329,14 +1322,14 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,nullptr); + ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL); } else { app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE); } - //minecraft->setLevel(nullptr); + //minecraft->setLevel(NULL); //minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects)); } @@ -1374,7 +1367,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac } } - if (to == nullptr) + if (to == NULL) { // Don't know if this should ever really happen, but seems safest to try and remove the entity that has been collected even if we can't // create a particle as we don't know what really collected it @@ -1382,7 +1375,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac return; } - if (from != nullptr) + if (from != NULL) { // If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In // particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid @@ -1396,7 +1389,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac // the tutorial for the player that actually picked up the item int playerPad = player->GetXboxPad(); - if( minecraft->localgameModes[playerPad] != nullptr ) + if( minecraft->localgameModes[playerPad] != NULL ) { // 4J-PB - add in the XP orb sound if(from->GetType() == eTYPE_EXPERIENCEORB) @@ -1410,7 +1403,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); } - minecraft->particleEngine->add(std::make_shared(minecraft->level, from, to, -0.5f)); + minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } else @@ -1423,7 +1416,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac else { level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f); - minecraft->particleEngine->add(std::make_shared(minecraft->level, from, to, -0.5f)); + minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) ); level->removeEntity(packet->itemId); } } @@ -1841,7 +1834,7 @@ void ClientConnection::handleChat(shared_ptr packet) void ClientConnection::handleAnimate(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; if (packet->action == AnimatePacket::SWING) { if (e->instanceof(eTYPE_LIVINGENTITY)) dynamic_pointer_cast(e)->swing(); @@ -1859,13 +1852,13 @@ void ClientConnection::handleAnimate(shared_ptr packet) } else if (packet->action == AnimatePacket::CRITICAL_HIT) { - shared_ptr critParticle = std::make_shared(minecraft->level, e); + shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add( critParticle ); } else if (packet->action == AnimatePacket::MAGIC_CRITICAL_HIT) { - shared_ptr critParticle = std::make_shared(minecraft->level, e, eParticleType_magicCrit); + shared_ptr critParticle = shared_ptr( new CritParticle(minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } @@ -1878,7 +1871,7 @@ void ClientConnection::handleAnimate(shared_ptr packet) void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; if (packet->action == EntityActionAtPositionPacket::START_SLEEP) { shared_ptr player = dynamic_pointer_cast(e); @@ -1938,7 +1931,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // Is this user friends with the host player? BOOL result; DWORD error; - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result != TRUE) { canPlay = FALSE; @@ -1968,7 +1961,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // Is this user friends with the host player? BOOL result; DWORD error; - error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr); + error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); if(error == ERROR_SUCCESS && result != TRUE) { canPlay = FALSE; @@ -2020,7 +2013,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE; } } @@ -2048,7 +2041,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); if(error == ERROR_SUCCESS) canPlay &= result; } if(!canPlay) break; @@ -2071,7 +2064,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { bool bChatRestricted=false; - ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,NULL,NULL); // Chat restricted orbis players can still play online #ifndef __ORBIS__ @@ -2160,11 +2153,11 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // which seems to be very unstable at the point of starting up the game if(m_userIndex == ProfileManager.GetPrimaryPad()) { - ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,NULL); } else { - ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,NULL); } // Chat restricted orbis players can still play online @@ -2337,8 +2330,8 @@ void ClientConnection::handlePreLogin(shared_ptr packet) } BOOL allAllowed, friendsAllowed; ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed); - send(std::make_shared(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed != TRUE && friendsAllowed == TRUE), - packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest(m_userIndex))); + send( shared_ptr( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE), + packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex )))); if(!g_NetworkManager.IsHost() ) { @@ -2415,7 +2408,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) level->putEntity(packet->id, mob); vector > *unpackedData = packet->getUnpackedData(); - if (unpackedData != nullptr) + if (unpackedData != NULL) { mob->getEntityData()->assignValues(unpackedData); } @@ -2450,10 +2443,10 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa // 4J: If the destination entity couldn't be found, defer handling of this packet // This was added to support leashing (the entity link packet is sent before the add entity packet) - if (destEntity == nullptr && packet->destId >= 0) + if (destEntity == NULL && packet->destId >= 0) { // We don't handle missing source entities because it shouldn't happen - assert(!(sourceEntity == nullptr && packet->sourceId >= 0)); + assert(!(sourceEntity == NULL && packet->sourceId >= 0)); deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet)); return; @@ -2466,16 +2459,16 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa { sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; - if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast(destEntity))->setDoLerp(false); + if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast(destEntity))->setDoLerp(false); - displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr); + displayMountMessage = (sourceEntity->riding == NULL && destEntity != NULL); } - else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) + else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) { (dynamic_pointer_cast(destEntity))->setDoLerp(true); } - if (sourceEntity == nullptr) return; + if (sourceEntity == NULL) return; sourceEntity->ride(destEntity); @@ -2489,9 +2482,9 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa } else if (packet->type == SetEntityLinkPacket::LEASH) { - if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB) ) + if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) ) { - if (destEntity != nullptr) + if (destEntity != NULL) { (dynamic_pointer_cast(sourceEntity))->setLeashedTo(destEntity, false); @@ -2507,7 +2500,7 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa void ClientConnection::handleEntityEvent(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if (e != nullptr) e->handleEntityEvent(packet->eventId); + if (e != NULL) e->handleEntityEvent(packet->eventId); } shared_ptr ClientConnection::getEntity(int entityId) @@ -2531,7 +2524,7 @@ void ClientConnection::handleSetHealth(shared_ptr packet) // We need food if(packet->food < FoodConstants::HEAL_LEVEL - 1) { - if(minecraft->localgameModes[m_userIndex] != nullptr && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() ) + if(minecraft->localgameModes[m_userIndex] != NULL && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() ) { minecraft->localgameModes[m_userIndex]->getTutorial()->changeTutorialState(e_Tutorial_State_Food_Bar); } @@ -2555,13 +2548,13 @@ void ClientConnection::handleTexture(shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); if(dwBytes!=0) { - send(std::make_shared(packet->textureName, pbData, dwBytes)); + send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } } else @@ -2587,7 +2580,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptrtextureName.c_str()); #endif - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); @@ -2598,18 +2591,18 @@ void ClientConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send(std::make_shared(packet->textureName, pbData, dwBytes, pDLCSkinFile)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) ); } else { - send(std::make_shared(packet->textureName, pbData, dwBytes)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) ); } } else { unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send(std::make_shared(packet->textureName, pbData, dwBytes, app.GetAdditionalSkinBoxes(packet->dwSkinID), uiAnimOverrideBitmask)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) ); } } } @@ -2637,7 +2630,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if ( (e == nullptr) || !e->instanceof(eTYPE_PLAYER) ) return; + if ( (e == NULL) || !e->instanceof(eTYPE_PLAYER) ) return; shared_ptr player = dynamic_pointer_cast(e); bool isLocalPlayer = false; @@ -2678,25 +2671,22 @@ void ClientConnection::handleTextureChange(shared_ptr packe #ifndef _CONTENT_PACKAGE wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(std::make_shared( - player->customTextureUrl, - nullptr, - static_cast(0))); + send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,nullptr,0); + app.AddMemoryTextureFile(packet->path,NULL,0); } } void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == nullptr) return; + if (e == NULL) return; shared_ptr player = dynamic_pointer_cast(e); - if( e == nullptr) return; + if( e == NULL) return; bool isLocalPlayer = false; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) @@ -2726,16 +2716,13 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(std::make_shared( - packet->path, - nullptr, - static_cast(0))); + send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,nullptr,0); + app.AddMemoryTextureFile(packet->path,NULL,0); } } @@ -2756,12 +2743,12 @@ void ClientConnection::handleRespawn(shared_ptr packet) level->removeClientConnection(this, false); MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); - if( dimensionLevel == nullptr ) + if( dimensionLevel == NULL ) { dimensionLevel = new MultiPlayerLevel(this, new LevelSettings(packet->mapSeed, packet->playerGameType, false, minecraft->level->getLevelData()->isHardcore(), packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty); // 4J Stu - We want to shared the savedDataStorage between both levels - //if( dimensionLevel->savedDataStorage != nullptr ) + //if( dimensionLevel->savedDataStorage != NULL ) //{ // Don't need to delete it here as it belongs to a client connection while will delete it when it's done // delete dimensionLevel->savedDataStorage;+ @@ -2801,7 +2788,7 @@ void ClientConnection::handleRespawn(shared_ptr packet) TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); #endif - if( minecraft->localgameModes[m_userIndex] != nullptr ) + if( minecraft->localgameModes[m_userIndex] != NULL ) { TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_userIndex]; gameMode->getTutorial()->showTutorialPopup(false); @@ -2912,7 +2899,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe default: assert(false); chestString = -1; break; } - if( player->openContainer(std::make_shared(chestString, packet->title, packet->customName, packet->size))) + if( player->openContainer(shared_ptr( new SimpleContainer(chestString, packet->title, packet->customName, packet->size) ))) { player->containerMenu->containerId = packet->containerId; } @@ -2924,7 +2911,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::HOPPER: { - shared_ptr hopper = std::make_shared(); + shared_ptr hopper = shared_ptr(new HopperTileEntity()); if (packet->customName) hopper->setCustomName(packet->title); if(player->openHopper(hopper)) { @@ -2938,7 +2925,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::FURNACE: { - shared_ptr furnace = std::make_shared(); + shared_ptr furnace = shared_ptr(new FurnaceTileEntity()); if (packet->customName) furnace->setCustomName(packet->title); if(player->openFurnace(furnace)) { @@ -2952,7 +2939,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::BREWING_STAND: { - shared_ptr brewingStand = std::make_shared(); + shared_ptr brewingStand = shared_ptr(new BrewingStandTileEntity()); if (packet->customName) brewingStand->setCustomName(packet->title); if( player->openBrewingStand(brewingStand)) @@ -2967,7 +2954,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::DROPPER: { - shared_ptr dropper = std::make_shared(); + shared_ptr dropper = shared_ptr(new DropperTileEntity()); if (packet->customName) dropper->setCustomName(packet->title); if( player->openTrap(dropper)) @@ -2982,7 +2969,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRAP: { - shared_ptr dispenser = std::make_shared(); + shared_ptr dispenser = shared_ptr(new DispenserTileEntity()); if (packet->customName) dispenser->setCustomName(packet->title); if( player->openTrap(dispenser)) @@ -3021,7 +3008,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::TRADER_NPC: { - shared_ptr csm = std::make_shared(player, packet->title); + shared_ptr csm = shared_ptr(new ClientSideMerchant(player, packet->title)); csm->createContainer(); if(player->openTrading(csm, packet->customName ? packet->title : L"")) { @@ -3035,7 +3022,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe break; case ContainerOpenPacket::BEACON: { - shared_ptr beacon = std::make_shared(); + shared_ptr beacon = shared_ptr(new BeaconTileEntity()); if (packet->customName) beacon->setCustomName(packet->title); if(player->openBeacon(beacon)) @@ -3073,7 +3060,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe iTitle = IDS_MULE; break; }; - if(player->openHorseInventory(dynamic_pointer_cast(entity), std::make_shared(iTitle, packet->title, packet->customName, packet->size))) + if(player->openHorseInventory(dynamic_pointer_cast(entity), shared_ptr(new AnimalChest(iTitle, packet->title, packet->customName, packet->size)))) { player->containerMenu->containerId = packet->containerId; } @@ -3108,7 +3095,7 @@ void ClientConnection::handleContainerOpen(shared_ptr packe } else { - send(std::make_shared(packet->containerId)); + send(shared_ptr(new ContainerClosePacket(packet->containerId))); } } } @@ -3128,9 +3115,9 @@ void ClientConnection::handleContainerSetSlot(shared_ptr if(packet->slot >= 36 && packet->slot < 36 + 9) { shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); - if (packet->item != nullptr) + if (packet->item != NULL) { - if (lastItem == nullptr || lastItem->count < packet->item->count) + if (lastItem == NULL || lastItem->count < packet->item->count) { packet->item->popTime = Inventory::POP_TIME_DURATION; } @@ -3148,7 +3135,7 @@ void ClientConnection::handleContainerSetSlot(shared_ptr void ClientConnection::handleContainerAck(shared_ptr packet) { shared_ptr player = minecraft->localplayers[m_userIndex]; - AbstractContainerMenu *menu = nullptr; + AbstractContainerMenu *menu = NULL; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { menu = player->inventoryMenu; @@ -3157,11 +3144,11 @@ void ClientConnection::handleContainerAck(shared_ptr packet) { menu = player->containerMenu; } - if (menu != nullptr) + if (menu != NULL) { if (!packet->accepted) { - send(std::make_shared(packet->containerId, packet->uid, true)); + send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) )); } } } @@ -3182,13 +3169,13 @@ void ClientConnection::handleContainerContent(shared_ptr packet) { shared_ptr tileEntity = level->getTileEntity(packet->x, packet->y, packet->z); - if (tileEntity != nullptr) + if (tileEntity != NULL) { minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity); } else if (packet->editorType == TileEditorOpenPacket::SIGN) { - shared_ptr localSignDummy = std::make_shared(); + shared_ptr localSignDummy = shared_ptr(new SignTileEntity()); localSignDummy->setLevel(level); localSignDummy->x = packet->x; localSignDummy->y = packet->y; @@ -3205,7 +3192,7 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); // 4J-PB - on a client connecting, the line below fails - if (dynamic_pointer_cast(te) != nullptr) + if (dynamic_pointer_cast(te) != NULL) { shared_ptr ste = dynamic_pointer_cast(te); for (int i = 0; i < MAX_SIGN_LINES; i++) @@ -3221,7 +3208,7 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) } else { - app.DebugPrintf("dynamic_pointer_cast(te) == nullptr\n"); + app.DebugPrintf("dynamic_pointer_cast(te) == NULL\n"); } } else @@ -3236,21 +3223,21 @@ void ClientConnection::handleTileEntityData(shared_ptr pac { shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); - if (te != nullptr) + if (te != NULL) { - if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast(te) != nullptr) + if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast(te) != NULL) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast(te) != nullptr) + else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast(te) != NULL) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast(te) != nullptr) + else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast(te) != NULL) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast(te) != nullptr) + else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast(te) != NULL) { dynamic_pointer_cast(te)->load(packet->tag); } @@ -3261,7 +3248,7 @@ void ClientConnection::handleTileEntityData(shared_ptr pac void ClientConnection::handleContainerSetData(shared_ptr packet) { onUnhandledPacket(packet); - if (minecraft->localplayers[m_userIndex]->containerMenu != nullptr && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) + if (minecraft->localplayers[m_userIndex]->containerMenu != NULL && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) { minecraft->localplayers[m_userIndex]->containerMenu->setData(packet->id, packet->value); } @@ -3270,7 +3257,7 @@ void ClientConnection::handleContainerSetData(shared_ptr void ClientConnection::handleSetEquippedItem(shared_ptr packet) { shared_ptr entity = getEntity(packet->entity); - if (entity != nullptr) + if (entity != NULL) { // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game entity->setEquippedSlot(packet->slot, packet->getItem() ); @@ -3296,7 +3283,7 @@ void ClientConnection::handleTileDestruction(shared_ptr p bool ClientConnection::canHandleAsyncPackets() { - return minecraft != nullptr && minecraft->level != nullptr && minecraft->localplayers[m_userIndex] != nullptr && level != nullptr; + return minecraft != NULL && minecraft->level != NULL && minecraft->localplayers[m_userIndex] != NULL && level != NULL; } void ClientConnection::handleGameEvent(shared_ptr gameEventPacket) @@ -3305,7 +3292,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack int param = gameEventPacket->param; if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH) { - if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was nullptr check + if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was NULL check { minecraft->localplayers[m_userIndex]->displayClientMessage(GameEventPacket::EVENT_LANGUAGE_ID[event]); } @@ -3337,7 +3324,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); // This just allows it to be shown - if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); // Temporarily make this scene fullscreen CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen ); @@ -3345,8 +3332,8 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack #else app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown - if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen); + if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, NULL, eUILayer_Scene, eUIGroup_Fullscreen); #endif } else if( event == GameEventPacket::START_SAVING ) @@ -3390,7 +3377,7 @@ void ClientConnection::handleLevelEvent(shared_ptr packet) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(minecraft->localplayers[i] != nullptr && minecraft->localplayers[i]->level != nullptr && minecraft->localplayers[i]->level->dimension->id == 1) + if(minecraft->localplayers[i] != NULL && minecraft->localplayers[i]->level != NULL && minecraft->localplayers[i]->level->dimension->id == 1) { minecraft->localplayers[i]->awardStat(GenericStats::completeTheEnd(),GenericStats::param_noArgs()); } @@ -3417,7 +3404,7 @@ void ClientConnection::handleAwardStat(shared_ptr packet) void ClientConnection::handleUpdateMobEffect(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; + if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; //( dynamic_pointer_cast(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier)); @@ -3429,7 +3416,7 @@ void ClientConnection::handleUpdateMobEffect(shared_ptr p void ClientConnection::handleRemoveMobEffect(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; + if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; ( dynamic_pointer_cast(e) )->removeEffectNoUpdate(packet->effectId); } @@ -3445,7 +3432,7 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); - if(networkPlayer != nullptr && networkPlayer->IsHost()) + if(networkPlayer != NULL && networkPlayer->IsHost()) { // Some settings should always be considered on for the host player Player::enableAllPlayerPrivileges(startingPrivileges,true); @@ -3456,17 +3443,17 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges); shared_ptr entity = getEntity(packet->m_entityId); - if(entity != nullptr && entity->instanceof(eTYPE_PLAYER)) + if(entity != NULL && entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges); } - if(networkPlayer != nullptr && networkPlayer->IsLocal()) + if(networkPlayer != NULL && networkPlayer->IsLocal()) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { shared_ptr localPlayer = minecraft->localplayers[i]; - if(localPlayer != nullptr && localPlayer->connection != nullptr && localPlayer->connection->getNetworkPlayer() == networkPlayer ) + if(localPlayer != NULL && localPlayer->connection != NULL && localPlayer->connection->getNetworkPlayer() == networkPlayer ) { localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges); displayPrivilegeChanges(localPlayer,startingPrivileges); @@ -3593,7 +3580,7 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr packet) { - send(std::make_shared(packet->id)); + send(shared_ptr(new KeepAlivePacket(packet->id))); } void ClientConnection::handlePlayerAbilities(shared_ptr playerAbilitiesPacket) @@ -3664,7 +3651,7 @@ void ClientConnection::handleServerSettingsChanged(shared_ptrlevels.length; ++i) { - if( minecraft->levels[i] != nullptr ) + if( minecraft->levels[i] != NULL ) { app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data); minecraft->levels[i]->difficulty = packet->data; @@ -3698,11 +3685,11 @@ void ClientConnection::handleUpdateProgress(shared_ptr pac void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr packet) { LPCWSTR string = app.GetGameRulesString(packet->m_messageId); - if(string != nullptr) + if(string != NULL) { wstring message(string); message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length); - if(minecraft->localgameModes[m_userIndex]!=nullptr) + if(minecraft->localgameModes[m_userIndex]!=NULL) { minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(message, packet->m_icon, packet->m_auxValue); } @@ -3748,7 +3735,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL); } else #else @@ -3763,7 +3750,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL); } else #endif @@ -3898,7 +3885,7 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr if (packet->method == SetPlayerTeamPacket::METHOD_ADD || packet->method == SetPlayerTeamPacket::METHOD_JOIN) { - for (size_t i = 0; i < packet->players.size(); i++) + for (int i = 0; i < packet->players.size(); i++) { scoreboard->addPlayerToTeam(packet->players[i], team); } @@ -3906,7 +3893,7 @@ void ClientConnection::handleSetPlayerTeamPacket(shared_ptr if (packet->method == SetPlayerTeamPacket::METHOD_LEAVE) { - for (size_t i = 0; i < packet->players.size(); i++) + for (int i = 0; i < packet->players.size(); i++) { scoreboard->removePlayerFromTeam(packet->players[i], team); } @@ -3941,7 +3928,7 @@ void ClientConnection::handleParticleEvent(shared_ptr pack void ClientConnection::handleUpdateAttributes(shared_ptr packet) { shared_ptr entity = getEntity(packet->getEntityId()); - if (entity == nullptr) return; + if (entity == NULL) return; if ( !entity->instanceof(eTYPE_LIVINGENTITY) ) { @@ -3980,7 +3967,7 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) { if (deferredEntityLinkPackets.empty()) return; - for (size_t i = 0; i < deferredEntityLinkPackets.size(); i++) + for (int i = 0; i < deferredEntityLinkPackets.size(); i++) { DeferredEntityLinkPacket *deferred = &deferredEntityLinkPackets[i]; diff --git a/Minecraft.Client/ClockTexture.cpp b/Minecraft.Client/ClockTexture.cpp index 5febeff3..837532fb 100644 --- a/Minecraft.Client/ClockTexture.cpp +++ b/Minecraft.Client/ClockTexture.cpp @@ -10,7 +10,7 @@ ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock") { rot = rota = 0.0; - m_dataTexture = nullptr; + m_dataTexture = NULL; m_iPad = XUSER_INDEX_ANY; } @@ -27,7 +27,7 @@ void ClockTexture::cycleFrames() Minecraft *mc = Minecraft::GetInstance(); double rott = 0; - if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr) + if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL) { float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1); rott = time; @@ -55,9 +55,9 @@ void ClockTexture::cycleFrames() rot += rota; // 4J Stu - We share data with another texture - if(m_dataTexture != nullptr) + if(m_dataTexture != NULL) { - int newFrame = static_cast((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = (int) ((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); while (newFrame < 0) { newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size(); @@ -70,7 +70,7 @@ void ClockTexture::cycleFrames() } else { - int newFrame = static_cast((rot + 1.0) * frames->size()) % frames->size(); + int newFrame = (int) ((rot + 1.0) * frames->size()) % frames->size(); while (newFrame < 0) { newFrame = (newFrame + frames->size()) % frames->size(); @@ -95,7 +95,7 @@ int ClockTexture::getSourceHeight() const int ClockTexture::getFrames() { - if(m_dataTexture == nullptr) + if(m_dataTexture == NULL) { return StitchedTexture::getFrames(); } @@ -107,7 +107,7 @@ int ClockTexture::getFrames() void ClockTexture::freeFrameTextures() { - if(m_dataTexture == nullptr) + if(m_dataTexture == NULL) { StitchedTexture::freeFrameTextures(); } @@ -115,5 +115,5 @@ void ClockTexture::freeFrameTextures() bool ClockTexture::hasOwnData() { - return m_dataTexture == nullptr; + return m_dataTexture == NULL; } \ No newline at end of file diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 24cb7bf4..4b8f5f5b 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -57,7 +57,7 @@ void SoundEngine::updateSoundEffectVolume(float fVal) {} void SoundEngine::add(const wstring& name, File *file) {} void SoundEngine::addMusic(const wstring& name, File *file) {} void SoundEngine::addStreaming(const wstring& name, File *file) {} -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return nullptr; } +char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; } bool SoundEngine::isStreamingWavebankReady() { return true; } void SoundEngine::playMusicTick() {}; @@ -334,7 +334,7 @@ void SoundEngine::tick(shared_ptr *players, float a) bool bListenerPostionSet = false; for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ ) { - if( players[i] != nullptr ) + if( players[i] != NULL ) { m_ListenerA[i].bValid=true; F32 x,y,z; @@ -401,7 +401,7 @@ SoundEngine::SoundEngine() m_iMusicDelay=0; m_validListenerCount=0; - m_bHeardTrackA=nullptr; + m_bHeardTrackA=NULL; // Start the streaming music playing some music from the overworld SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, @@ -547,8 +547,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa &m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, - nullptr, + NULL, + NULL, &s->sound) != MA_SUCCESS) { app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath); @@ -631,8 +631,8 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) &m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, - nullptr, + NULL, + NULL, &s->sound) != MA_SUCCESS) { delete s; @@ -700,7 +700,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y , float z, for(unsigned int i=0;ilocalplayers[i]!=nullptr) + if(pMinecraft->localplayers[i]!=NULL) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -794,7 +794,7 @@ int SoundEngine::getMusicID(int iDomain) Minecraft *pMinecraft=Minecraft::GetInstance(); // Before the game has started? - if(pMinecraft==nullptr) + if(pMinecraft==NULL) { // any track from the overworld return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max); @@ -927,8 +927,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) &soundEngine->m_engine, soundEngine->m_szStreamName, MA_SOUND_FLAG_STREAM, - nullptr, - nullptr, + NULL, + NULL, &soundEngine->m_musicStream); if (result != MA_SUCCESS) @@ -1186,7 +1186,7 @@ void SoundEngine::playMusicUpdate() if( !m_openStreamThread->isRunning() ) { delete m_openStreamThread; - m_openStreamThread = nullptr; + m_openStreamThread = NULL; app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive); @@ -1243,7 +1243,7 @@ void SoundEngine::playMusicUpdate() if( !m_openStreamThread->isRunning() ) { delete m_openStreamThread; - m_openStreamThread = nullptr; + m_openStreamThread = NULL; m_StreamState = eMusicStreamState_Stop; } break; @@ -1279,14 +1279,14 @@ void SoundEngine::playMusicUpdate() } if(GetIsPlayingStreamingGameMusic()) { - //if(m_MusicInfo.pCue!=nullptr) + //if(m_MusicInfo.pCue!=NULL) { bool playerInEnd = false; bool playerInNether=false; Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) { - if(pMinecraft->localplayers[i]!=nullptr) + if(pMinecraft->localplayers[i]!=NULL) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -1417,7 +1417,7 @@ void SoundEngine::playMusicUpdate() for(unsigned int i=0;ilocalplayers[i]!=nullptr) + if(pMinecraft->localplayers[i]!=NULL) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h index 2134c491..5417dcec 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Common/Audio/SoundEngine.h @@ -108,23 +108,23 @@ class SoundEngine : public ConsoleSoundEngine static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added public: SoundEngine(); - void destroy() override; + virtual void destroy(); #ifdef _DEBUG void GetSoundName(char *szSoundName,int iSound); #endif - void play(int iSound, float x, float y, float z, float volume, float pitch) override; - void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override; - void playUI(int iSound, float volume, float pitch) override; - void playMusicTick() override; - void updateMusicVolume(float fVal) override; - void updateSystemMusicPlaying(bool isPlaying) override; - void updateSoundEffectVolume(float fVal) override; - void init(Options *) override; - void tick(shared_ptr *players, float a) override; // 4J - updated to take array of local players rather than single one - void add(const wstring& name, File *file) override; - void addMusic(const wstring& name, File *file) override; - void addStreaming(const wstring& name, File *file) override; - char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false) override; + virtual void play(int iSound, float x, float y, float z, float volume, float pitch); + virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); + virtual void playUI(int iSound, float volume, float pitch); + virtual void playMusicTick(); + virtual void updateMusicVolume(float fVal); + virtual void updateSystemMusicPlaying(bool isPlaying); + virtual void updateSoundEffectVolume(float fVal); + virtual void init(Options *); + virtual void tick(shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one + virtual void add(const wstring& name, File *file); + virtual void addMusic(const wstring& name, File *file); + virtual void addStreaming(const wstring& name, File *file); + virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false); bool isStreamingWavebankReady(); // 4J Added int getMusicID(int iDomain); int getMusicID(const wstring& name); @@ -138,8 +138,7 @@ private: #ifdef __PS3__ int initAudioHardware(int iMinSpeakers); #else - int initAudioHardware(int iMinSpeakers) override - { return iMinSpeakers;} + int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;} #endif int GetRandomishTrack(int iStart,int iEnd); diff --git a/Minecraft.Client/Common/Audio/stb_vorbis.h b/Minecraft.Client/Common/Audio/stb_vorbis.h index 0e529413..9192b162 100644 --- a/Minecraft.Client/Common/Audio/stb_vorbis.h +++ b/Minecraft.Client/Common/Audio/stb_vorbis.h @@ -112,8 +112,8 @@ extern "C" { // query get_info to find the exact amount required. yes I know // this is lame). // -// If you pass in a non-nullptr buffer of the type below, allocation -// will occur from it as described above. Otherwise just pass nullptr +// If you pass in a non-NULL buffer of the type below, allocation +// will occur from it as described above. Otherwise just pass NULL // to use malloc()/alloca() typedef struct @@ -191,8 +191,8 @@ extern stb_vorbis *stb_vorbis_open_pushdata( // the first N bytes of the file--you're told if it's not enough, see below) // on success, returns an stb_vorbis *, does not set error, returns the amount of // data parsed/consumed on this call in *datablock_memory_consumed_in_bytes; -// on failure, returns nullptr on error and sets *error, does not change *datablock_memory_consumed -// if returns nullptr and *error is VORBIS_need_more_data, then the input block was +// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed +// if returns NULL and *error is VORBIS_need_more_data, then the input block was // incomplete and you need to pass in a larger block from the start of the file extern int stb_vorbis_decode_frame_pushdata( @@ -219,7 +219,7 @@ extern int stb_vorbis_decode_frame_pushdata( // without writing state-machiney code to record a partial detection. // // The number of channels returned are stored in *channels (which can be -// nullptr--it is always the same as the number of channels reported by +// NULL--it is always the same as the number of channels reported by // get_info). *output will contain an array of float* buffers, one per // channel. In other words, (*output)[0][0] contains the first sample from // the first channel, and (*output)[1][0] contains the first sample from @@ -269,18 +269,18 @@ extern int stb_vorbis_decode_memory(const unsigned char *mem, int len, int *chan extern stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from an ogg vorbis stream in memory (note -// this must be the entire stream!). on failure, returns nullptr and sets *error +// this must be the entire stream!). on failure, returns NULL and sets *error #ifndef STB_VORBIS_NO_STDIO extern stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from a filename via fopen(). on failure, -// returns nullptr and sets *error (possibly to VORBIS_file_open_failure). +// returns NULL and sets *error (possibly to VORBIS_file_open_failure). extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from an open FILE *, looking for a stream at -// the _current_ seek point (ftell). on failure, returns nullptr and sets *error. +// the _current_ seek point (ftell). on failure, returns NULL and sets *error. // note that stb_vorbis must "own" this stream; if you seek it in between // calls to stb_vorbis, it will become confused. Moreover, if you attempt to // perform stb_vorbis_seek_*() operations on this file, it will assume it @@ -291,7 +291,7 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl int *error, const stb_vorbis_alloc *alloc_buffer, unsigned int len); // create an ogg vorbis decoder from an open FILE *, looking for a stream at // the _current_ seek point (ftell); the stream will be of length 'len' bytes. -// on failure, returns nullptr and sets *error. note that stb_vorbis must "own" +// on failure, returns NULL and sets *error. note that stb_vorbis must "own" // this stream; if you seek it in between calls to stb_vorbis, it will become // confused. #endif @@ -314,7 +314,7 @@ extern float stb_vorbis_stream_length_in_seconds(stb_vorbis *f); extern int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output); // decode the next frame and return the number of samples. the number of -// channels returned are stored in *channels (which can be nullptr--it is always +// channels returned are stored in *channels (which can be NULL--it is always // the same as the number of channels reported by get_info). *output will // contain an array of float* buffers, one per channel. These outputs will // be overwritten on the next call to stb_vorbis_get_frame_*. @@ -588,7 +588,7 @@ enum STBVorbisError #include #endif #else // STB_VORBIS_NO_CRT - #define nullptr 0 + #define NULL 0 #define malloc(s) 0 #define free(s) ((void) 0) #define realloc(s) 0 @@ -949,11 +949,11 @@ static void *setup_malloc(vorb *f, int sz) f->setup_memory_required += sz; if (f->alloc.alloc_buffer) { void *p = (char *) f->alloc.alloc_buffer + f->setup_offset; - if (f->setup_offset + sz > f->temp_offset) return nullptr; + if (f->setup_offset + sz > f->temp_offset) return NULL; f->setup_offset += sz; return p; } - return sz ? malloc(sz) : nullptr; + return sz ? malloc(sz) : NULL; } static void setup_free(vorb *f, void *p) @@ -966,7 +966,7 @@ static void *setup_temp_malloc(vorb *f, int sz) { sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. if (f->alloc.alloc_buffer) { - if (f->temp_offset - sz < f->setup_offset) return nullptr; + if (f->temp_offset - sz < f->setup_offset) return NULL; f->temp_offset -= sz; return (char *) f->alloc.alloc_buffer + f->temp_offset; } @@ -1654,12 +1654,12 @@ static int codebook_decode_scalar_raw(vorb *f, Codebook *c) int i; prep_huffman(f); - if (c->codewords == nullptr && c->sorted_codewords == nullptr) + if (c->codewords == NULL && c->sorted_codewords == NULL) return -1; // cases to use binary search: sorted_codewords && !c->codewords // sorted_codewords && c->entries > 8 - if (c->entries > 8 ? c->sorted_codewords!=nullptr : !c->codewords) { + if (c->entries > 8 ? c->sorted_codewords!=NULL : !c->codewords) { // binary search uint32 code = bit_reverse(f->acc); int x=0, n=c->sorted_entries, len; @@ -2629,7 +2629,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype) // @OPTIMIZE: reduce register pressure by using fewer variables? int save_point = temp_alloc_save(f); float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2)); - float *u=nullptr,*v=nullptr; + float *u=NULL,*v=NULL; // twiddle factors float *A = f->A[blocktype]; @@ -3057,7 +3057,7 @@ static float *get_window(vorb *f, int len) len <<= 1; if (len == f->blocksize_0) return f->window[0]; if (len == f->blocksize_1) return f->window[1]; - return nullptr; + return NULL; } #ifndef STB_VORBIS_NO_DEFER_FLOOR @@ -3306,7 +3306,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, if (map->chan[j].mux == i) { if (zero_channel[j]) { do_not_decode[ch] = TRUE; - residue_buffers[ch] = nullptr; + residue_buffers[ch] = NULL; } else { do_not_decode[ch] = FALSE; residue_buffers[ch] = f->channel_buffers[j]; @@ -3351,7 +3351,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, if (really_zero_channel[i]) { memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2); } else { - do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], nullptr); + do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], NULL); } } #else @@ -3464,7 +3464,7 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right) if (f->previous_length) { int i,j, n = f->previous_length; float *w = get_window(f, n); - if (w == nullptr) return 0; + if (w == NULL) return 0; for (i=0; i < f->channels; ++i) { for (j=0; j < n; ++j) f->channel_buffers[i][left+j] = @@ -3647,24 +3647,24 @@ static int start_decoder(vorb *f) //file vendor len = get32_packet(f); f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1)); - if (f->vendor == nullptr) return error(f, VORBIS_outofmem); + if (f->vendor == NULL) return error(f, VORBIS_outofmem); for(i=0; i < len; ++i) { f->vendor[i] = get8_packet(f); } f->vendor[len] = (char)'\0'; //user comments f->comment_list_length = get32_packet(f); - f->comment_list = nullptr; + f->comment_list = NULL; if (f->comment_list_length > 0) { f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == nullptr) return error(f, VORBIS_outofmem); + if (f->comment_list == NULL) return error(f, VORBIS_outofmem); } for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f); f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1)); - if (f->comment_list[i] == nullptr) return error(f, VORBIS_outofmem); + if (f->comment_list[i] == NULL) return error(f, VORBIS_outofmem); for(j=0; j < len; ++j) { f->comment_list[i][j] = get8_packet(f); @@ -3710,7 +3710,7 @@ static int start_decoder(vorb *f) f->codebook_count = get_bits(f,8) + 1; f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count); - if (f->codebooks == nullptr) return error(f, VORBIS_outofmem); + if (f->codebooks == NULL) return error(f, VORBIS_outofmem); memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count); for (i=0; i < f->codebook_count; ++i) { uint32 *values; @@ -3771,7 +3771,7 @@ static int start_decoder(vorb *f) f->setup_temp_memory_required = c->entries; c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); - if (c->codeword_lengths == nullptr) return error(f, VORBIS_outofmem); + if (c->codeword_lengths == NULL) return error(f, VORBIS_outofmem); memcpy(c->codeword_lengths, lengths, c->entries); setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs! lengths = c->codeword_lengths; @@ -3791,7 +3791,7 @@ static int start_decoder(vorb *f) } c->sorted_entries = sorted_count; - values = nullptr; + values = NULL; CHECK(f); if (!c->sparse) { @@ -3820,11 +3820,11 @@ static int start_decoder(vorb *f) if (c->sorted_entries) { // allocate an extra slot for sentinels c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1)); - if (c->sorted_codewords == nullptr) return error(f, VORBIS_outofmem); + if (c->sorted_codewords == NULL) return error(f, VORBIS_outofmem); // allocate an extra slot at the front so that c->sorted_values[-1] is defined // so that we can catch that case without an extra if c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1)); - if (c->sorted_values == nullptr) return error(f, VORBIS_outofmem); + if (c->sorted_values == NULL) return error(f, VORBIS_outofmem); ++c->sorted_values; c->sorted_values[-1] = -1; compute_sorted_huffman(c, lengths, values); @@ -3834,7 +3834,7 @@ static int start_decoder(vorb *f) setup_temp_free(f, values, sizeof(*values)*c->sorted_entries); setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries); setup_temp_free(f, lengths, c->entries); - c->codewords = nullptr; + c->codewords = NULL; } compute_accelerated_huffman(c); @@ -3857,7 +3857,7 @@ static int start_decoder(vorb *f) } if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup); mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values); - if (mults == nullptr) return error(f, VORBIS_outofmem); + if (mults == NULL) return error(f, VORBIS_outofmem); for (j=0; j < (int) c->lookup_values; ++j) { int q = get_bits(f, c->value_bits); if (q == EOP) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); } @@ -3874,7 +3874,7 @@ static int start_decoder(vorb *f) c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions); } else c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions); - if (c->multiplicands == nullptr) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } + if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } len = sparse ? c->sorted_entries : c->entries; for (j=0; j < len; ++j) { unsigned int z = sparse ? c->sorted_values[j] : j; @@ -3902,7 +3902,7 @@ static int start_decoder(vorb *f) float last=0; CHECK(f); c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values); - if (c->multiplicands == nullptr) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } + if (c->multiplicands == NULL) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } for (j=0; j < (int) c->lookup_values; ++j) { float val = mults[j] * c->delta_value + c->minimum_value + last; c->multiplicands[j] = val; @@ -3931,7 +3931,7 @@ static int start_decoder(vorb *f) // Floors f->floor_count = get_bits(f, 6)+1; f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config)); - if (f->floor_config == nullptr) return error(f, VORBIS_outofmem); + if (f->floor_config == NULL) return error(f, VORBIS_outofmem); for (i=0; i < f->floor_count; ++i) { f->floor_types[i] = get_bits(f, 16); if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup); @@ -4007,7 +4007,7 @@ static int start_decoder(vorb *f) // Residue f->residue_count = get_bits(f, 6)+1; f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0])); - if (f->residue_config == nullptr) return error(f, VORBIS_outofmem); + if (f->residue_config == NULL) return error(f, VORBIS_outofmem); memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0])); for (i=0; i < f->residue_count; ++i) { uint8 residue_cascade[64]; @@ -4029,7 +4029,7 @@ static int start_decoder(vorb *f) residue_cascade[j] = high_bits*8 + low_bits; } r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications); - if (r->residue_books == nullptr) return error(f, VORBIS_outofmem); + if (r->residue_books == NULL) return error(f, VORBIS_outofmem); for (j=0; j < r->classifications; ++j) { for (k=0; k < 8; ++k) { if (residue_cascade[j] & (1 << k)) { @@ -4049,7 +4049,7 @@ static int start_decoder(vorb *f) int classwords = f->codebooks[r->classbook].dimensions; int temp = j; r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords); - if (r->classdata[j] == nullptr) return error(f, VORBIS_outofmem); + if (r->classdata[j] == NULL) return error(f, VORBIS_outofmem); for (k=classwords-1; k >= 0; --k) { r->classdata[j][k] = temp % r->classifications; temp /= r->classifications; @@ -4059,14 +4059,14 @@ static int start_decoder(vorb *f) f->mapping_count = get_bits(f,6)+1; f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping)); - if (f->mapping == nullptr) return error(f, VORBIS_outofmem); + if (f->mapping == NULL) return error(f, VORBIS_outofmem); memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping)); for (i=0; i < f->mapping_count; ++i) { Mapping *m = f->mapping + i; int mapping_type = get_bits(f,16); if (mapping_type != 0) return error(f, VORBIS_invalid_setup); m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan)); - if (m->chan == nullptr) return error(f, VORBIS_outofmem); + if (m->chan == NULL) return error(f, VORBIS_outofmem); if (get_bits(f,1)) m->submaps = get_bits(f,4)+1; else @@ -4128,11 +4128,11 @@ static int start_decoder(vorb *f) f->channel_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1); f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist); - if (f->channel_buffers[i] == nullptr || f->previous_window[i] == nullptr || f->finalY[i] == nullptr) return error(f, VORBIS_outofmem); + if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem); memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1); #ifdef STB_VORBIS_NO_DEFER_FLOOR f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); - if (f->floor_buffers[i] == nullptr) return error(f, VORBIS_outofmem); + if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem); #endif } @@ -4232,7 +4232,7 @@ static void vorbis_deinit(stb_vorbis *p) setup_free(p, c->codewords); setup_free(p, c->sorted_codewords); // c->sorted_values[-1] is the first entry in the array - setup_free(p, c->sorted_values ? c->sorted_values-1 : nullptr); + setup_free(p, c->sorted_values ? c->sorted_values-1 : NULL); } setup_free(p, p->codebooks); } @@ -4266,14 +4266,14 @@ static void vorbis_deinit(stb_vorbis *p) void stb_vorbis_close(stb_vorbis *p) { - if (p == nullptr) return; + if (p == NULL) return; vorbis_deinit(p); setup_free(p,p); } static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) { - memset(p, 0, sizeof(*p)); // nullptr out all malloc'd pointers to start + memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start if (z) { p->alloc = *z; p->alloc.alloc_buffer_length_in_bytes &= ~7; @@ -4281,12 +4281,12 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) } p->eof = 0; p->error = VORBIS__no_error; - p->stream = nullptr; - p->codebooks = nullptr; + p->stream = NULL; + p->codebooks = NULL; p->page_crc_tests = -1; #ifndef STB_VORBIS_NO_STDIO p->close_on_free = FALSE; - p->f = nullptr; + p->f = NULL; #endif } @@ -4509,7 +4509,7 @@ int stb_vorbis_decode_frame_pushdata( stb_vorbis *stb_vorbis_open_pushdata( const unsigned char *data, int data_len, // the memory available for decoding - int *data_used, // only defined if result is not nullptr + int *data_used, // only defined if result is not NULL int *error, const stb_vorbis_alloc *alloc) { stb_vorbis *f, p; @@ -4523,7 +4523,7 @@ stb_vorbis *stb_vorbis_open_pushdata( else *error = p.error; vorbis_deinit(&p); - return nullptr; + return NULL; } f = vorbis_alloc(&p); if (f) { @@ -4533,7 +4533,7 @@ stb_vorbis *stb_vorbis_open_pushdata( return f; } else { vorbis_deinit(&p); - return nullptr; + return NULL; } } #endif // STB_VORBIS_NO_PUSHDATA_API @@ -4680,7 +4680,7 @@ static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset) set_file_offset(f, previous_safe); - while (vorbis_find_page(f, &end, nullptr)) { + while (vorbis_find_page(f, &end, NULL)) { if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset) return 1; set_file_offset(f, end); @@ -4770,7 +4770,7 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number) set_file_offset(f, left.page_end + (delta / 2) - 32768); } - if (!vorbis_find_page(f, nullptr, nullptr)) goto error; + if (!vorbis_find_page(f, NULL, NULL)) goto error; } for (;;) { @@ -4920,7 +4920,7 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) if (sample_number != f->current_loc) { int n; uint32 frame_start = f->current_loc; - stb_vorbis_get_frame_float(f, &n, nullptr); + stb_vorbis_get_frame_float(f, &n, NULL); assert(sample_number > frame_start); assert(f->channel_buffer_start + (int) (sample_number-frame_start) <= f->channel_buffer_end); f->channel_buffer_start += (sample_number - frame_start); @@ -5063,7 +5063,7 @@ stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *er } if (error) *error = p.error; vorbis_deinit(&p); - return nullptr; + return NULL; } stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc) @@ -5081,14 +5081,14 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st FILE *f; #if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__) if (0 != fopen_s(&f, filename, "rb")) - f = nullptr; + f = NULL; #else f = fopen(filename, "rb"); #endif if (f) return stb_vorbis_open_file(f, TRUE, error, alloc); if (error) *error = VORBIS_file_open_failure; - return nullptr; + return NULL; } #endif // STB_VORBIS_NO_STDIO @@ -5097,7 +5097,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err stb_vorbis *f, p; if (!data) { if (error) *error = VORBIS_unexpected_eof; - return nullptr; + return NULL; } vorbis_init(&p, alloc); p.stream = (uint8 *) data; @@ -5116,7 +5116,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err } if (error) *error = p.error; vorbis_deinit(&p); - return nullptr; + return NULL; } #ifndef STB_VORBIS_NO_INTEGER_CONVERSION @@ -5255,8 +5255,8 @@ static void convert_samples_short(int buf_c, short **buffer, int b_offset, int d int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples) { - float **output = nullptr; - int len = stb_vorbis_get_frame_float(f, nullptr, &output); + float **output = NULL; + int len = stb_vorbis_get_frame_float(f, NULL, &output); if (len > num_samples) len = num_samples; if (len) convert_samples_short(num_c, buffer, 0, f->channels, output, 0, len); @@ -5294,7 +5294,7 @@ int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buff float **output; int len; if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts); - len = stb_vorbis_get_frame_float(f, nullptr, &output); + len = stb_vorbis_get_frame_float(f, NULL, &output); if (len) { if (len*num_c > num_shorts) len = num_shorts / num_c; convert_channels_short_interleaved(num_c, buffer, f->channels, output, 0, len); @@ -5316,7 +5316,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short n += k; f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; } return n; } @@ -5333,7 +5333,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in n += k; f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; } return n; } @@ -5343,8 +5343,8 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ { int data_len, offset, total, limit, error; short *data; - stb_vorbis *v = stb_vorbis_open_filename(filename, &error, nullptr); - if (v == nullptr) return -1; + stb_vorbis *v = stb_vorbis_open_filename(filename, &error, NULL); + if (v == NULL) return -1; limit = v->channels * 4096; *channels = v->channels; if (sample_rate) @@ -5352,7 +5352,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ offset = data_len = 0; total = limit; data = (short *) malloc(total * sizeof(*data)); - if (data == nullptr) { + if (data == NULL) { stb_vorbis_close(v); return -2; } @@ -5365,7 +5365,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ short *data2; total *= 2; data2 = (short *) realloc(data, total * sizeof(*data)); - if (data2 == nullptr) { + if (data2 == NULL) { free(data); stb_vorbis_close(v); return -2; @@ -5383,8 +5383,8 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp { int data_len, offset, total, limit, error; short *data; - stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, nullptr); - if (v == nullptr) return -1; + stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, NULL); + if (v == NULL) return -1; limit = v->channels * 4096; *channels = v->channels; if (sample_rate) @@ -5392,7 +5392,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp offset = data_len = 0; total = limit; data = (short *) malloc(total * sizeof(*data)); - if (data == nullptr) { + if (data == NULL) { stb_vorbis_close(v); return -2; } @@ -5405,7 +5405,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp short *data2; total *= 2; data2 = (short *) realloc(data, total * sizeof(*data)); - if (data2 == nullptr) { + if (data2 == NULL) { free(data); stb_vorbis_close(v); return -2; @@ -5440,7 +5440,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; } return n; @@ -5466,7 +5466,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in f->channel_buffer_start += k; if (n == num_samples) break; - if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; } return n; diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index 07326b8c..fa1e9d69 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -325,7 +325,7 @@ void ColourTable::staticCtor() { for(unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; ++i) { - s_colourNamesMap.insert( unordered_map::value_type( ColourTableElements[i], static_cast(i)) ); + s_colourNamesMap.insert( unordered_map::value_type( ColourTableElements[i], (eMinecraftColour)i) ); } } @@ -366,7 +366,7 @@ void ColourTable::setColour(const wstring &colourName, int value) auto it = s_colourNamesMap.find(colourName); if(it != s_colourNamesMap.end()) { - m_colourValues[static_cast(it->second)] = value; + m_colourValues[(int)it->second] = value; } } @@ -377,5 +377,5 @@ void ColourTable::setColour(const wstring &colourName, const wstring &value) unsigned int ColourTable::getColour(eMinecraftColour id) { - return m_colourValues[static_cast(id)]; + return m_colourValues[(int)id]; } diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index c3a623d5..43cf73e1 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -100,7 +100,7 @@ CMinecraftApp::CMinecraftApp() { m_eTMSAction[i]=eTMSAction_Idle; m_eXuiAction[i]=eAppAction_Idle; - m_eXuiActionParam[i] = nullptr; + m_eXuiActionParam[i] = NULL; //m_dwAdditionalModelParts[i] = 0; if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&m_currentSigninInfo[i]))) @@ -157,9 +157,9 @@ CMinecraftApp::CMinecraftApp() // m_bRead_TMS_XUIDS_XML=false; // m_bRead_TMS_DLCINFO_XML=false; - m_pDLCFileBuffer=nullptr; + m_pDLCFileBuffer=NULL; m_dwDLCFileSize=0; - m_pBannedListFileBuffer=nullptr; + m_pBannedListFileBuffer=NULL; m_dwBannedListFileSize=0; m_bDefaultCapeInstallAttempted=false; @@ -763,7 +763,7 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr inventory, sh #ifdef _WINDOWS64 static void Win64_GetSettingsPath(char *outPath, DWORD size) { - GetModuleFileNameA(nullptr, outPath, size); + GetModuleFileNameA(NULL, outPath, size); char *lastSlash = strrchr(outPath, '\\'); if (lastSlash) *(lastSlash + 1) = '\0'; strncat_s(outPath, size, "settings.dat", _TRUNCATE); @@ -773,7 +773,7 @@ static void Win64_SaveSettings(GAME_SETTINGS *gs) if (!gs) return; char filePath[MAX_PATH] = {}; Win64_GetSettingsPath(filePath, MAX_PATH); - FILE *f = nullptr; + FILE *f = NULL; if (fopen_s(&f, filePath, "wb") == 0 && f) { fwrite(gs, sizeof(GAME_SETTINGS), 1, f); @@ -785,7 +785,7 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs) if (!gs) return; char filePath[MAX_PATH] = {}; Win64_GetSettingsPath(filePath, MAX_PATH); - FILE *f = nullptr; + FILE *f = NULL; if (fopen_s(&f, filePath, "rb") == 0 && f) { GAME_SETTINGS temp = {}; @@ -803,7 +803,7 @@ void CMinecraftApp::InitGameSettings() #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GameSettingsA[i]=(GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(i); #else - GameSettingsA[i]=static_cast(ProfileManager.GetGameDefinedProfileData(i)); + GameSettingsA[i]=(GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(i); #endif // clear the flag to say the settings have changed GameSettingsA[i]->bSettingsChanged=false; @@ -840,7 +840,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con SetGameSettings(iPad,eGameSetting_FOV,0); // 4J-PB - Don't reset the difficult level if we're in-game - if(Minecraft::GetInstance()->level==nullptr) + if(Minecraft::GetInstance()->level==NULL) { app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); SetGameSettings(iPad,eGameSetting_Difficulty,1); @@ -935,7 +935,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTI int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) #endif { - CMinecraftApp *pApp=static_cast(pParam); + CMinecraftApp *pApp=(CMinecraftApp *)pParam; // flag the default options to be set @@ -1372,29 +1372,29 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_MusicVolume: if(iPad==ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set(Options::Option::MUSIC,static_cast(GameSettingsA[iPad]->ucMusicVolume)/100.0f); + pMinecraft->options->set(Options::Option::MUSIC,((float)GameSettingsA[iPad]->ucMusicVolume)/100.0f); } break; - case eGameSetting_SoundFXVolume: - if (iPad == ProfileManager.GetPrimaryPad()) - { - pMinecraft->options->set(Options::Option::SOUND, static_cast(GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); - } + case eGameSetting_SoundFXVolume: + if(iPad==ProfileManager.GetPrimaryPad()) + { + pMinecraft->options->set(Options::Option::SOUND,((float)GameSettingsA[iPad]->ucSoundFXVolume)/100.0f); + } break; case eGameSetting_RenderDistance: - if (iPad == ProfileManager.GetPrimaryPad()) - { - int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF; + if(iPad == ProfileManager.GetPrimaryPad()) + { + int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF; - int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist); - pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level); - }; + int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist); + pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level); + } break; case eGameSetting_Gamma: if(iPad==ProfileManager.GetPrimaryPad()) { #if defined(_WIN64) || defined(_WINDOWS64) - pMinecraft->options->set(Options::Option::GAMMA, static_cast(GameSettingsA[iPad]->ucGamma) / 100.0f); + pMinecraft->options->set(Options::Option::GAMMA, ((float)GameSettingsA[iPad]->ucGamma) / 100.0f); #else // ucGamma range is 0-100, UpdateGamma is 0 - 32768 float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f; @@ -1421,7 +1421,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty); // send this to the other players if we are in-game - bool bInGame=pMinecraft->level!=nullptr; + bool bInGame=pMinecraft->level!=NULL; // Game Host only (and for now we can't change the diff while in game, so this shouldn't happen) if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) @@ -1438,7 +1438,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_Sensitivity_InGame: // 4J-PB - we don't use the options value // tell the input that we've changed the sensitivity - range of the slider is 0 to 200, default is 100 - pMinecraft->options->set(Options::Option::SENSITIVITY,static_cast(GameSettingsA[iPad]->ucSensitivity)/100.0f); + pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); //InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); break; @@ -1485,7 +1485,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) break; case eGameSetting_GamertagsVisible: { - bool bInGame=pMinecraft->level!=nullptr; + bool bInGame=pMinecraft->level!=NULL; // Game Host only if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) @@ -1514,7 +1514,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_DisplaySplitscreenGamertags: for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(pMinecraft->localplayers[idx] != nullptr) + if(pMinecraft->localplayers[idx] != NULL) { if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN) { @@ -1558,17 +1558,19 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_FriendsOfFriends: //nothing to do here break; - case eGameSetting_BedrockFog: - { - bool bInGame = pMinecraft->level != nullptr; + case eGameSetting_BedrockFog: + { + bool bInGame=pMinecraft->level!=NULL; - if (bInGame && g_NetworkManager.IsHost() && (iPad == ProfileManager.GetPrimaryPad())) - { - app.SetGameHostOption(eGameHostOption_BedrockFog, GetGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); - app.SetXuiServerAction(iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); - } - } - break; + // Game Host only + if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) + { + // Update the Game Host setting if you are the host and you are in-game + app.SetGameHostOption(eGameHostOption_BedrockFog,GetGameSettings(iPad,eGameSetting_BedrockFog)?1:0); + app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_BedrockFog); + } + } + break; case eGameSetting_DisplayHUD: //nothing to do here break; @@ -1615,7 +1617,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId) TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); - if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId); + if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId); } @@ -1627,8 +1629,8 @@ wstring CMinecraftApp::GetPlayerSkinName(int iPad) DWORD CMinecraftApp::GetPlayerSkinId(int iPad) { // 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed. - DLCPack *Pack=nullptr; - DLCSkinFile *skinFile=nullptr; + DLCPack *Pack=NULL; + DLCSkinFile *skinFile=NULL; DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin; wchar_t chars[256]; @@ -1683,7 +1685,7 @@ void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId) //SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); - if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); + if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); } wstring CMinecraftApp::GetPlayerCapeName(int iPad) @@ -1716,7 +1718,7 @@ unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad) void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos) { - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=static_cast(iPos); + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=(unsigned char)iPos; GameSettingsA[iPad]->bSettingsChanged = true; } @@ -1753,7 +1755,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad) // Also check they haven't reverted to a trial pack DLCPack *pDLCPack=app.m_dlcManager.getPackContainingSkin(chars); - if(pDLCPack!=nullptr) + if(pDLCPack!=NULL) { // 4J-PB - We should let players add the free skins to their favourites as well! //DLCFile *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars); @@ -1800,7 +1802,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) { // if there are no game settings read yet, return the default language - if(GameSettingsA[iPad]==nullptr) + if(GameSettingsA[iPad]==NULL) { return 0; } @@ -1819,7 +1821,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale) unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) { // if there are no game settings read yet, return the default language - if(GameSettingsA[iPad]==nullptr) + if(GameSettingsA[iPad]==NULL) { return 0; } @@ -2521,7 +2523,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; - if(bOverridePlayer || player==nullptr) + if(bOverridePlayer || player==NULL) { return GameSettingsA[iPad]->uiDebugBitmask; } @@ -2695,7 +2697,7 @@ int CMinecraftApp::DisplaySavingMessage(void *pParam, C4JStorage::ESavingMessage void CMinecraftApp::SetActionConfirmed(LPVOID param) { - XuiActionParam *actionInfo = static_cast(param); + XuiActionParam *actionInfo = (XuiActionParam *)param; app.SetAction(actionInfo->iPad, actionInfo->action); } @@ -2833,7 +2835,7 @@ void CMinecraftApp::HandleXuiActions(void) app.SetAutosaveTimerTime(); SetAction(i,eAppAction_Idle); // Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==nullptr) + /*if(StorageManager.GetSaveName()==NULL) { app.NavigateToScene(i,eUIScene_SaveWorld); } @@ -2851,7 +2853,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = static_cast(false); + loadingParams->lpParam = (LPVOID)false; // 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user pulls their network cable out while saving the title will hang. loadingParams->waitForThreadToDelete = true; @@ -2902,7 +2904,7 @@ void CMinecraftApp::HandleXuiActions(void) ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); // This just allows it to be shown - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); //INT saveOrCheckpointId = 0; //bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); @@ -2912,7 +2914,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (LPVOID)(true); + loadingParams->lpParam = (LPVOID)true; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2978,7 +2980,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idxlocalplayers[idx]!=nullptr)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3060,7 +3062,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idxlocalplayers[idx]!=nullptr)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3286,8 +3288,8 @@ void CMinecraftApp::HandleXuiActions(void) UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); // If param is non-null then this is a forced exit by the server, so make sure the player knows why // 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead - completionData->bRequiresUserAction = FALSE;//(param != nullptr) ? TRUE : FALSE; - completionData->bShowTips = (param != nullptr) ? FALSE : TRUE; + completionData->bRequiresUserAction = FALSE;//(param != NULL) ? TRUE : FALSE; + completionData->bShowTips = (param != NULL) ? FALSE : TRUE; completionData->bShowBackground=TRUE; completionData->bShowLogo=TRUE; completionData->type = e_ProgressCompletion_NavigateToHomeMenu; @@ -3399,7 +3401,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_WaitForRespawnComplete: player = pMinecraft->localplayers[i]; - if(player != nullptr && player->GetPlayerRespawned()) + if(player != NULL && player->GetPlayerRespawned()) { SetAction(i,eAppAction_Idle); @@ -3424,7 +3426,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_WaitForDimensionChangeComplete: player = pMinecraft->localplayers[i]; - if(player != nullptr && player->connection && player->connection->isStarted()) + if(player != NULL && player->connection && player->connection->isStarted()) { SetAction(i,eAppAction_Idle); ui.CloseUIScenes(i); @@ -3738,12 +3740,12 @@ void CMinecraftApp::HandleXuiActions(void) // unload any texture pack audio // if there is audio in use, clear out the audio, and unmount the pack TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=nullptr; + DLCTexturePack *pDLCTexPack=NULL; if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it - pDLCTexPack=static_cast(pTexPack); + pDLCTexPack=(DLCTexturePack *)pTexPack; } // change to the default texture pack @@ -3762,11 +3764,11 @@ void CMinecraftApp::HandleXuiActions(void) pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); #ifdef _XBOX - if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) + if(pDLCTexPack->m_pStreamedWaveBank!=NULL) { pDLCTexPack->m_pStreamedWaveBank->Destroy(); } - if(pDLCTexPack->m_pSoundBank!=nullptr) + if(pDLCTexPack->m_pSoundBank!=NULL) { pDLCTexPack->m_pSoundBank->Destroy(); } @@ -3785,18 +3787,18 @@ void CMinecraftApp::HandleXuiActions(void) for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { if(ProfileManager.IsSignedIn(index) ) - { - if (index == i || pMinecraft->localplayers[index] != nullptr) - { - m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask(index); - } + { + if(index==i || pMinecraft->localplayers[index]!=NULL ) + { + m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index ); + } } } #endif - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; - loadingParams->lpParam = static_cast(&m_InviteData); + LoadingInputParams *loadingParams = new LoadingInputParams(); + loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; + loadingParams->lpParam = (LPVOID)&m_InviteData; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -3819,7 +3821,7 @@ void CMinecraftApp::HandleXuiActions(void) g_NetworkManager.SetLocalGame(false); - JoinFromInviteData *inviteData = static_cast(param); + JoinFromInviteData *inviteData = (JoinFromInviteData *)param; // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -3894,7 +3896,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc; - loadingParams->lpParam = nullptr; + loadingParams->lpParam = NULL; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); #ifdef __PS3__ @@ -3945,7 +3947,7 @@ void CMinecraftApp::HandleXuiActions(void) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i); #else - SetDefaultOptions(static_cast(param), i); + SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i); #endif // if the profile data has been changed, then force a profile write @@ -3975,7 +3977,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc; - loadingParams->lpParam = nullptr; + loadingParams->lpParam = NULL; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bRequiresUserAction=FALSE; @@ -4274,7 +4276,7 @@ void CMinecraftApp::HandleXuiActions(void) SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile); #elif defined _XBOX_ONE - //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",nullptr,nullptr, 0); + //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, 0); SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly); #else @@ -4363,7 +4365,7 @@ void CMinecraftApp::HandleXuiActions(void) int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = static_cast(pParam); + CMinecraftApp* pApp = (CMinecraftApp*)pParam; //Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4371,7 +4373,7 @@ int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStor #if defined _XBOX || defined _XBOX_ONE INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer(); // unban the level - if (pHost != nullptr) + if (pHost != NULL) { #if defined _XBOX pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName()); @@ -4421,10 +4423,10 @@ void CMinecraftApp::loadMediaArchive() HANDLE hFile = CreateFile( path.c_str(), GENERIC_READ, FILE_SHARE_READ, - nullptr, + NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, - nullptr ); + NULL ); if( hFile != INVALID_HANDLE_VALUE ) { @@ -4440,7 +4442,7 @@ void CMinecraftApp::loadMediaArchive() m_fBody, dwFileSize, &m_fSize, - nullptr ); + NULL ); assert( m_fSize == dwFileSize ); @@ -4452,7 +4454,7 @@ void CMinecraftApp::loadMediaArchive() { assert( false ); // AHHHHHHHHHHHH - m_mediaArchive = nullptr; + m_mediaArchive = NULL; } #endif } @@ -4461,7 +4463,7 @@ void CMinecraftApp::loadStringTable() { #ifndef _XBOX - if(m_stringTable!=nullptr) + if(m_stringTable!=NULL) { // we need to unload the current string table, this is a reload delete m_stringTable; @@ -4475,7 +4477,7 @@ void CMinecraftApp::loadStringTable() } else { - m_stringTable = nullptr; + m_stringTable = NULL; assert(false); // AHHHHHHHHH. } @@ -4488,7 +4490,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(void *pParam,int iPad,const C4 //Minecraft *pMinecraft=Minecraft::GetInstance(); // if the player is null, we're in the menus - //if(Minecraft::GetInstance()->player!=nullptr) + //if(Minecraft::GetInstance()->player!=NULL) // We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game // at this point we want to handle it differently from just being in a menu @@ -4509,10 +4511,10 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto Minecraft *pMinecraft=Minecraft::GetInstance(); // if the player is null, we're in the menus - if (Minecraft::GetInstance()->player != nullptr) - { - app.SetAction(pMinecraft->player->GetXboxPad(), eAppAction_EthernetDisconnectedReturned); - } + if(Minecraft::GetInstance()->player!=NULL) + { + app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned); + } else { // 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus @@ -4541,7 +4543,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) bool saveStats = false; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() ) { - if(lpParameter != nullptr ) + if(lpParameter != NULL ) { switch( app.GetDisconnectReason() ) { @@ -4573,16 +4575,16 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) } pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); // 4J - Force a disconnection, this handles the situation that the server has already disconnected - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false); } else { exitReasonStringId = IDS_EXITING_GAME; pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(); } // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks @@ -4597,7 +4599,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) } else { - if(lpParameter != nullptr ) + if(lpParameter != NULL ) { switch( app.GetDisconnectReason() ) { @@ -4634,7 +4636,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); } } - pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats,true); + pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats,true); // 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output: // TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world @@ -4660,7 +4662,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM // bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes // 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player - if(pMinecraft->player==nullptr) + if(pMinecraft->player==NULL) { bNoPlayer=true; } @@ -4672,7 +4674,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -4717,7 +4719,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -4772,7 +4774,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = static_cast(pParam); + CMinecraftApp* pApp = (CMinecraftApp*)pParam; Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4782,7 +4784,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -4844,7 +4846,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = static_cast(pParam); + CMinecraftApp* pApp = (CMinecraftApp*)pParam; Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4855,7 +4857,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -4902,7 +4904,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR void CMinecraftApp::ProfileReadErrorCallback(void *pParam) { - CMinecraftApp *pApp=static_cast(pParam); + CMinecraftApp *pApp=(CMinecraftApp *)pParam; int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); } @@ -4934,7 +4936,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); #endif - CMinecraftApp *pApp=static_cast(pParam); + CMinecraftApp *pApp=(CMinecraftApp *)pParam; // check if the primary player signed out int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); @@ -4999,7 +5001,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange if(i == iPrimaryPlayer) continue; // A guest a signed in or out, out of order which invalidates all the guest players we have in the game - if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr) + if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) { pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i); pApp->SetAction(i, eAppAction_ExitPlayer); @@ -5023,7 +5025,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // 4J-HG: If either the player is in the network manager or in the game, need to exit player // TODO: Do we need to check the network manager? - if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr || Minecraft::GetInstance()->localplayers[i] != nullptr) + if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL || Minecraft::GetInstance()->localplayers[i] != NULL) { pApp->DebugPrintf("Player %d signed out\n", i); pApp->SetAction(i, eAppAction_ExitPlayer); @@ -5034,7 +5036,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // check if any of the addition players have signed out of PSN (primary player is handled below) if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame()) { - if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr) + if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) { if(ProfileManager.IsSignedInLive(i) == false) { @@ -5109,7 +5111,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam) { - CMinecraftApp* pClass = static_cast(pParam); + CMinecraftApp* pClass = (CMinecraftApp*)pParam; // push these on to the notifications to be handled in qnet's dowork @@ -5131,7 +5133,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if(!InputManager.IsPadConnected(i) && - Minecraft::GetInstance()->localplayers[i] != nullptr && + Minecraft::GetInstance()->localplayers[i] != NULL && !ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) ) { ui.CloseUIScenes(i); @@ -5160,7 +5162,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un { DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID(); - if( XContentGetDeviceState( deviceID, nullptr ) != ERROR_SUCCESS ) + if( XContentGetDeviceState( deviceID, NULL ) != ERROR_SUCCESS ) { // Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do, // and also so that we don't try and unmount this again, or play any sounds from it in the future @@ -5168,11 +5170,11 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un // need to stop the streaming audio - by playing streaming audio from the default texture pack now Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); - if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) + if(pDLCTexPack->m_pStreamedWaveBank!=NULL) { pDLCTexPack->m_pStreamedWaveBank->Destroy(); } - if(pDLCTexPack->m_pSoundBank!=nullptr) + if(pDLCTexPack->m_pSoundBank!=NULL) { pDLCTexPack->m_pSoundBank->Destroy(); } @@ -5298,7 +5300,7 @@ void CMinecraftApp::SetDebugSequence(const char *pchSeq) } int CMinecraftApp::DebugInputCallback(LPVOID pParam) { - CMinecraftApp* pClass = static_cast(pParam); + CMinecraftApp* pClass = (CMinecraftApp*)pParam; //printf("sequence matched\n"); pClass->m_bDebugOptions=!pClass->m_bDebugOptions; @@ -5324,7 +5326,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) Minecraft *pMinecraft = Minecraft::GetInstance(); for(int i=0;ilocalplayers[i] != nullptr) + if(pMinecraft != NULL && pMinecraft->localplayers[i] != NULL) { iPlayerC++; } @@ -5474,15 +5476,15 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) ); - if( pack != nullptr && pack->IsCorrupt() ) + if( pack != NULL && pack->IsCorrupt() ) { app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); app.m_dlcManager.removePack(pack); - pack = nullptr; + pack = NULL; } - if(pack == nullptr) + if(pack == NULL) { app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); @@ -5534,8 +5536,8 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d // bool bRes=app.IsFileInMemoryTextures(wTemp); // // if the file is not already in the memory textures, then read it from TMS // if(!bRes) -// { -// BYTE* pBuffer = nullptr; +// { +// BYTE *pBuffer=NULL; // DWORD dwSize=0; // // 4J-PB - out for now for DaveK so he doesn't get the birthday cape // #ifdef _CONTENT_PACKAGE @@ -5564,7 +5566,7 @@ void CMinecraftApp::HandleDLC(DLCPack *pack) // 4J Stu - I don't know why we handle more than one file here any more, however this doesn't seem to work with the PS4 patches if(dlcFilenames.size() > 0) m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[0], pack); #else - for(size_t i=0; i(qwTicksPerSec.QuadPart); + m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; // Save the start time QueryPerformanceCounter( &m_Time.qwTime ); @@ -5669,10 +5671,16 @@ void CMinecraftApp::UpdateTime() m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart; m_Time.qwTime.QuadPart = qwNewTime.QuadPart; - m_Time.fElapsedTime = m_Time.fSecsPerTick * static_cast(qwDeltaTime.QuadPart); - m_Time.fAppTime = m_Time.fSecsPerTick * static_cast(m_Time.qwAppTime.QuadPart); + m_Time.fElapsedTime = m_Time.fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); + m_Time.fAppTime = m_Time.fSecsPerTick * ((FLOAT)(m_Time.qwAppTime.QuadPart)); } + + + + + + bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { if(m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) @@ -5701,7 +5709,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD { EnterCriticalSection(&csMemFilesLock); // check it's not already in - PMEMDATA pData=nullptr; + PMEMDATA pData=NULL; auto it = m_MEM_Files.find(wName); if(it != m_MEM_Files.end()) { @@ -5712,8 +5720,8 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD if(pData->dwBytes == 0 && dwBytes != 0) { - // This should never be nullptr if dwBytes is 0 - if(pData->pbData!=nullptr) delete [] pData->pbData; + // This should never be NULL if dwBytes is 0 + if(pData->pbData!=NULL) delete [] pData->pbData; pData->pbData=pbData; pData->dwBytes=dwBytes; @@ -5809,7 +5817,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes) { EnterCriticalSection(&csMemTPDLock); // check it's not already in - PMEMDATA pData=nullptr; + PMEMDATA pData=NULL; auto it = m_MEM_TPD.find(iConfig); if(it == m_MEM_TPD.end()) { @@ -5829,7 +5837,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) { EnterCriticalSection(&csMemTPDLock); // check it's not already in - PMEMDATA pData=nullptr; + PMEMDATA pData=NULL; auto it = m_MEM_TPD.find(iConfig); if(it != m_MEM_TPD.end()) { @@ -5844,7 +5852,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) #ifdef _XBOX int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) { - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // run through the DLC info to find the right texture pack/mash-up pack for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -5862,7 +5870,7 @@ int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) #elif defined _XBOX_ONE int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) { - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // run through the DLC info to find the right texture pack/mash-up pack for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -5958,7 +5966,7 @@ void CMinecraftApp::ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, con int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = static_cast(pParam); + CMinecraftApp* pApp = (CMinecraftApp*)pParam; //Minecraft *pMinecraft=Minecraft::GetInstance(); // buttons are swapped on this menu @@ -5972,7 +5980,7 @@ int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMess int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp *pClass = static_cast(pParam); + CMinecraftApp *pClass = (CMinecraftApp *)pParam; // Exit with or without saving // Decline means save in this dialog if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) @@ -6063,7 +6071,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor { // 4J-PB - need to check this user can access the store bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -6082,7 +6090,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; @@ -6132,7 +6140,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str()); - StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr); + StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -6165,7 +6173,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor // need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } else @@ -6211,7 +6219,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4 uiIDA[1]=IDS_CONFIRM_CANCEL; // Give the player a warning about the trial version of the texture pack - ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,nullptr); + ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,NULL); return S_OK; } @@ -6723,7 +6731,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) default: break; } - return nullptr; + return NULL; #else wstring replacement = L""; switch(uiVKey) @@ -6822,7 +6830,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) default: break; } - return nullptr; + return NULL; #else wchar_t string[128]; @@ -6877,11 +6885,11 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHA { HRESULT hr=S_OK; eXUID eTempXuid=eXUID_Undefined; - MOJANG_DATA *pMojangData=nullptr; + MOJANG_DATA *pMojangData=NULL; // ignore the names if we don't recognize them - if (pXuidName != nullptr) - { + if(pXuidName!=NULL) + { if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 ) { eTempXuid = eXUID_Notch; // might be needed for the apple at some point @@ -6920,8 +6928,8 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue) HRESULT hr=S_OK; // #ifdef _XBOX - // if(pType!=nullptr) - // { + // if(pType!=NULL) + // { // if(wcscmp(pType,L"XboxOneTransfer")==0) // { // if(iValue>0) @@ -6971,8 +6979,8 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe } #endif - if(pType!=nullptr) - { + if(pType!=NULL) + { if(wcscmp(pType,L"Skin")==0) { pDLCData->eDLCType=e_DLC_SkinPack; @@ -7156,7 +7164,7 @@ bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID) auto it = DLCTextures_PackID.find(iPackID); if( it == DLCTextures_PackID.end() ) { - *ppchKeyID=nullptr; + *ppchKeyID=NULL; return false; } else @@ -7176,21 +7184,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName) if( it == DLCInfo.end() ) { // nothing for this - return nullptr; + return NULL; } else { return it->second; } } - else return nullptr; + else return NULL; } DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) { unordered_map::iterator it= DLCInfo.begin(); - for(size_t i=0;isecond)->iConfig==iTPID) { @@ -7198,7 +7206,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) } ++it; } - return nullptr; + return NULL; } DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex) @@ -7254,12 +7262,12 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &Produc } // DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(wstring &ProductId) // { -// return nullptr; +// return NULL; // } DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { - return nullptr; + return NULL; } DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { @@ -7313,7 +7321,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pull } DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) { - //DLC_INFO *pDLCInfo=nullptr; + //DLC_INFO *pDLCInfo=NULL; if(DLCInfo_Trial.size()>0) { auto it = DLCInfo_Trial.find(ullOfferID_Trial); @@ -7321,14 +7329,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) if( it == DLCInfo_Trial.end() ) { // nothing for this - return nullptr; + return NULL; } else { return it->second; } } - else return nullptr; + else return NULL; } DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) @@ -7378,21 +7386,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID) if( it == DLCInfo_Full.end() ) { // nothing for this - return nullptr; + return NULL; } else { return it->second; } } - else return nullptr; + else return NULL; } DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) { unordered_map::iterator it= DLCInfo_Full.begin(); wstring wsProductName=pwchProductName; - for(size_t i=0;isecond; if(wsProductName==pDLCInfo->wsDisplayName) @@ -7402,7 +7410,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) ++it; } - return nullptr; + return NULL; } #elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) @@ -7418,14 +7426,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) if( it == DLCInfo_Full.end() ) { // nothing for this - return nullptr; + return NULL; } else { return it->second; } } - else return nullptr; + else return NULL; } #endif @@ -7516,7 +7524,7 @@ void CMinecraftApp::ExitGameFromRemoteSave( LPVOID lpParameter ) uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,nullptr); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,NULL); } int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) @@ -7532,9 +7540,9 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4 { #ifndef _XBOX // Inform fullscreen progress scene that it's not being cancelled after all - UIScene_FullscreenProgress *pScene = static_cast(ui.FindScene(eUIScene_FullscreenProgress)); + UIScene_FullscreenProgress *pScene = (UIScene_FullscreenProgress *)ui.FindScene(eUIScene_FullscreenProgress); #ifdef __PS3__ - if(pScene!=nullptr) + if(pScene!=NULL) #else if (pScene != nullptr) #endif @@ -7550,7 +7558,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4 void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index) { - if(index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr) + if(index >= 0 && index < 32 && GameSettingsA[iPad] != NULL) { GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<pszLevelName,pszLevelName); m_vBannedListA[iPad]->push_back(pBannedListData); - if (bWriteToTMS) - { - DWORD dwDataBytes = static_cast(sizeof(BANNEDLISTDATA)* m_vBannedListA[iPad]->size()); - PBANNEDLISTDATA pBannedList = reinterpret_cast(new CHAR [dwDataBytes]); + if(bWriteToTMS) + { + DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); + PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]); int iCount=0; for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] ) { @@ -7622,9 +7630,9 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps //bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); #ifdef _XBOX - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,NULL,NULL, 0); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); #endif } // update telemetry too @@ -7658,7 +7666,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha { PBANNEDLISTDATA pBannedListData = *it; - if(pBannedListData!=nullptr) + if(pBannedListData!=NULL) { #ifdef _XBOX_ONE PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID; @@ -7683,22 +7691,22 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } } - DWORD dwDataBytes=static_cast(sizeof(BANNEDLISTDATA) * m_vBannedListA[iPad]->size()); + DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); if(dwDataBytes==0) { // wipe the file #ifdef _XBOX StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList"); #elif defined _XBOX_ONE - StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",nullptr,nullptr, 0); + StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",NULL,NULL, 0); #endif } else { PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]); - size_t iSize=m_vBannedListA[iPad]->size(); - for(size_t i=0;isize(); + for(int i=0;iat(i); @@ -7707,7 +7715,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha #ifdef _XBOX StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); #endif delete [] pBannedList; } @@ -7751,7 +7759,7 @@ bool CMinecraftApp::AlreadySeenCreditText(const wstring &wstemp) unsigned int CMinecraftApp::GetDLCCreditsCount() { - return static_cast(vDLCCredits.size()); + return (unsigned int)vDLCCredits.size(); } SCreditTextItemDef * CMinecraftApp::GetDLCCredits(int iIndex) @@ -8171,7 +8179,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings, eGame bool CMinecraftApp::CanRecordStatsAndAchievements() { - bool isTutorial = Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->isTutorial(); + bool isTutorial = Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->isTutorial(); // 4J Stu - All of these options give the host player some advantage, so should not allow achievements return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || @@ -8870,7 +8878,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto { #endif - CMinecraftApp* pClass = static_cast(pParam); + CMinecraftApp* pClass = (CMinecraftApp *) pParam; // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -8889,8 +8897,9 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto // set this to retrieved whether it found it or not pCurrent->eState=e_TMS_ContentState_Retrieved; - if(pFileData!=nullptr) - { + if(pFileData!=NULL) + { + #ifdef _XBOX_ONE @@ -9130,7 +9139,7 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved() int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad) { - CMinecraftApp* pClass = static_cast(pParam); + CMinecraftApp* pClass = (CMinecraftApp *) pParam; // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -9155,10 +9164,10 @@ eDLCContentType CMinecraftApp::Find_eDLCContentType(DWORD dwType) { if(m_dwContentTypeA[i]==dwType) { - return static_cast(i); + return (eDLCContentType)i; } } - return static_cast(0); + return (eDLCContentType)0; } bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) { @@ -9241,7 +9250,7 @@ vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalModelParts ); - vector *pvModelParts=nullptr; + vector *pvModelParts=NULL; if(m_AdditionalModelParts.size()>0) { auto it = m_AdditionalModelParts.find(dwSkinID); @@ -9258,7 +9267,7 @@ vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalSkinBoxes ); - vector *pvSkinBoxes=nullptr; + vector *pvSkinBoxes=NULL; if(m_AdditionalSkinBoxes.size()>0) { auto it = m_AdditionalSkinBoxes.find(dwSkinID); @@ -9362,92 +9371,95 @@ wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) } -int CMinecraftApp::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) +int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { + #if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ - if (result == C4JStorage::EMessage_ResultAccept) - { - Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID())) - { - // it's been installed already - } - else - { - // we need to enable background downloading for the DLC - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + if(result==C4JStorage::EMessage_ResultAccept) + { + Minecraft *pMinecraft = Minecraft::GetInstance(); + if( pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()) ) + { + // it's been installed already + } + else + { + // we need to enable background downloading for the DLC + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); + if(pSONYDLCInfo!=NULL) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - SONYDLC* pSONYDLCInfo = app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); - if (pSONYDLCInfo != nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN); - - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - - #ifdef __ORBIS__ - strcpy(chName, chKeyName); - #else - sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); - #endif - - app.GetDLCSkuIDFromProductList(chName, chSkuID); - - if (app.CheckForEmptyStore(iPad) == false) - { - if (app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } - } - else - { - app.DebugPrintf("Continuing without installing texture pack\n"); - } + #ifdef __ORBIS__ + strcpy(chName, chKeyName); + #else + sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + #endif + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store + if(app.CheckForEmptyStore(iPad)==false) + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } + } + } + else + { + app.DebugPrintf("Continuing without installing texture pack\n"); + } #endif #ifdef _XBOX - if (result != C4JStorage::EMessage_Cancelled) - { - if (app.GetRequiredTexturePackID() != 0) - { - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + if(result!=C4JStorage::EMessage_Cancelled) + { + if(app.GetRequiredTexturePackID()!=0) + { + // we need to enable background downloading for the DLC + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - ULONGLONG ullOfferID_Full; - ULONGLONG ullIndexA[1]; - app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(), &ullOfferID_Full); + ULONGLONG ullOfferID_Full; + ULONGLONG ullIndexA[1]; + app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(),&ullOfferID_Full); - if (result == C4JStorage::EMessage_ResultAccept) - { - ullIndexA[0] = ullOfferID_Full; - StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr); - } - else - { - DLC_INFO* pDLCInfo = app.GetDLCInfoForFullOfferID(ullOfferID_Full); - ullIndexA[0] = pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr); - } - } - } + if( result==C4JStorage::EMessage_ResultAccept ) // Full version + { + ullIndexA[0]=ullOfferID_Full; + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + } + else // trial version + { + DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full); + ullIndexA[0]=pDLCInfo->ullOfferID_Trial; + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + } + } + } #endif - return 0; + return 0; } + int CMinecraftApp::getArchiveFileSize(const wstring &filename) { - TexturePack *tPack = nullptr; + TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) @@ -9459,7 +9471,7 @@ int CMinecraftApp::getArchiveFileSize(const wstring &filename) bool CMinecraftApp::hasArchiveFile(const wstring &filename) { - TexturePack *tPack = nullptr; + TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true; @@ -9468,7 +9480,7 @@ bool CMinecraftApp::hasArchiveFile(const wstring &filename) byteArray CMinecraftApp::getArchiveFile(const wstring &filename) { - TexturePack *tPack = nullptr; + TexturePack *tPack = NULL; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) @@ -9497,19 +9509,19 @@ int CMinecraftApp::GetDLCInfoFullOffersCount() } #else int CMinecraftApp::GetDLCInfoTrialOffersCount() -{ - return static_cast(DLCInfo_Trial.size()); +{ + return (int)DLCInfo_Trial.size(); } -int CMinecraftApp::GetDLCInfoFullOffersCount() -{ - return static_cast(DLCInfo_Full.size()); +int CMinecraftApp::GetDLCInfoFullOffersCount() +{ + return (int)DLCInfo_Full.size(); } #endif int CMinecraftApp::GetDLCInfoTexturesOffersCount() -{ - return static_cast(DLCTextures_PackID.size()); +{ + return (int)DLCTextures_PackID.size(); } // AUTOSAVE @@ -9809,7 +9821,7 @@ void CMinecraftApp::getLocale(vector &vecWstrLocales) locales.push_back(eMCLang_enUS); locales.push_back(eMCLang_null); - for (size_t i=0; i(0), bool bCallback=false)=0; + virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0; private: @@ -862,12 +862,12 @@ public: bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];} void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;} - void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=nullptr;BannedListA[iPad].dwBytes=0;} + void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;} DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;} void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;} - virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = nullptr; *pdwBytes = 0;} + virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;} //XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; } diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp index ee0cb7a7..7116f62d 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp @@ -8,7 +8,7 @@ DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) { - m_pbData = nullptr; + m_pbData = NULL; m_dwBytes = 0; } @@ -40,7 +40,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring & { if(paramName.compare(wchTypeNamesA[i]) == 0) { - type = static_cast(i); + type = (EAudioParameterType)i; break; } } @@ -87,7 +87,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons { i++; } - size_t iLast=creditValue.find_last_of(L" ", i); + int iLast=(int)creditValue.find_last_of(L" ",i); switch(XGetLanguage()) { case XC_LANGUAGE_JAPANESE: @@ -96,7 +96,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons iLast = maximumChars; break; default: - iLast=creditValue.find_last_of(L" ", i); + iLast=(int)creditValue.find_last_of(L" ",i); break; } @@ -133,7 +133,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) if(uiVersion < CURRENT_AUDIO_VERSION_NUM) { - if(pbData!=nullptr) delete [] pbData; + if(pbData!=NULL) delete [] pbData; app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); return false; } @@ -145,7 +145,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) for(unsigned int i=0;i(pParams->wchData)); + wstring parameterName((WCHAR *)pParams->wchData); EAudioParameterType type = getParameterType(parameterName); if( type != e_AudioParamType_Invalid ) { @@ -169,7 +169,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) for(unsigned int i=0;i(pFile->dwType); + EAudioType type = (EAudioType)pFile->dwType; // Params unsigned int uiParameterCount=*(unsigned int *)pbTemp; pbTemp+=sizeof(int); @@ -182,7 +182,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) if(it != parameterMapping.end() ) { - addParameter(type,static_cast(pParams->dwType),(WCHAR *)pParams->wchData); + addParameter(type,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData); } pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; @@ -198,7 +198,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) return true; } -int DLCAudioFile::GetCountofType(EAudioType eType) +int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType) { return m_parameters[eType].size(); } diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.h b/Minecraft.Client/Common/DLC/DLCAudioFile.h index 50131785..f1a356fe 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.h +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.h @@ -32,11 +32,11 @@ public: DLCAudioFile(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; - PBYTE getData(DWORD &dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual PBYTE getData(DWORD &dwBytes); bool processDLCDataFile(PBYTE pbData, DWORD dwLength); - int GetCountofType(EAudioType ptype); + int GetCountofType(DLCAudioFile::EAudioType ptype); wstring &GetSoundName(int iIndex); private: @@ -49,6 +49,6 @@ private: vector m_parameters[e_AudioType_Max]; // use the EAudioType to order these - void addParameter(EAudioType type, EAudioParameterType ptype, const wstring &value); - EAudioParameterType getParameterType(const wstring ¶mName); + void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const wstring &value); + DLCAudioFile::EAudioParameterType getParameterType(const wstring ¶mName); }; diff --git a/Minecraft.Client/Common/DLC/DLCCapeFile.h b/Minecraft.Client/Common/DLC/DLCCapeFile.h index 9e9466c6..8373d340 100644 --- a/Minecraft.Client/Common/DLC/DLCCapeFile.h +++ b/Minecraft.Client/Common/DLC/DLCCapeFile.h @@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile public: DLCCapeFile(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp index a0c818a7..ec800dac 100644 --- a/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp @@ -7,12 +7,12 @@ DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path) { - m_colourTable = nullptr; + m_colourTable = NULL; } DLCColourTableFile::~DLCColourTableFile() { - if(m_colourTable != nullptr) + if(m_colourTable != NULL) { app.DebugPrintf("Deleting DLCColourTableFile data\n"); delete m_colourTable; diff --git a/Minecraft.Client/Common/DLC/DLCColourTableFile.h b/Minecraft.Client/Common/DLC/DLCColourTableFile.h index ded6f515..84269739 100644 --- a/Minecraft.Client/Common/DLC/DLCColourTableFile.h +++ b/Minecraft.Client/Common/DLC/DLCColourTableFile.h @@ -10,9 +10,9 @@ private: public: DLCColourTableFile(const wstring &path); - ~DLCColourTableFile() override; + ~DLCColourTableFile(); - void addData(PBYTE pbData, DWORD dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); - ColourTable *getColourTable() const { return m_colourTable; } + ColourTable *getColourTable() { return m_colourTable; } }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCFile.h b/Minecraft.Client/Common/DLC/DLCFile.h index 31b638ef..3a40dbc7 100644 --- a/Minecraft.Client/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Common/DLC/DLCFile.h @@ -12,12 +12,12 @@ public: DLCFile(DLCManager::EDLCType type, const wstring &path); virtual ~DLCFile() {} - DLCManager::EDLCType getType() const { return m_type; } + DLCManager::EDLCType getType() { return m_type; } wstring getPath() { return m_path; } - DWORD getSkinID() const { return m_dwSkinId; } + DWORD getSkinID() { return m_dwSkinId; } virtual void addData(PBYTE pbData, DWORD dwBytes) {} - virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; } + virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {} virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp index d84e2a60..8ca520d6 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp @@ -4,7 +4,7 @@ DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) { - m_pbData = nullptr; + m_pbData = NULL; m_dwBytes = 0; } diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesFile.h b/Minecraft.Client/Common/DLC/DLCGameRulesFile.h index 671cab6a..e6456d73 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesFile.h +++ b/Minecraft.Client/Common/DLC/DLCGameRulesFile.h @@ -10,6 +10,6 @@ private: public: DLCGameRulesFile(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; - PBYTE getData(DWORD &dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual PBYTE getData(DWORD &dwBytes); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp index 2b785998..39b85219 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp @@ -11,14 +11,14 @@ DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) { - m_pbData = nullptr; + m_pbData = NULL; m_dwBytes = 0; m_hasData = false; m_grfPath = path.substr(0, path.length() - 4) + L".grf"; - lgo = nullptr; + lgo = NULL; } void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.h b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.h index 7409540d..4521ae11 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.h +++ b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.h @@ -14,52 +14,29 @@ private: bool m_hasData; public: - bool requiresTexturePack() override - {return m_bRequiresTexturePack;} + virtual bool requiresTexturePack() {return m_bRequiresTexturePack;} + virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;} + virtual wstring getDefaultSaveName() {return m_defaultSaveName;} + virtual LPCWSTR getWorldName() {return m_worldName.c_str();} + virtual LPCWSTR getDisplayName() {return m_displayName.c_str();} + virtual wstring getGrfPath() {return L"GameRules.grf";} - UINT getRequiredTexturePackId() override - {return m_requiredTexturePackId;} - - wstring getDefaultSaveName() override - {return m_defaultSaveName;} - - LPCWSTR getWorldName() override - {return m_worldName.c_str();} - - LPCWSTR getDisplayName() override - {return m_displayName.c_str();} - - wstring getGrfPath() override - {return L"GameRules.grf";} - - void setRequiresTexturePack(bool x) override - {m_bRequiresTexturePack = x;} - - void setRequiredTexturePackId(UINT x) override - {m_requiredTexturePackId = x;} - - void setDefaultSaveName(const wstring &x) override - {m_defaultSaveName = x;} - - void setWorldName(const wstring & x) override - {m_worldName = x;} - - void setDisplayName(const wstring & x) override - {m_displayName = x;} - - void setGrfPath(const wstring & x) override - {m_grfPath = x;} + virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;} + virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;} + virtual void setDefaultSaveName(const wstring &x) {m_defaultSaveName = x;} + virtual void setWorldName(const wstring & x) {m_worldName = x;} + virtual void setDisplayName(const wstring & x) {m_displayName = x;} + virtual void setGrfPath(const wstring & x) {m_grfPath = x;} LevelGenerationOptions *lgo; public: DLCGameRulesHeader(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; - PBYTE getData(DWORD &dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual PBYTE getData(DWORD &dwBytes); void setGrfData(PBYTE fData, DWORD fSize, StringTable *); - bool ready() override - { return m_hasData; } + virtual bool ready() { return m_hasData; } }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp index 90921434..358a93e5 100644 --- a/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp @@ -5,7 +5,7 @@ DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path) { - m_strings = nullptr; + m_strings = NULL; } void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes) diff --git a/Minecraft.Client/Common/DLC/DLCLocalisationFile.h b/Minecraft.Client/Common/DLC/DLCLocalisationFile.h index 419d714d..083e60d8 100644 --- a/Minecraft.Client/Common/DLC/DLCLocalisationFile.h +++ b/Minecraft.Client/Common/DLC/DLCLocalisationFile.h @@ -12,7 +12,7 @@ public: DLCLocalisationFile(const wstring &path); DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++ - void addData(PBYTE pbData, DWORD dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); StringTable *getStringTable() { return m_strings; } }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 931b0e1d..dd34e67f 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -6,7 +6,6 @@ #include "..\..\..\Minecraft.World\StringHelpers.h" #include "..\..\Minecraft.h" #include "..\..\TexturePackRepository.h" -#include "Common/UI/UI.h" const WCHAR *DLCManager::wchTypeNamesA[]= { @@ -48,7 +47,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const wstring ¶mN { if(paramName.compare(wchTypeNamesA[i]) == 0) { - type = static_cast(i); + type = (EDLCParameterType)i; break; } } @@ -71,7 +70,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) } else { - packCount = static_cast(m_packs.size()); + packCount = (DWORD)m_packs.size(); } return packCount; } @@ -83,7 +82,7 @@ void DLCManager::addPack(DLCPack *pack) void DLCManager::removePack(DLCPack *pack) { - if(pack != nullptr) + if(pack != NULL) { auto it = find(m_packs.begin(), m_packs.end(), pack); if(it != m_packs.end() ) m_packs.erase(it); @@ -113,7 +112,7 @@ void DLCManager::LanguageChanged(void) DLCPack *DLCManager::getPack(const wstring &name) { - DLCPack *pack = nullptr; + DLCPack *pack = NULL; //DWORD currentIndex = 0; for( DLCPack * currentPack : m_packs ) { @@ -131,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name) #ifdef _XBOX_ONE DLCPack *DLCManager::getPackFromProductID(const wstring &productID) { - DLCPack *pack = nullptr; + DLCPack *pack = NULL; for( DLCPack *currentPack : m_packs ) { wstring wsName=currentPack->getPurchaseOfferId(); @@ -148,7 +147,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID) DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/) { - DLCPack *pack = nullptr; + DLCPack *pack = NULL; if( type != e_DLCType_All ) { DWORD currentIndex = 0; @@ -182,9 +181,9 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D { DWORD foundIndex = 0; found = false; - if(pack == nullptr) + if(pack == NULL) { - app.DebugPrintf("DLCManager: Attempting to find the index for a nullptr pack\n"); + app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n"); //__debugbreak(); return foundIndex; } @@ -245,7 +244,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found) DLCPack *DLCManager::getPackContainingSkin(const wstring &path) { - DLCPack *foundPack = nullptr; + DLCPack *foundPack = NULL; for( DLCPack *pack : m_packs ) { if(pack->getDLCItemsCount(e_DLCType_Skin)>0) @@ -262,11 +261,11 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path) DLCSkinFile *DLCManager::getSkinFile(const wstring &path) { - DLCSkinFile *foundSkinfile = nullptr; + DLCSkinFile *foundSkinfile = NULL; for( DLCPack *pack : m_packs ) { foundSkinfile=pack->getSkinFile(path); - if(foundSkinfile!=nullptr) + if(foundSkinfile!=NULL) { break; } @@ -277,14 +276,14 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path) DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; - DLCPack *firstCorruptPack = nullptr; + DLCPack *firstCorruptPack = NULL; for( DLCPack *pack : m_packs ) { if( pack->IsCorrupt() ) { ++corruptDLCCount; - if(firstCorruptPack == nullptr) firstCorruptPack = pack; + if(firstCorruptPack == NULL) firstCorruptPack = pack; } } @@ -292,13 +291,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - if(corruptDLCCount == 1 && firstCorruptPack != nullptr) + if(corruptDLCCount == 1 && firstCorruptPack != NULL) { // pass in the pack format string WCHAR wchFormat[132]; swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); - C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat); + C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,wchFormat); } else @@ -331,13 +330,13 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL #ifdef _WINDOWS64 string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #elif defined(_DURANGO) wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -348,9 +347,9 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL return false; } - DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { // need to treat the file as corrupt, and flag it, so can't call fatal error @@ -373,7 +372,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack) { - unordered_map parameterMapping; + unordered_map parameterMapping; unsigned int uiCurrentByte=0; // File format defined in the DLC_Creator @@ -392,7 +391,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD if(uiVersion < CURRENT_DLC_VERSION_NUM) { - if(pbData!=nullptr) delete [] pbData; + if(pbData!=NULL) delete [] pbData; app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); return false; } @@ -404,9 +403,9 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;i(pParams->wchData)); - EDLCParameterType type = getParameterType(parameterName); - if( type != e_DLCParamType_Invalid ) + wstring parameterName((WCHAR *)pParams->wchData); + DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); + if( type != DLCManager::e_DLCParamType_Invalid ) { parameterMapping[pParams->dwType] = type; } @@ -430,10 +429,10 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;i(pFile->dwType); + DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType; - DLCFile *dlcFile = nullptr; - DLCPack *dlcTexturePack = nullptr; + DLCFile *dlcFile = NULL; + DLCPack *dlcTexturePack = NULL; if(type == e_DLCType_TexturePack) { @@ -462,8 +461,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } else { - if(dlcFile != nullptr) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData); - else if(dlcTexturePack != nullptr) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData); + if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData); + else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData); } } pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); @@ -471,28 +470,28 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } //pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); - if(dlcTexturePack != nullptr) + if(dlcTexturePack != NULL) { DWORD texturePackFilesProcessed = 0; bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack); - pack->SetDataPointer(nullptr); // If it's a child pack, it doesn't own the data + pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data if(!validPack || texturePackFilesProcessed == 0) { delete dlcTexturePack; - dlcTexturePack = nullptr; + dlcTexturePack = NULL; } else { pack->addChildPack(dlcTexturePack); - if(dlcTexturePack->getDLCItemsCount(e_DLCType_Texture) > 0) + if(dlcTexturePack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0) { Minecraft::GetInstance()->skins->addTexturePackFromDLC(dlcTexturePack, dlcTexturePack->GetPackId() ); } } ++dwFilesProcessed; } - else if(dlcFile != nullptr) + else if(dlcFile != NULL) { // Data dlcFile->addData(pbTemp,pFile->uiFileSize); @@ -500,7 +499,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD // TODO - 4J Stu Remove the need for this vSkinNames vector, or manage it differently switch(pFile->dwType) { - case e_DLCType_Skin: + case DLCManager::e_DLCType_Skin: app.vSkinNames.push_back((WCHAR *)pFile->wchFile); break; } @@ -515,13 +514,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; } - if( pack->getDLCItemsCount(e_DLCType_GameRules) > 0 - || pack->getDLCItemsCount(e_DLCType_GameRulesHeader) > 0) + if( pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0 + || pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0) { app.m_gameRules.loadGameRules(pack); } - if(pack->getDLCItemsCount(e_DLCType_Audio) > 0) + if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0) { //app.m_Audio.loadAudioDetails(pack); } @@ -538,22 +537,22 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac #ifdef _WINDOWS64 string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #elif defined(_DURANGO) wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { return 0; } - DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { // need to treat the file as corrupt, and flag it, so can't call fatal error @@ -580,7 +579,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { DWORD packId=0; bool bPackIDSet=false; - unordered_map parameterMapping; + unordered_map parameterMapping; unsigned int uiCurrentByte=0; // File format defined in the DLC_Creator @@ -609,9 +608,9 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;i(pParams->wchData)); - EDLCParameterType type = getParameterType(parameterName); - if( type != e_DLCParamType_Invalid ) + wstring parameterName((WCHAR *)pParams->wchData); + DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); + if( type != DLCManager::e_DLCParamType_Invalid ) { parameterMapping[pParams->dwType] = type; } @@ -634,7 +633,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;i(pFile->dwType); + DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType; // Params uiParameterCount=*(unsigned int *)pbTemp; @@ -650,7 +649,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { if(it->second==e_DLCParamType_PackId) { - wstring wsTemp=static_cast(pParams->wchData); + wstring wsTemp=(WCHAR *)pParams->wchData; std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually ss << std::dec << wsTemp.c_str(); diff --git a/Minecraft.Client/Common/DLC/DLCPack.cpp b/Minecraft.Client/Common/DLC/DLCPack.cpp index 110008c6..ea8a270f 100644 --- a/Minecraft.Client/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Common/DLC/DLCPack.cpp @@ -24,14 +24,14 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask) m_isCorrupt = false; m_packId = 0; m_packVersion = 0; - m_parentPack = nullptr; + m_parentPack = NULL; m_dlcMountIndex = -1; #ifdef _XBOX m_dlcDeviceID = XCONTENTDEVICE_ANY; #endif // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = nullptr; + m_data = NULL; } #ifdef _XBOX_ONE @@ -44,11 +44,11 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas m_isCorrupt = false; m_packId = 0; m_packVersion = 0; - m_parentPack = nullptr; + m_parentPack = NULL; m_dlcMountIndex = -1; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = nullptr; + m_data = NULL; } #endif @@ -76,7 +76,7 @@ DLCPack::~DLCPack() wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str()); #endif // For the same reason, don't delete data pointer for any child pack as it just points to a region within the parent pack that has already been freed - if( m_parentPack == nullptr ) + if( m_parentPack == NULL ) { delete [] m_data; } @@ -85,7 +85,7 @@ DLCPack::~DLCPack() DWORD DLCPack::GetDLCMountIndex() { - if(m_parentPack != nullptr) + if(m_parentPack != NULL) { return m_parentPack->GetDLCMountIndex(); } @@ -94,7 +94,7 @@ DWORD DLCPack::GetDLCMountIndex() XCONTENTDEVICEID DLCPack::GetDLCDeviceID() { - if(m_parentPack != nullptr ) + if(m_parentPack != NULL ) { return m_parentPack->GetDLCDeviceID(); } @@ -156,7 +156,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va m_dataPath = value; break; default: - m_parameters[static_cast(type)] = value; + m_parameters[(int)type] = value; break; } } @@ -187,7 +187,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) { - DLCFile *newFile = nullptr; + DLCFile *newFile = NULL; switch(type) { @@ -243,7 +243,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) break; }; - if( newFile != nullptr ) + if( newFile != NULL ) { m_files[newFile->getType()].push_back(newFile); } @@ -252,7 +252,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) } // MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler -static const wstring *g_pathCmpString = nullptr; +static const wstring *g_pathCmpString = NULL; static bool pathCmp(DLCFile *val) { return (g_pathCmpString->compare(val->getPath()) == 0); @@ -263,7 +263,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path bool hasFile = false; if(type == DLCManager::e_DLCType_All) { - for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) + for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) { hasFile = doesPackContainFile(currentType,path); if(hasFile) break; @@ -284,13 +284,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) { - DLCFile *file = nullptr; + DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) { - for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) + for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) { file = getFile(currentType,index); - if(file != nullptr) break; + if(file != NULL) break; } } else @@ -306,13 +306,13 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) { - DLCFile *file = nullptr; + DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) { - for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) + for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) { file = getFile(currentType,path); - if(file != nullptr) break; + if(file != NULL) break; } } else @@ -323,7 +323,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) if(it == m_files[type].end()) { // Not found - file = nullptr; + file = NULL; } else { @@ -346,11 +346,11 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT case DLCManager::e_DLCType_All: for(int i = 0; i < DLCManager::e_DLCType_Max; ++i) { - count += getDLCItemsCount(static_cast(i)); + count += getDLCItemsCount((DLCManager::EDLCType)i); } break; default: - count = static_cast(m_files[(int)type].size()); + count = (DWORD)m_files[(int)type].size(); break; }; return count; @@ -420,12 +420,12 @@ void DLCPack::UpdateLanguage() { // find the language file DLCManager::e_DLCType_LocalisationData; - DLCFile *file = nullptr; + DLCFile *file = NULL; if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0) { file = m_files[DLCManager::e_DLCType_LocalisationData][0]; - DLCLocalisationFile *localisationFile = static_cast(getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")); + DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); StringTable *strTable = localisationFile->getStringTable(); strTable->ReloadStringTable(); } diff --git a/Minecraft.Client/Common/DLC/DLCPack.h b/Minecraft.Client/Common/DLC/DLCPack.h index 14129cbe..df1f65f0 100644 --- a/Minecraft.Client/Common/DLC/DLCPack.h +++ b/Minecraft.Client/Common/DLC/DLCPack.h @@ -87,8 +87,8 @@ public: DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); } DWORD getSkinIndexAt(const wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); } - DLCSkinFile *getSkinFile(const wstring &path) { return static_cast(getFile(DLCManager::e_DLCType_Skin, path)); } - DLCSkinFile *getSkinFile(DWORD index) { return static_cast(getFile(DLCManager::e_DLCType_Skin, index)); } + DLCSkinFile *getSkinFile(const wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } + DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } bool doesPackContainSkin(const wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); } bool hasPurchasedFile(DLCManager::EDLCType type, const wstring &path); diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp index f7ef2ad0..c845acd9 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp @@ -79,7 +79,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring { i++; } - size_t iLast=creditValue.find_last_of(L" ", i); + int iLast=(int)creditValue.find_last_of(L" ",i); switch(XGetLanguage()) { case XC_LANGUAGE_JAPANESE: @@ -88,7 +88,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring iLast = maximumChars; break; default: - iLast=creditValue.find_last_of(L" ", i); + iLast=(int)creditValue.find_last_of(L" ",i); break; } @@ -178,7 +178,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring int DLCSkinFile::getAdditionalBoxesCount() { - return static_cast(m_AdditionalBoxes.size()); + return (int)m_AdditionalBoxes.size(); } vector *DLCSkinFile::getAdditionalBoxes() { diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.h b/Minecraft.Client/Common/DLC/DLCSkinFile.h index 15a50e71..c8dcf0e9 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.h +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.h @@ -17,11 +17,11 @@ public: DLCSkinFile(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; - void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value); - wstring getParameterAsString(DLCManager::EDLCParameterType type) override; - bool getParameterAsBool(DLCManager::EDLCParameterType type) override; + virtual wstring getParameterAsString(DLCManager::EDLCParameterType type); + virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); vector *getAdditionalBoxes(); int getAdditionalBoxesCount(); unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;} diff --git a/Minecraft.Client/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Common/DLC/DLCTextureFile.cpp index fb9c5b03..edf071c6 100644 --- a/Minecraft.Client/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCTextureFile.cpp @@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCT m_bIsAnim = false; m_animString = L""; - m_pbData = nullptr; + m_pbData = NULL; m_dwBytes = 0; } diff --git a/Minecraft.Client/Common/DLC/DLCTextureFile.h b/Minecraft.Client/Common/DLC/DLCTextureFile.h index 2b397e8e..bc791686 100644 --- a/Minecraft.Client/Common/DLC/DLCTextureFile.h +++ b/Minecraft.Client/Common/DLC/DLCTextureFile.h @@ -14,11 +14,11 @@ private: public: DLCTextureFile(const wstring &path); - void addData(PBYTE pbData, DWORD dwBytes) override; - PBYTE getData(DWORD &dwBytes) override; + virtual void addData(PBYTE pbData, DWORD dwBytes); + virtual PBYTE getData(DWORD &dwBytes); - void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override; + virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value); - wstring getParameterAsString(DLCManager::EDLCParameterType type) override; - bool getParameterAsBool(DLCManager::EDLCParameterType type) override; + virtual wstring getParameterAsString(DLCManager::EDLCParameterType type); + virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp index 597c4b7b..a2a56bca 100644 --- a/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp @@ -4,14 +4,14 @@ DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) { - m_pbData = nullptr; + m_pbData = NULL; m_dwBytes = 0; m_canDeleteData = false; } DLCUIDataFile::~DLCUIDataFile() { - if(m_canDeleteData && m_pbData != nullptr) + if(m_canDeleteData && m_pbData != NULL) { app.DebugPrintf("Deleting DLCUIDataFile data\n"); delete [] m_pbData; diff --git a/Minecraft.Client/Common/DLC/DLCUIDataFile.h b/Minecraft.Client/Common/DLC/DLCUIDataFile.h index c858933c..105ad0df 100644 --- a/Minecraft.Client/Common/DLC/DLCUIDataFile.h +++ b/Minecraft.Client/Common/DLC/DLCUIDataFile.h @@ -10,11 +10,11 @@ private: public: DLCUIDataFile(const wstring &path); - ~DLCUIDataFile() override; + ~DLCUIDataFile(); using DLCFile::addData; using DLCFile::addParameter; virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false); - PBYTE getData(DWORD &dwBytes) override; + virtual PBYTE getData(DWORD &dwBytes); }; diff --git a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp index f97bfdd1..555ed8b4 100644 --- a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp @@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) { bool enchanted = false; - if (item != nullptr) + if (item != NULL) { // 4J-JEV: Ripped code from enchantmenthelpers // Maybe we want to add an addEnchantment method to EnchantmentHelpers @@ -58,7 +58,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) { Enchantment *e = Enchantment::enchantments[m_enchantmentId]; - if(e != nullptr && e->category->canEnchant(item->getItem())) + if(e != NULL && e->category->canEnchant(item->getItem())) { int level = min(e->getMaxLevel(), m_enchantmentLevel); item->enchant(e, m_enchantmentLevel); diff --git a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp index 49809d0c..801a2937 100644 --- a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp @@ -41,11 +41,11 @@ void AddItemRuleDefinition::getChildren(vector *children) GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) { rule = new AddEnchantmentRuleDefinition(); - m_enchantments.push_back(static_cast(rule)); + m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule); } else { @@ -97,10 +97,10 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, int slotId) { bool added = false; - if(Item::items[m_itemId] != nullptr) + if(Item::items[m_itemId] != NULL) { int quantity = std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); - shared_ptr newItem = std::make_shared(m_itemId, quantity, m_auxValue); + shared_ptr newItem = shared_ptr(new ItemInstance(m_itemId,quantity,m_auxValue) ); newItem->set4JData(m_dataTag); for( auto& it : m_enchantments ) @@ -118,7 +118,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, container->setItem( slotId, newItem ); added = true; } - else if(dynamic_pointer_cast(container) != nullptr) + else if(dynamic_pointer_cast(container) != NULL) { added = dynamic_pointer_cast(container)->add(newItem); } diff --git a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp index 3c7e02a3..a740a2be 100644 --- a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption { m_levelGenOptions = levelGenOptions; m_location = Vec3::newPermanent(0,0,0); - m_locationBox = nullptr; + m_locationBox = NULL; m_totalBlocksChanged = 0; m_totalBlocksChangedLighting = 0; m_rotation = ConsoleSchematicFile::eSchematicRot_0; m_completed = false; m_dimension = 0; - m_schematic = nullptr; + m_schematic = NULL; } ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() { app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n"); if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName); - m_schematic = nullptr; + m_schematic = NULL; delete m_location; } @@ -72,20 +72,20 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co else if(attributeName.compare(L"x") == 0) { m_location->x = _fromString(attributeValue); - if( static_cast(abs(m_location->x))%2 != 0) m_location->x -=1; + if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1; //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter x=%f\n",m_location->x); } else if(attributeName.compare(L"y") == 0) { m_location->y = _fromString(attributeValue); - if( static_cast(abs(m_location->y))%2 != 0) m_location->y -= 1; + if( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1; if(m_location->y < 0) m_location->y = 0; //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter y=%f\n",m_location->y); } else if(attributeName.compare(L"z") == 0) { m_location->z = _fromString(attributeValue); - if(static_cast(abs(m_location->z))%2 != 0) m_location->z -= 1; + if(((int)abs(m_location->z))%2 != 0) m_location->z -= 1; //app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter z=%f\n",m_location->z); } else if(attributeName.compare(L"rot") == 0) @@ -95,7 +95,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co while(degrees < 0) degrees += 360; while(degrees >= 360) degrees -= 360; float quad = degrees/90; - degrees = static_cast(quad + 0.5f); + degrees = (int)(quad + 0.5f); switch(degrees) { case 1: @@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co void ApplySchematicRuleDefinition::updateLocationBox() { - if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); m_locationBox = AABB::newPermanent(0,0,0,0,0,0); @@ -162,9 +162,9 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk * if(chunk->level->dimension->id != m_dimension) return; PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition"); - if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - if(m_locationBox == nullptr) updateLocationBox(); + if(m_locationBox == NULL) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); @@ -189,7 +189,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk * { m_completed = true; //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = nullptr; + //m_schematic = NULL; } } PIXEndNamedEvent(); @@ -201,9 +201,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve if(chunk->level->dimension->id != m_dimension) return; PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)"); - if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - if(m_locationBox == nullptr) updateLocationBox(); + if(m_locationBox == NULL) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); @@ -223,7 +223,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve { m_completed = true; //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = nullptr; + //m_schematic = NULL; } } PIXEndNamedEvent(); @@ -231,13 +231,13 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) { - if( m_locationBox == nullptr ) updateLocationBox(); + if( m_locationBox == NULL ) updateLocationBox(); return m_locationBox->intersects(x0,y0,z0,x1,y1,z1); } int ApplySchematicRuleDefinition::getMinY() { - if( m_locationBox == nullptr ) updateLocationBox(); + if( m_locationBox == NULL ) updateLocationBox(); return m_locationBox->y0; } diff --git a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp index 7f03a0fe..f3b48445 100644 --- a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp @@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) { bool statusChanged = false; - if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) + if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) { if(!getComplete(rule)) { @@ -90,21 +90,13 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr= m_quantity) { setComplete(rule, true); - app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId, m_auxValue, m_quantity, m_4JDataValue); + app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue); - if (rule->getConnection() != nullptr) - { - rule->getConnection()->send(std::make_shared( - getActionType(), - this->m_descriptionId, - m_itemId, - m_auxValue, - this->m_4JDataValue, - nullptr, - static_cast(0) - )); - } - } + if(rule->getConnection() != NULL) + { + rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); + } + } } } return statusChanged; @@ -114,7 +106,7 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr item) { // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd wstring xml = L""; - if(item != nullptr) + if(item != NULL) { xml = L"id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\""; if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\""; diff --git a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp index cd23cd50..b928b26c 100644 --- a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr); } } - if(rule->getConnection() != nullptr) + if(rule->getConnection() != NULL) { PacketData data; data.goal = goal; @@ -45,20 +45,20 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) int icon = -1; int auxValue = 0; - if(m_lastRuleStatusChanged != nullptr) + if(m_lastRuleStatusChanged != NULL) { icon = m_lastRuleStatusChanged->getIcon(); auxValue = m_lastRuleStatusChanged->getAuxValue(); - m_lastRuleStatusChanged = nullptr; + m_lastRuleStatusChanged = NULL; } - rule->getConnection()->send(std::make_shared(getActionType(), this->m_descriptionId, icon, auxValue, 0, &data, sizeof(PacketData))); + rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); } app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal); } wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength) { - PacketData *values = static_cast(data); + PacketData *values = (PacketData *)data; wstring newDesc = description; newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress)); newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal)); diff --git a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp index f75eddd4..395b4eeb 100644 --- a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -6,7 +6,7 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition() { - m_lastRuleStatusChanged = nullptr; + m_lastRuleStatusChanged = NULL; } CompoundGameRuleDefinition::~CompoundGameRuleDefinition() @@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector *child GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) { rule = new CompleteAllRuleDefinition(); @@ -49,13 +49,13 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); #endif } - if(rule != nullptr) m_children.push_back(rule); + if(rule != NULL) m_children.push_back(rule); return rule; } void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule) { - GameRule *newRule = nullptr; + GameRule *newRule = NULL; int i = 0; for (auto& it : m_children ) { diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp index dd777682..f505ce7a 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp @@ -10,7 +10,7 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { m_x = m_y = m_z = 0; - boundingBox = nullptr; + boundingBox = NULL; orientation = Direction::NORTH; m_dimension = 0; } @@ -25,26 +25,26 @@ void ConsoleGenerateStructure::getChildren(vector *childre GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) { rule = new XboxStructureActionGenerateBox(); - m_actions.push_back(static_cast(rule)); + m_actions.push_back((XboxStructureActionGenerateBox *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock) { rule = new XboxStructureActionPlaceBlock(); - m_actions.push_back(static_cast(rule)); + m_actions.push_back((XboxStructureActionPlaceBlock *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer) { rule = new XboxStructureActionPlaceContainer(); - m_actions.push_back(static_cast(rule)); + m_actions.push_back((XboxStructureActionPlaceContainer *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner) { rule = new XboxStructureActionPlaceSpawner(); - m_actions.push_back(static_cast(rule)); + m_actions.push_back((XboxStructureActionPlaceSpawner *)rule); } else { @@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const BoundingBox* ConsoleGenerateStructure::getBoundingBox() { - if(boundingBox == nullptr) + if(boundingBox == NULL) { // Find the max bounds int maxX, maxY, maxZ; @@ -139,25 +139,25 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin { case ConsoleGameRules::eGameRuleType_GenerateBox: { - XboxStructureActionGenerateBox *genBox = static_cast(action); + XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action; genBox->generateBoxInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceBlock: { - XboxStructureActionPlaceBlock *pPlaceBlock = static_cast(action); + XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action; pPlaceBlock->placeBlockInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceContainer: { - XboxStructureActionPlaceContainer *pPlaceContainer = static_cast(action); + XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action; pPlaceContainer->placeContainerInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceSpawner: { - XboxStructureActionPlaceSpawner *pPlaceSpawner = static_cast(action); + XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action; pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB); } break; diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h index 712a29ab..91c4ef35 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h +++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h @@ -36,7 +36,7 @@ public: virtual int getMinY(); - EStructurePiece GetType() { return static_cast(0); } + EStructurePiece GetType() { return (EStructurePiece)0; } void addAdditonalSaveData(CompoundTag *tag) {} void readAdditonalSaveData(CompoundTag *tag) {} }; \ No newline at end of file diff --git a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp index c261e0cd..7b69c4b4 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp @@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile() { m_xSize = m_ySize = m_zSize = 0; m_refCount = 1; - m_data.data = nullptr; + m_data.data = NULL; } ConsoleSchematicFile::~ConsoleSchematicFile() { app.DebugPrintf("Deleting schematic file\n"); - if(m_data.data != nullptr) delete [] m_data.data; + if(m_data.data != NULL) delete [] m_data.data; } void ConsoleSchematicFile::save(DataOutputStream *dos) { - if(dos != nullptr) + if(dos != NULL) { dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); @@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos) void ConsoleSchematicFile::load(DataInputStream *dis) { - if(dis != nullptr) + if(dis != NULL) { // VERSION CHECK // int version = dis->readInt(); @@ -61,7 +61,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions { - compressionType = static_cast(dis->readByte()); + compressionType = (Compression::ECompressionTypes)dis->readByte(); } if (version > XBOX_SCHEMATIC_CURRENT_VERSION) @@ -75,10 +75,10 @@ void ConsoleSchematicFile::load(DataInputStream *dis) byteArray compressedBuffer(compressedSize); dis->readFully(compressedBuffer); - if(m_data.data != nullptr) + if(m_data.data != NULL) { - delete [] m_data.data; - m_data.data = nullptr; + delete [] m_data.data; + m_data.data = NULL; } if(compressionType == Compression::eCompressionType_None) @@ -111,17 +111,17 @@ void ConsoleSchematicFile::load(DataInputStream *dis) // READ TAGS // CompoundTag *tag = NbtIo::read(dis); ListTag *tileEntityTags = (ListTag *) tag->getList(L"TileEntities"); - if (tileEntityTags != nullptr) + if (tileEntityTags != NULL) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if(te == nullptr) + if(te == NULL) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n"); + app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n"); __debugbreak(); #endif } @@ -132,7 +132,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) } } ListTag *entityTags = (ListTag *) tag->getList(L"Entities"); - if (entityTags != nullptr) + if (entityTags != NULL) { for (int i = 0; i < entityTags->size(); i++) { @@ -145,15 +145,15 @@ void ConsoleSchematicFile::load(DataInputStream *dis) double z = pos->get(2)->data; if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME ) - { - x = static_cast(eTag->get(L"TileX"))->data; - y = static_cast(eTag->get(L"TileY"))->data; - z = static_cast(eTag->get(L"TileZ"))->data; - } + { + x = ((IntTag *) eTag->get(L"TileX") )->data; + y = ((IntTag *) eTag->get(L"TileY") )->data; + z = ((IntTag *) eTag->get(L"TileZ") )->data; + } #ifdef _DEBUG //app.DebugPrintf(1,"Loaded entity type %d at (%f,%f,%f)\n",(int)type,x,y,z); #endif - m_entities.push_back( pair(Vec3::newPermanent(x,y,z),static_cast(eTag->copy()))); + m_entities.push_back( pair(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy())); } } delete tag; @@ -178,7 +178,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos) tag->put(L"Entities", entityTags); for (auto& it : m_entities ) - entityTags->add( static_cast((it).second->copy()) ); + entityTags->add( (CompoundTag *)(it).second->copy() ); NbtIo::write(tag,dos); delete tag; @@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos) int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) { - int xStart = static_cast(std::fmax(destinationBox->x0, static_cast(chunk->x)*16)); - int xEnd = static_cast(std::fmin(destinationBox->x1, static_cast((xStart >> 4) << 4) + 16)); + int xStart = static_cast(std::fmax(destinationBox->x0, (double)chunk->x*16)); + int xEnd = static_cast(std::fmin(destinationBox->x1, (double)((xStart >> 4) << 4) + 16)); int yStart = destinationBox->y0; int yEnd = destinationBox->y1; if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - int zStart = static_cast(std::fmax(destinationBox->z0, static_cast(chunk->z) * 16)); - int zEnd = static_cast(std::fmin(destinationBox->z1, static_cast((zStart >> 4) << 4) + 16)); + int zStart = static_cast(std::fmax(destinationBox->z0, (double)chunk->z * 16)); + int zEnd = static_cast(std::fmin(destinationBox->z1, (double)((zStart >> 4) << 4) + 16)); #ifdef _DEBUG app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1); @@ -442,10 +442,10 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); if( chunkBox->containsIncludingLowerBound(pos) ) { - shared_ptr teCopy = chunk->getTileEntity( static_cast(targetX) & 15, static_cast(targetY) & 15, static_cast(targetZ) & 15 ); + shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); - if ( teCopy != nullptr ) - { + if ( teCopy != NULL ) + { CompoundTag *teData = new CompoundTag(); te->save(teData); @@ -493,7 +493,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } CompoundTag *eTag = it->second; - shared_ptr e = EntityIO::loadStatic(eTag, nullptr); + shared_ptr e = EntityIO::loadStatic(eTag, NULL); if( e->GetType() == eTYPE_PAINTING ) { @@ -582,18 +582,18 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l app.DebugPrintf("Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), %dx%dx%d\n",xStart,yStart,zStart,xEnd,yEnd,zEnd,xSize,ySize,zSize); - if(dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); + if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); - if(dos != nullptr) dos->writeByte(compressionType); + if(dos != NULL) dos->writeByte(compressionType); //Write xSize - if(dos != nullptr) dos->writeInt(xSize); + if(dos != NULL) dos->writeInt(xSize); //Write ySize - if(dos != nullptr) dos->writeInt(ySize); + if(dos != NULL) dos->writeInt(ySize); //Write zSize - if(dos != nullptr) dos->writeInt(zSize); + if(dos != NULL) dos->writeInt(zSize); //byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false); int xRowSize = ySize * zSize; @@ -660,8 +660,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l delete [] result.data; byteArray buffer = byteArray(ucTemp,inputSize); - if(dos != nullptr) dos->writeInt(inputSize); - if(dos != nullptr) dos->write(buffer); + if(dos != NULL) dos->writeInt(inputSize); + if(dos != NULL) dos->write(buffer); delete [] buffer.data; CompoundTag tag; @@ -725,10 +725,10 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l pos->get(2)->data -= zStart; if( e->instanceof(eTYPE_HANGING_ENTITY) ) - { - static_cast(eTag->get(L"TileX"))->data -= xStart; - static_cast(eTag->get(L"TileY"))->data -= yStart; - static_cast(eTag->get(L"TileZ"))->data -= zStart; + { + ((IntTag *) eTag->get(L"TileX") )->data -= xStart; + ((IntTag *) eTag->get(L"TileY") )->data -= yStart; + ((IntTag *) eTag->get(L"TileZ") )->data -= zStart; } entitiesTag->add(eTag); @@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l tag.put(L"Entities", entitiesTag); - if(dos != nullptr) NbtIo::write(&tag,dos); + if(dos != NULL) NbtIo::write(&tag,dos); } void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP) diff --git a/Minecraft.Client/Common/GameRules/GameRule.h b/Minecraft.Client/Common/GameRules/GameRule.h index e35f1375..3b9dba7e 100644 --- a/Minecraft.Client/Common/GameRules/GameRule.h +++ b/Minecraft.Client/Common/GameRules/GameRule.h @@ -40,7 +40,7 @@ public: stringValueMapType m_parameters; // These are the members of this rule that maintain it's state public: - GameRule(GameRuleDefinition *definition, Connection *connection = nullptr); + GameRule(GameRuleDefinition *definition, Connection *connection = NULL); virtual ~GameRule(); Connection *getConnection() { return m_connection; } diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp index 770b56d5..80d02956 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp @@ -50,7 +50,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType #ifndef _CONTENT_PACKAGE wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); #endif - return nullptr; + return NULL; } void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h index 4a2c43a1..afec8fbc 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h @@ -61,6 +61,6 @@ public: // Static functions static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection); - static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = nullptr, int dataLength = 0); + static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index ff294a65..0606808c 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -85,24 +85,24 @@ const WCHAR *GameRuleManager::wchAttrNameA[] = GameRuleManager::GameRuleManager() { - m_currentGameRuleDefinitions = nullptr; - m_currentLevelGenerationOptions = nullptr; + m_currentGameRuleDefinitions = NULL; + m_currentLevelGenerationOptions = NULL; } void GameRuleManager::loadGameRules(DLCPack *pack) { - StringTable *strings = nullptr; + StringTable *strings = NULL; if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc")) { - DLCLocalisationFile *localisationFile = static_cast(pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")); + DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); strings = localisationFile->getStringTable(); } int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); for(int i = 0; i < gameRulesCount; ++i) { - DLCGameRulesHeader *dlcHeader = static_cast(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); + DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); DWORD dSize; byte *dData = dlcHeader->getData(dSize); @@ -120,7 +120,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules); for (int i = 0; i < gameRulesCount; ++i) { - DLCGameRulesFile *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_GameRules, i)); + DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); DWORD dSize; byte *dData = dlcFile->getData(dSize); @@ -182,7 +182,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT compr_content(new BYTE[compr_len], compr_len); dis.read(compr_content); - Compression::getCompression()->SetDecompressionType( static_cast(compression_type) ); + Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type ); Compression::getCompression()->DecompressLZXRLE( content.data, &content.length, compr_content.data, compr_content.length); Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL ); @@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT // 4J-JEV: Reverse of loadGameRules. void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) { - if (m_currentGameRuleDefinitions == nullptr && - m_currentLevelGenerationOptions == nullptr) + if (m_currentGameRuleDefinitions == NULL && + m_currentLevelGenerationOptions == NULL) { app.DebugPrintf("GameRuleManager:: Nothing here to save."); - *dOut = nullptr; + *dOut = NULL; *dSize = 0; return; } @@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) ByteArrayOutputStream compr_baos; DataOutputStream compr_dos(&compr_baos); - if (m_currentGameRuleDefinitions == nullptr) + if (m_currentGameRuleDefinitions == NULL) { compr_dos.writeInt( 0 ); // numStrings for StringTable compr_dos.writeInt( version_number ); @@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) { StringTable *st = m_currentGameRuleDefinitions->getStringTable(); - if (st == nullptr) + if (st == NULL) { - app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!"); + app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!"); } else { @@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) *dSize = baos.buf.length; *dOut = baos.buf.data; - baos.buf.data = nullptr; + baos.buf.data = NULL; dos.close(); baos.close(); } @@ -399,8 +399,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT for(int i = 0; i < 8; ++i) dis.readBoolean(); } - ByteArrayInputStream *contentBais = nullptr; - DataInputStream *contentDis = nullptr; + ByteArrayInputStream *contentBais = NULL; + DataInputStream *contentDis = NULL; if(compressionType == Compression::eCompressionType_None) { @@ -469,13 +469,13 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT tagsAndAtts.push_back( contentDis->readUTF() ); unordered_map tagIdMap; - for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < static_cast(ConsoleGameRules::eGameRuleType_Count); ++type) + for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type) { for(UINT i = 0; i < numStrings; ++i) { if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0) { - tagIdMap.insert( unordered_map::value_type(i, static_cast(type)) ); + tagIdMap.insert( unordered_map::value_type(i, (ConsoleGameRules::EGameRuleType)type) ); break; } } @@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT auto it = tagIdMap.find(tagId); if(it != tagIdMap.end()) tagVal = it->second; - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) { @@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT { // Not default contentDis->close(); - if(contentBais != nullptr) delete contentBais; + if(contentBais != NULL) delete contentBais; delete contentDis; } dis.close(); bais.reset(); - //if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; } + //if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; } if(!gameRulesAdded) delete gameRules; return true; @@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector *tags int attID = dis->readInt(); wstring value = dis->readUTF(); - if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value); + if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value); } } @@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector *tagsAn auto it = tagIdMap->find(tagId); if(it != tagIdMap->end()) tagVal = it->second; - GameRuleDefinition *childRule = nullptr; - if(rule != nullptr) childRule = rule->addChild(tagVal); + GameRuleDefinition *childRule = NULL; + if(rule != NULL) childRule = rule->addChild(tagVal); readAttributes(dis,tagsAndAtts,childRule); readChildren(dis,tagsAndAtts,tagIdMap,childRule); @@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector *tagsAn void GameRuleManager::processSchematics(LevelChunk *levelChunk) { - if(getLevelGenerationOptions() != nullptr) + if(getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); levelGenOptions->processSchematics(levelChunk); @@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk) void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk) { - if(getLevelGenerationOptions() != nullptr) + if(getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); levelGenOptions->processSchematicsLighting(levelChunk); @@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen { unloadCurrentGameRules(); - m_currentGameRuleDefinitions = nullptr; + m_currentGameRuleDefinitions = NULL; m_currentLevelGenerationOptions = levelGen; - if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() ) + if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() ) { m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules(); } - if(m_currentLevelGenerationOptions != nullptr) + if(m_currentLevelGenerationOptions != NULL) m_currentLevelGenerationOptions->reset_start(); } LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key) { - if(m_currentGameRuleDefinitions != nullptr && !key.empty() ) + if(m_currentGameRuleDefinitions != NULL && !key.empty() ) { return m_currentGameRuleDefinitions->getString(key); } @@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions * void GameRuleManager::unloadCurrentGameRules() { - if (m_currentLevelGenerationOptions != nullptr) + if (m_currentLevelGenerationOptions != NULL) { - if (m_currentGameRuleDefinitions != nullptr + if (m_currentGameRuleDefinitions != NULL && m_currentLevelGenerationOptions->isFromSave()) m_levelRules.removeLevelRule( m_currentGameRuleDefinitions ); @@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules() } } - m_currentGameRuleDefinitions = nullptr; - m_currentLevelGenerationOptions = nullptr; + m_currentGameRuleDefinitions = NULL; + m_currentLevelGenerationOptions = NULL; } diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp index 2f121f4f..59fde56e 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp @@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; } LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) { - m_spawnPos = nullptr; - m_stringTable = nullptr; + m_spawnPos = NULL; + m_stringTable = NULL; m_hasLoadedData = false; @@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) m_minY = INT_MAX; m_bRequiresGameRules = false; - m_pbBaseSaveData = nullptr; + m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; m_parentDLCPack = parentPack; @@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) LevelGenerationOptions::~LevelGenerationOptions() { clearSchematics(); - if(m_spawnPos != nullptr) delete m_spawnPos; + if(m_spawnPos != NULL) delete m_spawnPos; for (auto& it : m_schematicRules ) { delete it; @@ -141,26 +141,26 @@ void LevelGenerationOptions::getChildren(vector *children) GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) { rule = new ApplySchematicRuleDefinition(this); - m_schematicRules.push_back(static_cast(rule)); + m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure) { rule = new ConsoleGenerateStructure(); - m_structureRules.push_back(static_cast(rule)); + m_structureRules.push_back((ConsoleGenerateStructure *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride) { rule = new BiomeOverride(); - m_biomeOverrides.push_back(static_cast(rule)); + m_biomeOverrides.push_back((BiomeOverride *)rule); } else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature) { rule = new StartFeature(); - m_features.push_back(static_cast(rule)); + m_features.push_back((StartFeature *)rule); } else { @@ -180,21 +180,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws } else if(attributeName.compare(L"spawnX") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->x = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value); } else if(attributeName.compare(L"spawnY") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->y = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value); } else if(attributeName.compare(L"spawnZ") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->z = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",value); @@ -268,7 +268,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk) if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15)) { BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15); - structureStart->postProcess(chunk->level, nullptr, bb); + structureStart->postProcess(chunk->level, NULL, bb); delete bb; } } @@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f return it->second; } - ConsoleSchematicFile *schematic = nullptr; + ConsoleSchematicFile *schematic = NULL; byteArray data(pbData,dwLen); ByteArrayInputStream bais(data); DataInputStream dis(&bais); @@ -366,7 +366,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename) { - ConsoleSchematicFile *schematic = nullptr; + ConsoleSchematicFile *schematic = NULL; // If we have already loaded this, just return auto it = m_schematics.find(filename); if(it != m_schematics.end()) @@ -399,7 +399,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table) LPCWSTR LevelGenerationOptions::getString(const wstring &key) { - if(m_stringTable == nullptr) + if(m_stringTable == NULL) { return L""; } @@ -456,7 +456,7 @@ unordered_map *LevelGenerationOptions::getUnfin void LevelGenerationOptions::loadBaseSaveData() { int mountIndex = -1; - if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex(); + if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex(); if(mountIndex > -1) { @@ -485,7 +485,7 @@ void LevelGenerationOptions::loadBaseSaveData() int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) { - LevelGenerationOptions *lgo = static_cast(pParam); + LevelGenerationOptions *lgo = (LevelGenerationOptions *)pParam; lgo->m_bLoadingData = false; if(dwErr!=ERROR_SUCCESS) { @@ -499,7 +499,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD int gameRulesCount = lgo->m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); for(int i = 0; i < gameRulesCount; ++i) { - DLCGameRulesHeader *dlcFile = static_cast(lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); + DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); if (!dlcFile->getGrfPath().empty()) { @@ -513,10 +513,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -524,10 +524,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif @@ -536,7 +536,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD DWORD dwFileSize = grf.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -565,10 +565,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(save.getPath()); @@ -576,18 +576,18 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -624,8 +624,8 @@ void LevelGenerationOptions::reset_start() void LevelGenerationOptions::reset_finish() { - //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = nullptr; } - //if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; } + //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; } + //if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; } if (isFromDLC()) { @@ -694,8 +694,8 @@ bool LevelGenerationOptions::ready() { return info()->ready(); } void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; } PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; } -bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != nullptr; } -void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; } +bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; } +void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h index 378ac6c5..cf669019 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h @@ -167,7 +167,7 @@ private: bool m_bLoadingData; public: - LevelGenerationOptions(DLCPack *parentPack = nullptr); + LevelGenerationOptions(DLCPack *parentPack = NULL); ~LevelGenerationOptions(); virtual ConsoleGameRules::EGameRuleType getActionType(); @@ -202,7 +202,7 @@ public: LevelRuleset *getRequiredGameRules(); void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile); - bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = nullptr); + bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL); void loadStringTable(StringTable *table); LPCWSTR getString(const wstring &key); diff --git a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp index de17bacc..658abe91 100644 --- a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp @@ -6,7 +6,7 @@ LevelRuleset::LevelRuleset() { - m_stringTable = nullptr; + m_stringTable = NULL; } LevelRuleset::~LevelRuleset() @@ -26,11 +26,11 @@ void LevelRuleset::getChildren(vector *children) GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea) { rule = new NamedAreaRuleDefinition(); - m_areas.push_back(static_cast(rule)); + m_areas.push_back((NamedAreaRuleDefinition *)rule); } else { @@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table) LPCWSTR LevelRuleset::getString(const wstring &key) { - if(m_stringTable == nullptr) + if(m_stringTable == NULL) { return L""; } diff --git a/Minecraft.Client/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Common/GameRules/StartFeature.cpp index 14b6d9c9..904bce73 100644 --- a/Minecraft.Client/Common/GameRules/StartFeature.cpp +++ b/Minecraft.Client/Common/GameRules/StartFeature.cpp @@ -47,7 +47,7 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att else if(attributeName.compare(L"feature") == 0) { int value = _fromString(attributeValue); - m_feature = static_cast(value); + m_feature = (StructureFeature::EFeatureTypes)value; app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature); } else @@ -58,6 +58,6 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation) { - if(orientation != nullptr) *orientation = m_orientation; + if(orientation != NULL) *orientation = m_orientation; return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature; } \ No newline at end of file diff --git a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 99aee99b..ec218c7a 100644 --- a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;; m_health = 0; m_food = 0; - m_spawnPos = nullptr; + m_spawnPos = NULL; m_yRot = 0.0f; } @@ -65,11 +65,11 @@ void UpdatePlayerRuleDefinition::getChildren(vector *child GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); - m_items.push_back(static_cast(rule)); + m_items.push_back((AddItemRuleDefinition *)rule); } else { @@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons { if(attributeName.compare(L"spawnX") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->x = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value); } else if(attributeName.compare(L"spawnY") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->y = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value); } else if(attributeName.compare(L"spawnZ") == 0) { - if(m_spawnPos == nullptr) m_spawnPos = new Pos(); + if(m_spawnPos == NULL) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->z = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value); @@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) double z = player->z; float yRot = player->yRot; float xRot = player->xRot; - if(m_spawnPos != nullptr) + if(m_spawnPos != NULL) { x = m_spawnPos->x; y = m_spawnPos->y; @@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) yRot = m_yRot; } - if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); + if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); for(auto& addItem : m_items) { diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp index 1f494691..fa68ef6a 100644 --- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -33,11 +33,11 @@ void XboxStructureActionPlaceContainer::getChildren(vector GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = nullptr; + GameRuleDefinition *rule = NULL; if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); - m_items.push_back(static_cast(rule)); + m_items.push_back((AddItemRuleDefinition *)rule); } else { @@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st if ( chunkBB->isInside( worldX, worldY, worldZ ) ) { - if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr ) + if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) { // Remove the current tile entity level->removeTileEntity( worldX, worldY, worldZ ); @@ -81,7 +81,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st shared_ptr container = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ); - if ( container != nullptr ) + if ( container != NULL ) { level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS); // Add items diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp index 3e61154f..3f6204af 100644 --- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp +++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp @@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct if ( chunkBB->isInside( worldX, worldY, worldZ ) ) { - if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr ) + if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) { // Remove the current tile entity level->removeTileEntity( worldX, worldY, worldZ ); @@ -59,7 +59,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct #ifndef _CONTENT_PACKAGE wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ); #endif - if( entity != nullptr ) + if( entity != NULL ) { entity->setEntityId(m_entityId); } diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp index 06f9a69b..07463517 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp @@ -6,8 +6,8 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man) m_manager = man; m_pending = false; - m_filter = static_cast(-1); - m_callback = nullptr; + m_filter = (LeaderboardManager::EFilterMode) -1; + m_callback = NULL; m_difficulty = 0; m_type = LeaderboardManager::eStatsType_UNDEFINED; m_startIndex = 0; diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp index 2ba1efd6..33707b14 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp @@ -12,7 +12,7 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] = void LeaderboardManager::DeleteInstance() { delete m_instance; - m_instance = nullptr; + m_instance = NULL; } LeaderboardManager::LeaderboardManager() @@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters() { m_difficulty = -1; m_statsType = eStatsType_UNDEFINED; - m_readListener = nullptr; + m_readListener = NULL; m_startIndex = 0; m_readCount = 0; m_eFilterMode = eFM_UNDEFINED; diff --git a/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp index f2d48947..78d62568 100644 --- a/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp +++ b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp @@ -35,7 +35,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = nullptr; + m_scores = NULL; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -47,7 +47,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = nullptr; + m_threadScoreboard = NULL; } SonyLeaderboardManager::~SonyLeaderboardManager() @@ -288,7 +288,7 @@ bool SonyLeaderboardManager::getScoreByIds() SonyRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = nullptr; + SceNpId *npIds = NULL; int ret; uint32_t num = 0; @@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds() ZeroMemory(comments, sizeof(SceNpScoreComment) * num); /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -342,9 +342,9 @@ bool SonyLeaderboardManager::getScoreByIds() destroyTransactionContext(ret); - if (npIds != nullptr) delete [] npIds; - if (ptr != nullptr) delete [] ptr; - if (comments != nullptr) delete [] comments; + if (npIds != NULL) delete [] npIds; + if (ptr != NULL) delete [] ptr; + if (comments != NULL) delete [] comments; return false; } @@ -355,9 +355,9 @@ bool SonyLeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != nullptr) delete [] npIds; - if (ptr != nullptr) delete [] ptr; - if (comments != nullptr) delete [] comments; + if (npIds != NULL) delete [] npIds; + if (ptr != NULL) delete [] ptr; + if (comments != NULL) delete [] comments; return false; } @@ -387,14 +387,14 @@ bool SonyLeaderboardManager::getScoreByIds() comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments #endif - nullptr, 0, // GameData. (unused) + NULL, 0, // GameData. (unused) tmpNum, &last_sort_date, &mTotalRecord, - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -425,7 +425,7 @@ bool SonyLeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -458,7 +458,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != nullptr) delete [] npIds; + if (npIds != NULL) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -511,14 +511,14 @@ bool SonyLeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - nullptr, 0, // GameData. + NULL, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -539,7 +539,7 @@ bool SonyLeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = nullptr; + m_scores = NULL; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -557,7 +557,7 @@ bool SonyLeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != nullptr) + if (m_readListener != NULL) { app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -716,16 +716,16 @@ void SonyLeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = nullptr; + m_scores = NULL; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = nullptr; + view.m_queries = NULL; - if ( m_readListener != nullptr ) + if ( m_readListener != NULL ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -747,7 +747,7 @@ bool SonyLeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == nullptr) + if (m_threadScoreboard == NULL) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -837,7 +837,7 @@ void SonyLeaderboardManager::FlushStats() {} void SonyLeaderboardManager::CancelOperation() { - m_readListener = nullptr; + m_readListener = NULL; m_eStatsState = eStatsState_Canceled; if (m_requestId != 0) @@ -980,7 +980,7 @@ void SonyLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = getComment(in)[i]; - unsigned char fivebits = strtol(ch, nullptr, 32) << 3; + unsigned char fivebits = strtol(ch, NULL, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -1041,7 +1041,7 @@ bool SonyLeaderboardManager::test_string(string testing) int ctx = createTransactionContext(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr); + int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index aef1ef9c..92ea8ad0 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -56,8 +56,8 @@ CGameNetworkManager::CGameNetworkManager() m_bFullSessionMessageOnNextSessionChange = false; #ifdef __ORBIS__ - m_pUpsell = nullptr; - m_pInviteInfo = nullptr; + m_pUpsell = NULL; + m_pInviteInfo = NULL; #endif } @@ -120,26 +120,26 @@ void CGameNetworkManager::DoWork() s_pPlatformNetworkManager->DoWork(); #ifdef __ORBIS__ - if (m_pUpsell != nullptr && m_pUpsell->hasResponse()) + if (m_pUpsell != NULL && m_pUpsell->hasResponse()) { int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex; m_iPlayerInvited = -1; delete m_pUpsell; - m_pUpsell = nullptr; + m_pUpsell = NULL; if (ProfileManager.HasPlayStationPlus(iPad_checking)) { this->GameInviteReceived(iPad_invited, m_pInviteInfo); // m_pInviteInfo deleted by GameInviteReceived. - m_pInviteInfo = nullptr; + m_pInviteInfo = NULL; } else { delete m_pInviteInfo; - m_pInviteInfo = nullptr; + m_pInviteInfo = NULL; } } #endif @@ -194,16 +194,16 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame ProfileManager.SetDeferredSignoutEnabled(true); #endif - int64_t seed = 0; - if (lpParameter != nullptr) + int64_t seed = 0; + if(lpParameter != NULL) { - NetworkGameInitData *param = static_cast(lpParameter); + NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; seed = param->seed; app.setLevelGenerationOptions(param->levelGen); - if(param->levelGen != nullptr) + if(param->levelGen != NULL) { - if(app.getLevelGenerationOptions() == nullptr) + if(app.getLevelGenerationOptions() == NULL) { app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n"); return false; @@ -248,10 +248,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -259,18 +259,18 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -312,7 +312,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame } else { - Socket::Initialise(nullptr); + Socket::Initialise(NULL); } #ifndef _XBOX @@ -358,27 +358,27 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame if( g_NetworkManager.IsHost() ) { - connection = new ClientConnection(minecraft, nullptr); + connection = new ClientConnection(minecraft, NULL); } else { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile()); - if(pNetworkPlayer == nullptr) + if(pNetworkPlayer == NULL) { MinecraftServer::HaltServer(); app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile()); - // If the player is nullptr here then something went wrong in the session setup, and continuing will end up in a crash + // If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash return false; } Socket *socket = pNetworkPlayer->GetSocket(); // Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data - if(socket == nullptr) + if(socket == NULL) { assert(false); MinecraftServer::HaltServer(); - // If the socket is nullptr here then something went wrong in the session setup, and continuing will end up in a crash + // If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash return false; } @@ -389,12 +389,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame { assert(false); delete connection; - connection = nullptr; + connection = NULL; MinecraftServer::HaltServer(); return false; } - connection->send(std::make_shared(minecraft->user->name)); + connection->send( shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); // Tick connection until we're ready to go. The stages involved in this are: // (1) Creating the ClientConnection sends a prelogin packet to the server @@ -453,7 +453,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Already have setup the primary pad if(idx == ProfileManager.GetPrimaryPad() ) continue; - if( GetLocalPlayerByUserIndex(idx) != nullptr && !ProfileManager.IsSignedIn(idx) ) + if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) ) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); Socket *socket = pNetworkPlayer->GetSocket(); @@ -467,7 +467,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // when joining any other way, so just because they are signed in doesn't mean they are in the session // 4J Stu - If they are in the session, then we should add them to the game. Otherwise we won't be able to add them later INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) continue; ClientConnection *connection; @@ -481,7 +481,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send(std::make_shared(convStringToWstring(ProfileManager.GetGamertag(idx)))); + connection->send( shared_ptr( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) ); createdConnections.push_back( connection ); @@ -744,7 +744,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession // Make sure that the Primary Pad is in by default localUsersMask |= GetLocalPlayerMask( ProfileManager.GetPrimaryPad() ); - return static_cast(s_pPlatformNetworkManager->JoinGame(searchResult, localUsersMask, primaryUserIndex)); + return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); } void CGameNetworkManager::CancelJoinGame(LPVOID lpParam) @@ -762,7 +762,7 @@ bool CGameNetworkManager::LeaveGame(bool bMigrateHost) int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad) { - INVITE_INFO * pInviteInfo = static_cast(pParam); + INVITE_INFO * pInviteInfo = (INVITE_INFO *)pParam; if(bContinue==true) { @@ -801,9 +801,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL); #elif defined(__ORBIS__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&noUGC,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL); #endif if(noUGC) @@ -823,7 +823,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() ); @@ -912,7 +912,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed ); } // If we failed before the server started, clear the game rules. Otherwise the server will clear it up. - if(MinecraftServer::getInstance() == nullptr) app.m_gameRules.unloadCurrentGameRules(); + if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules(); Tile::ReleaseThreadStorage(); return -1; } @@ -929,15 +929,15 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) int CGameNetworkManager::ServerThreadProc( void* lpParameter ) { - int64_t seed = 0; - if (lpParameter != nullptr) + int64_t seed = 0; + if(lpParameter != NULL) { - NetworkGameInitData *param = static_cast(lpParameter); + NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; seed = param->seed; app.SetGameHostOption(eGameHostOption_All,param->settings); // 4J Stu - If we are loading a DLC save that's separate from the texture pack, load - if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) + if( param->levelGen != NULL && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) { while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin())) { @@ -966,7 +966,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter ) IntCache::ReleaseThreadStorage(); Level::destroyLightingCache(); - if(lpParameter != nullptr) delete lpParameter; + if(lpParameter != NULL) delete lpParameter; return S_OK; } @@ -979,7 +979,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) Compression::UseDefaultThreadStorage(); //app.SetGameStarted(false); - UIScene_PauseMenu::_ExitWorld(nullptr); + UIScene_PauseMenu::_ExitWorld(NULL); while( g_NetworkManager.IsInSession() ) { @@ -988,7 +988,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) // Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in #if !defined(__PS3__) && !defined(__PSVITA__) - JoinFromInviteData *inviteData = static_cast(lpParam); + JoinFromInviteData *inviteData = (JoinFromInviteData *)lpParam; app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); #else if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) @@ -1216,14 +1216,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) #endif // Null the network player of all the server players that are local, to stop them being removed from the server when removed from the session - if( pServer != nullptr ) + if( pServer != NULL ) { PlayerList *players = pServer->getPlayers(); for(auto& servPlayer : players->players) { if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) { - servPlayer->connection->connection->getSocket()->setPlayer(nullptr); + servPlayer->connection->connection->getSocket()->setPlayer(NULL); } } } @@ -1259,7 +1259,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) char numLocalPlayers = 0; for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) { numLocalPlayers++; localUsersMask |= GetLocalPlayerMask(index); @@ -1277,11 +1277,11 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Restore the network player of all the server players that are local - if( pServer != nullptr ) + if( pServer != NULL ) { for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) { PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); @@ -1295,7 +1295,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Player might have a pending connection - if (pMinecraft->m_pendingLocalConnections[index] != nullptr) + if (pMinecraft->m_pendingLocalConnections[index] != NULL) { // Update the network player pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index)); @@ -1361,8 +1361,8 @@ void CGameNetworkManager::renderQueueMeter() #ifdef _XBOX int height = 720; - CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(nullptr, false); - CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(nullptr, false); + CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false); + CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false); Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000); @@ -1426,7 +1426,7 @@ void CGameNetworkManager::StateChange_AnyToStarting() { LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = nullptr; + loadingParams->lpParam = NULL; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1447,7 +1447,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i); - if(pNetworkPlayer != nullptr && ProfileManager.IsSignedIn( i ) ) + if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) ) { app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i ); Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex()); @@ -1482,12 +1482,12 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc { Minecraft *pMinecraft = Minecraft::GetInstance(); - Socket *socket = nullptr; + Socket *socket = NULL; shared_ptr mpPlayer = nullptr; int userIdx = pNetworkPlayer->GetUserIndex(); if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT) mpPlayer = pMinecraft->localplayers[userIdx]; - if( localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr) + if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) { // If we already have a MultiplayerLocalPlayer here then we are doing a session type change socket = mpPlayer->connection->getSocket(); @@ -1523,14 +1523,14 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc if( connection->createdOk ) { - connection->send(std::make_shared(pNetworkPlayer->GetOnlineName())); + connection->send( shared_ptr( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) ); pMinecraft->addPendingLocalConnection(idx, connection); } else { pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed ); delete connection; - connection = nullptr; + connection = NULL; } } } @@ -1540,10 +1540,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer ) { MinecraftServer *server = MinecraftServer::getInstance(); - if( server != nullptr ) + if( server != NULL ) { PlayerList *players = server->getPlayers(); - if( players != nullptr ) + if( players != NULL ) { players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId()); } @@ -1559,7 +1559,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) for (int iPad=0; iPadlocalplayers[idx] != nullptr) + if(Minecraft::GetInstance()->localplayers[idx] != NULL) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1609,7 +1609,7 @@ void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer ) { for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(Minecraft::GetInstance()->localplayers[idx] != nullptr) + if(Minecraft::GetInstance()->localplayers[idx] != NULL) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1632,7 +1632,7 @@ void CGameNetworkManager::WriteStats( INetworkPlayer *pNetworkPlayer ) void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo) { #ifdef __ORBIS__ - if (m_pUpsell != nullptr) + if (m_pUpsell != NULL) { delete pInviteInfo; return; @@ -1721,7 +1721,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * { // 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player) // 4J Stu - If we are not in a game, then bring in all players signed in - if(index==userIndex || pMinecraft->localplayers[index]!=nullptr ) + if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) { ++joiningUsers; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; @@ -1736,7 +1736,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * BOOL pccAllowed = TRUE; BOOL pccFriendsAllowed = TRUE; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); #else ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1781,14 +1781,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * uiIDA[0]=IDS_CONFIRM_OK; // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard - //StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + //StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY); } else { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1984,7 +1984,7 @@ const char *CGameNetworkManager::GetOnlineName(int playerIdx) void CGameNetworkManager::ServerReadyCreate(bool create) { - m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : nullptr ); + m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL ); } void CGameNetworkManager::ServerReady() @@ -2000,17 +2000,17 @@ void CGameNetworkManager::ServerReadyWait() void CGameNetworkManager::ServerReadyDestroy() { delete m_hServerReadyEvent; - m_hServerReadyEvent = nullptr; + m_hServerReadyEvent = NULL; } bool CGameNetworkManager::ServerReadyValid() { - return ( m_hServerReadyEvent != nullptr ); + return ( m_hServerReadyEvent != NULL ); } void CGameNetworkManager::ServerStoppedCreate(bool create) { - m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : nullptr ); + m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL ); } void CGameNetworkManager::ServerStopped() @@ -2051,12 +2051,12 @@ void CGameNetworkManager::ServerStoppedWait() void CGameNetworkManager::ServerStoppedDestroy() { delete m_hServerStoppedEvent; - m_hServerStoppedEvent = nullptr; + m_hServerStoppedEvent = NULL; } bool CGameNetworkManager::ServerStoppedValid() { - return ( m_hServerStoppedEvent != nullptr ); + return ( m_hServerStoppedEvent != NULL ); } int CGameNetworkManager::GetJoiningReadyPercentage() diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 3357b3cd..15c7f0b0 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -108,7 +108,7 @@ public: static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface bool LeaveGame(bool bMigrateHost); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); - void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); void SendInviteGUI(int iPad); void ResetLeavingGame(); @@ -137,17 +137,17 @@ public: // Events - void ServerReadyCreate(bool create); // Create the signal (or set to nullptr) + void ServerReadyCreate(bool create); // Create the signal (or set to NULL) void ServerReady(); // Signal that we are ready void ServerReadyWait(); // Wait for the signal void ServerReadyDestroy(); // Destroy signal - bool ServerReadyValid(); // Is non-nullptr + bool ServerReadyValid(); // Is non-NULL void ServerStoppedCreate(bool create); // Create the signal void ServerStopped(); // Signal that we are ready - void ServerStoppedWait(); // Wait for the signal - void ServerStoppedDestroy(); // Destroy signal - bool ServerStoppedValid(); // Is non-nullptr + void ServerStoppedWait(); // Wait for the signal + void ServerStoppedDestroy(); // Destroy signal + bool ServerStoppedValid(); // Is non-NULL #ifdef __PSVITA__ static bool usingAdhocMode(); diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h index 3ed0f888..31c415a7 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h @@ -93,7 +93,7 @@ private: public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr) = 0; + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0; private: virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0; diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 03be8ec9..970dfd24 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -26,7 +26,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerXbox *networkPlayer = static_cast(addNetworkPlayer(pQNetPlayer)); + NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); if( pQNetPlayer->IsLocal() ) { @@ -103,7 +103,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -112,7 +112,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -127,11 +127,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag()); INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer); - if (networkPlayer == nullptr) + if (networkPlayer == NULL) return; Socket* socket = networkPlayer->GetSocket(); - if (socket != nullptr) + if (socket != NULL) { if (m_pIQNet->IsHost()) g_NetworkManager.CloseConnection(networkPlayer); @@ -146,7 +146,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (playerChangedCallback[idx] != nullptr) + if (playerChangedCallback[idx] != NULL) playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true); } @@ -162,7 +162,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -173,8 +173,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -182,10 +182,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; + m_pSearchResults[i] = NULL; + m_pQoSResult[i] = NULL; + m_pCurrentSearchResults[i] = NULL; + m_pCurrentQoSResult[i] = NULL; m_currentSearchResultsCount[i] = 0; } @@ -231,7 +231,7 @@ void CPlatformNetworkManagerStub::DoWork() while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId)) { IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId); - if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId) + if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId) { NotifyPlayerLeaving(qnetPlayer); qnetPlayer->m_smallId = 0; @@ -386,7 +386,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, #ifdef _WINDOWS64 int port = WIN64_NET_DEFAULT_PORT; - const char* bindIp = nullptr; + const char* bindIp = NULL; if (g_Win64DedicatedServer) { if (g_Win64DedicatedServerPort > 0) @@ -419,7 +419,7 @@ bool CPlatformNetworkManagerStub::_StartGame() int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex) { #ifdef _WINDOWS64 - if (searchResult == nullptr) + if (searchResult == NULL) return CGameNetworkManager::JOINGAME_FAIL_GENERAL; const char* hostIP = searchResult->data.hostIP; @@ -493,8 +493,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -514,7 +514,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() if (IQNet::m_player[i].m_isRemote) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]); - if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr) + if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL) { Socket::addIncomingSocket(pNetworkPlayer->GetSocket()); } @@ -524,14 +524,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() return true; } -void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { // DWORD playerCount = m_pIQNet->GetPlayerCount(); // // if( this->m_bLeavingGame ) // return; // -// if( GetHostPlayer() == nullptr ) +// if( GetHostPlayer() == NULL ) // return; // // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -551,13 +551,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } @@ -568,18 +568,18 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast(lpParam); + INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -669,7 +669,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -685,7 +685,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -713,7 +713,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() for(unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer *pQNetPlayer = static_cast(GetPlayerByIndex(i))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -728,7 +728,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() void CPlatformNetworkManagerStub::TickSearch() { #ifdef _WINDOWS64 - if (m_SessionsUpdatedCallback == nullptr) + if (m_SessionsUpdatedCallback == NULL) return; static DWORD lastSearchTime = 0; @@ -757,7 +757,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(lanSessions[i].hostName); info->displayLabel = new wchar_t[nameLen + 1]; wcscpy_s(info->displayLabel, nameLen + 1, lanSessions[i].hostName); - info->displayLabelLength = static_cast(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.netVersion = lanSessions[i].netVersion; @@ -772,8 +772,7 @@ void CPlatformNetworkManagerStub::SearchForGames() info->data.playerCount = lanSessions[i].playerCount; info->data.maxPlayers = lanSessions[i].maxPlayers; - info->sessionId = static_cast(inet_addr(lanSessions[i].hostIP)) | - static_cast(lanSessions[i].hostPort) << 32; + info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32)); friendsSessions[0].push_back(info); } @@ -813,7 +812,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(label); info->displayLabel = new wchar_t[nameLen+1]; wcscpy_s(info->displayLabel, nameLen + 1, label); - info->displayLabelLength = static_cast(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.isReadyToJoin = true; info->data.isJoinable = true; @@ -827,9 +826,9 @@ void CPlatformNetworkManagerStub::SearchForGames() std::fclose(file); } - m_searchResultsCount[0] = static_cast(friendsSessions[0].size()); + m_searchResultsCount[0] = (int)friendsSessions[0].size(); - if (m_SessionsUpdatedCallback != nullptr) + if (m_SessionsUpdatedCallback != NULL) m_SessionsUpdatedCallback(m_pSearchParam); #endif } @@ -877,7 +876,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; + m_pSearchResults[i] = NULL; } } @@ -904,7 +903,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index 4a3f4068..261639f2 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -81,7 +81,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index 7ae53c28..ce6365bc 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -113,7 +113,7 @@ public: FriendSessionInfo() { - displayLabel = nullptr; + displayLabel = NULL; displayLabelLength = 0; displayLabelViewableStartIndex = 0; hasPartyMember = false; @@ -121,7 +121,7 @@ public: ~FriendSessionInfo() { - if (displayLabel != nullptr) + if (displayLabel != NULL) delete displayLabel; } }; diff --git a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp index a1cc4038..21cd82aa 100644 --- a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp @@ -4,7 +4,7 @@ NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer) { m_sqrPlayer = qnetPlayer; - m_pSocket = nullptr; + m_pSocket = NULL; m_lastChunkPacketTime = 0; } @@ -16,12 +16,12 @@ unsigned char NetworkPlayerSony::GetSmallId() void NetworkPlayerSony::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority, bool ack) { // TODO - handle priority - m_sqrPlayer->SendData( static_cast(player)->m_sqrPlayer, pvData, dataSize, ack ); + m_sqrPlayer->SendData( ((NetworkPlayerSony *)player)->m_sqrPlayer, pvData, dataSize, ack ); } bool NetworkPlayerSony::IsSameSystem(INetworkPlayer *player) { - return m_sqrPlayer->IsSameSystem(static_cast(player)->m_sqrPlayer); + return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony *)player)->m_sqrPlayer); } int NetworkPlayerSony::GetOutstandingAckCount() @@ -133,5 +133,5 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms() } int64_t currentTime = System::currentTimeMillis(); - return static_cast(currentTime - m_lastChunkPacketTime); + return (int)( currentTime - m_lastChunkPacketTime ); } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp index 107101f4..a9799d26 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -123,7 +123,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize, false); } else @@ -132,7 +132,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize); } } @@ -226,7 +226,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -235,7 +235,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -258,7 +258,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -274,19 +274,19 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( nullptr ); + networkPlayer->SetSocket( NULL ); } if( m_pSQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pSQRPlayer) ) { - SQRNetworkPlayer *pNewSQRPrimaryPlayer = nullptr; + SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL; for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i ) { SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i ); - if ( pSQRPlayer2 != nullptr && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) + if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) { pNewSQRPrimaryPlayer = pSQRPlayer2; break; @@ -298,7 +298,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay m_machineSQRPrimaryPlayers.erase( it ); } - if( pNewSQRPrimaryPlayer != nullptr ) + if( pNewSQRPrimaryPlayer != NULL ) m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer ); } @@ -311,7 +311,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -320,7 +320,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -391,7 +391,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) { // we're signed into the PSN, but we won't be online yet, force a sign-in online here - m_pSQRNet_Vita->AttemptPSNSignIn(nullptr, nullptr); + m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL); } @@ -402,7 +402,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -413,11 +413,11 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; m_searchResultsCount = 0; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; m_lastSearchStartTime = 0; @@ -622,11 +622,11 @@ bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex ) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // We can't remove the player from qnet until we have stopped using it to communicate C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); @@ -702,11 +702,11 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE); @@ -718,13 +718,13 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) // 4J Stu - Clear our reference to this socket pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); } delete socket; } else { - //printf("Socket is already nullptr\n"); + //printf("Socket is already NULL\n"); } } @@ -878,8 +878,8 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -917,7 +917,7 @@ bool CPlatformNetworkManagerSony::_RunNetworkGame() // Note that this does less than the xbox equivalent as we have HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager when players are added/removed etc., so this // call is only used to update the game host settings & then do the final push out of the data. -void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { if( this->m_bLeavingGame ) return; @@ -934,7 +934,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN // If this is called With a pNetworkPlayerLeaving, then the call has ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, so we don't need to sync each change // as that function does a sync at the end of all changes. - if( pNetworkPlayerLeaving == nullptr ) + if( pNetworkPlayerLeaving == NULL ) { m_pSQRNet->UpdateExternalRoomData(); } @@ -946,14 +946,14 @@ int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpP Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -1030,7 +1030,7 @@ void CPlatformNetworkManagerSony::SystemFlagReset() void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -1046,7 +1046,7 @@ void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -1064,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerSony::GatherStats() { #if 0 - return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) ) - + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) ); + return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); #else return L""; #endif @@ -1111,7 +1111,7 @@ void CPlatformNetworkManagerSony::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -1126,7 +1126,7 @@ void CPlatformNetworkManagerSony::TickSearch() if( usingAdhocMode()) searchDelay = 5000; #endif - if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) + if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) { if( m_pSQRNet->FriendRoomManagerSearch() ) { @@ -1189,7 +1189,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = nullptr; + FriendSessionInfo *sessionInfo = NULL; auto itFriendSession = friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1231,7 +1231,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session sessionInfo->data.isJoinable) { foundSessionInfo->data = sessionInfo->data; - if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel; + if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel; foundSessionInfo->displayLabel = new wchar_t[100]; memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) ); foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength; @@ -1267,7 +1267,7 @@ void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete m_pSearchResults; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; } INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) @@ -1293,7 +1293,7 @@ void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlay INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) { - return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : nullptr; + return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h index 9131e897..258acd83 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -102,7 +102,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp index 7561c17d..f23a0a63 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp @@ -16,7 +16,7 @@ int SQRNetworkManager::GetSendQueueSizeBytes() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { queueSize += player->GetTotalSendQueueBytes(); } @@ -31,7 +31,7 @@ int SQRNetworkManager::GetSendQueueSizeMessages() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { queueSize += player->GetTotalSendQueueMessages(); } diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp index 4ed27824..79c9835b 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp @@ -279,12 +279,12 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack { // no data, just the flag assert(dataSize == 0); - assert(data == nullptr); + assert(data == NULL); int dataSize = dataRemaining; if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD; - sendBlock.start = nullptr; - sendBlock.end = nullptr; - sendBlock.current = nullptr; + sendBlock.start = NULL; + sendBlock.end = NULL; + sendBlock.current = NULL; sendBlock.ack = ackFlags; m_sendQueue.push(sendBlock); } @@ -387,9 +387,9 @@ int SQRNetworkPlayer::ReadDataPacket(void* data, int dataSize) unsigned char* packetData = new unsigned char[packetSize]; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); + int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); + int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -426,9 +426,9 @@ void SQRNetworkPlayer::ReadAck() { DataPacketHeader header; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); + int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); + int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -459,7 +459,7 @@ void SQRNetworkPlayer::ReadAck() void SQRNetworkPlayer::WriteAck() { - SendInternal(nullptr, 0, e_flag_AckReturning); + SendInternal(NULL, 0, e_flag_AckReturning); } int SQRNetworkPlayer::GetOutstandingAckCount() diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h index c67069d1..a72e5a41 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h @@ -63,7 +63,7 @@ class SQRNetworkPlayer public: DataPacketHeader() : m_dataSize(0), m_ackFlags(e_flag_AckUnknown) {} DataPacketHeader(int dataSize, AckFlags ackFlags) : m_dataSize(dataSize), m_ackFlags(ackFlags) { } - AckFlags GetAckFlags() { return static_cast(m_ackFlags);} + AckFlags GetAckFlags() { return (AckFlags)m_ackFlags;} int GetDataSize() { return m_dataSize; } }; diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp index 47beb63c..02fc73cf 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp @@ -29,8 +29,8 @@ static SceRemoteStorageStatus statParams; // void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) // { // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); -// -// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr); +// +// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); // } @@ -39,13 +39,13 @@ static SceRemoteStorageStatus statParams; void SonyRemoteStorage::SetRetrievedDescData() { DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription; - ESavePlatform testPlatform = static_cast(MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3])); + ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]); if(testPlatform == SAVE_FILE_PLATFORM_NONE) { // new version of the descData DescriptionData_V2* pDescData2 = (DescriptionData_V2*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = GetU32FromHexBytes(pDescData2->m_descDataVersion); - m_retrievedDescData.m_savePlatform = static_cast(MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3])); + m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData2->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData2->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData2->m_texturePack); @@ -58,7 +58,7 @@ void SonyRemoteStorage::SetRetrievedDescData() // old version,copy the data across to the new version DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription; m_retrievedDescData.m_descDataVersion = 1; - m_retrievedDescData.m_savePlatform = static_cast(MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3])); + m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]); m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData->m_seed); m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData->m_hostOptions); m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData->m_texturePack); @@ -73,7 +73,7 @@ void SonyRemoteStorage::SetRetrievedDescData() void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code); if(error_code == 0) { @@ -99,7 +99,7 @@ void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int static void getSaveInfoInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; if(error_code != 0) { app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code); @@ -143,7 +143,7 @@ bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb, static void setSaveDataInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - SonyRemoteStorage* pRemoteStorage = static_cast(lpParam); + SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam; if(error_code != 0) { app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); @@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename() const char* SonyRemoteStorage::getSaveNameUTF8() { if(m_getInfoStatus != e_infoFound) - return nullptr; + return NULL; return m_retrievedDescData.m_saveNameUTF8; } @@ -244,7 +244,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - SonyRemoteStorage *pClass= static_cast(lpParam); + SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam; if(pClass->m_bAborting) { @@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum } else { - app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); - pClass->m_thumbnailData = nullptr; + app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); + pClass->m_thumbnailData = NULL; pClass->m_thumbnailDataSize = 0; } - if(pClass->m_SetDataThread != nullptr) + if(pClass->m_SetDataThread != NULL) delete pClass->m_SetDataThread; pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread"); @@ -277,7 +277,7 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum int SonyRemoteStorage::setDataThread(void* lpParam) { - SonyRemoteStorage* pClass = static_cast(lpParam); + SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; pClass->m_startTime = System::currentTimeMillis(); pClass->setDataInternal(); return 0; @@ -322,8 +322,8 @@ int SonyRemoteStorage::getDataProgress() int64_t time = System::currentTimeMillis(); int elapsedSecs = (time - m_startTime) / 1000; - float estimatedTransfered = static_cast(elapsedSecs * transferRatePerSec); - int progVal = m_dataProgress + (estimatedTransfered / static_cast(totalSize)) * 100; + float estimatedTransfered = float(elapsedSecs * transferRatePerSec); + int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; if(progVal > nextChunk) return nextChunk; if(progVal > 99) @@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown() app.DebugPrintf("Term request done \n"); m_bInitialised = false; free(m_memPoolBuffer); - m_memPoolBuffer = nullptr; + m_memPoolBuffer = NULL; return true; } else @@ -406,11 +406,10 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData) unsigned int uiHostOptions; bool bHostOptionsRead; DWORD uiTexturePack; - char seed[22]; - app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize, reinterpret_cast(seed), - uiHostOptions, bHostOptionsRead, uiTexturePack); + char seed[22]; + app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed, nullptr,10); + int64_t iSeed = strtoll(seed,NULL,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); @@ -449,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed, nullptr,10); + int64_t iSeed = strtoll(seed,NULL,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h index 5740f78d..89ecc066 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h @@ -140,7 +140,7 @@ public: static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); static int setDataThread(void* lpParam); - SonyRemoteStorage() : m_getInfoStatus(e_noInfoFound), m_bInitialised(false),m_memPoolBuffer(nullptr) {} + SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} protected: const char* getRemoteSaveFilename(); diff --git a/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp b/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp index 5561e2a1..4b04b19c 100644 --- a/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp +++ b/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp @@ -148,7 +148,7 @@ This should be tracked independently of saved games (restoring a save should not */ INT CTelemetryManager::GetSecondsSinceInitialize() { - return static_cast(app.getAppTime() - m_initialiseTime); + return (INT)(app.getAppTime() - m_initialiseTime); } /* @@ -165,21 +165,21 @@ INT CTelemetryManager::GetMode(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr ) + if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL ) { GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType(); if (gameType->isSurvival()) { - mode = static_cast(eTelem_ModeId_Survival); + mode = (INT)eTelem_ModeId_Survival; } else if (gameType->isCreative()) { - mode = static_cast(eTelem_ModeId_Creative); + mode = (INT)eTelem_ModeId_Creative; } else { - mode = static_cast(eTelem_ModeId_Undefined); + mode = (INT)eTelem_ModeId_Undefined; } } return mode; @@ -198,11 +198,11 @@ INT CTelemetryManager::GetSubMode(DWORD dwUserId) if(Minecraft::GetInstance()->isTutorial()) { - subMode = static_cast(eTelem_SubModeId_Tutorial); + subMode = (INT)eTelem_SubModeId_Tutorial; } else { - subMode = static_cast(eTelem_SubModeId_Normal); + subMode = (INT)eTelem_SubModeId_Normal; } return subMode; @@ -220,7 +220,7 @@ INT CTelemetryManager::GetLevelId(DWORD dwUserId) { INT levelId = (INT)eTelem_LevelId_Undefined; - levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); + levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel; return levelId; } @@ -237,18 +237,18 @@ INT CTelemetryManager::GetSubLevelId(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[dwUserId] != nullptr) + if(pMinecraft->localplayers[dwUserId] != NULL) { switch(pMinecraft->localplayers[dwUserId]->dimension) { case 0: - subLevelId = static_cast(eTelem_SubLevelId_Overworld); + subLevelId = (INT)eTelem_SubLevelId_Overworld; break; case -1: - subLevelId = static_cast(eTelem_SubLevelId_Nether); + subLevelId = (INT)eTelem_SubLevelId_Nether; break; case 1: - subLevelId = static_cast(eTelem_SubLevelId_End); + subLevelId = (INT)eTelem_SubLevelId_End; break; }; } @@ -272,7 +272,7 @@ Helps differentiate level attempts when a play plays the same mode/level - espec */ INT CTelemetryManager::GetLevelInstanceID() { - return static_cast(m_levelInstanceID); + return (INT)m_levelInstanceID; } /* @@ -314,19 +314,19 @@ INT CTelemetryManager::GetSingleOrMultiplayer() if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Single_Player); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player; } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local; } else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live; } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live; } return singleOrMultiplayer; @@ -343,16 +343,16 @@ INT CTelemetryManager::GetDifficultyLevel(INT diff) switch(diff) { case 0: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); + difficultyLevel = (INT)eSen_DifficultyLevel_Easiest; break; case 1: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); + difficultyLevel = (INT)eSen_DifficultyLevel_Easier; break; case 2: - difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); + difficultyLevel = (INT)eSen_DifficultyLevel_Normal; break; case 3: - difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); + difficultyLevel = (INT)eSen_DifficultyLevel_Harder; break; } @@ -372,11 +372,11 @@ INT CTelemetryManager::GetLicense() if(ProfileManager.IsFullVersion()) { - license = static_cast(eSen_License_Full_Purchased_Title); + license = (INT)eSen_License_Full_Purchased_Title; } else { - license = static_cast(eSen_License_Trial_or_Demo); + license = (INT)eSen_License_Trial_or_Demo; } return license; } @@ -411,15 +411,15 @@ INT CTelemetryManager::GetAudioSettings(DWORD dwUserId) if(volume == 0) { - audioSettings = static_cast(eSen_AudioSettings_Off); + audioSettings = (INT)eSen_AudioSettings_Off; } else if(volume == DEFAULT_VOLUME_LEVEL) { - audioSettings = static_cast(eSen_AudioSettings_On_Default); + audioSettings = (INT)eSen_AudioSettings_On_Default; } else { - audioSettings = static_cast(eSen_AudioSettings_On_CustomSetting); + audioSettings = (INT)eSen_AudioSettings_On_CustomSetting; } } return audioSettings; diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp index 06e73d6f..f01db84e 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp @@ -61,9 +61,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) + if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send(std::make_shared(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); + player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } @@ -89,7 +89,7 @@ void ChangeStateConstraint::tick(int iPad) if(m_changeGameMode) { - if(minecraft->localgameModes[iPad] != nullptr) + if(minecraft->localgameModes[iPad] != NULL) { m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL; @@ -102,9 +102,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) + if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send(std::make_shared(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); + player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } @@ -126,9 +126,9 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) + if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) { - player->connection->send(std::make_shared(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs)); + player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } } } diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h index e5f2d74b..2156870d 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h @@ -30,7 +30,7 @@ private: public: virtual ConstraintType getType() { return e_ConstraintChangeState; } - ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = nullptr ); + ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = NULL ); ~ChangeStateConstraint(); virtual void tick(int iPad); diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index 023e4b22..1ea34ace 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -8,12 +8,11 @@ #include "ChoiceTask.h" #include "..\..\..\Minecraft.World\Material.h" #include "..\..\Windows64\KeyboardMouseInput.h" -#include "Common/UI/UI.h" ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, - eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) + int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, + eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp index f2fb8c12..43b2f7f3 100644 --- a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp +++ b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp @@ -3,7 +3,7 @@ #include "CompleteUsingItemTask.h" CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL) { m_iValidItemsA= new int [itemIdsLength]; for(int i=0;i *inConstraints /*= nullptr*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= NULL*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), @@ -17,7 +17,7 @@ CraftTask::CraftTask( int itemId, int auxValue, int quantity, } CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= nullptr*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= NULL*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), diff --git a/Minecraft.Client/Common/Tutorial/CraftTask.h b/Minecraft.Client/Common/Tutorial/CraftTask.h index 4246711e..1496f07a 100644 --- a/Minecraft.Client/Common/Tutorial/CraftTask.h +++ b/Minecraft.Client/Common/Tutorial/CraftTask.h @@ -5,10 +5,10 @@ class CraftTask : public TutorialTask { public: CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); ~CraftTask(); diff --git a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp index 428bbe3c..86dbe500 100644 --- a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp @@ -22,7 +22,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri int DiggerItemHint::startDestroyBlock(shared_ptr item, Tile *tile) { - if(item != nullptr) + if(item != NULL) { bool itemFound = false; for(unsigned int i=0;i item, Tile *tile) int DiggerItemHint::attack(shared_ptr item, shared_ptr entity) { - if(item != nullptr) + if(item != NULL) { bool itemFound = false; for(unsigned int i=0;iid, this, IDS_TUTORIAL_TASK_PLACE_DOOR) ); addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) ); - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); - if(area != nullptr) + if(area != NULL) { vector *areaConstraints = new vector(); areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -283,10 +283,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * MINECART * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea"); - if(area != nullptr) + if(area != NULL) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Minecart, IDS_TUTORIAL_HINT_MINECART, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -298,10 +298,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BOAT * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea"); - if(area != nullptr) + if(area != NULL) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Boat, IDS_TUTORIAL_HINT_BOAT, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -313,10 +313,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FISHING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea"); - if(area != nullptr) + if(area != NULL) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Fishing, IDS_TUTORIAL_HINT_FISHING, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -328,10 +328,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - SELF-REPAIRING BRIDGE * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea"); - if(area != nullptr) + if(area != NULL) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_None, IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1, true ) ); } @@ -343,10 +343,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - PISTON AND REDSTONE CIRCUITS * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Redstone_And_Piston, redstoneAndPistonStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -368,10 +368,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PORTAL * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Portal, portalStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -391,10 +391,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * CREATIVE * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_CreativeMode, creativeStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1,true,true,GameType::CREATIVE) ); @@ -411,7 +411,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this ); AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); - if(exitArea != nullptr) + if(exitArea != NULL) { vector *creativeExitAreaConstraints = new vector(); creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) ); @@ -434,10 +434,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREWING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -467,10 +467,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENCHANTING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enchanting, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -492,10 +492,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ANVIL * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -517,10 +517,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * TRADING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -541,10 +541,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FIREWORKS * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -563,10 +563,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BEACON * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -585,10 +585,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * HOPPER * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -610,10 +610,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENDERCHEST * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enderchests, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -632,10 +632,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FARMING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -661,10 +661,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREEDING * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -689,10 +689,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * SNOW AND IRON GOLEM * */ - if(app.getGameRuleDefinitions() != nullptr) + if(app.getGameRuleDefinitions() != NULL) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea"); - if(area != nullptr) + if(area != NULL) { eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Golem, golemStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); diff --git a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp index f1357c6c..54985d21 100644 --- a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp +++ b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp @@ -3,7 +3,7 @@ #include "FullTutorialActiveTask.h" FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/) - : TutorialTask( tutorial, -1, false, nullptr, false, false, false ) + : TutorialTask( tutorial, -1, false, NULL, false, false, false ) { m_completeAction = completeAction; } diff --git a/Minecraft.Client/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Common/Tutorial/InfoTask.cpp index 2e481804..6a78ed92 100644 --- a/Minecraft.Client/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Common/Tutorial/InfoTask.cpp @@ -8,11 +8,10 @@ #include "InfoTask.h" #include "..\..\..\Minecraft.World\Material.h" #include "..\..\Windows64\KeyboardMouseInput.h" -#include "Common/UI/UI.h" InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, - int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) + int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) + : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/PickupTask.h b/Minecraft.Client/Common/Tutorial/PickupTask.h index 9f2d2426..68e1d479 100644 --- a/Minecraft.Client/Common/Tutorial/PickupTask.h +++ b/Minecraft.Client/Common/Tutorial/PickupTask.h @@ -8,7 +8,7 @@ class PickupTask : public TutorialTask { public: PickupTask( int itemId, unsigned int quantity, int auxValue, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_itemId( itemId), diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp index ddf15a55..0e3b3e37 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp @@ -11,7 +11,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask() void ProcedureCompoundTask::AddTask(TutorialTask *task) { - if(task != nullptr) + if(task != NULL) { m_taskSequence.push_back(task); } diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h index 0a5b7eee..36b32798 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h @@ -8,7 +8,7 @@ class ProcedureCompoundTask : public TutorialTask { public: ProcedureCompoundTask(Tutorial *tutorial ) - : TutorialTask(tutorial, -1, false, nullptr, false, true, false ) + : TutorialTask(tutorial, -1, false, NULL, false, true, false ) {} ~ProcedureCompoundTask(); diff --git a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h index 9baea5a5..b96e1bc0 100644 --- a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h +++ b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h @@ -17,7 +17,7 @@ private: EProgressFlagType m_type; public: ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) : - TutorialTask(tutorial, -1, false, nullptr ), + TutorialTask(tutorial, -1, false, NULL ), flags( flags ), m_mask( mask ), m_type( type ) {} diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp b/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp index 29b77645..29fe592d 100644 --- a/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp +++ b/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp @@ -23,7 +23,7 @@ bool RideEntityTask::isCompleted() void RideEntityTask::onRideEntity(shared_ptr entity) { - if (entity->instanceof(static_cast(m_eType))) + if (entity->instanceof((eINSTANCEOF) m_eType)) { bIsCompleted = true; } diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.h b/Minecraft.Client/Common/Tutorial/RideEntityTask.h index 749b187f..d9b6d41e 100644 --- a/Minecraft.Client/Common/Tutorial/RideEntityTask.h +++ b/Minecraft.Client/Common/Tutorial/RideEntityTask.h @@ -13,7 +13,7 @@ protected: public: RideEntityTask(const int eTYPE, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = nullptr, + bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); diff --git a/Minecraft.Client/Common/Tutorial/StatTask.cpp b/Minecraft.Client/Common/Tutorial/StatTask.cpp index c2dc82aa..5f8b215e 100644 --- a/Minecraft.Client/Common/Tutorial/StatTask.cpp +++ b/Minecraft.Client/Common/Tutorial/StatTask.cpp @@ -6,7 +6,7 @@ #include "StatTask.h" StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr ) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL ) { this->stat = stat; @@ -20,6 +20,6 @@ bool StatTask::isCompleted() return true; Minecraft *minecraft = Minecraft::GetInstance(); - bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= static_cast(targetValue); + bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= (unsigned int)targetValue; return bIsCompleted; } \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/StateChangeTask.h b/Minecraft.Client/Common/Tutorial/StateChangeTask.h index ab34d35d..fb9e6396 100644 --- a/Minecraft.Client/Common/Tutorial/StateChangeTask.h +++ b/Minecraft.Client/Common/Tutorial/StateChangeTask.h @@ -9,7 +9,7 @@ private: eTutorial_State m_state; public: StateChangeTask(eTutorial_State state, - Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector *inConstraints = nullptr, + Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_state( state ) diff --git a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp index 3a318488..a1a5c37a 100644 --- a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp @@ -19,7 +19,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u bool TakeItemHint::onTake(shared_ptr item) { - if(item != nullptr) + if(item != NULL) { bool itemFound = false; for(unsigned int i=0;i Tutorial::s_completableTasks; @@ -32,7 +31,7 @@ int Tutorial::m_iTutorialFreezeTimeValue = 8000; bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other) { - if(other == nullptr) return false; + if(other == NULL) return false; bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0); bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0); @@ -361,12 +360,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_hintDisplayed = false; m_freezeTime = false; m_timeFrozen = false; - m_UIScene = nullptr; + m_UIScene = NULL; m_allowShow = true; m_bHasTickedOnce = false; m_firstTickTime = 0; - m_lastMessage = nullptr; + m_lastMessage = NULL; lastMessageTime = 0; m_iTaskReminders = 0; @@ -375,13 +374,13 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_CurrentState = e_Tutorial_State_Gameplay; m_hasStateChanged = false; #ifdef _XBOX - m_hTutorialScene=nullptr; + m_hTutorialScene=NULL; #endif for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { - currentTask[i] = nullptr; - currentFailedConstraint[i] = nullptr; + currentTask[i] = NULL; + currentFailedConstraint[i] = NULL; } // DEFAULT TASKS THAT ALL TUTORIALS SHARE @@ -1013,7 +1012,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); // 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial. - if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr, false, false, false) ); + if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, false, false, false) ); else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); @@ -1164,8 +1163,8 @@ Tutorial::~Tutorial() delete it; } - currentTask[i] = nullptr; - currentFailedConstraint[i] = nullptr; + currentTask[i] = NULL; + currentFailedConstraint[i] = NULL; } } @@ -1174,7 +1173,7 @@ void Tutorial::debugResetPlayerSavedProgress(int iPad) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(iPad); #else - GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(iPad)); + GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(iPad); #endif ZeroMemory( pGameSettings->ucTutorialCompletion, TUTORIAL_PROFILE_STORAGE_BYTES ); pGameSettings->uiSpecialTutorialBitmask = 0; @@ -1203,7 +1202,7 @@ void Tutorial::setCompleted( int completableId ) #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); #else - GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(m_iPad)); + GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); @@ -1236,7 +1235,7 @@ bool Tutorial::getCompleted( int completableId ) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad); #else - GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(m_iPad)); + GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); @@ -1363,7 +1362,7 @@ void Tutorial::tick() if(!m_allowShow) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1413,7 +1412,7 @@ void Tutorial::tick() if(ui.IsPauseMenuDisplayed( m_iPad ) ) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1461,12 +1460,12 @@ void Tutorial::tick() // Check constraints // Only need to update these if we aren't already failing something - if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == nullptr || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) + if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) { - if( currentFailedConstraint[m_CurrentState] != nullptr && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) + if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) { constraintChanged = true; - currentFailedConstraint[m_CurrentState] = nullptr; + currentFailedConstraint[m_CurrentState] = NULL; } for (auto& constraint : constraints[m_CurrentState]) { @@ -1478,7 +1477,7 @@ void Tutorial::tick() } } - if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == nullptr ) + if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL ) { // Update tasks bool isCurrentTask = true; @@ -1497,7 +1496,7 @@ void Tutorial::tick() eTutorial_CompletionAction compAction = task->getCompletionAction(); it = activeTasks[m_CurrentState].erase( it ); delete task; - task = nullptr; + task = NULL; if( activeTasks[m_CurrentState].size() > 0 ) { @@ -1553,12 +1552,12 @@ void Tutorial::tick() { setStateCompleted( m_CurrentState ); - currentTask[m_CurrentState] = nullptr; + currentTask[m_CurrentState] = NULL; } taskChanged = true; // If we can complete this early, check if we can complete it right now - if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isPreCompletionEnabled() ) + if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() ) { isCurrentTask = true; } @@ -1567,7 +1566,7 @@ void Tutorial::tick() { ++it; } - if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) + if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) { task->setShownForMinimumTime(); @@ -1588,7 +1587,7 @@ void Tutorial::tick() } } - if( currentTask[m_CurrentState] == nullptr && activeTasks[m_CurrentState].size() > 0 ) + if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 ) { currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; currentTask[m_CurrentState]->setAsCurrentTask(); @@ -1617,17 +1616,17 @@ void Tutorial::tick() } if( constraintChanged || taskChanged || m_hasStateChanged || - (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_lastMessage == nullptr || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) + (currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) ) { - if( currentFailedConstraint[m_CurrentState] != nullptr ) + if( currentFailedConstraint[m_CurrentState] != NULL ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId(); message->m_allowFade = false; setMessage( message ); } - else if( currentTask[m_CurrentState] != nullptr ) + else if( currentTask[m_CurrentState] != NULL ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); @@ -1638,7 +1637,7 @@ void Tutorial::tick() } else { - setMessage( nullptr ); + setMessage( NULL ); } } @@ -1647,7 +1646,7 @@ void Tutorial::tick() m_hintDisplayed = false; } - if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) + if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) { // Reminder PopupMessageDetails *message = new PopupMessageDetails(); @@ -1672,7 +1671,7 @@ void Tutorial::tick() bool Tutorial::setMessage(PopupMessageDetails *message) { - if(message != nullptr && !message->m_forceDisplay && + if(message != NULL && !message->m_forceDisplay && m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) ) @@ -1682,7 +1681,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) return false; } - if(message != nullptr && (message->m_messageId > 0 || !message->m_messageString.empty()) ) + if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) ) { m_lastMessageState = m_CurrentState; @@ -1696,7 +1695,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else { auto it = messages.find(message->m_messageId); - if( it != messages.end() && it->second != nullptr ) + if( it != messages.end() && it->second != NULL ) { TutorialMessage *messageString = it->second; text = wstring( messageString->getMessageForDisplay() ); @@ -1726,7 +1725,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else if(message->m_promptId >= 0) { auto it = messages.find(message->m_promptId); - if(it != messages.end() && it->second != nullptr) + if(it != messages.end() && it->second != NULL) { TutorialMessage *prompt = it->second; text.append( prompt->getMessageForDisplay() ); @@ -1755,7 +1754,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } } - else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) + else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) { // This should cause the popup to dissappear TutorialPopupInfo popupInfo; @@ -1764,7 +1763,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } - if(m_lastMessage != nullptr) delete m_lastMessage; + if(m_lastMessage != NULL) delete m_lastMessage; m_lastMessage = message; return true; @@ -1778,7 +1777,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) bool messageShown = false; DWORD time = GetTickCount(); - if(message != nullptr && (message->m_forceDisplay || hintsOn) && + if(message != NULL && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ( (m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) || @@ -1793,7 +1792,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) { m_lastHintDisplayedTime = time; m_hintDisplayed = true; - if(hint!=nullptr) setHintCompleted( hint ); + if(hint!=NULL) setHintCompleted( hint ); } } return messageShown; @@ -1816,7 +1815,7 @@ void Tutorial::showTutorialPopup(bool show) if(!show) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1927,7 +1926,7 @@ void Tutorial::handleUIInput(int iAction) { if( m_hintDisplayed ) return; - if(currentTask[m_CurrentState] != nullptr) + if(currentTask[m_CurrentState] != NULL) currentTask[m_CurrentState]->handleUIInput(iAction); } @@ -1989,7 +1988,7 @@ void Tutorial::onSelectedItemChanged(shared_ptr item) // Menus and states like riding in a minecart will NOT allow this if( isSelectedItemState() ) { - if(item != nullptr) + if(item != NULL) { switch(item->id) { @@ -2152,7 +2151,7 @@ void Tutorial::AddConstraint(TutorialConstraint *c) void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/) { if( currentFailedConstraint[m_CurrentState] == c ) - currentFailedConstraint[m_CurrentState] = nullptr; + currentFailedConstraint[m_CurrentState] = NULL; if( c->getQueuedForRemoval() ) { @@ -2212,16 +2211,16 @@ void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned } #ifdef _XBOX -void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= nullptr*/) +void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/) #else -void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= nullptr*/) +void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/) #endif { if(newState == m_CurrentState) { // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == nullptr ) + if( scene == NULL ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } @@ -2242,7 +2241,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } // The action that caused the change of state may also have completed the current task - if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isCompleted() ) + if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() ) { activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) ); @@ -2253,21 +2252,21 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } else { - currentTask[m_CurrentState] = nullptr; + currentTask[m_CurrentState] = NULL; } } - if( currentTask[m_CurrentState] != nullptr ) + if( currentTask[m_CurrentState] != NULL ) { currentTask[m_CurrentState]->onStateChange(newState); } // Make sure that the current message is cleared - setMessage( nullptr ); + setMessage( NULL ); // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == nullptr ) + if( scene == NULL ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.h b/Minecraft.Client/Common/Tutorial/Tutorial.h index c36a9086..169c33e3 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Common/Tutorial/Tutorial.h @@ -139,9 +139,9 @@ public: bool getCompleted( int completableId ); #ifdef _XBOX - void changeTutorialState(eTutorial_State newState, CXuiScene *scene = nullptr); + void changeTutorialState(eTutorial_State newState, CXuiScene *scene = NULL); #else - void changeTutorialState(eTutorial_State newState, UIScene *scene = nullptr); + void changeTutorialState(eTutorial_State newState, UIScene *scene = NULL); #endif bool isSelectedItemState(); diff --git a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp index d80d7d16..5f0808bf 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp @@ -9,7 +9,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), - m_lastTile( nullptr ), m_hintNeeded( true ), m_allowFade(allowFade) + m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) { tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); } diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp index 50a45a42..82c81598 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp @@ -15,7 +15,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *con TutorialMode::~TutorialMode() { - if(tutorial != nullptr) + if(tutorial != NULL) delete tutorial; } @@ -38,7 +38,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) } shared_ptr item = minecraft->player->getSelectedItem(); int damageBefore; - if(item != nullptr) + if(item != NULL) { damageBefore = item->getDamageValue(); } @@ -46,7 +46,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) if(!tutorial->m_allTutorialsComplete) { - if ( item != nullptr && item->isDamageableItem() ) + if ( item != NULL && item->isDamageableItem() ) { int max = item->getMaxDamage(); int damageNow = item->getDamageValue(); @@ -88,7 +88,7 @@ bool TutorialMode::useItemOn(shared_ptr player, Level *level, shared_ptr if(!bTestUseOnly) { - if(item != nullptr) + if(item != NULL) { haveItem = true; itemCount = item->count; diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Common/Tutorial/TutorialMode.h index 2263a91c..75e24edf 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.h @@ -19,7 +19,7 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); virtual void tick(); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr); + virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); virtual void attack(shared_ptr player, shared_ptr entity); virtual bool isInputAllowed(int mapping); diff --git a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp index 1b6d84b2..53fdd275 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp @@ -9,7 +9,7 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ), m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false ) { - if(inConstraints != nullptr) + if(inConstraints != NULL) { for(auto& constraint : *inConstraints) { diff --git a/Minecraft.Client/Common/Tutorial/UseItemTask.h b/Minecraft.Client/Common/Tutorial/UseItemTask.h index 9c8f0192..6c729540 100644 --- a/Minecraft.Client/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Common/Tutorial/UseItemTask.h @@ -13,7 +13,7 @@ private: public: UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); virtual void useItem(shared_ptr item, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/UseTileTask.h b/Minecraft.Client/Common/Tutorial/UseTileTask.h index 1f72fb2e..74b3a40c 100644 --- a/Minecraft.Client/Common/Tutorial/UseTileTask.h +++ b/Minecraft.Client/Common/Tutorial/UseTileTask.h @@ -16,9 +16,9 @@ private: public: UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); + bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); virtual bool isCompleted(); virtual void useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp index d0217d19..71b88479 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp @@ -22,13 +22,13 @@ bool XuiCraftingTask::isCompleted() switch(m_type) { case e_Crafting_SelectGroup: - if(craftScene != nullptr && craftScene->getCurrentGroup() == m_group) + if(craftScene != NULL && craftScene->getCurrentGroup() == m_group) { completed = true; } break; case e_Crafting_SelectItem: - if(craftScene != nullptr && craftScene->isItemSelected(m_item)) + if(craftScene != NULL && craftScene->isItemSelected(m_item)) { completed = true; } diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h index 146b1554..2dc48709 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h @@ -12,7 +12,7 @@ public: }; // Select group - XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector *inConstraints = nullptr, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_group(groupToSelect), @@ -20,7 +20,7 @@ public: {} // Select Item - XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector *inConstraints = nullptr, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_item(itemId), diff --git a/Minecraft.Client/Common/UI/IUIController.h b/Minecraft.Client/Common/UI/IUIController.h index 35a808c5..3040c2cc 100644 --- a/Minecraft.Client/Common/UI/IUIController.h +++ b/Minecraft.Client/Common/UI/IUIController.h @@ -12,7 +12,7 @@ public: virtual void StartReloadSkinThread() = 0; virtual bool IsReloadingSkin() = 0; virtual void CleanUpSkinReload() = 0; - virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0; + virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0; virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT) = 0; virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; virtual void CloseAllPlayersScenes() = 0; diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 21f21627..e55f207d 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -2,7 +2,6 @@ #include "IUIScene_AbstractContainerMenu.h" -#include "UI.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.crafting.h" @@ -22,9 +21,9 @@ SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false }; IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { - m_menu = nullptr; + m_menu = NULL; m_autoDeleteMenu = false; - m_lastPointerLabelSlot = nullptr; + m_lastPointerLabelSlot = NULL; m_pointerPos.x = 0.0f; m_pointerPos.y = 0.0f; @@ -42,7 +41,7 @@ IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu() void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack) { - assert( menu != nullptr ); + assert( menu != NULL ); m_menu = menu; m_autoDeleteMenu = autoDeleteMenu; @@ -268,10 +267,10 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() void IUIScene_AbstractContainerMenu::onMouseTick() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != nullptr) + if( pMinecraft->localgameModes[getPad()] != NULL) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP)) { @@ -297,8 +296,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() int iPad = getPad(); bool bStickInput = false; - float fInputX = InputManager.GetJoypadStick_LX( iPad, false )*(static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu))/100.0f); // apply the sensitivity - float fInputY = InputManager.GetJoypadStick_LY( iPad, false )*(static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu))/100.0f); // apply the sensitivity + float fInputX = InputManager.GetJoypadStick_LX( iPad, false )*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f); // apply the sensitivity + float fInputY = InputManager.GetJoypadStick_LY( iPad, false )*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f); // apply the sensitivity #ifdef __ORBIS__ // should have sensitivity for the touchpad @@ -407,7 +406,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING ) { ++m_iConsectiveInputTicks; - fInputScale = ( static_cast(m_iConsectiveInputTicks) / static_cast((MAX_INPUT_TICKS_FOR_SCALING)) ); + fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) ); } #ifdef TAP_DETECTION else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING ) @@ -495,11 +494,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if (winW > 0 && winH > 0) { - float scaleX = static_cast(getMovieWidth()) / static_cast(winW); - float scaleY = static_cast(getMovieHeight()) / static_cast(winH); + float scaleX = (float)getMovieWidth() / (float)winW; + float scaleY = (float)getMovieHeight() / (float)winH; - vPointerPos.x += static_cast(deltaX) * scaleX; - vPointerPos.y += static_cast(deltaY) * scaleY; + vPointerPos.x += (float)deltaX * scaleX; + vPointerPos.y += (float)deltaY * scaleY; } if (deltaX != 0 || deltaY != 0) @@ -528,7 +527,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else if ( eSectionUnderPointer == eSectionNone ) { - ESceneSection eSection = static_cast(iSection); + ESceneSection eSection = ( ESceneSection )( iSection ); // Get position of this section. UIVec2D sectionPos; @@ -759,17 +758,17 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // What are we carrying on pointer. shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; shared_ptr carriedItem = nullptr; - if(player != nullptr) carriedItem = player->inventory->getCarried(); + if(player != NULL) carriedItem = player->inventory->getCarried(); shared_ptr slotItem = nullptr; - Slot *slot = nullptr; + Slot *slot = NULL; int slotIndex = 0; if(bPointerIsOverSlot) { slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer ); slot = m_menu->getSlot(slotIndex); } - bool bIsItemCarried = carriedItem != nullptr; + bool bIsItemCarried = carriedItem != NULL; int iCarriedCount = 0; bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer. if ( bIsItemCarried ) @@ -789,7 +788,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if ( bPointerIsOverSlot ) { slotItem = slot->getItem(); - bSlotHasItem = slotItem != nullptr; + bSlotHasItem = slotItem != NULL; if ( bSlotHasItem ) { iSlotCount = slotItem->GetCount(); @@ -830,13 +829,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { vector *desc = GetSectionHoverText(eSectionUnderPointer); SetPointerText(desc, false); - m_lastPointerLabelSlot = nullptr; + m_lastPointerLabelSlot = NULL; delete desc; } else { - SetPointerText(nullptr, false); - m_lastPointerLabelSlot = nullptr; + SetPointerText(NULL, false); + m_lastPointerLabelSlot = NULL; } EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack; @@ -1022,7 +1021,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // Get the info on this item. shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); bool bValidFuel = FurnaceTileEntity::isFuel(item); - bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != nullptr; + bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL; if(bValidIngredient) { @@ -1037,7 +1036,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else { - if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr) + if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) { buttonY = eToolTipQuickMove; } @@ -1077,7 +1076,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else { - if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr) + if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) { buttonY = eToolTipQuickMove; } @@ -1310,9 +1309,9 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } vPointerPos.x = floor(vPointerPos.x); - vPointerPos.x += ( static_cast(vPointerPos.x)%2); + vPointerPos.x += ( (int)vPointerPos.x%2); vPointerPos.y = floor(vPointerPos.y); - vPointerPos.y += ( static_cast(vPointerPos.y)%2); + vPointerPos.y += ( (int)vPointerPos.y%2); m_pointerPos = vPointerPos; adjustPointerForSafeZone(); @@ -1323,10 +1322,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b bool bHandled = false; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != nullptr ) + if( pMinecraft->localgameModes[getPad()] != NULL ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -1528,20 +1527,20 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b if ( bSlotHasItem ) { shared_ptr item = getSlotItem(m_eCurrSection, currentIndex); - if( Minecraft::GetInstance()->localgameModes[iPad] != nullptr ) + if( Minecraft::GetInstance()->localgameModes[iPad] != NULL ) { Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails; message->m_messageId = item->getUseDescriptionId(); - if(Item::items[item->id] != nullptr) message->m_titleString = Item::items[item->id]->getHoverName(item); + if(Item::items[item->id] != NULL) message->m_titleString = Item::items[item->id]->getHoverName(item); message->m_titleId = item->getDescriptionId(); message->m_icon = item->id; message->m_iAuxVal = item->getAuxValue(); message->m_forceDisplay = true; - TutorialMode *gameMode = static_cast(Minecraft::GetInstance()->localgameModes[iPad]); - gameMode->getTutorial()->setMessage(nullptr, message); + TutorialMode *gameMode = (TutorialMode *)Minecraft::GetInstance()->localgameModes[iPad]; + gameMode->getTutorial()->setMessage(NULL, message); ui.PlayUISFX(eSFX_Press); } } @@ -1643,7 +1642,7 @@ void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSectio void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey) { // 4J Stu - Removed this line as unused - //if (slot != nullptr) slotId = slot->index; + //if (slot != NULL) slotId = slot->index; Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] ); @@ -1660,7 +1659,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr itemA, shared_ptr itemB) { - if(itemA == nullptr || itemB == nullptr) return false; + if(itemA == NULL || itemB == NULL) return false; return (itemA->id == itemB->id && (!itemB->isStackedByData() || itemB->getAuxValue() == itemA->getAuxValue()) && ItemInstance::tagMatches(itemB, itemA) ); } @@ -1669,7 +1668,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) { int iResult = 0; - if(slot != nullptr && slot->hasItem()) + if(slot != NULL && slot->hasItem()) { shared_ptr item = slot->getItem(); if ( item->isStackable() ) @@ -1688,7 +1687,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot) { - if(slot == nullptr) return nullptr; + if(slot == NULL) return NULL; vector *lines = slot->getItem()->getHoverText(nullptr, false); @@ -1708,5 +1707,5 @@ vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo vector *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection) { - return nullptr; + return NULL; } diff --git a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp index 1e6fa6fa..10d1bcc4 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp @@ -10,7 +10,7 @@ IUIScene_AnvilMenu::IUIScene_AnvilMenu() { m_inventory = nullptr; - m_repairMenu = nullptr; + m_repairMenu = NULL; m_itemName = L""; } @@ -231,7 +231,7 @@ void IUIScene_AnvilMenu::handleTick() void IUIScene_AnvilMenu::updateItemName() { Slot *slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0) { @@ -245,7 +245,7 @@ void IUIScene_AnvilMenu::updateItemName() ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeUTF(m_itemName); - Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::make_shared(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())); + Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()))); } void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector > *items) @@ -257,10 +257,10 @@ void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotI { if (slotIndex == AnvilMenu::INPUT_SLOT) { - m_itemName = item == nullptr ? L"" : item->getHoverName(); + m_itemName = item == NULL ? L"" : item->getHoverName(); setEditNameValue(m_itemName); - setEditNameEditable(item != nullptr); - if (item != nullptr) + setEditNameEditable(item != NULL); + if (item != NULL) { updateItemName(); } diff --git a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp index 3dede3d9..bb13deb8 100644 --- a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp @@ -216,13 +216,13 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection, i { case eSectionBeaconConfirm: { - if( (m_beacon->getItem(0) == nullptr) || (m_beacon->getPrimaryPower() <= 0) ) return; + if( (m_beacon->getItem(0) == NULL) || (m_beacon->getPrimaryPower() <= 0) ) return; ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeInt(m_beacon->getPrimaryPower()); dos.writeInt(m_beacon->getSecondaryPower()); - Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::make_shared(CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray())); + Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray()))); if (m_beacon->getPrimaryPower() > 0) { @@ -286,7 +286,7 @@ void IUIScene_BeaconMenu::handleTick() for (int c = 0; c < count; c++) { - if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; + if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); @@ -315,7 +315,7 @@ void IUIScene_BeaconMenu::handleTick() for (int c = 0; c < count - 1; c++) { - if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; + if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); @@ -355,7 +355,7 @@ void IUIScene_BeaconMenu::handleTick() } } - SetConfirmButtonEnabled( (m_beacon->getItem(0) != nullptr) && (m_beacon->getPrimaryPower() > 0) ); + SetConfirmButtonEnabled( (m_beacon->getItem(0) != NULL) && (m_beacon->getPrimaryPower() > 0) ); } int IUIScene_BeaconMenu::GetId(int tier, int effectId) @@ -365,7 +365,7 @@ int IUIScene_BeaconMenu::GetId(int tier, int effectId) vector *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSection) { - vector *desc = nullptr; + vector *desc = NULL; switch(eSection) { case eSectionBeaconSecondaryTwo: diff --git a/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp index 3af01678..4371b4e5 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp @@ -20,6 +20,6 @@ void IUIScene_CommandBlockMenu::ConfirmButtonClicked() dos.writeInt(m_commandBlock->z); dos.writeUTF(GetCommand()); - Minecraft::GetInstance()->localplayers[GetPad()]->connection->send(std::make_shared(CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, baos.toByteArray())); + Minecraft::GetInstance()->localplayers[GetPad()]->connection->send(shared_ptr(new CustomPayloadPacket(CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, baos.toByteArray()))); } diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index 6fddece9..fc012be3 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -6,8 +6,6 @@ #include "..\..\LocalPlayer.h" #include "IUIScene_CraftingMenu.h" -#include "UI.h" - Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA[IUIScene_CraftingMenu::m_iMaxGroup2x2]= { Recipy::eGroupType_Structure, @@ -156,10 +154,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != nullptr ) + if( pMinecraft->localgameModes[getPad()] != NULL ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -213,10 +211,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != nullptr) + if( pMinecraft->localgameModes[iPad] != NULL) { Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { tutorial->onCrafted(pTempItemInst); } @@ -249,10 +247,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != nullptr ) + if( pMinecraft->localgameModes[iPad] != NULL ) { Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { tutorial->createItemSelected(pTempItemInst, pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]); } @@ -290,12 +288,12 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) } // 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake - if (ingItemInst != nullptr) + if (ingItemInst != NULL) { if (ingItemInst->getItem()->hasCraftingRemainingItem()) { // replace item with remaining result - m_pPlayer->inventory->add(std::make_shared(ingItemInst->getItem()->getCraftingRemainingItem())); + m_pPlayer->inventory->add( shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); } } @@ -610,7 +608,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // dump out the inventory /* for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) { - if (m_pPlayer->inventory->items[k] != nullptr) + if (m_pPlayer->inventory->items[k] != NULL) { wstring itemstring=m_pPlayer->inventory->items[k]->toString(); @@ -622,15 +620,15 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() */ RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - int iRecipeC=static_cast(recipes->size()); + int iRecipeC=(int)recipes->size(); auto itRecipe = recipes->begin(); // dump out the recipe products // for (int i = 0; i < iRecipeC; i++) // { - // shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); - // if (pTempItemInst != nullptr) + // shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); + // if (pTempItemInst != NULL) // { // wstring itemstring=pTempItemInst->toString(); // @@ -685,7 +683,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // Does the player have this ingredient? for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) { - if (m_pPlayer->inventory->items[k] != nullptr) + if (m_pPlayer->inventory->items[k] != NULL) { // do they have the ingredient, and the aux value matches, and enough off it? if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && @@ -705,7 +703,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() for(unsigned int l=0;linventory->items.length;l++) { - if (m_pPlayer->inventory->items[l] != nullptr) + if (m_pPlayer->inventory->items[l] != NULL) { if( (m_pPlayer->inventory->items[l]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && @@ -1073,7 +1071,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]; Item *item = Item::items[id]; - shared_ptr itemInst= std::make_shared(item, pRecipeIngredientsRequired[iRecipe].iIngValA[i], iAuxVal); + shared_ptr itemInst= shared_ptr(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal)); // 4J-PB - a very special case - the bed can use any kind of wool, so we can't use the item description // and the same goes for the painting @@ -1158,7 +1156,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { iAuxVal = 1; } - shared_ptr itemInst= std::make_shared(id, 1, iAuxVal); + shared_ptr itemInst= shared_ptr(new ItemInstance(id,1,iAuxVal)); setIngredientSlotItem(getPad(),index,itemInst); // show the ingredients we don't have if we can't make the recipe if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L< > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount]; @@ -22,6 +21,7 @@ vector< shared_ptr > IUIScene_CreativeMenu::categoryGroups[eCreati #define ITEM_AUX(id, aux) list->push_back( shared_ptr(new ItemInstance(id, 1, aux)) ); #define DEF(index) list = &categoryGroups[index]; + void IUIScene_CreativeMenu::staticCtor() { vector< shared_ptr > *list; @@ -488,14 +488,14 @@ void IUIScene_CreativeMenu::staticCtor() for(unsigned int i = 0; i < Enchantment::enchantments.length; ++i) { Enchantment *enchantment = Enchantment::enchantments[i]; - if (enchantment == nullptr || enchantment->category == nullptr) continue; + if (enchantment == NULL || enchantment->category == NULL) continue; list->push_back(Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, enchantment->getMaxLevel()))); } #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn()) { - shared_ptr debugSword = std::make_shared(Item::sword_diamond_Id, 1, 0); + shared_ptr debugSword = shared_ptr(new ItemInstance(Item::sword_diamond_Id, 1, 0)); debugSword->enchant( Enchantment::damageBonus, 50 ); debugSword->setHoverName(L"Sword of Debug"); list->push_back(debugSword); @@ -673,7 +673,7 @@ void IUIScene_CreativeMenu::staticCtor() #ifndef _CONTENT_PACKAGE ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations}; - specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, nullptr, 1, debugDecorationsGroup); + specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL, 1, debugDecorationsGroup); #else ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup); @@ -707,7 +707,7 @@ void IUIScene_CreativeMenu::staticCtor() #ifndef _CONTENT_PACKAGE ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc}; ECreative_Inventory_Groups debugMiscGroup[] = {eCreativeInventory_ArtToolsMisc}; - specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, nullptr, 1, debugMiscGroup); + specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, NULL, 1, debugMiscGroup); #else ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc}; specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup); @@ -766,12 +766,12 @@ void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos) // 4J JEV - Tab Spec Struct -IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= nullptr*/) +IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/) : m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount) { m_pages = 0; - m_staticGroupsA = nullptr; + m_staticGroupsA = NULL; unsigned int dynamicItems = 0; m_staticItems = 0; @@ -786,7 +786,7 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta } } - m_debugGroupsA = nullptr; + m_debugGroupsA = NULL; m_debugItems = 0; if(debugGroupsCount > 0) { @@ -798,8 +798,8 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta } } - m_dynamicGroupsA = nullptr; - if(dynamicGroupsCount > 0 && dynamicGroups != nullptr) + m_dynamicGroupsA = NULL; + if(dynamicGroupsCount > 0 && dynamicGroups != NULL) { m_dynamicGroupsA = new ECreative_Inventory_Groups[dynamicGroupsCount]; for(int i = 0; i < dynamicGroupsCount; ++i) @@ -816,9 +816,9 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta IUIScene_CreativeMenu::TabSpec::~TabSpec() { - if(m_staticGroupsA != nullptr) delete [] m_staticGroupsA; - if(m_dynamicGroupsA != nullptr) delete [] m_dynamicGroupsA; - if(m_debugGroupsA != nullptr) delete [] m_debugGroupsA; + if(m_staticGroupsA != NULL) delete [] m_staticGroupsA; + if(m_dynamicGroupsA != NULL) delete [] m_dynamicGroupsA; + if(m_debugGroupsA != NULL) delete [] m_debugGroupsA; } void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page) @@ -826,7 +826,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i int lastSlotIndex = 0; // Fill the dynamic group - if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != nullptr) + if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL) { for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) { @@ -957,7 +957,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptrsize(); - Slot *slot = nullptr; + Slot *slot = NULL; for (int i = 0; i < TabSpec::MAX_SIZE; i++) { // 4J JEV - These values get set by addSlot anyway. @@ -1036,11 +1036,11 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu { shared_ptr newItem = m_menu->getSlot(i)->getItem(); - if(newItem != nullptr) + if(newItem != NULL) { m_menu->getSlot(i)->set(nullptr); // call this function to synchronize multiplayer item bar - pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - static_cast(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START); + pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START); } } return true; @@ -1054,7 +1054,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr playerInventory = pMinecraft->localplayers[iPad]->inventory; - if (playerInventory->getCarried() != nullptr) + if (playerInventory->getCarried() != NULL) { if (buttonNum == 0) { @@ -1082,8 +1082,8 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction) // Fall through intentional case ACTION_MENU_RIGHT_SCROLL: { - ECreativeInventoryTabs tab = static_cast(m_curTab + dir); - if (tab < 0) tab = static_cast(eCreativeInventoryTab_COUNT - 1); + ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir); + if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1); if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks; switchTab(tab); ui.PlayUISFX(eSFX_Focus); @@ -1143,7 +1143,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; shared_ptr carried = playerInventory->getCarried(); shared_ptr clicked = m_menu->getSlot(currentIndex)->getItem(); - if (clicked != nullptr) + if (clicked != NULL) { playerInventory->setCarried(ItemInstance::clone(clicked)); carried = playerInventory->getCarried(); @@ -1176,7 +1176,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]); shared_ptr newItem = m_menu->getSlot(currentIndex)->getItem(); // call this function to synchronize multiplayer item bar - pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - static_cast(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START); + pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START); if(m_bCarryingCreativeItem) { @@ -1224,7 +1224,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr item, for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { shared_ptr slotItem = m_menu->getSlot(i)->getItem(); - if( slotItem != nullptr && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) + if( slotItem != NULL && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) { sameItemFound = true; slotX = i - TabSpec::MAX_SIZE; @@ -1237,7 +1237,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr item, // Find an empty slot for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { - if( m_menu->getSlot(i)->getItem() == nullptr ) + if( m_menu->getSlot(i)->getItem() == NULL ) { slotX = i - TabSpec::MAX_SIZE; emptySlotFound = true; @@ -1316,7 +1316,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis // diamonds give trails if (trail) expTag->putBoolean(FireworksItem::TAG_E_TRAIL, true); - intArray colorArray(static_cast(colors.size())); + intArray colorArray(colors.size()); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); @@ -1335,7 +1335,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis vector colors; colors.push_back(DyePowderItem::COLOR_RGB[fadeColor]); - intArray colorArray(static_cast(colors.size())); + intArray colorArray(colors.size()); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); @@ -1350,7 +1350,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis shared_ptr firework; { - firework = std::make_shared(Item::fireworks); + firework = shared_ptr( new ItemInstance(Item::fireworks) ); CompoundTag *itemTag = new CompoundTag(); CompoundTag *fireTag = new CompoundTag(FireworksItem::TAG_FIREWORKS); ListTag *expTags = new ListTag(FireworksItem::TAG_EXPLOSIONS); @@ -1358,7 +1358,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis expTags->add(expTag); fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphur)); + fireTag->putByte(FireworksItem::TAG_FLIGHT, (byte) sulphur); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h index 864fb560..64b78029 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h @@ -69,7 +69,7 @@ public: unsigned int m_debugItems; public: - TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount = 0, ECreative_Inventory_Groups *dynamicGroups = nullptr, int debugGroupsCount = 0, ECreative_Inventory_Groups *debugGroups = nullptr ); + TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount = 0, ECreative_Inventory_Groups *dynamicGroups = NULL, int debugGroupsCount = 0, ECreative_Inventory_Groups *debugGroups = NULL ); ~TabSpec(); void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page); diff --git a/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp index fbbf7c24..c73f7dc5 100644 --- a/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp @@ -181,5 +181,5 @@ bool IUIScene_EnchantingMenu::IsSectionSlotList( ESceneSection eSection ) EnchantmentMenu *IUIScene_EnchantingMenu::getMenu() { - return static_cast(m_menu); + return (EnchantmentMenu *)m_menu; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp index fd977966..03adbd2c 100644 --- a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp @@ -7,8 +7,6 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.entity.monster.h" #include "IUIScene_HUD.h" -#include "UI.h" - IUIScene_HUD::IUIScene_HUD() { m_lastActiveSlot = -1; @@ -81,7 +79,7 @@ void IUIScene_HUD::updateFrameTick() { //SetRidingHorse(false, 0); shared_ptr riding = pMinecraft->localplayers[iPad]->riding; - if(riding == nullptr) + if(riding == NULL) { SetRidingHorse(false, false, 0); } @@ -148,8 +146,8 @@ void IUIScene_HUD::updateFrameTick() { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -158,7 +156,7 @@ void IUIScene_HUD::updateFrameTick() } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else @@ -168,12 +166,12 @@ void IUIScene_HUD::updateFrameTick() { ucAlpha=15; } - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } SetOpacity(fVal); bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(iPad) && !(app.GetXuiAction(iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(iPad,eGameSetting_DisplayHUD)!=0; - if(bDisplayGui && pMinecraft->localplayers[iPad] != nullptr) + if(bDisplayGui && pMinecraft->localplayers[iPad] != NULL) { SetVisible(true); } @@ -200,7 +198,7 @@ void IUIScene_HUD::renderPlayerHealth() bool bHasPoison = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::poison); bool bHasWither = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::wither); AttributeInstance *maxHealthAttribute = pMinecraft->localplayers[iPad]->getAttribute(SharedMonsterAttributes::MAX_HEALTH); - float maxHealth = static_cast(maxHealthAttribute->getValue()); + float maxHealth = (float)maxHealthAttribute->getValue(); float totalAbsorption = pMinecraft->localplayers[iPad]->getAbsorptionAmount(); // Update armour @@ -221,7 +219,7 @@ void IUIScene_HUD::renderPlayerHealth() shared_ptr riding = pMinecraft->localplayers[iPad]->riding; - if(riding == nullptr || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) + if(riding == NULL || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) { SetRidingHorse(false, false, 0); @@ -244,8 +242,8 @@ void IUIScene_HUD::renderPlayerHealth() if (pMinecraft->localplayers[iPad]->isUnderLiquid(Material::water)) { ShowAir(true); - int count = static_cast(ceil((pMinecraft->localplayers[iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY)); - int extra = static_cast(ceil((pMinecraft->localplayers[iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY)) - count; + int count = (int) ceil((pMinecraft->localplayers[iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY); + int extra = (int) ceil((pMinecraft->localplayers[iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count; SetAir(count, extra); } else @@ -256,7 +254,7 @@ void IUIScene_HUD::renderPlayerHealth() else if(riding->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(riding); - int riderCurrentHealth = static_cast(ceil(living->getHealth())); + int riderCurrentHealth = (int) ceil(living->getHealth()); float maxRiderHealth = living->getMaxHealth(); SetRidingHorse(true, pMinecraft->localplayers[iPad]->isRidingJumpable(), maxRiderHealth); diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index e88ed08c..ab1767d4 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -52,7 +52,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) @@ -229,7 +229,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 { // 4J-PB - need to check this user can access the store bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -248,7 +248,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; @@ -300,7 +300,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str()); - StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr); + StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -336,7 +336,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 // need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } else @@ -352,7 +352,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 int IUIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) { - bool bAutosave=static_cast(lpParameter); + bool bAutosave=(bool)lpParameter; if(bAutosave) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); @@ -421,7 +421,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) bool saveStats = true; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { - if(lpParameter != nullptr ) + if(lpParameter != NULL ) { // 4J-PB - check if we have lost connection to Live if(ProfileManager.GetLiveConnectionStatus()!=XONLINE_S_LOGON_CONNECTION_ESTABLISHED ) @@ -522,17 +522,17 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) exitReasonStringId = -1; // 4J - Force a disconnection, this handles the situation that the server has already disconnected - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false); - if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(false); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false); + if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(false); } else { exitReasonStringId = IDS_EXITING_GAME; pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(); - if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(); + if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(); } // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks @@ -548,7 +548,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) } else { - if(lpParameter != nullptr && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) + if(lpParameter != NULL && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) { switch( app.GetDisconnectReason() ) { @@ -625,7 +625,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) { Sleep(1); } - pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats); + pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats); TelemetryManager->Flush(); diff --git a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index 735da438..d3a9e8f0 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -45,7 +45,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this // REMOVE UNTIL WORKING - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -86,7 +86,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() // add a TMS request for them app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n"); app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData); - if(m_iConfigA!=nullptr) + if(m_iConfigA!=NULL) { delete m_iConfigA; } @@ -123,7 +123,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() void IUIScene_StartGame::handleSelectionChanged(F64 selectedId) { - m_iSetTexturePackDescription = static_cast(selectedId); + m_iSetTexturePackDescription = (int)selectedId; if(!m_texturePackDescDisplayed) { @@ -135,13 +135,13 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(index); - if(tp==nullptr) + if(tp==NULL) { #if TO_BE_IMPLEMENTED // this is probably a texture pack icon added from TMS DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=nullptr,pbFileData=nullptr; + PBYTE pbData=NULL,pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -171,7 +171,7 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); } #endif } @@ -214,7 +214,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(m_currentTexturePackIndex); // if the texture pack is null, you don't have it yet - if(tp==nullptr) + if(tp==NULL) { #if TO_BE_IMPLEMENTED // Upsell @@ -254,7 +254,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) int IUIScene_StartGame::TrialTexturePackWarningReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - IUIScene_StartGame* pScene = static_cast(pParam); + IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -269,7 +269,7 @@ int IUIScene_StartGame::TrialTexturePackWarningReturned(void *pParam,int iPad,C4 int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - IUIScene_StartGame* pScene = static_cast(pParam); + IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -279,7 +279,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStora ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -289,9 +289,9 @@ int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStora } - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); #elif defined _XBOX_ONE - //StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,nullptr,nullptr); + //StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); #endif // the license change coming in when the offer has been installed will cause this scene to refresh @@ -311,7 +311,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStora int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - IUIScene_StartGame *pClass = static_cast(pParam); + IUIScene_StartGame *pClass = (IUIScene_StartGame *)pParam; #ifdef _XBOX @@ -332,7 +332,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora if( result==C4JStorage::EMessage_ResultAccept ) // Full version { ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } else // trial version @@ -343,7 +343,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora { ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } } @@ -360,7 +360,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora app.GetDLCFullOfferIDForPackID(pClass->m_MoreOptionsParams.dwTexturePack,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); + StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 0b1e0df2..059f9b75 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -8,14 +8,12 @@ #include "..\..\ClientConnection.h" #include "IUIScene_TradingMenu.h" -#include "UI.h" - IUIScene_TradingMenu::IUIScene_TradingMenu() { m_validOffersCount = 0; m_selectedSlot = 0; m_offersStartIndex = 0; - m_menu = nullptr; + m_menu = NULL; m_bHasUpdatedOnce = false; } @@ -33,10 +31,10 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != nullptr ) + if( pMinecraft->localgameModes[getPad()] != NULL ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != nullptr) + if(tutorial != NULL) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -78,7 +76,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); - if( (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || buyBMatches >= buyBItem->count) ) + if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) { // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple �Enchanted Books� will cause the title to crash. int actualShopItem = m_activeOffers.at(selectedShopItem).second; @@ -97,7 +95,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) } // Send a packet to the server - player->connection->send(std::make_shared(m_menu->containerId, actualShopItem)); + player->connection->send( shared_ptr( new TradeItemPacket(m_menu->containerId, actualShopItem) ) ); updateDisplay(); } @@ -154,7 +152,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); output.writeInt(actualShopItem); - Minecraft::GetInstance()->getConnection(getPad())->send(std::make_shared(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())); + Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); } } return handled; @@ -164,7 +162,7 @@ void IUIScene_TradingMenu::handleTick() { int offerCount = 0; MerchantRecipeList *offers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]); - if (offers != nullptr) + if (offers != NULL) { offerCount = offers->size(); @@ -183,7 +181,7 @@ void IUIScene_TradingMenu::updateDisplay() int iA = -1; MerchantRecipeList *unfilteredOffers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]); - if (unfilteredOffers != nullptr) + if (unfilteredOffers != NULL) { m_activeOffers.clear(); int unfilteredIndex = 0; @@ -207,7 +205,7 @@ void IUIScene_TradingMenu::updateDisplay() ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); output.writeInt(firstValidTrade); - Minecraft::GetInstance()->getConnection(getPad())->send(std::make_shared(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())); + Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()))); } } @@ -243,7 +241,7 @@ void IUIScene_TradingMenu::updateDisplay() // 4J-PB - need to get the villager type here wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM); wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",m_merchant->getDisplayName()); - size_t iPos=wsTemp.find(L"%s"); + int iPos=wsTemp.find(L"%s"); wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName()); setTitle(wsTemp.c_str()); @@ -257,10 +255,10 @@ void IUIScene_TradingMenu::updateDisplay() setRequest1Item(buyAItem); setRequest2Item(buyBItem); - if(buyAItem != nullptr) setRequest1Name(buyAItem->getHoverName()); + if(buyAItem != NULL) setRequest1Name(buyAItem->getHoverName()); else setRequest1Name(L""); - if(buyBItem != nullptr) setRequest2Name(buyBItem->getHoverName()); + if(buyBItem != NULL) setRequest2Name(buyBItem->getHoverName()); else setRequest2Name(L""); bool canMake = true; @@ -286,15 +284,15 @@ void IUIScene_TradingMenu::updateDisplay() } else { - if(buyBItem!=nullptr) + if(buyBItem!=NULL) { setRequest2RedBox(true); canMake = false; } else { - setRequest2RedBox(buyBItem != nullptr); - canMake = canMake && buyBItem == nullptr; + setRequest2RedBox(buyBItem != NULL); + canMake = canMake && buyBItem == NULL; } } @@ -322,7 +320,7 @@ void IUIScene_TradingMenu::updateDisplay() bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) { bool canMake = false; - if (recipe != nullptr) + if (recipe != NULL) { if(recipe->isDeprecated()) return false; @@ -337,7 +335,7 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) } else { - canMake = buyAItem == nullptr; + canMake = buyAItem == NULL; } int buyBMatches = player->inventory->countMatches(buyBItem); @@ -347,7 +345,7 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) } else { - canMake = canMake && buyBItem == nullptr; + canMake = canMake && buyBItem == NULL; } } return canMake; diff --git a/Minecraft.Client/Common/UI/UI.h b/Minecraft.Client/Common/UI/UI.h index a7c416f8..428b3b90 100644 --- a/Minecraft.Client/Common/UI/UI.h +++ b/Minecraft.Client/Common/UI/UI.h @@ -123,6 +123,4 @@ #include "UIScene_TeleportMenu.h" #include "UIScene_EndPoem.h" #include "UIScene_EULA.h" -#include "UIScene_NewUpdateMessage.h" - -extern ConsoleUIController ui; \ No newline at end of file +#include "UIScene_NewUpdateMessage.h" \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index e9d110b7..afc2b139 100644 --- a/Minecraft.Client/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIBitmapFont.cpp @@ -53,42 +53,42 @@ void UIAbstractBitmapFont::registerFont() IggyFontMetrics * RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(void *user_context,IggyFontMetrics *metrics) { - return static_cast(user_context)->GetFontMetrics(metrics); + return ((UIAbstractBitmapFont *) user_context)->GetFontMetrics(metrics); } S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void *user_context,U32 codepoint) { - return static_cast(user_context)->GetCodepointGlyph(codepoint); + return ((UIAbstractBitmapFont *) user_context)->GetCodepointGlyph(codepoint); } IggyGlyphMetrics * RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(void *user_context,S32 glyph,IggyGlyphMetrics *metrics) { - return static_cast(user_context)->GetGlyphMetrics(glyph,metrics); + return ((UIAbstractBitmapFont *) user_context)->GetGlyphMetrics(glyph,metrics); } rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void *user_context,S32 glyph) { - return static_cast(user_context)->IsGlyphEmpty(glyph); + return ((UIAbstractBitmapFont *) user_context)->IsGlyphEmpty(glyph); } F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(void *user_context,S32 first_glyph,S32 second_glyph) { - return static_cast(user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); + return ((UIAbstractBitmapFont *) user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); } rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale) { - return static_cast(user_context)->CanProvideBitmap(glyph,pixel_scale); + return ((UIAbstractBitmapFont *) user_context)->CanProvideBitmap(glyph,pixel_scale); } rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return static_cast(user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); + return ((UIAbstractBitmapFont *) user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); } void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return static_cast(user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap); + return ((UIAbstractBitmapFont *) user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap); } UIBitmapFont::UIBitmapFont( SFontData &sfontdata ) @@ -321,7 +321,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte // 4J-PB - this was chopping off the top of the characters, so accented ones were losing a couple of pixels at the top // DaveK has reduced the height of the accented capitalised characters, and we've dropped this from 0.65 to 0.64 - bitmap->top_left_y = -static_cast(m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; + bitmap->top_left_y = -((S32) m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; bitmap->oversample = 0; bitmap->point_sample = true; @@ -351,7 +351,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX; // 4J-JEV: Additional information needed to release memory afterwards. - bitmap->user_context_for_free = nullptr; + bitmap->user_context_for_free = NULL; return true; } diff --git a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp index 555f36e4..901b5a77 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp @@ -46,7 +46,7 @@ void UIComponent_Chat::handleTimerComplete(int id) Minecraft *pMinecraft = Minecraft::GetInstance(); bool anyVisible = false; - if(pMinecraft->localplayers[m_iPad]!= nullptr) + if(pMinecraft->localplayers[m_iPad]!= NULL) { Gui *pGui = pMinecraft->gui; //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); @@ -102,15 +102,15 @@ void UIComponent_Chat::render(S32 width, S32 height, C4JRender::eViewportType vi { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -124,14 +124,14 @@ void UIComponent_Chat::render(S32 width, S32 height, C4JRender::eViewportType vi { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - tileHeight = static_cast(ui.getScreenHeight()); + tileHeight = (S32)(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: diff --git a/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp b/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp index 3aab5b98..240429bc 100644 --- a/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp @@ -10,7 +10,7 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(int iPad, v IggyDataValue result; IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(0); // WIN64 + value[0].number = (F64)0; // WIN64 #if defined _XBOX value[0].number = (F64)1; #elif defined _DURANGO @@ -22,7 +22,7 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(int iPad, v #elif defined __PSVITA__ value[0].number = (F64)5; #elif defined _WINDOWS64 - value[0].number = static_cast(0); + value[0].number = (F64)0; #endif IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value ); } diff --git a/Minecraft.Client/Common/UI/UIComponent_MenuBackground.cpp b/Minecraft.Client/Common/UI/UIComponent_MenuBackground.cpp index 1718e8cb..d3a4c4c0 100644 --- a/Minecraft.Client/Common/UI/UIComponent_MenuBackground.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_MenuBackground.cpp @@ -42,15 +42,15 @@ void UIComponent_MenuBackground::render(S32 width, S32 height, C4JRender::eViewp { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -64,14 +64,14 @@ void UIComponent_MenuBackground::render(S32 width, S32 height, C4JRender::eViewp { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - tileHeight = static_cast(ui.getScreenHeight()); + tileHeight = (S32)(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp index a5b93118..a52ebd72 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp @@ -45,7 +45,7 @@ void UIComponent_Panorama::tick() Minecraft *pMinecraft = Minecraft::GetInstance(); EnterCriticalSection(&pMinecraft->m_setLevelCS); - if(pMinecraft->level!=nullptr) + if(pMinecraft->level!=NULL) { int64_t i64TimeOfDay =0; // are we in the Nether? - Leave the time as 0 if we are, so we show daylight @@ -85,10 +85,10 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -99,7 +99,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp S32 tileXStart = 0; S32 tileYStart = 0; S32 tileWidth = width; - S32 tileHeight = static_cast(ui.getScreenHeight()); + S32 tileHeight = (S32)(ui.getScreenHeight()); IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight ); diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp index 85661125..255740c9 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp @@ -154,8 +154,8 @@ void UIComponent_Tooltips::tick() { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -164,7 +164,7 @@ void UIComponent_Tooltips::tick() } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else @@ -174,7 +174,7 @@ void UIComponent_Tooltips::tick() { ucAlpha=15; } - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } setOpacity(fVal); @@ -206,15 +206,15 @@ void UIComponent_Tooltips::render(S32 width, S32 height, C4JRender::eViewportTyp { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -228,14 +228,14 @@ void UIComponent_Tooltips::render(S32 width, S32 height, C4JRender::eViewportTyp { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - tileHeight = static_cast(ui.getScreenHeight()); + tileHeight = (S32)(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: @@ -351,7 +351,7 @@ void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, UIString label, void UIComponent_Tooltips::_Relayout() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , NULL ); #ifdef __PSVITA__ // rebuild touchboxes diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp index fcbd17f3..3b4eb097 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp @@ -12,8 +12,8 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void *initData, U // Setup all the Iggy references we need for this scene initialiseMovie(); - m_interactScene = nullptr; - m_lastInteractSceneMoved = nullptr; + m_interactScene = NULL; + m_lastInteractSceneMoved = NULL; m_lastSceneMovedLeft = false; m_bAllowFade = false; m_iconItem = nullptr; @@ -90,7 +90,7 @@ void UIComponent_TutorialPopup::RemoveInteractSceneReference(UIScene *scene) { if( m_interactScene == scene ) { - m_interactScene = nullptr; + m_interactScene = NULL; } } @@ -132,7 +132,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws { m_interactScene = interactScene; app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene); - if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = nullptr; + if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL; if(desc.empty()) { SetVisible( false ); @@ -212,20 +212,20 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, if( icon != TUTORIAL_NO_ICON ) { m_iconIsFoil = false; - m_iconItem = std::make_shared(icon, 1, iAuxVal); + m_iconItem = shared_ptr(new ItemInstance(icon,1,iAuxVal)); } else { m_iconItem = nullptr; wstring openTag(L"{*ICON*}"); wstring closeTag(L"{*/ICON*}"); - size_t iconTagStartPos = temp.find(openTag); - size_t iconStartPos = iconTagStartPos + openTag.length(); - if( iconTagStartPos > 0 && iconStartPos < temp.length() ) + int iconTagStartPos = (int)temp.find(openTag); + int iconStartPos = iconTagStartPos + (int)openTag.length(); + if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) { - size_t iconEndPos = temp.find(closeTag, iconStartPos); + int iconEndPos = (int)temp.find( closeTag, iconStartPos ); - if(iconEndPos > iconStartPos && iconEndPos < temp.length() ) + if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) { wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); @@ -241,7 +241,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, { iAuxVal = 0; } - m_iconItem = std::make_shared(iconId, 1, iAuxVal); + m_iconItem = shared_ptr(new ItemInstance(iconId,1,iAuxVal)); temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L""); } @@ -250,63 +250,63 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, // remove any icon text else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::workBench_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::workBench_Id,1,0)); } else if(temp.find(L"{*SticksIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::stick_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::stick_Id,1,0)); } else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::wood_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::wood_Id,1,0)); } else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::shovel_wood_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::shovel_wood_Id,1,0)); } else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::hatchet_wood_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::hatchet_wood_Id,1,0)); } else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::pickAxe_wood_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::pickAxe_wood_Id,1,0)); } else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::furnace_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::furnace_Id,1,0)); } else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::door_wood, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::door_wood,1,0)); } else if(temp.find(L"{*TorchIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::torch_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::torch_Id,1,0)); } else if(temp.find(L"{*BoatIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::boat_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::boat_Id,1,0)); } else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::fishingRod_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::fishingRod_Id,1,0)); } else if(temp.find(L"{*FishIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::fish_raw_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::fish_raw_Id,1,0)); } else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Item::minecart_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Item::minecart_Id,1,0)); } else if(temp.find(L"{*RailIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::rail_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::rail_Id,1,0)); } else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::goldenRail_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::goldenRail_Id,1,0)); } else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos) { @@ -320,15 +320,15 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, } else if(temp.find(L"{*StoneIcon*}")!=wstring::npos) { - m_iconItem = std::make_shared(Tile::stone_Id, 1, 0); + m_iconItem = shared_ptr(new ItemInstance(Tile::stone_Id,1,0)); } else { m_iconItem = nullptr; } } - if(!isFixedIcon && m_iconItem != nullptr) setupIconHolder(e_ICON_TYPE_IGGY); - m_controlIconHolder.setVisible( isFixedIcon || m_iconItem != nullptr); + if(!isFixedIcon && m_iconItem != NULL) setupIconHolder(e_ICON_TYPE_IGGY); + m_controlIconHolder.setVisible( isFixedIcon || m_iconItem != NULL); return temp; } @@ -341,13 +341,13 @@ wstring UIComponent_TutorialPopup::_SetImage(wstring &desc) wstring openTag(L"{*IMAGE*}"); wstring closeTag(L"{*/IMAGE*}"); - size_t imageTagStartPos = desc.find(openTag); - size_t imageStartPos = imageTagStartPos + openTag.length(); - if( imageTagStartPos > 0 && imageStartPos < desc.length() ) + int imageTagStartPos = (int)desc.find(openTag); + int imageStartPos = imageTagStartPos + (int)openTag.length(); + if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) { - size_t imageEndPos = desc.find( closeTag, imageStartPos ); + int imageEndPos = (int)desc.find( closeTag, imageStartPos ); - if(imageEndPos > imageStartPos && imageEndPos < desc.length() ) + if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) { wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); m_image.SetImagePath( id.c_str() ); @@ -425,7 +425,7 @@ wstring UIComponent_TutorialPopup::ParseDescription(int iPad, wstring &text) void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { - if( m_interactScene == nullptr ) return; + if( m_interactScene == NULL ) return; // 4J-PB - check this players screen section to see if we should allow the animation bool bAllowAnim=false; @@ -479,20 +479,20 @@ void UIComponent_TutorialPopup::render(S32 width, S32 height, C4JRender::eViewpo switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; } //Adjust for safezone @@ -529,7 +529,7 @@ void UIComponent_TutorialPopup::render(S32 width, S32 height, C4JRender::eViewpo void UIComponent_TutorialPopup::customDraw(IggyCustomDrawCallbackRegion *region) { - if(m_iconItem != nullptr) customDrawSlotControl(region,m_iPad,m_iconItem,1.0f,m_iconItem->isFoil() || m_iconIsFoil,false); + if(m_iconItem != NULL) customDrawSlotControl(region,m_iPad,m_iconItem,1.0f,m_iconItem->isFoil() || m_iconIsFoil,false); } void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) @@ -538,7 +538,7 @@ void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) IggyDataValue result; IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(icon); + value[0].number = (F64)icon; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetupIconHolder , 1 , value ); m_iconType = icon; diff --git a/Minecraft.Client/Common/UI/UIControl.cpp b/Minecraft.Client/Common/UI/UIControl.cpp index 7582e82f..3d853ac4 100644 --- a/Minecraft.Client/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Common/UI/UIControl.cpp @@ -6,7 +6,7 @@ UIControl::UIControl() { - m_parentScene = nullptr; + m_parentScene = NULL; m_lastOpacity = 1.0f; m_controlName = ""; m_isVisible = true; @@ -31,15 +31,15 @@ bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string m_nameVisible = registerFastName(L"visible"); F64 fx, fy, fwidth, fheight; - IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , nullptr , &fx ); - IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , nullptr , &fy ); - IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , nullptr , &fwidth ); - IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , nullptr , &fheight ); + IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx ); + IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy ); + IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth ); + IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight ); - m_x = static_cast(fx); - m_y = static_cast(fy); - m_width = static_cast(Math::round(fwidth)); - m_height = static_cast(Math::round(fheight)); + m_x = (S32)fx; + m_y = (S32)fy; + m_width = (S32)Math::round(fwidth); + m_height = (S32)Math::round(fheight); return res; } @@ -47,14 +47,14 @@ bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string void UIControl::UpdateControl() { F64 fx, fy, fwidth, fheight; - IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , nullptr , &fx ); - IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , nullptr , &fy ); - IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , nullptr , &fwidth ); - IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , nullptr , &fheight ); - m_x = static_cast(fx); - m_y = static_cast(fy); - m_width = static_cast(Math::round(fwidth)); - m_height = static_cast(Math::round(fheight)); + IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx ); + IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy ); + IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth ); + IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight ); + m_x = (S32)fx; + m_y = (S32)fy; + m_width = (S32)Math::round(fwidth); + m_height = (S32)Math::round(fheight); } void UIControl::ReInit() @@ -76,7 +76,7 @@ void UIControl::ReInit() IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, m_parentScene->m_rootPath , m_funcSetAlpha , 2 , value ); } - IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, nullptr, m_isVisible ); + IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, m_isVisible ); } IggyValuePath *UIControl::getIggyValuePath() @@ -130,7 +130,7 @@ void UIControl::setVisible(bool visible) { if(visible != m_isVisible) { - rrbool succ = IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, nullptr, visible ); + rrbool succ = IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, visible ); if(succ) m_isVisible = visible; else app.DebugPrintf("Failed to set visibility for control\n"); } @@ -140,7 +140,7 @@ bool UIControl::getVisible() { rrbool bVisible = false; - IggyResult result = IggyValueGetBooleanRS ( getIggyValuePath() , m_nameVisible, nullptr, &bVisible ); + IggyResult result = IggyValueGetBooleanRS ( getIggyValuePath() , m_nameVisible, NULL, &bVisible ); m_isVisible = bVisible; diff --git a/Minecraft.Client/Common/UI/UIControl_Base.cpp b/Minecraft.Client/Common/UI/UIControl_Base.cpp index 87c2862f..7a4a24e5 100644 --- a/Minecraft.Client/Common/UI/UIControl_Base.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Base.cpp @@ -72,7 +72,7 @@ void UIControl_Base::setLabel(UIString label, bool instant, bool force) const wchar_t* UIControl_Base::getLabel() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetLabel, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetLabel, 0, NULL); if(result.type == IGGY_DATATYPE_string_UTF16) { @@ -90,7 +90,7 @@ void UIControl_Base::setAllPossibleLabels(int labelCount, wchar_t labels[][256]) for(unsigned int i = 0; i < labelCount; ++i) { - stringVal[i].string = static_cast(labels[i]); + stringVal[i].string = (IggyUTF16 *)labels[i]; stringVal[i].length = wcslen(labels[i]); value[i].type = IGGY_DATATYPE_string_UTF16; value[i].string16 = stringVal[i]; diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp index 4f0e5ca0..4d60a477 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp @@ -60,7 +60,7 @@ void UIControl_ButtonList::ReInit() void UIControl_ButtonList::clearList() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_removeAllItemsFunc , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_removeAllItemsFunc , 0 , NULL ); m_itemCount = 0; } @@ -82,7 +82,7 @@ void UIControl_ButtonList::addItem(const string &label, int data) IggyStringUTF8 stringVal; stringVal.string = (char*)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF8; value[0].string8 = stringVal; diff --git a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp index e5f4da7a..1c3e8afe 100644 --- a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp +++ b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp @@ -60,7 +60,7 @@ void UIControl_CheckBox::init(UIString label, int id, bool checked) bool UIControl_CheckBox::IsChecked() { rrbool checked = false; - IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, nullptr, &checked ); + IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, NULL, &checked ); m_bChecked = checked; return checked; } diff --git a/Minecraft.Client/Common/UI/UIControl_DLCList.cpp b/Minecraft.Client/Common/UI/UIControl_DLCList.cpp index 39f8ff39..35e6b08a 100644 --- a/Minecraft.Client/Common/UI/UIControl_DLCList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_DLCList.cpp @@ -20,7 +20,7 @@ void UIControl_DLCList::addItem(const string &label, bool showTick, int iId) IggyStringUTF8 stringVal; stringVal.string = (char*)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF8; value[0].string8 = stringVal; @@ -41,7 +41,7 @@ void UIControl_DLCList::addItem(const wstring &label, bool showTick, int iId) IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16 *)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF16; value[0].string16 = stringVal; diff --git a/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp b/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp index 8c275893..fa29a137 100644 --- a/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp @@ -74,12 +74,12 @@ void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive) S32 UIControl_DynamicLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = static_cast(result.number); + iRealWidth = (S32)result.number; } return iRealWidth; } @@ -87,12 +87,12 @@ S32 UIControl_DynamicLabel::GetRealWidth() S32 UIControl_DynamicLabel::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = static_cast(result.number); + iRealHeight = (S32)result.number; } return iRealHeight; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp index f091b0fc..9664dbf4 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp @@ -12,7 +12,7 @@ UIControl_EnchantmentBook::UIControl_EnchantmentBook() { UIControl::setControlType(UIControl::eEnchantmentBook); - model = nullptr; + model = NULL; last = nullptr; time = 0; @@ -69,12 +69,12 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region) glEnable(GL_CULL_FACE); - if(model == nullptr) + if(model == NULL) { // Share the model the the EnchantTableRenderer - EnchantTableRenderer *etr = static_cast(TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY)); - if(etr != nullptr) + EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY); + if(etr != NULL) { model = etr->bookModel; } @@ -96,7 +96,7 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region) void UIControl_EnchantmentBook::tickBook() { - UIScene_EnchantingMenu *m_containerScene = static_cast(m_parentScene); + UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene; EnchantmentMenu *menu = m_containerScene->getMenu(); shared_ptr current = menu->getSlot(0)->getItem(); if (!ItemInstance::matches(current, last)) diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp index 156f9815..f1e2735a 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp @@ -55,7 +55,7 @@ void UIControl_EnchantmentButton::tick() void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) { - UIScene_EnchantingMenu *enchantingScene = static_cast(m_parentScene); + UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene; EnchantmentMenu *menu = enchantingScene->getMenu(); float width = region->x1 - region->x0; @@ -108,7 +108,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) if (pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel < cost && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild) { col = m_textDisabledColour; - font->drawWordWrap(m_enchantmentString, 0, 0, static_cast(m_width)/ss, col, static_cast(m_height)/ss); + font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss); font = pMinecraft->font; //col = (0x80ff20 & 0xfefefe) >> 1; //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); @@ -120,7 +120,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) //col = 0xffff80; col = m_textFocusColour; } - font->drawWordWrap(m_enchantmentString, 0, 0, static_cast(m_width)/ss, col, static_cast(m_height)/ss); + font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss); font = pMinecraft->font; //col = 0x80ff20; //font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col); @@ -137,7 +137,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region) void UIControl_EnchantmentButton::updateState() { - UIScene_EnchantingMenu *enchantingScene = static_cast(m_parentScene); + UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene; EnchantmentMenu *menu = enchantingScene->getMenu(); EState state = eState_Inactive; @@ -182,7 +182,7 @@ void UIControl_EnchantmentButton::updateState() IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(state); + value[0].number = (int)state; IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value ); if(out == IGGY_RESULT_SUCCESS) m_lastState = state; diff --git a/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp b/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp index b6bd3e47..8b7eb9a1 100644 --- a/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp @@ -23,7 +23,7 @@ bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, co void UIControl_HTMLLabel::startAutoScroll() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , NULL ); } void UIControl_HTMLLabel::ReInit() @@ -79,12 +79,12 @@ void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive) S32 UIControl_HTMLLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = static_cast(result.number); + iRealWidth = (S32)result.number; } return iRealWidth; } @@ -92,12 +92,12 @@ S32 UIControl_HTMLLabel::GetRealWidth() S32 UIControl_HTMLLabel::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = static_cast(result.number); + iRealHeight = (S32)result.number; } return iRealHeight; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp b/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp index 3920e004..c34b5e87 100644 --- a/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp @@ -45,7 +45,7 @@ void UIControl_LeaderboardList::ReInit() void UIControl_LeaderboardList::clearList() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , NULL ); } void UIControl_LeaderboardList::setupTitles(const wstring &rank, const wstring &gamertag) diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp index 25fc0316..457e2028 100644 --- a/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp +++ b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp @@ -27,10 +27,10 @@ UIControl_MinecraftHorse::UIControl_MinecraftHorse() Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; } void UIControl_MinecraftHorse::render(IggyCustomDrawCallbackRegion *region) @@ -49,7 +49,7 @@ void UIControl_MinecraftHorse::render(IggyCustomDrawCallbackRegion *region) glTranslatef(xo, yo - (height / 7.5f), 50.0f); //UIScene_InventoryMenu *containerMenu = (UIScene_InventoryMenu *)m_parentScene; - UIScene_HorseInventoryMenu *containerMenu = static_cast(m_parentScene); + UIScene_HorseInventoryMenu *containerMenu = (UIScene_HorseInventoryMenu *)m_parentScene; shared_ptr entityHorse = containerMenu->m_horse; diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp b/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp index ae65ac2b..d0625bce 100644 --- a/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp +++ b/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp @@ -19,10 +19,10 @@ UIControl_MinecraftPlayer::UIControl_MinecraftPlayer() Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; } void UIControl_MinecraftPlayer::render(IggyCustomDrawCallbackRegion *region) @@ -49,7 +49,7 @@ void UIControl_MinecraftPlayer::render(IggyCustomDrawCallbackRegion *region) glScalef(-ss, ss, ss); glRotatef(180, 0, 0, 1); - UIScene_InventoryMenu *containerMenu = static_cast(m_parentScene); + UIScene_InventoryMenu *containerMenu = (UIScene_InventoryMenu *)m_parentScene; float oybr = pMinecraft->localplayers[containerMenu->getPad()]->yBodyRot; float oyr = pMinecraft->localplayers[containerMenu->getPad()]->yRot; diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp index 0703919f..41534dc2 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp @@ -21,7 +21,7 @@ void UIControl_PlayerList::addItem(const wstring &label, int iPlayerIcon, int iV IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF16; value[0].string16 = stringVal; diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index b8c439b1..d74bd185 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -23,10 +23,10 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; m_customTextureUrl = L"default"; m_backupTexture = TN_MOB_CHAR; @@ -55,7 +55,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() m_fOriginalRotation = 0.0f; m_framesAnimatingRotation = 0; m_bAnimatingToFacing = false; - m_pvAdditionalModelParts=nullptr; + m_pvAdditionalModelParts=NULL; m_uiAnimOverrideBitmask=0L; } @@ -167,7 +167,7 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni void UIControl_PlayerSkinPreview::CycleNextAnimation() { - m_currentAnimation = static_cast(m_currentAnimation + 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1); if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking; m_swingTime = 0.0f; @@ -175,8 +175,8 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation() void UIControl_PlayerSkinPreview::CyclePreviousAnimation() { - m_currentAnimation = static_cast(m_currentAnimation - 1); - if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast(e_SkinPreviewAnimation_Count - 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); + if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); m_swingTime = 0.0f; } @@ -210,7 +210,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) Lighting::turnOn(); //glRotatef(-45 - 90, 0, 1, 0); - glRotatef(-static_cast(m_xRot), 1, 0, 0); + glRotatef(-(float)m_xRot, 1, 0, 0); // 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen bool wasHidingGui = pMinecraft->options->hideGui; @@ -218,7 +218,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) //EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1); EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER); - if (renderer != nullptr) + if (renderer != NULL) { // 4J-PB - any additional parts to turn on for this player (skin dependent) //vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); @@ -257,12 +257,12 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou glPushMatrix(); glDisable(GL_CULL_FACE); - HumanoidModel *model = static_cast(renderer->getModel()); + HumanoidModel *model = (HumanoidModel *)renderer->getModel(); //getAttackAnim(mob, a); - //if (armor != nullptr) armor->attackTime = model->attackTime; + //if (armor != NULL) armor->attackTime = model->attackTime; //model->riding = mob->isRiding(); - //if (armor != nullptr) armor->riding = model->riding; + //if (armor != NULL) armor->riding = model->riding; // 4J Stu - Remember to reset these values once the rendering is done if you add another one model->attackTime = 0; @@ -292,7 +292,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou { m_swingTime = 0; } - model->attackTime = m_swingTime / static_cast(Player::SWING_DURATION * 3); + model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3); break; default: break; @@ -306,7 +306,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou //setupPosition(mob, x, y, z); // is equivalent to - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); //float bob = getBob(mob, a); #ifdef SKIN_PREVIEW_BOB_ANIM @@ -383,11 +383,11 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou double xa = sin(yr * PI / 180); double za = -cos(yr * PI / 180); - float flap = static_cast(yd) * 10; + float flap = (float) yd * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = static_cast(xd * xa + zd * za) * 100; - float lean2 = static_cast(xd * za - zd * xa) * 100; + float lean = (float) (xd * xa + zd * za) * 100; + float lean2 = (float) (xd * za - zd * xa) * 100; if (lean < 0) lean = 0; //float pow = 1;//mob->oBob + (bob - mob->oBob) * a; diff --git a/Minecraft.Client/Common/UI/UIControl_Progress.cpp b/Minecraft.Client/Common/UI/UIControl_Progress.cpp index 20dc1ff7..78e7c1d0 100644 --- a/Minecraft.Client/Common/UI/UIControl_Progress.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Progress.cpp @@ -53,7 +53,7 @@ void UIControl_Progress::setProgress(int current) { m_current = current; - float percent = static_cast((m_current - m_min))/(m_max-m_min); + float percent = (float)((m_current-m_min))/(m_max-m_min); if(percent != m_lastPercent) { diff --git a/Minecraft.Client/Common/UI/UIControl_SaveList.cpp b/Minecraft.Client/Common/UI/UIControl_SaveList.cpp index 5ae9c8f0..f83454d7 100644 --- a/Minecraft.Client/Common/UI/UIControl_SaveList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_SaveList.cpp @@ -52,7 +52,7 @@ void UIControl_SaveList::addItem(const string &label, const wstring &iconName, i IggyStringUTF8 stringVal; stringVal.string = (char*)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF8; value[0].string8 = stringVal; @@ -74,7 +74,7 @@ void UIControl_SaveList::addItem(const wstring &label, const wstring &iconName, IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = static_cast(label.length()); + stringVal.length = (S32)label.length(); value[0].type = IGGY_DATATYPE_string_UTF16; value[0].string16 = stringVal; diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp index 2d56a29c..c2168002 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -92,12 +92,12 @@ void UIControl_Slider::SetSliderTouchPos(float fTouchPos) S32 UIControl_Slider::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth , 0 , NULL ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = static_cast(result.number); + iRealWidth = (S32)result.number; } return iRealWidth; } diff --git a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp index 75bbac29..653b0592 100644 --- a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp +++ b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp @@ -63,7 +63,7 @@ void UIControl_SpaceIndicatorBar::reset() void UIControl_SpaceIndicatorBar::addSave(int64_t size) { - float startPercent = static_cast((m_currentTotal - m_min))/(m_max-m_min); + float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min); m_sizeAndOffsets.push_back( pair(size, startPercent) ); @@ -90,7 +90,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size) { m_currentSave = size; - float percent = static_cast((m_currentSave - m_min))/(m_max-m_min); + float percent = (float)((m_currentSave-m_min))/(m_max-m_min); IggyDataValue result; IggyDataValue value[1]; @@ -101,7 +101,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size) void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size) { - float percent = static_cast((m_currentTotal - m_min))/(m_max-m_min); + float percent = (float)((m_currentTotal-m_min))/(m_max-m_min); IggyDataValue result; IggyDataValue value[1]; diff --git a/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp b/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp index 7f721493..02336e00 100644 --- a/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp @@ -83,7 +83,7 @@ void UIControl_TexturePackList::selectSlot(int id) void UIControl_TexturePackList::clearSlots() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , NULL ); } void UIControl_TexturePackList::setEnabled(bool enable) @@ -125,7 +125,7 @@ bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) S32 bCanTouchTrigger = false; if(result.type == IGGY_DATATYPE_boolean) { - bCanTouchTrigger = static_cast(result.boolval); + bCanTouchTrigger = (bool)result.boolval; } return bCanTouchTrigger; } @@ -133,12 +133,12 @@ bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) S32 UIControl_TexturePackList::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = static_cast(result.number); + iRealHeight = (S32)result.number; } return iRealHeight; } diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 3da1b11a..840ed389 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -61,14 +61,14 @@ DWORD UIController::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; static UIControl_Slider *FindSliderById(UIScene *pScene, int sliderId) { vector *controls = pScene->GetControls(); - if (!controls) return nullptr; + if (!controls) return NULL; for (size_t i = 0; i < controls->size(); ++i) { UIControl *ctrl = (*controls)[i]; if (ctrl && ctrl->getControlType() == UIControl::eSlider && ctrl->getId() == sliderId) - return static_cast(ctrl); + return (UIControl_Slider *)ctrl; } - return nullptr; + return NULL; } #endif @@ -148,7 +148,7 @@ int64_t UIController::iggyAllocCount = 0; static unordered_map allocations; static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned ) { - UIController *controller = static_cast(alloc_callback_user_data); + UIController *controller = (UIController *)alloc_callback_user_data; EnterCriticalSection(&controller->m_Allocatorlock); #ifdef EXCLUDE_IGGY_ALLOCATIONS_FROM_HEAP_INSPECTOR void *alloc = __real_malloc(size_requested); @@ -165,7 +165,7 @@ static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_ static void RADLINK DeallocateFunction ( void * alloc_callback_user_data , void * ptr ) { - UIController *controller = static_cast(alloc_callback_user_data); + UIController *controller = (UIController *)alloc_callback_user_data; EnterCriticalSection(&controller->m_Allocatorlock); size_t size = allocations[ptr]; UIController::iggyAllocCount -= size; @@ -181,15 +181,15 @@ static void RADLINK DeallocateFunction ( void * alloc_callback_user_data , void UIController::UIController() { - m_uiDebugConsole = nullptr; - m_reloadSkinThread = nullptr; + m_uiDebugConsole = NULL; + m_reloadSkinThread = NULL; m_navigateToHomeOnReload = false; m_bCleanupOnReload = false; - m_mcTTFFont = nullptr; - m_moj7 = nullptr; - m_moj11 = nullptr; + m_mcTTFFont = NULL; + m_moj7 = NULL; + m_moj11 = NULL; // 4J-JEV: It's important that these remain the same, unless updateCurrentLanguage is going to be called. m_eCurrentFont = m_eTargetFont = eFont_NotLoaded; @@ -270,7 +270,7 @@ void UIController::SetSysUIShowing(bool bVal) void UIController::SetSystemUIShowing(LPVOID lpParam,bool bVal) { - UIController *pClass=static_cast(lpParam); + UIController *pClass=(UIController *)lpParam; pClass->SetSysUIShowing(bVal); } @@ -310,13 +310,13 @@ void UIController::postInit() for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) { - m_groups[i] = new UIGroup(static_cast(i),i-1); + m_groups[i] = new UIGroup((EUIGroup)i,i-1); } #ifdef ENABLE_IGGY_EXPLORER iggy_explorer = IggyExpCreate("127.0.0.1", 9190, malloc(IGGYEXP_MIN_STORAGE), IGGYEXP_MIN_STORAGE); - if ( iggy_explorer == nullptr ) + if ( iggy_explorer == NULL ) { // not normally an error, just an error for this demo! app.DebugPrintf( "Couldn't connect to Iggy Explorer, did you run it first?" ); @@ -329,7 +329,7 @@ void UIController::postInit() #ifdef ENABLE_IGGY_PERFMON m_iggyPerfmonEnabled = false; - iggy_perfmon = IggyPerfmonCreate(perf_malloc, perf_free, nullptr); + iggy_perfmon = IggyPerfmonCreate(perf_malloc, perf_free, NULL); IggyInstallPerfmon(iggy_perfmon); #endif @@ -370,7 +370,7 @@ UITTFFont *UIController::createFont(EFont fontLanguage) #endif // 4J-JEV, Cyrillic characters have been added to this font now, (4/July/14) // XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK: - default: return nullptr; + default: return NULL; } } @@ -397,17 +397,17 @@ void UIController::SetupFont() if (m_eCurrentFont != eFont_NotLoaded) app.DebugPrintf("[UIController] Font switch required for language transition to %i.\n", nextLanguage); else app.DebugPrintf("[UIController] Initialising font for language %i.\n", nextLanguage); - if (m_mcTTFFont != nullptr) + if (m_mcTTFFont != NULL) { delete m_mcTTFFont; - m_mcTTFFont = nullptr; + m_mcTTFFont = NULL; } if(m_eTargetFont == eFont_Bitmap) { // these may have been set up by a previous language being chosen - if (m_moj7 == nullptr) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); - if (m_moj11 == nullptr) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11); + if (m_moj7 == NULL) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); + if (m_moj11 == NULL) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11); // 4J-JEV: Ensure we redirect to them correctly, even if the objects were previously initialised. m_moj7->registerFont(); @@ -615,7 +615,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN if(!skinPath.empty() && app.hasArchiveFile(skinPath)) { byteArray baFile = app.getArchiveFile(skinPath); - lib = IggyLibraryCreateFromMemoryUTF16( (IggyUTF16 *)skinName.c_str() , (void *)baFile.data, baFile.length, nullptr ); + lib = IggyLibraryCreateFromMemoryUTF16( (IggyUTF16 *)skinName.c_str() , (void *)baFile.data, baFile.length, NULL ); delete[] baFile.data; #ifdef _DEBUG @@ -623,12 +623,12 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN rrbool res; int iteration = 0; int64_t totalStatic = 0; - while(res = IggyDebugGetMemoryUseInfo (nullptr, - lib , - "" , - 0 , - iteration , - &memoryInfo )) + while(res = IggyDebugGetMemoryUseInfo ( NULL , + lib , + "" , + 0 , + iteration , + &memoryInfo )) { totalStatic += memoryInfo.static_allocation_bytes; app.DebugPrintf(app.USER_SR, "%ls - %.*s, static: %dB, dynamic: %dB\n", skinPath.c_str(), memoryInfo.subcategory_stringlen, memoryInfo.subcategory, memoryInfo.static_allocation_bytes, memoryInfo.dynamic_allocation_bytes); @@ -692,7 +692,7 @@ void UIController::StartReloadSkinThread() int UIController::reloadSkinThreadProc(void* lpParam) { EnterCriticalSection(&ms_reloadSkinCS); // MGH - added to prevent crash loading Iggy movies while the skins were being reloaded - UIController *controller = static_cast(lpParam); + UIController *controller = (UIController *)lpParam; // Load new skin controller->loadSkins(); @@ -727,7 +727,7 @@ bool UIController::IsExpectingOrReloadingSkin() void UIController::CleanUpSkinReload() { delete m_reloadSkinThread; - m_reloadSkinThread = nullptr; + m_reloadSkinThread = NULL; if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { @@ -787,28 +787,26 @@ void UIController::tickInput() #endif { #ifdef _WINDOWS64 - m_mouseClickConsumedByScene = false; - if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) - { - UIScene *pScene = nullptr; - - // Search by layer priority across all groups (layer-first). - // Tooltip layer is skipped because it holds non-interactive - // overlays (button hints, timer) that should never capture mouse. - // Old group-first order found those tooltips on eUIGroup_Fullscreen - // before reaching in-game menus on eUIGroup_Player1. - static const EUILayer mouseLayers[] = { + m_mouseClickConsumedByScene = false; + if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) + { + UIScene *pScene = NULL; + // Search by layer priority across all groups (layer-first). + // Tooltip layer is skipped because it holds non-interactive + // overlays (button hints, timer) that should never capture mouse. + // Old group-first order found those tooltips on eUIGroup_Fullscreen + // before reaching in-game menus on eUIGroup_Player1. + static const EUILayer mouseLayers[] = { #ifndef _CONTENT_PACKAGE - eUILayer_Debug, + eUILayer_Debug, #endif - eUILayer_Error, - eUILayer_Alert, - eUILayer_Popup, - eUILayer_Fullscreen, - eUILayer_Scene, - }; - - for (int l = 0; l < _countof(mouseLayers) && !pScene; ++l) + eUILayer_Error, + eUILayer_Alert, + eUILayer_Popup, + eUILayer_Fullscreen, + eUILayer_Scene, + }; + for (int l = 0; l < _countof(mouseLayers) && !pScene; ++l) { for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) { @@ -816,25 +814,9 @@ void UIController::tickInput() } } if (pScene && pScene->getMovie()) - { - int rawMouseX = g_KBMInput.GetMouseX(); - int rawMouseY = g_KBMInput.GetMouseY(); - F32 mouseX = static_cast(rawMouseX); - F32 mouseY = static_cast(rawMouseY); - - extern HWND g_hWnd; - if (g_hWnd) - { - RECT rc; - GetClientRect(g_hWnd, &rc); - int winW = rc.right - rc.left; - int winH = rc.bottom - rc.top; - if (winW > 0 && winH > 0) - { - mouseX = mouseX * (m_fScreenWidth / static_cast(winW)); - mouseY = mouseY * (m_fScreenHeight / static_cast(winH)); - } - } + { + int rawMouseX = g_KBMInput.GetMouseX(); + int rawMouseY = g_KBMInput.GetMouseY(); // Only update hover focus when the mouse has actually moved, // so that mouse-wheel scrolling can change list selection @@ -1034,7 +1016,7 @@ void UIController::tickInput() if (pMainPanel && ctrl->getParentPanel() != pMainPanel) continue; - UIControl_Slider *pSlider = static_cast(ctrl); + UIControl_Slider *pSlider = (UIControl_Slider *)ctrl; pSlider->UpdateControl(); S32 cx = pSlider->getXPos() + panelOffsetX; S32 cy = pSlider->getYPos() + panelOffsetY; @@ -1063,7 +1045,7 @@ void UIController::tickInput() S32 sliderWidth = pSlider->GetRealWidth(); if (sliderWidth > 0) { - float fNewSliderPos = (sceneMouseX - static_cast(sliderX)) / static_cast(sliderWidth); + float fNewSliderPos = (sceneMouseX - (float)sliderX) / (float)sliderWidth; if (fNewSliderPos < 0.0f) fNewSliderPos = 0.0f; if (fNewSliderPos > 1.0f) fNewSliderPos = 1.0f; pSlider->SetSliderTouchPos(fNewSliderPos); @@ -1150,7 +1132,7 @@ void UIController::handleInput() if(ProfileManager.GetLockedProfile() >= 0 && !InputManager.IsPadLocked( ProfileManager.GetLockedProfile() ) && firstUnfocussedUnhandledPad >= 0) { - ProfileManager.RequestSignInUI(false, false, false, false, true, nullptr, nullptr, firstUnfocussedUnhandledPad ); + ProfileManager.RequestSignInUI(false, false, false, false, true, NULL, NULL, firstUnfocussedUnhandledPad ); } } #endif @@ -1177,8 +1159,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) if((m_bTouchscreenPressed==false) && pTouchData->reportNum==1) { // no active touch? clear active and highlighted touch UI elements - m_ActiveUIElement = nullptr; - m_HighlightedUIElement = nullptr; + m_ActiveUIElement = NULL; + m_HighlightedUIElement = NULL; // fullscreen first UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene(); @@ -1478,7 +1460,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) IggyMemoryUseInfo memoryInfo; rrbool res; int iteration = 0; - while(res = IggyDebugGetMemoryUseInfo ( nullptr , + while(res = IggyDebugGetMemoryUseInfo ( NULL , m_iggyLibraries[i] , "" , 0 , @@ -1509,7 +1491,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) bool handled = false; // Send the key to the fullscreen group first - m_groups[static_cast(eUIGroup_Fullscreen)]->handleInput(iPad, key, repeat, pressed, released, handled); + m_groups[(int)eUIGroup_Fullscreen]->handleInput(iPad, key, repeat, pressed, released, handled); if(!handled) { // If it's not been handled yet, then pass the event onto the players specific group @@ -1520,9 +1502,9 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) rrbool RADLINK UIController::ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call) { - UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); + UIScene *scene = (UIScene *)IggyPlayerGetUserdata(player); - if(scene != nullptr) + if(scene != NULL) { scene->externalCallback(call); } @@ -1587,25 +1569,25 @@ void UIController::getRenderDimensions(C4JRender::eViewportType viewport, S32 &w switch( viewport ) { case C4JRender::VIEWPORT_TYPE_FULLSCREEN: - width = static_cast(getScreenWidth()); - height = static_cast(getScreenHeight()); + width = (S32)(getScreenWidth()); + height = (S32)(getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - width = static_cast(getScreenWidth() / 2); - height = static_cast(getScreenHeight() / 2); + width = (S32)(getScreenWidth() / 2); + height = (S32)(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - width = static_cast(getScreenWidth() / 2); - height = static_cast(getScreenHeight() / 2); + width = (S32)(getScreenWidth() / 2); + height = (S32)(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - width = static_cast(getScreenWidth() / 2); - height = static_cast(getScreenHeight() / 2); + width = (S32)(getScreenWidth() / 2); + height = (S32)(getScreenHeight() / 2); break; } } @@ -1621,30 +1603,30 @@ void UIController::setupRenderPosition(C4JRender::eViewportType viewport) switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - xPos = static_cast(getScreenWidth() / 4); + xPos = (S32)(getScreenWidth() / 4); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - xPos = static_cast(getScreenWidth() / 4); - yPos = static_cast(getScreenHeight() / 2); + xPos = (S32)(getScreenWidth() / 4); + yPos = (S32)(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - yPos = static_cast(getScreenHeight() / 4); + yPos = (S32)(getScreenHeight() / 4); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - xPos = static_cast(getScreenWidth() / 2); - yPos = static_cast(getScreenHeight() / 4); + xPos = (S32)(getScreenWidth() / 2); + yPos = (S32)(getScreenHeight() / 4); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(getScreenWidth() / 2); + xPos = (S32)(getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(getScreenHeight() / 2); + yPos = (S32)(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(getScreenWidth() / 2); - yPos = static_cast(getScreenHeight() / 2); + xPos = (S32)(getScreenWidth() / 2); + yPos = (S32)(getScreenHeight() / 2); break; } m_tileOriginX = xPos; @@ -1709,8 +1691,8 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo Minecraft *pMinecraft=Minecraft::GetInstance(); // Clear just the region required for this control. - float sceneWidth = static_cast(scene->getRenderWidth()); - float sceneHeight = static_cast(scene->getRenderHeight()); + float sceneWidth = (float)scene->getRenderWidth(); + float sceneHeight = (float)scene->getRenderHeight(); LONG left, right, top, bottom; #ifdef __PS3__ @@ -1738,10 +1720,10 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo if(!m_bScreenWidthSetup) { Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != nullptr) + if(pMinecraft != NULL) { - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fScreenHeight=static_cast(pMinecraft->height_phys); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fScreenHeight=(float)pMinecraft->height_phys; m_bScreenWidthSetup = true; } } @@ -1785,9 +1767,9 @@ void UIController::endCustomDrawGameStateAndMatrices() void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *player, IggyCustomDrawCallbackRegion *region) { - UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); + UIScene *scene = (UIScene *)IggyPlayerGetUserdata(player); - if(scene != nullptr) + if(scene != NULL) { scene->customDraw(region); } @@ -1799,7 +1781,7 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl //width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). -//return - A platform-independent wrapped texture handle provided by GDraw, or nullptr (nullptr with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. +//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. // //Discussion // @@ -1814,7 +1796,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length); BufferedImage image(it->second.data, it->second.length); - if( image.getData() != nullptr ) + if( image.getData() != NULL ) { image.preMultiplyAlpha(); Textures *t = Minecraft::GetInstance()->textures; @@ -1832,18 +1814,18 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * #endif *destroy_callback_data = (void *)id; - app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", static_cast(texture_name), id, image.getWidth(), image.getHeight()); + app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", (wchar_t *)texture_name, id, image.getWidth(), image.getHeight()); return ui.getSubstitutionTexture(id); } else { - return nullptr; + return NULL; } } else { - app.DebugPrintf("Could not find substitution texture %ls\n", static_cast(texture_name)); - return nullptr; + app.DebugPrintf("Could not find substitution texture %ls\n", (wchar_t *)texture_name); + return NULL; } } @@ -1853,7 +1835,7 @@ void RADLINK UIController::TextureSubstitutionDestroyCallback ( void * user_call { // Orbis complains about casting a pointer to an int LONGLONG llVal=(LONGLONG)destroy_callback_data; - int id=static_cast(llVal); + int id=(int)llVal; app.DebugPrintf("Destroying iggy texture %d\n", id); ui.destroySubstitutionTexture(user_callback_data, handle); @@ -1955,7 +1937,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI if( ( iPad != 255 ) && ( iPad >= 0 ) ) { menuDisplayedPad = iPad; - group = static_cast(iPad + 1); + group = (EUIGroup)(iPad+1); } else group = eUIGroup_Fullscreen; } @@ -1970,7 +1952,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI EnterCriticalSection(&m_navigationLock); SetMenuDisplayed(menuDisplayedPad,true); - bool success = m_groups[static_cast(group)]->NavigateToScene(iPad, scene, initData, layer); + bool success = m_groups[(int)group]->NavigateToScene(iPad, scene, initData, layer); if(success && group == eUIGroup_Fullscreen) setFullscreenMenuDisplayed(true); LeaveCriticalSection(&m_navigationLock); @@ -1985,18 +1967,18 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI bool navComplete = false; if( app.GetGameStarted() ) { - bool navComplete = m_groups[static_cast(eUIGroup_Fullscreen)]->NavigateBack(iPad, eScene, eLayer); + bool navComplete = m_groups[(int)eUIGroup_Fullscreen]->NavigateBack(iPad, eScene, eLayer); if(!navComplete && ( iPad != 255 ) && ( iPad >= 0 ) ) { - EUIGroup group = static_cast(iPad + 1); - navComplete = m_groups[static_cast(group)]->NavigateBack(iPad, eScene, eLayer); - if(!m_groups[static_cast(group)]->GetMenuDisplayed())SetMenuDisplayed(iPad,false); + EUIGroup group = (EUIGroup)(iPad+1); + navComplete = m_groups[(int)group]->NavigateBack(iPad, eScene, eLayer); + if(!m_groups[(int)group]->GetMenuDisplayed())SetMenuDisplayed(iPad,false); } // 4J-PB - autosave in fullscreen doesn't clear the menuDisplayed flag else { - if(!m_groups[static_cast(eUIGroup_Fullscreen)]->GetMenuDisplayed()) + if(!m_groups[(int)eUIGroup_Fullscreen]->GetMenuDisplayed()) { setFullscreenMenuDisplayed(false); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) @@ -2008,8 +1990,8 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI } else { - navComplete = m_groups[static_cast(eUIGroup_Fullscreen)]->NavigateBack(iPad, eScene, eLayer); - if(!m_groups[static_cast(eUIGroup_Fullscreen)]->GetMenuDisplayed()) SetMenuDisplayed(XUSER_INDEX_ANY,false); + navComplete = m_groups[(int)eUIGroup_Fullscreen]->NavigateBack(iPad, eScene, eLayer); + if(!m_groups[(int)eUIGroup_Fullscreen]->GetMenuDisplayed()) SetMenuDisplayed(XUSER_INDEX_ANY,false); } return navComplete; } @@ -2030,11 +2012,11 @@ void UIController::NavigateToHomeMenu() TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=nullptr; + DLCTexturePack *pDLCTexPack=NULL; if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it - pDLCTexPack=static_cast(pTexPack); + pDLCTexPack=(DLCTexturePack *)pTexPack; } // change to the default texture pack @@ -2051,11 +2033,11 @@ void UIController::NavigateToHomeMenu() eStream_CD_1); pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); - // if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) + // if(pDLCTexPack->m_pStreamedWaveBank!=NULL) // { // pDLCTexPack->m_pStreamedWaveBank->Destroy(); // } - // if(pDLCTexPack->m_pSoundBank!=nullptr) + // if(pDLCTexPack->m_pSoundBank!=NULL) // { // pDLCTexPack->m_pSoundBank->Destroy(); // } @@ -2089,7 +2071,7 @@ UIScene *UIController::GetTopScene(int iPad, EUILayer layer, EUIGroup group) // If the game isn't running treat as user 0, otherwise map index directly from pad if( ( iPad != 255 ) && ( iPad >= 0 ) ) { - group = static_cast(iPad + 1); + group = (EUIGroup)(iPad+1); } else group = eUIGroup_Fullscreen; } @@ -2099,7 +2081,7 @@ UIScene *UIController::GetTopScene(int iPad, EUILayer layer, EUIGroup group) group = eUIGroup_Fullscreen; } } - return m_groups[static_cast(group)]->GetTopScene(layer); + return m_groups[(int)group]->GetTopScene(layer); } size_t UIController::RegisterForCallbackId(UIScene *scene) @@ -2126,7 +2108,7 @@ void UIController::UnregisterCallbackId(size_t id) UIScene *UIController::GetSceneFromCallbackId(size_t id) { - UIScene *scene = nullptr; + UIScene *scene = NULL; auto it = m_registeredCallbackScenes.find(id); if(it != m_registeredCallbackScenes.end() ) { @@ -2147,7 +2129,7 @@ void UIController::LeaveCallbackIdCriticalSection() void UIController::CloseAllPlayersScenes() { - m_groups[static_cast(eUIGroup_Fullscreen)]->getTooltips()->SetTooltips(-1); + m_groups[(int)eUIGroup_Fullscreen]->getTooltips()->SetTooltips(-1); for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) { //m_bCloseAllScenes[i] = true; @@ -2170,7 +2152,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) if( app.GetGameStarted() || forceIPad ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2178,22 +2160,22 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) group = eUIGroup_Fullscreen; } - m_groups[static_cast(group)]->closeAllScenes(); - m_groups[static_cast(group)]->getTooltips()->SetTooltips(-1); + m_groups[(int)group]->closeAllScenes(); + m_groups[(int)group]->getTooltips()->SetTooltips(-1); // This should cause the popup to dissappear TutorialPopupInfo popupInfo; - if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetTutorialDescription(&popupInfo); + if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo); if(group==eUIGroup_Fullscreen) setFullscreenMenuDisplayed(false); - SetMenuDisplayed((group == eUIGroup_Fullscreen ? XUSER_INDEX_ANY : iPad), m_groups[static_cast(group)]->GetMenuDisplayed()); + SetMenuDisplayed((group == eUIGroup_Fullscreen ? XUSER_INDEX_ANY : iPad), m_groups[(int)group]->GetMenuDisplayed()); } void UIController::setFullscreenMenuDisplayed(bool displayed) { // Show/hide the tooltips for the fullscreen group - m_groups[static_cast(eUIGroup_Fullscreen)]->showComponent(ProfileManager.GetPrimaryPad(),eUIComponent_Tooltips,eUILayer_Tooltips,displayed); + m_groups[(int)eUIGroup_Fullscreen]->showComponent(ProfileManager.GetPrimaryPad(),eUIComponent_Tooltips,eUILayer_Tooltips,displayed); // Show/hide tooltips for the other layers for(unsigned int i = (eUIGroup_Fullscreen+1); i < eUIGroup_COUNT; ++i) @@ -2208,14 +2190,14 @@ bool UIController::IsPauseMenuDisplayed(int iPad) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[static_cast(group)]->IsPauseMenuDisplayed(); + return m_groups[(int)group]->IsPauseMenuDisplayed(); } bool UIController::IsContainerMenuDisplayed(int iPad) @@ -2224,14 +2206,14 @@ bool UIController::IsContainerMenuDisplayed(int iPad) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[static_cast(group)]->IsContainerMenuDisplayed(); + return m_groups[(int)group]->IsContainerMenuDisplayed(); } bool UIController::IsIgnorePlayerJoinMenuDisplayed(int iPad) @@ -2240,14 +2222,14 @@ bool UIController::IsIgnorePlayerJoinMenuDisplayed(int iPad) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[static_cast(group)]->IsIgnorePlayerJoinMenuDisplayed(); + return m_groups[(int)group]->IsIgnorePlayerJoinMenuDisplayed(); } bool UIController::IsIgnoreAutosaveMenuDisplayed(int iPad) @@ -2256,14 +2238,14 @@ bool UIController::IsIgnoreAutosaveMenuDisplayed(int iPad) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[static_cast(eUIGroup_Fullscreen)]->IsIgnoreAutosaveMenuDisplayed() || (group != eUIGroup_Fullscreen && m_groups[static_cast(group)]->IsIgnoreAutosaveMenuDisplayed()); + return m_groups[(int)eUIGroup_Fullscreen]->IsIgnoreAutosaveMenuDisplayed() || (group != eUIGroup_Fullscreen && m_groups[(int)group]->IsIgnoreAutosaveMenuDisplayed()); } void UIController::SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) @@ -2277,14 +2259,14 @@ bool UIController::IsSceneInStack(int iPad, EUIScene eScene) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[static_cast(group)]->IsSceneInStack(eScene); + return m_groups[(int)group]->IsSceneInStack(eScene); } bool UIController::GetMenuDisplayed(int iPad) @@ -2365,14 +2347,14 @@ void UIController::SetTooltipText( unsigned int iPad, unsigned int tooltip, int if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->SetTooltipText(tooltip, iTextID); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltipText(tooltip, iTextID); } void UIController::SetEnableTooltips( unsigned int iPad, BOOL bVal ) @@ -2381,14 +2363,14 @@ void UIController::SetEnableTooltips( unsigned int iPad, BOOL bVal ) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->SetEnableTooltips(bVal); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetEnableTooltips(bVal); } void UIController::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) @@ -2397,14 +2379,14 @@ void UIController::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool sh if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->ShowTooltip(tooltip,show); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->ShowTooltip(tooltip,show); } void UIController::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY, int iLT, int iRT, int iLB, int iRB, int iLS, int iRS, int iBack, bool forceUpdate) @@ -2426,14 +2408,14 @@ void UIController::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int i if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->SetTooltips(iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, iRS, iBack, forceUpdate); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltips(iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, iRS, iBack, forceUpdate); } void UIController::EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) @@ -2442,14 +2424,14 @@ void UIController::EnableTooltip( unsigned int iPad, unsigned int tooltip, bool if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->EnableTooltip(tooltip,enable); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->EnableTooltip(tooltip,enable); } void UIController::RefreshTooltips(unsigned int iPad) @@ -2468,7 +2450,7 @@ void UIController::AnimateKeyPress(int iPad, int iAction, bool bRepeat, bool bPr if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2476,7 +2458,7 @@ void UIController::AnimateKeyPress(int iPad, int iAction, bool bRepeat, bool bPr group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->handleInput(iPad, iAction, bRepeat, bPressed, bReleased, handled); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->handleInput(iPad, iAction, bRepeat, bPressed, bReleased, handled); } void UIController::OverrideSFX(int iPad, int iAction,bool bVal) @@ -2486,7 +2468,7 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2494,7 +2476,7 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal) group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->overrideSFX(iPad, iAction,bVal); + if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->overrideSFX(iPad, iAction,bVal); } void UIController::PlayUISFX(ESoundEffect eSound) @@ -2522,13 +2504,13 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) { show = false; } - EUIGroup group = static_cast(iPad + 1); - if(m_groups[static_cast(group)]->getHUD()) m_groups[static_cast(group)]->getHUD()->ShowDisplayName(show); + EUIGroup group = (EUIGroup)(iPad+1); + if(m_groups[(int)group]->getHUD()) m_groups[(int)group]->getHUD()->ShowDisplayName(show); // Update TutorialPopup in Splitscreen if no container is displayed (to make sure the Popup does not overlap with the Gamertag!) - if(app.GetLocalPlayerCount() > 1 && m_groups[static_cast(group)]->getTutorialPopup() && !m_groups[static_cast(group)]->IsContainerMenuDisplayed()) + if(app.GetLocalPlayerCount() > 1 && m_groups[(int)group]->getTutorialPopup() && !m_groups[(int)group]->IsContainerMenuDisplayed()) { - m_groups[static_cast(group)]->getTutorialPopup()->UpdateTutorialPopup(); + m_groups[(int)group]->getTutorialPopup()->UpdateTutorialPopup(); } } @@ -2539,7 +2521,7 @@ void UIController::SetSelectedItem(unsigned int iPad, const wstring &name) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2547,7 +2529,7 @@ void UIController::SetSelectedItem(unsigned int iPad, const wstring &name) group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[static_cast(group)]->getHUD()) m_groups[static_cast(group)]->getHUD()->SetSelectedLabel(name); + if(m_groups[(int)group]->getHUD()) m_groups[(int)group]->getHUD()->SetSelectedLabel(name); } void UIController::UpdateSelectedItemPos(unsigned int iPad) @@ -2600,10 +2582,10 @@ void UIController::HandleInventoryUpdated(int iPad) EUIGroup group = eUIGroup_Fullscreen; if( app.GetGameStarted() && ( iPad != 255 ) && ( iPad >= 0 ) ) { - group = static_cast(iPad + 1); + group = (EUIGroup)(iPad+1); } - m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, nullptr); + m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, NULL); } void UIController::HandleGameTick() @@ -2622,14 +2604,14 @@ void UIController::SetTutorial(int iPad, Tutorial *tutorial) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetTutorial(tutorial); + if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorial(tutorial); } void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) @@ -2638,7 +2620,7 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2646,11 +2628,11 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTutorialPopup()) + if(m_groups[(int)group]->getTutorialPopup()) { // tutorial popup needs to know if a container menu is being displayed - m_groups[static_cast(group)]->getTutorialPopup()->SetContainerMenuVisible(m_groups[static_cast(group)]->IsContainerMenuDisplayed()); - m_groups[static_cast(group)]->getTutorialPopup()->SetTutorialDescription(info); + m_groups[(int)group]->getTutorialPopup()->SetContainerMenuVisible(m_groups[(int)group]->IsContainerMenuDisplayed()); + m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(info); } } @@ -2658,9 +2640,9 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) void UIController::RemoveInteractSceneReference(int iPad, UIScene *scene) { EUIGroup group; - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; - if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->RemoveInteractSceneReference(scene); + if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->RemoveInteractSceneReference(scene); } #endif @@ -2670,14 +2652,14 @@ void UIController::SetTutorialVisible(int iPad, bool visible) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetVisible(visible); + if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetVisible(visible); } bool UIController::IsTutorialVisible(int iPad) @@ -2686,7 +2668,7 @@ bool UIController::IsTutorialVisible(int iPad) if( app.GetGameStarted() ) { // If the game isn't running treat as user 0, otherwise map index directly from pad - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); else group = eUIGroup_Fullscreen; } else @@ -2694,7 +2676,7 @@ bool UIController::IsTutorialVisible(int iPad) group = eUIGroup_Fullscreen; } bool visible = false; - if(m_groups[static_cast(group)]->getTutorialPopup()) visible = m_groups[static_cast(group)]->getTutorialPopup()->IsVisible(); + if(m_groups[(int)group]->getTutorialPopup()) visible = m_groups[(int)group]->getTutorialPopup()->IsVisible(); return visible; } @@ -2704,7 +2686,7 @@ void UIController::UpdatePlayerBasePositions() for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(pMinecraft->localplayers[idx] != nullptr) + if(pMinecraft->localplayers[idx] != NULL) { if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN) { @@ -2714,7 +2696,7 @@ void UIController::UpdatePlayerBasePositions() { DisplayGamertag(idx,true); } - m_groups[idx+1]->SetViewportType(static_cast(pMinecraft->localplayers[idx]->m_iScreenSection)); + m_groups[idx+1]->SetViewportType((C4JRender::eViewportType)pMinecraft->localplayers[idx]->m_iScreenSection); } else { @@ -2747,7 +2729,7 @@ void UIController::ShowOtherPlayersBaseScene(unsigned int iPad, bool show) void UIController::ShowTrialTimer(bool show) { - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showTrialTimer(show); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showTrialTimer(show); } void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds) @@ -2759,7 +2741,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) { WCHAR wcTime[20]; - DWORD dwTimeTicks=static_cast(app.getTrialTimer()); + DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -2778,11 +2760,11 @@ void UIController::UpdateTrialTimer(unsigned int iPad) int iMins=dwTimeTicks/60; int iSeconds=dwTimeTicks%60; swprintf( wcTime, 20, L"%d:%02d",iMins,iSeconds); - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcTime); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcTime); } else { - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(L""); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(L""); } // are we out of time? @@ -2792,7 +2774,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) // bring up the pause menu to stop the trial over message box being called again? if(!ui.GetMenuDisplayed( iPad ) ) { - ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene); app.SetAction(iPad,eAppAction_TrialOver); } @@ -2801,7 +2783,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) void UIController::ReduceTrialTimerValue() { - DWORD dwTimeTicks=static_cast(app.getTrialTimer()); + DWORD dwTimeTicks=(int)app.getTrialTimer(); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -2813,7 +2795,7 @@ void UIController::ReduceTrialTimerValue() void UIController::ShowAutosaveCountdownTimer(bool show) { - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showTrialTimer(show); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showTrialTimer(show); } void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) @@ -2821,7 +2803,7 @@ void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) WCHAR wcAutosaveCountdown[100]; swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif } @@ -2838,12 +2820,12 @@ void UIController::ShowSavingMessage(unsigned int iPad, C4JStorage::ESavingMessa show = true; break; } - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showSaveIcon(show); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showSaveIcon(show); } void UIController::ShowPlayerDisplayname(bool show) { - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPlayerDisplayName(show); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPlayerDisplayName(show); } void UIController::SetWinUserIndex(unsigned int iPad) @@ -2862,12 +2844,12 @@ void UIController::ShowUIDebugConsole(bool show) if(show) { - m_uiDebugConsole = static_cast(m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIConsole, eUILayer_Debug)); + m_uiDebugConsole = (UIComponent_DebugUIConsole *)m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIConsole, eUILayer_Debug); } else { m_groups[eUIGroup_Fullscreen]->removeComponent(eUIComponent_DebugUIConsole, eUILayer_Debug); - m_uiDebugConsole = nullptr; + m_uiDebugConsole = NULL; } #endif } @@ -2878,12 +2860,12 @@ void UIController::ShowUIDebugMarketingGuide(bool show) if(show) { - m_uiDebugMarketingGuide = static_cast(m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIMarketingGuide, eUILayer_Debug)); + m_uiDebugMarketingGuide = (UIComponent_DebugUIMarketingGuide *)m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIMarketingGuide, eUILayer_Debug); } else { m_groups[eUIGroup_Fullscreen]->removeComponent(eUIComponent_DebugUIMarketingGuide, eUILayer_Debug); - m_uiDebugMarketingGuide = nullptr; + m_uiDebugMarketingGuide = NULL; } #endif } @@ -2901,13 +2883,13 @@ bool UIController::PressStartPlaying(unsigned int iPad) void UIController::ShowPressStart(unsigned int iPad) { m_iPressStartQuadrantsMask|=1<(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPressStart(iPad, true); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPressStart(iPad, true); } void UIController::HidePressStart() { ClearPressStart(); - if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPressStart(0, false); + if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPressStart(0, false); } void UIController::ClearPressStart() @@ -2970,7 +2952,7 @@ C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT ui } } -C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) +C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -3002,7 +2984,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 #endif } -C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) +C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -3040,7 +3022,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT void UIController::setFontCachingCalculationBuffer(int length) { /* 4J-JEV: As described in an email from Sean. - If your `optional_temp_buffer` is nullptr, Iggy will allocate the temp + If your `optional_temp_buffer` is NULL, Iggy will allocate the temp buffer on the stack during Iggy draw calls. The size of the buffer it will allocate is 16 bytes times `max_chars` in 32-bit, and 24 bytes times `max_chars` in 64-bit. If the stack of the thread making the @@ -3053,10 +3035,10 @@ void UIController::setFontCachingCalculationBuffer(int length) static const int CHAR_SIZE = 16; #endif - if (m_tempBuffer != nullptr) delete [] m_tempBuffer; + if (m_tempBuffer != NULL) delete [] m_tempBuffer; if (length<0) { - if (m_defaultBuffer == nullptr) m_defaultBuffer = new char[CHAR_SIZE*5000]; + if (m_defaultBuffer == NULL) m_defaultBuffer = new char[CHAR_SIZE*5000]; IggySetFontCachingCalculationBuffer(5000, m_defaultBuffer, CHAR_SIZE*5000); } else @@ -3066,16 +3048,16 @@ void UIController::setFontCachingCalculationBuffer(int length) } } -// Returns the first scene of given type if it exists, nullptr otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UIController::FindScene(EUIScene sceneType) { - UIScene *pScene = nullptr; + UIScene *pScene = NULL; for (int i = 0; i < eUIGroup_COUNT; i++) { pScene = m_groups[i]->FindScene(sceneType); #ifdef __PS3__ - if (pScene != nullptr) return pScene; + if (pScene != NULL) return pScene; #else if (pScene != nullptr) return pScene; #endif @@ -3241,7 +3223,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) } //app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y); - m_HighlightedUIElement = nullptr; + m_HighlightedUIElement = NULL; return false; } diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h index f6d0e87d..5b897b13 100644 --- a/Minecraft.Client/Common/UI/UIController.h +++ b/Minecraft.Client/Common/UI/UIController.h @@ -293,7 +293,7 @@ protected: static GDrawTexture * RADLINK TextureSubstitutionCreateCallback( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void **destroy_callback_data ); static void RADLINK TextureSubstitutionDestroyCallback( void * user_callback_data , void * destroy_callback_data , GDrawTexture * handle ); - virtual GDrawTexture *getSubstitutionTexture(int textureId) { return nullptr; } + virtual GDrawTexture *getSubstitutionTexture(int textureId) { return NULL; } virtual void destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle) {} public: @@ -302,7 +302,7 @@ public: public: // NAVIGATION - bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); + bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT); void NavigateToHomeMenu(); UIScene *GetTopScene(int iPad, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); @@ -382,14 +382,14 @@ public: virtual void HidePressStart(); void ClearPressStart(); - virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, WCHAR *pwchFormatString=nullptr); - virtual C4JStorage::EMessageResult RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, WCHAR *pwchFormatString=nullptr); + virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL); + virtual C4JStorage::EMessageResult RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL); private: virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad,int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError); public: - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); - C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); + C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); + C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); virtual void SetWinUserIndex(unsigned int iPad); unsigned int GetWinUserIndex(); diff --git a/Minecraft.Client/Common/UI/UIFontData.cpp b/Minecraft.Client/Common/UI/UIFontData.cpp index 715d08dd..c5ad46ef 100644 --- a/Minecraft.Client/Common/UI/UIFontData.cpp +++ b/Minecraft.Client/Common/UI/UIFontData.cpp @@ -145,9 +145,9 @@ CFontData::CFontData() { m_unicodeMap = unordered_map(); - m_sFontData = nullptr; - m_kerningTable = nullptr; - m_pbRawImage = nullptr; + m_sFontData = NULL; + m_kerningTable = NULL; + m_pbRawImage = NULL; } CFontData::CFontData(SFontData &sFontData, int *pbRawImage) diff --git a/Minecraft.Client/Common/UI/UIGroup.cpp b/Minecraft.Client/Common/UI/UIGroup.cpp index baccc17f..79d3c38f 100644 --- a/Minecraft.Client/Common/UI/UIGroup.cpp +++ b/Minecraft.Client/Common/UI/UIGroup.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include "UIGroup.h" -#include "UI.h" - UIGroup::UIGroup(EUIGroup group, int iPad) { m_group = group; @@ -25,22 +23,22 @@ UIGroup::UIGroup(EUIGroup group, int iPad) #endif } - m_tooltips = (UIComponent_Tooltips *)m_layers[static_cast(eUILayer_Tooltips)]->addComponent(0, eUIComponent_Tooltips); + m_tooltips = (UIComponent_Tooltips *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_Tooltips); - m_tutorialPopup = nullptr; - m_hud = nullptr; - m_pressStartToPlay = nullptr; + m_tutorialPopup = NULL; + m_hud = NULL; + m_pressStartToPlay = NULL; if(m_group != eUIGroup_Fullscreen) { - m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[static_cast(eUILayer_Popup)]->addComponent(m_iPad, eUIComponent_TutorialPopup); + m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[(int)eUILayer_Popup]->addComponent(m_iPad, eUIComponent_TutorialPopup); - m_hud = (UIScene_HUD *)m_layers[static_cast(eUILayer_HUD)]->addComponent(m_iPad, eUIScene_HUD); + m_hud = (UIScene_HUD *)m_layers[(int)eUILayer_HUD]->addComponent(m_iPad, eUIScene_HUD); //m_layers[(int)eUILayer_Chat]->addComponent(m_iPad, eUIComponent_Chat); } else { - m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[static_cast(eUILayer_Tooltips)]->addComponent(0, eUIComponent_PressStartToPlay); + m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_PressStartToPlay); } // 4J Stu - Pre-allocate this for cached rendering in scenes. It's horribly slow to do dynamically, but we should only need one @@ -67,7 +65,7 @@ void UIGroup::ReloadAll() if(highestRenderable < eUILayer_Fullscreen) highestRenderable = eUILayer_Fullscreen; for(; highestRenderable >= 0; --highestRenderable) { - if(highestRenderable < eUILayer_COUNT) m_layers[highestRenderable]->ReloadAll(highestRenderable != static_cast(eUILayer_Fullscreen)); + if(highestRenderable < eUILayer_COUNT) m_layers[highestRenderable]->ReloadAll(highestRenderable != (int)eUILayer_Fullscreen); } } @@ -129,7 +127,7 @@ void UIGroup::getRenderDimensions(S32 &width, S32 &height) // NAVIGATION bool UIGroup::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer) { - bool succeeded = m_layers[static_cast(layer)]->NavigateToScene(iPad, scene, initData); + bool succeeded = m_layers[(int)layer]->NavigateToScene(iPad, scene, initData); updateStackStates(); return succeeded; } @@ -153,9 +151,9 @@ void UIGroup::closeAllScenes() Minecraft *pMinecraft = Minecraft::GetInstance(); if( m_iPad >= 0 ) { - if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(true); @@ -165,14 +163,14 @@ void UIGroup::closeAllScenes() for(unsigned int i = 0; i < eUILayer_COUNT; ++i) { // Ignore the error layer - if(i != static_cast(eUILayer_Error)) m_layers[i]->closeAllScenes(); + if(i != (int)eUILayer_Error) m_layers[i]->closeAllScenes(); } updateStackStates(); } UIScene *UIGroup::GetTopScene(EUILayer layer) { - return m_layers[static_cast(layer)]->GetTopScene(); + return m_layers[(int)layer]->GetTopScene(); } bool UIGroup::GetMenuDisplayed() @@ -216,10 +214,10 @@ UIScene *UIGroup::getCurrentScene() { pScene=m_layers[i]->getCurrentScene(); - if(pScene!=nullptr) return pScene; + if(pScene!=NULL) return pScene; } - return nullptr; + return NULL; } #endif @@ -414,16 +412,16 @@ int UIGroup::getCommandBufferList() return m_commandBufferList; } -// Returns the first scene of given type if it exists, nullptr otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UIGroup::FindScene(EUIScene sceneType) { - UIScene *pScene = nullptr; + UIScene *pScene = NULL; for (int i = 0; i < eUILayer_COUNT; i++) { pScene = m_layers[i]->FindScene(sceneType); #ifdef __PS3__ - if (pScene != nullptr) return pScene; + if (pScene != NULL) return pScene; #else if (pScene != nullptr) return pScene; #endif diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index bf360c07..2063778b 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -102,7 +102,7 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) bool UILayer::IsSceneInStack(EUIScene scene) { bool inStack = false; - for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i) + for(int i = m_sceneStack.size() - 1;i >= 0; --i) { if(m_sceneStack[i]->getSceneType() == scene) { @@ -118,7 +118,7 @@ bool UILayer::HasFocus(int iPad) bool hasFocus = false; if(m_hasFocus) { - for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i) + for(int i = m_sceneStack.size() - 1;i >= 0; --i) { if(m_sceneStack[i]->stealsFocus() ) { @@ -146,7 +146,7 @@ bool UILayer::hidesLowerScenes() } if(!hidesScenes && !m_sceneStack.empty()) { - for(size_t i = (int)m_sceneStack.size() - 1;i >= 0; --i) + for(int i = m_sceneStack.size() - 1;i >= 0; --i) { if(m_sceneStack[i]->hidesLowerScenes()) { @@ -197,7 +197,7 @@ bool UILayer::GetMenuDisplayed() bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) { - UIScene *newScene = nullptr; + UIScene *newScene = NULL; switch(scene) { // Debug @@ -424,7 +424,7 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) break; }; - if(newScene == nullptr) + if(newScene == NULL) { app.DebugPrintf("WARNING: Scene %d was not created. Add it to UILayer::NavigateToScene\n", scene); return false; @@ -451,7 +451,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene) bool navigated = false; if(eScene < eUIScene_COUNT) { - UIScene *scene = nullptr; + UIScene *scene = NULL; do { scene = m_sceneStack.back(); @@ -523,9 +523,9 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) return itComp; } } - return nullptr; + return NULL; } - UIScene *newScene = nullptr; + UIScene *newScene = NULL; switch(scene) { @@ -573,7 +573,7 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) break; }; - if(newScene == nullptr) return nullptr; + if(newScene == NULL) return NULL; m_components.push_back(newScene); @@ -661,12 +661,12 @@ void UILayer::closeAllScenes() } } -// Get top scene on stack (or nullptr if stack is empty) +// Get top scene on stack (or NULL if stack is empty) UIScene *UILayer::GetTopScene() { if(m_sceneStack.size() == 0) { - return nullptr; + return NULL; } else { @@ -789,7 +789,7 @@ UIScene *UILayer::getCurrentScene() } } - return nullptr; + return NULL; } #endif @@ -894,10 +894,10 @@ void UILayer::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic) totalDynamic += layerDynamic; } -// Returns the first scene of given type if it exists, nullptr otherwise +// Returns the first scene of given type if it exists, NULL otherwise UIScene *UILayer::FindScene(EUIScene sceneType) { - for (size_t i = 0; i < m_sceneStack.size(); i++) + for (int i = 0; i < m_sceneStack.size(); i++) { if (m_sceneStack[i]->getSceneType() == sceneType) { @@ -905,5 +905,5 @@ UIScene *UILayer::FindScene(EUIScene sceneType) } } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UILayer.h b/Minecraft.Client/Common/UI/UILayer.h index 7f1a0bf5..ec6a1f8a 100644 --- a/Minecraft.Client/Common/UI/UILayer.h +++ b/Minecraft.Client/Common/UI/UILayer.h @@ -61,7 +61,7 @@ public: // E.g. you can keep a component active while performing navigation with other scenes on this layer void showComponent(int iPad, EUIScene scene, bool show); bool isComponentVisible(EUIScene scene); - UIScene *addComponent(int iPad, EUIScene scene, void *initData = nullptr); + UIScene *addComponent(int iPad, EUIScene scene, void *initData = NULL); void removeComponent(EUIScene scene); // INPUT diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index a714d32e..3f204414 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -11,8 +11,8 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) { m_parentLayer = parentLayer; m_iPad = iPad; - swf = nullptr; - m_pItemRenderer = nullptr; + swf = NULL; + m_pItemRenderer = NULL; bHasFocus = false; m_hasTickedOnce = false; @@ -26,7 +26,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) m_lastOpacity = 1.0f; m_bUpdateOpacity = false; - m_backScene = nullptr; + m_backScene = NULL; m_cacheSlotRenders = false; m_needsCacheRendered = true; @@ -49,14 +49,14 @@ UIScene::~UIScene() ui.UnregisterCallbackId(m_callbackUniqueId); } - if(m_pItemRenderer != nullptr) delete m_pItemRenderer; + if(m_pItemRenderer != NULL) delete m_pItemRenderer; } void UIScene::destroyMovie() { /* Destroy the Iggy player. */ IggyPlayerDestroy( swf ); - swf = nullptr; + swf = NULL; // Clear out the controls collection (doesn't delete the controls, and they get re-setup later) m_controls.clear(); @@ -115,7 +115,7 @@ bool UIScene::needsReloaded() bool UIScene::hasMovie() { - return swf != nullptr; + return swf != NULL; } F64 UIScene::getSafeZoneHalfHeight() @@ -330,7 +330,7 @@ void UIScene::loadMovie() byteArray baFile = ui.getMovieData(moviePath.c_str()); int64_t beforeLoad = ui.iggyAllocCount; - swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, nullptr); + swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); int64_t afterLoad = ui.iggyAllocCount; IggyPlayerInitializeAndTickRS ( swf ); int64_t afterTick = ui.iggyAllocCount; @@ -365,7 +365,7 @@ void UIScene::loadMovie() int64_t totalStatic = 0; int64_t totalDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - nullptr , + NULL , 0 , 0 , iteration , @@ -389,22 +389,21 @@ void UIScene::loadMovie() void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo) { - rrbool res; - IggyMemoryUseInfo internalMemoryInfo; - int internalIteration = 0; - while (res = IggyDebugGetMemoryUseInfo(swf, - 0, - memoryInfo.subcategory, - memoryInfo.subcategory_stringlen, - internalIteration, - &internalMemoryInfo)) - { - app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, - internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count); - ++internalIteration; - if (internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) - getDebugMemoryUseRecursive(moviePath, internalMemoryInfo); - } + rrbool res; + IggyMemoryUseInfo internalMemoryInfo; + int internalIteration = 0; + while(res = IggyDebugGetMemoryUseInfo ( swf , + NULL , + memoryInfo.subcategory , + memoryInfo.subcategory_stringlen , + internalIteration , + &internalMemoryInfo )) + { + app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory, + internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count); + ++internalIteration; + if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo); + } } void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic) @@ -417,7 +416,7 @@ void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic) int64_t sceneStatic = 0; int64_t sceneDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - 0 , + NULL , "" , 0 , iteration , @@ -465,7 +464,7 @@ void UIScene::tick() UIControl* UIScene::GetMainPanel() { - return nullptr; + return NULL; } #ifdef _WINDOWS64 @@ -667,19 +666,19 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene) void UIScene::slideLeft() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , NULL ); } void UIScene::slideRight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , NULL ); } void UIScene::doHorizontalResizeCheck() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , NULL ); } void UIScene::render(S32 width, S32 height, C4JRender::eViewportType viewport) @@ -722,7 +721,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations) { - if (item!= nullptr) + if (item!= NULL) { if(m_cacheSlotRenders) { @@ -850,7 +849,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); + float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; float sx = x; float sy = y; float sxoffs = 8 * scaleX; @@ -861,7 +860,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt } PIXBeginNamedEvent(0,"Render and decorate"); - if(m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer(); + if(m_pItemRenderer == NULL) m_pItemRenderer = new ItemRenderer(); RenderManager.StateSetBlendEnable(true); RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); RenderManager.StateSetBlendFactor(0xffffffff); @@ -879,15 +878,15 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt { glPushMatrix(); glScalef(scaleX, scaleY, 1.0f); - int iX= static_cast(0.5f + ((float)x) / scaleX); - int iY= static_cast(0.5f + ((float)y) / scaleY); + int iX= (int)(0.5f+((float)x)/scaleX); + int iY= (int)(0.5f+((float)y)/scaleY); m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, iX, iY, fAlpha); glPopMatrix(); } else { - m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, static_cast(x), static_cast(y), fAlpha); + m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, (int)x, (int)y, fAlpha); } } @@ -898,9 +897,9 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt // 4J Stu - Not threadsafe //void UIScene::navigateForward(int iPad, EUIScene scene, void *initData) //{ -// if(m_parentLayer == nullptr) +// if(m_parentLayer == NULL) // { -// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is nullptr!\n"); +// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is NULL!\n"); //#ifndef _CONTENT_PACKAGE // __debugbreak(); //#endif @@ -918,9 +917,9 @@ void UIScene::navigateBack() ui.NavigateBack(m_iPad); - if(m_parentLayer == nullptr) + if(m_parentLayer == NULL) { -// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is nullptr!\n"); +// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is NULL!\n"); #ifndef _CONTENT_PACKAGE // __debugbreak(); #endif @@ -1043,7 +1042,7 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released IggyEvent keyEvent; // 4J Stu - Keyloc is always standard as we don't care about shift/alt - IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, static_cast(iggyKeyCode), IGGY_KEYLOC_Standard ); + IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard ); IggyEventResult result; IggyPlayerDispatchEventRS ( swf , &keyEvent , &result ); @@ -1332,8 +1331,8 @@ bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) void UIScene::_handleFocusChange(F64 controlId, F64 childId) { - m_iFocusControl = static_cast(controlId); - m_iFocusChild = static_cast(childId); + m_iFocusControl = (int)controlId; + m_iFocusChild = (int)childId; handleFocusChange(controlId, childId); ui.PlayUISFX(eSFX_Focus); @@ -1341,8 +1340,8 @@ void UIScene::_handleFocusChange(F64 controlId, F64 childId) void UIScene::_handleInitFocus(F64 controlId, F64 childId) { - m_iFocusControl = static_cast(controlId); - m_iFocusChild = static_cast(childId); + m_iFocusControl = (int)controlId; + m_iFocusChild = (int)childId; //handleInitFocus(controlId, childId); handleFocusChange(controlId, childId); diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index ca089d39..e45ecdd1 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -265,7 +265,7 @@ public: // NAVIGATION protected: - //void navigateForward(int iPad, EUIScene scene, void *initData = nullptr); + //void navigateForward(int iPad, EUIScene scene, void *initData = NULL); void navigateBack(); public: diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index b8193bac..6b196c1b 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -49,15 +49,15 @@ void UIScene_AbstractContainerMenu::handleDestroy() #endif Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(pMinecraft->localplayers[m_iPad] != nullptr && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) + if(pMinecraft->localplayers[m_iPad] != NULL && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { pMinecraft->localplayers[m_iPad]->closeContainer(); } @@ -149,8 +149,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) m_fPointerMaxX = m_fPanelMaxX + fPointerWidth; m_fPointerMaxY = m_fPanelMaxY + (fPointerHeight/2); -// m_hPointerText=nullptr; -// m_hPointerTextBkg=nullptr; +// m_hPointerText=NULL; +// m_hPointerTextBkg=NULL; // Put the pointer over first item in use row to start with. UIVec2D itemPos; @@ -187,8 +187,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) IggyEvent mouseEvent; S32 width, height; m_parentLayer->getRenderDimensions(width, height); - S32 x = m_pointerPos.x*(static_cast(width)/m_movieWidth); - S32 y = m_pointerPos.y*(static_cast(height)/m_movieHeight); + S32 x = m_pointerPos.x*((float)width/m_movieWidth); + S32 y = m_pointerPos.y*((float)height/m_movieHeight); IggyMakeEventMouseMove( &mouseEvent, x, y); IggyEventResult result; @@ -212,8 +212,8 @@ void UIScene_AbstractContainerMenu::tick() S32 width, height; m_parentLayer->getRenderDimensions(width, height); - S32 x = static_cast(m_pointerPos.x * ((float)width / m_movieWidth)); - S32 y = static_cast(m_pointerPos.y * ((float)height / m_movieHeight)); + S32 x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth)); + S32 y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight)); IggyMakeEventMouseMove( &mouseEvent, x, y); @@ -254,7 +254,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eVi void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; @@ -265,7 +265,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } else { - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -278,7 +278,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } } - if(item != nullptr) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); + if(item != NULL) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); } void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) @@ -337,7 +337,7 @@ Slot *UIScene_AbstractContainerMenu::getSlot(ESceneSection eSection, int iSlot) { Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot ); if(slot) return slot; - else return nullptr; + else return NULL; } bool UIScene_AbstractContainerMenu::isSlotEmpty(ESceneSection eSection, int iSlot) diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h index c6ef29bb..605f5dbd 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h @@ -53,7 +53,7 @@ protected: virtual bool isSlotEmpty(ESceneSection eSection, int iSlot); virtual void adjustPointerForSafeZone(); - virtual UIControl *getSection(ESceneSection eSection) { return nullptr; } + virtual UIControl *getSection(ESceneSection eSection) { return NULL; } virtual int GetBaseSlotCount() { return 0; } public: diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index a3fb0d2d..4d43a638 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp @@ -16,13 +16,13 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL m_labelAnvil.init( app.GetString(IDS_REPAIR_AND_NAME) ); - AnvilScreenInput *initData = static_cast(_initData); + AnvilScreenInput *initData = (AnvilScreenInput *)_initData; m_inventory = initData->inventory; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != nullptr ) + if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Anvil_Menu, this); } @@ -263,7 +263,7 @@ void UIScene_AnvilMenu::setSectionSelectedSlot(ESceneSection eSection, int x, in int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionAnvilItem1: @@ -291,7 +291,7 @@ void UIScene_AnvilMenu::setSectionSelectedSlot(ESceneSection eSection, int x, in UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionAnvilItem1: @@ -334,7 +334,7 @@ void UIScene_AnvilMenu::onDirectEditFinished(UIControl_TextInput *input, UIContr int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - UIScene_AnvilMenu *pClass=static_cast(lpParam); + UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam; pClass->setIgnoreInput(false); if (bRes) @@ -343,8 +343,8 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); - pClass->setEditNameValue(reinterpret_cast(pchText)); - pClass->m_itemName = reinterpret_cast(pchText); + pClass->setEditNameValue((wchar_t *)pchText); + pClass->m_itemName = (wchar_t *)pchText; pClass->updateItemName(); #else uint16_t pchText[128]; @@ -395,7 +395,7 @@ void UIScene_AnvilMenu::handleEditNamePressed() break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),static_cast(m_iPad),30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); #endif #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp index 64e12373..e70397d6 100644 --- a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp @@ -21,12 +21,12 @@ UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void *_initData, UILayer *paren m_buttonsPowers[eControl_Secondary1].setVisible(false); m_buttonsPowers[eControl_Secondary2].setVisible(false); - BeaconScreenInput *initData = static_cast(_initData); + BeaconScreenInput *initData = (BeaconScreenInput *)_initData; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Beacon_Menu, this); } @@ -254,7 +254,7 @@ void UIScene_BeaconMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionBeaconItem: @@ -276,7 +276,7 @@ void UIScene_BeaconMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i UIControl *UIScene_BeaconMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionBeaconItem: @@ -324,11 +324,11 @@ UIControl *UIScene_BeaconMenu::getSection(ESceneSection eSection) void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if(slotId >= 0 && slotId >= m_menu->getSize() ) { @@ -336,22 +336,22 @@ void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) switch(icon) { case 0: - item = std::make_shared(Item::emerald); + item = shared_ptr(new ItemInstance(Item::emerald) ); break; case 1: - item = std::make_shared(Item::diamond); + item = shared_ptr(new ItemInstance(Item::diamond) ); break; case 2: - item = std::make_shared(Item::goldIngot); + item = shared_ptr(new ItemInstance(Item::goldIngot) ); break; case 3: - item = std::make_shared(Item::ironIngot); + item = shared_ptr(new ItemInstance(Item::ironIngot) ); break; default: assert(false); break; }; - if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); + if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); } else { diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp index 129868fd..8563054c 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp @@ -14,15 +14,15 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI m_progressBrewingArrow.init(L"",0,0,PotionBrewing::BREWING_TIME_SECONDS * SharedConstants::TICKS_PER_SECOND,0); m_progressBrewingBubbles.init(L"",0,0,30,0); - BrewingScreenInput *initData = static_cast(_initData); + BrewingScreenInput *initData = (BrewingScreenInput *)_initData; m_brewingStand = initData->brewingStand; m_labelBrewingStand.init( m_brewingStand->getName() ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Brewing_Menu, this); } @@ -249,7 +249,7 @@ void UIScene_BrewingStandMenu::setSectionSelectedSlot(ESceneSection eSection, in int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionBrewingBottle1: @@ -280,7 +280,7 @@ void UIScene_BrewingStandMenu::setSectionSelectedSlot(ESceneSection eSection, in UIControl *UIScene_BrewingStandMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionBrewingBottle1: diff --git a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp index e10a5a62..968072a8 100644 --- a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp @@ -15,7 +15,7 @@ UIScene_ConnectingProgress::UIScene_ConnectingProgress(int iPad, void *_initData m_progressBar.setVisible( false ); m_labelTip.setVisible( false ); - ConnectionProgressParams *param = static_cast(_initData); + ConnectionProgressParams *param = (ConnectionProgressParams *)_initData; if( param->stringId >= 0 ) { @@ -210,7 +210,7 @@ void UIScene_ConnectingProgress::handleInput(int iPad, int key, bool repeat, boo // 4J-PB - Removed the option to cancel join - it didn't work anyway // case ACTION_MENU_CANCEL: // { -// if(m_cancelFunc != nullptr) +// if(m_cancelFunc != NULL) // { // m_cancelFunc(m_cancelFuncParam); // } @@ -245,7 +245,7 @@ void UIScene_ConnectingProgress::handleInput(int iPad, int key, bool repeat, boo void UIScene_ConnectingProgress::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Confirm: if(m_showingButton) diff --git a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp index b26ae48e..9e48a57b 100644 --- a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp @@ -13,7 +13,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) { - ContainerScreenInput *initData = static_cast(_initData); + ContainerScreenInput *initData = (ContainerScreenInput *)_initData; m_bLargeChest = (initData->container->getContainerSize() > 3*9)?true:false; // Setup all the Iggy references we need for this scene @@ -24,9 +24,9 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer ContainerMenu* menu = new ContainerMenu( initData->inventory, initData->container ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != nullptr ) + if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Container_Menu, this); } @@ -181,7 +181,7 @@ void UIScene_ContainerMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionContainerChest: @@ -203,7 +203,7 @@ void UIScene_ContainerMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_ContainerMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionContainerChest: diff --git a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp index 939efde1..57567248 100644 --- a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp @@ -13,7 +13,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; #if defined(_XBOX) || defined(_WIN64) - value[0].number = static_cast(0); + value[0].number = (F64)0; #elif defined(_DURANGO) value[0].number = (F64)1; #elif defined(__PS3__) @@ -25,7 +25,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa #endif IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value ); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { @@ -84,7 +84,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa IggyDataValue result; IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(m_iCurrentNavigatedControlsLayout); + value[0].number = (F64)m_iCurrentNavigatedControlsLayout; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetControllerLayout , 1 , value ); } @@ -180,7 +180,7 @@ void UIScene_ControlsMenu::handleInput(int iPad, int key, bool repeat, bool pres void UIScene_ControlsMenu::handleCheckboxToggled(F64 controlId, bool selected) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_InvertLook: app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,(unsigned char)( selected ) ); @@ -194,13 +194,13 @@ void UIScene_ControlsMenu::handleCheckboxToggled(F64 controlId, bool selected) void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) { - int control = static_cast(controlId); + int control = (int)controlId; switch(control) { case eControl_Button0: case eControl_Button1: case eControl_Button2: - app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast(control)); + app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)control); LPWSTR layoutString = new wchar_t[ 128 ]; swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[control])); #ifdef __ORBIS__ @@ -216,7 +216,7 @@ void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) void UIScene_ControlsMenu::handleFocusChange(F64 controlId, F64 childId) { - int control = static_cast(controlId); + int control = (int)controlId; switch(control) { case eControl_Button0: diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index 16b63c4c..2d1b4302 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -22,7 +22,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p #endif m_bIgnoreKeyPresses = false; - CraftingPanelScreenInput* initData = static_cast(_initData); + CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData; m_iContainerType=initData->iContainerType; m_pPlayer=initData->player; m_bSplitscreen=initData->bSplitscreen; @@ -117,9 +117,9 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p // Update the tutorial state Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); if(m_iContainerType==RECIPE_TYPE_2x2) { @@ -198,14 +198,14 @@ void UIScene_CraftingMenu::handleDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr && Minecraft::GetInstance()->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL && Minecraft::GetInstance()->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); } @@ -525,14 +525,14 @@ void UIScene_CraftingMenu::handleReload() void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; float alpha = 1.0f; bool decorations = true; bool inventoryItem = false; - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -560,7 +560,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_vSlotsInfo[iIndex].show) { item = m_vSlotsInfo[iIndex].item; - alpha = static_cast(m_vSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_vSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_H_SLOT_START && slotId < (CRAFTING_H_SLOT_START + m_iCraftablesMaxHSlotC) ) @@ -596,7 +596,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_hSlotsInfo[iIndex].show) { item = m_hSlotsInfo[iIndex].item; - alpha = static_cast(m_hSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_hSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_LAYOUT_START && slotId < (CRAFTING_INGREDIENTS_LAYOUT_START + m_iIngredientsMaxSlotC) ) @@ -605,7 +605,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsSlotsInfo[iIndex].show) { item = m_ingredientsSlotsInfo[iIndex].item; - alpha = static_cast(m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_DESCRIPTION_START && slotId < (CRAFTING_INGREDIENTS_DESCRIPTION_START + 4) ) @@ -614,7 +614,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsInfo[iIndex].show) { item = m_ingredientsInfo[iIndex].item; - alpha = static_cast(m_ingredientsInfo[iIndex].alpha)/31.0f; + alpha = ((float)m_ingredientsInfo[iIndex].alpha)/31.0f; } } else if(slotId == CRAFTING_OUTPUT_SLOT_START ) @@ -622,11 +622,11 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_craftingOutputSlotInfo.show) { item = m_craftingOutputSlotInfo.item; - alpha = static_cast(m_craftingOutputSlotInfo.alpha)/31.0f; + alpha = ((float)m_craftingOutputSlotInfo.alpha)/31.0f; } } - if(item != nullptr) + if(item != NULL) { if(!inventoryItem) { @@ -742,7 +742,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptrgetId(); - m_pDLCPack = nullptr; + m_pDLCPack = NULL; m_bRebuildTouchBoxes = false; m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); @@ -96,7 +96,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay // #ifdef __PS3__ // if(ProfileManager.IsSignedInLive( m_iPad )) // { - // ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,nullptr); + // ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,NULL); // } // #endif @@ -184,7 +184,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay #if TO_BE_IMPLEMENTED // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -289,6 +289,7 @@ void UIScene_CreateWorldMenu::tick() { UIScene::tick(); + if(m_iSetTexturePackDescription >= 0 ) { UpdateTexturePackDescription( m_iSetTexturePackDescription ); @@ -431,7 +432,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_EditWorldName: { @@ -481,7 +482,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) break; case eControl_TexturePackList: { - UpdateCurrentTexturePack(static_cast(childId)); + UpdateCurrentTexturePack((int)childId); } break; case eControl_NewWorld: @@ -527,7 +528,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack==nullptr) + if(pTexturePack==NULL) { #if TO_BE_IMPLEMENTED // They've selected a texture pack they don't have yet @@ -577,7 +578,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() { // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - DLCTexturePack *pDLCTexPack=static_cast(pTexturePack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack; m_pDLCPack=pDLCTexPack->getDLCInfoParentPack(); // do we have a license? @@ -605,7 +606,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -648,8 +649,8 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_Difficulty: m_sliderDifficulty.handleSliderMove(value); @@ -724,7 +725,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) if(m_iConfigA[i]!=-1) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); @@ -733,7 +734,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) if(dwBytes > 0 && pbData) { DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -763,7 +764,7 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) { - UIScene_CreateWorldMenu *pClass=static_cast(lpParam); + UIScene_CreateWorldMenu *pClass=(UIScene_CreateWorldMenu *)lpParam; pClass->m_bIgnoreInput=false; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) @@ -890,7 +891,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return; } @@ -910,7 +911,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); return; } } @@ -950,7 +951,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() #if defined(__PS3__) || defined(__PSVITA__) if(isOnlineGame && isSignedInLive) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,NULL,&bContentRestricted,NULL); } #endif @@ -979,7 +980,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return; } @@ -997,7 +998,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); } #endif @@ -1039,7 +1040,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return; } @@ -1061,7 +1062,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); } #endif @@ -1071,7 +1072,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1135,7 +1136,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD if (wSeed.length() != 0) { int64_t value = 0; - unsigned int len = static_cast(wSeed.length()); + unsigned int len = (unsigned int)wSeed.length(); //Check if the input string contains a numerical value bool isNumber = true; @@ -1173,7 +1174,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -1209,8 +1210,8 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); #ifdef _LARGE_WORLDS app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN - pClass->m_MoreOptionsParams.currentWorldSize = static_cast(pClass->m_MoreOptionsParams.worldSize + 1); - pClass->m_MoreOptionsParams.newWorldSize = static_cast(pClass->m_MoreOptionsParams.worldSize + 1); + pClass->m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1); + pClass->m_MoreOptionsParams.newWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1); #endif g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); @@ -1252,7 +1253,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1270,7 +1271,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_CreateWorldMenu* pClass = static_cast(pParam); + UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; if(bContinue==true) { @@ -1378,7 +1379,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_CreateWorldMenu* pClass = static_cast(pParam); + UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -1431,7 +1432,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); diff --git a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp index ba2cd845..0895cdff 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp @@ -19,9 +19,9 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p // Setup all the Iggy references we need for this scene initialiseMovie(); - InventoryScreenInput *initData = static_cast(_initData); + InventoryScreenInput *initData = (InventoryScreenInput *)_initData; - shared_ptr creativeContainer = std::make_shared(0, L"", false, TabSpec::MAX_SIZE); + shared_ptr creativeContainer = shared_ptr(new SimpleContainer( 0, L"", false, TabSpec::MAX_SIZE )); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack); @@ -42,9 +42,9 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p } Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Creative_Inventory_Menu, this); } @@ -144,7 +144,7 @@ void UIScene_CreativeMenu::handleOtherClicked(int iPad, ESceneSection eSection, case eSectionInventoryCreativeTab_6: case eSectionInventoryCreativeTab_7: { - ECreativeInventoryTabs tab = static_cast((int)eCreativeInventoryTab_BuildingBlocks + (int)eSection - (int)eSectionInventoryCreativeTab_0); + ECreativeInventoryTabs tab = (ECreativeInventoryTabs)((int)eCreativeInventoryTab_BuildingBlocks + (int)eSection - (int)eSectionInventoryCreativeTab_0); if(tab != m_curTab) { switchTab(tab); @@ -193,8 +193,8 @@ void UIScene_CreativeMenu::handleInput(int iPad, int key, bool repeat, bool pres // Fall through intentional case VK_PAD_RSHOULDER: { - ECreativeInventoryTabs tab = static_cast(m_curTab + dir); - if (tab < 0) tab = static_cast(eCreativeInventoryTab_COUNT - 1); + ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir); + if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1); if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks; switchTab(tab); ui.PlayUISFX(eSFX_Focus); @@ -220,7 +220,7 @@ void UIScene_CreativeMenu::updateTabHighlightAndText(ECreativeInventoryTabs tab) IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(tab); + value[0].number = (F64)tab; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ) , m_funcSetActiveTab , 1 , value ); @@ -400,7 +400,7 @@ void UIScene_CreativeMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionInventoryCreativeSelector: @@ -419,7 +419,7 @@ void UIScene_CreativeMenu::setSectionSelectedSlot(ESceneSection eSection, int x, UIControl *UIScene_CreativeMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionInventoryCreativeSelector: @@ -468,10 +468,10 @@ void UIScene_CreativeMenu::updateScrollCurrentPage(int currentPage, int pageCoun IggyDataValue value[2]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(pageCount); + value[0].number = (F64)pageCount; value[1].type = IGGY_DATATYPE_number; - value[1].number = static_cast(currentPage) - 1; + value[1].number = (F64)currentPage - 1; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ) , m_funcSetScrollBar , 2 , value ); } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Common/UI/UIScene_Credits.cpp index 9900169c..75ddf92f 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -593,11 +593,11 @@ void UIScene_Credits::tick() } // Set up the new text element. - if(pDef->m_Text!=nullptr) // 4J-PB - think the RAD logo ones aren't set up yet and are coming is as null + if(pDef->m_Text!=NULL) // 4J-PB - think the RAD logo ones aren't set up yet and are coming is as null { if ( pDef->m_iStringID[0] == CREDIT_ICON ) { - addImage(static_cast(pDef->m_iStringID[1])); + addImage((ECreditIcons)pDef->m_iStringID[1]); } else // using additional translated string. { @@ -670,7 +670,7 @@ void UIScene_Credits::setNextLabel(const wstring &label, ECreditTextTypes size) value[0].string16 = stringVal; value[1].type = IGGY_DATATYPE_number; - value[1].number = static_cast(size); + value[1].number = (int)size; value[2].type = IGGY_DATATYPE_boolean; value[2].boolval = (m_iCurrDefIndex == (m_iNumTextDefs - 1)); @@ -684,7 +684,7 @@ void UIScene_Credits::addImage(ECreditIcons icon) IggyDataValue value[2]; value[0].type = IGGY_DATATYPE_number; - value[0].number = static_cast(icon); + value[0].number = (int)icon; value[1].type = IGGY_DATATYPE_boolean; value[1].boolval = (m_iCurrDefIndex == (m_iNumTextDefs - 1)); diff --git a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp index 6d705765..77ffdffd 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp @@ -121,11 +121,11 @@ void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool press void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_OffersList: { - int iIndex = static_cast(childId); + int iIndex = (int)childId; DLCOffersParam *param = new DLCOffersParam(); param->iPad = m_iPad; @@ -134,7 +134,7 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) // Xbox One will have requested the marketplace content - there is only that type #ifndef _XBOX_ONE - app.AddDLCRequest(static_cast(iIndex), true); + app.AddDLCRequest((eDLCMarketplaceType)iIndex, true); #endif killTimer(PLAYER_ONLINE_TIMER_ID); ui.NavigateToScene(m_iPad, eUIScene_DLCOffersMenu, param); @@ -166,7 +166,7 @@ void UIScene_DLCMainMenu::handleTimerComplete(int id) int UIScene_DLCMainMenu::ExitDLCMainMenu(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_DLCMainMenu* pClass = static_cast(pParam); + UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam; #if defined __ORBIS__ || defined __PSVITA__ app.GetCommerce()->HidePsStoreIcon(); diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index 5e644803..c109ed62 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -16,12 +16,12 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { m_bProductInfoShown=false; - DLCOffersParam *param=static_cast(initData); + DLCOffersParam *param=(DLCOffersParam *)initData; m_iProductInfoIndex=param->iType; m_iCurrentDLC=0; m_iTotalDLC=0; #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - m_pvProductInfo=nullptr; + m_pvProductInfo=NULL; #endif m_bAddAllDLCButtons=true; @@ -51,7 +51,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer * } #ifdef _DURANGO - m_pNoImageFor_DLC = nullptr; + m_pNoImageFor_DLC = NULL; // If we don't yet have this DLC, we need to display a timer m_bDLCRequiredIsRetrieved=false; m_bIgnorePress=true; @@ -103,7 +103,7 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id) int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_DLCOffersMenu* pClass = static_cast(pParam); + UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam; #if defined __ORBIS__ || defined __PSVITA__ app.GetCommerce()->HidePsStoreIcon(); @@ -217,7 +217,7 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_OffersList: { @@ -261,13 +261,13 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) #endif // __PS3__ #elif defined _XBOX_ONE int iIndex = (int)childId; - StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,nullptr,nullptr); + StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); #else - int iIndex = static_cast(childId); + int iIndex = (int)childId; ULONGLONG ullIndexA[1]; ullIndexA[0]=StorageManager.GetOffer(iIndex).qwOfferID; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); #endif } break; @@ -343,10 +343,10 @@ void UIScene_DLCOffersMenu::tick() { m_bAddAllDLCButtons=false; // add the categories to the list box - if(m_pvProductInfo==nullptr) + if(m_pvProductInfo==NULL) { m_pvProductInfo=app.GetProductList(m_iProductInfoIndex); - if(m_pvProductInfo==nullptr) + if(m_pvProductInfo==NULL) { m_iTotalDLC=0; // need to display text to say no downloadable content available yet @@ -690,7 +690,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC!=nullptr) + if(pDLC!=NULL) { OrderA[uiDLCCount].uiContentIndex=i; OrderA[uiDLCCount++].uiSortIndex=pDLC->uiSortIndex; @@ -710,7 +710,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC==nullptr) + if(pDLC==NULL) { // skip this one app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName); @@ -736,7 +736,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // find the DLC in the installed packages XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if(pContentData!=nullptr) + if(pContentData!=NULL) { m_buttonListOffers.addItem(wstrTemp,!pContentData->bTrialLicense,OrderA[i].uiContentIndex); } @@ -809,7 +809,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.wszOfferName); #endif - if (dlc != nullptr) + if (dlc != NULL) { WCHAR *cString = dlc->wchBanner; @@ -844,7 +844,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) { if(hasRegisteredSubstitutionTexture(cString)==false) { - BYTE *pData=nullptr; + BYTE *pData=NULL; DWORD dwSize=0; app.GetMemFileDetails(cString,&pData,&dwSize); // set the image diff --git a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp index a4dbe8a8..8f0f4c11 100644 --- a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp @@ -18,9 +18,9 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa m_bIgnoreInput = false; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(false); @@ -30,9 +30,9 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa UIScene_DeathMenu::~UIScene_DeathMenu() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(true); @@ -81,7 +81,7 @@ void UIScene_DeathMenu::handleInput(int iPad, int key, bool repeat, bool pressed void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Respawn: m_bIgnoreInput = true; @@ -104,9 +104,9 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { UINT uiIDA[3]; int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != nullptr ) + if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); } TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Failed); diff --git a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp index d698b51f..d3da0870 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -132,96 +132,82 @@ void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, b void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { #ifdef _WINDOWS64 - if (isDirectEditBlocking()) - return; + if (isDirectEditBlocking()) return; #endif + switch((int)controlId) + { + case eControl_Create: + { + // We want the start to be even + if(m_data->startX > 0 && m_data->startX%2 != 0) + m_data->startX-=1; + else if(m_data->startX < 0 && m_data->startX%2 !=0) + m_data->startX-=1; + if(m_data->startY < 0) m_data->startY = 0; + else if(m_data->startY > 0 && m_data->startY%2 != 0) + m_data->startY-=1; + if(m_data->startZ > 0 && m_data->startZ%2 != 0) + m_data->startZ-=1; + else if(m_data->startZ < 0 && m_data->startZ%2 !=0) + m_data->startZ-=1; - switch (static_cast(controlId)) - { - case eControl_Create: - { - // We want the start to be even - if (m_data->startX > 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; - else if (m_data->startX < 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; + // We want the end to be odd to have a total size that is even + if(m_data->endX > 0 && m_data->endX%2 == 0) + m_data->endX+=1; + else if(m_data->endX < 0 && m_data->endX%2 ==0) + m_data->endX+=1; + if(m_data->endY > Level::maxBuildHeight) + m_data->endY = Level::maxBuildHeight; + else if(m_data->endY > 0 && m_data->endY%2 == 0) + m_data->endY+=1; + else if(m_data->endY < 0 && m_data->endY%2 ==0) + m_data->endY+=1; + if(m_data->endZ > 0 && m_data->endZ%2 == 0) + m_data->endZ+=1; + else if(m_data->endZ < 0 && m_data->endZ%2 ==0) + m_data->endZ+=1; - if (m_data->startY < 0) - m_data->startY = 0; - else if (m_data->startY > 0 && m_data->startY % 2 != 0) - m_data->startY -= 1; + app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), eXuiServerAction_ExportSchematic, (void *)m_data); - if (m_data->startZ > 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; - else if (m_data->startZ < 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; - - // We want the end to be odd to have a total size that is even - if (m_data->endX > 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - else if (m_data->endX < 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - - if (m_data->endY > Level::maxBuildHeight) - m_data->endY = Level::maxBuildHeight; - else if (m_data->endY > 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - else if (m_data->endY < 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - - if (m_data->endZ > 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; - else if (m_data->endZ < 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; - - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), eXuiServerAction_ExportSchematic, static_cast(m_data)); - navigateBack(); - } - break; - - case eControl_Name: - case eControl_StartX: - case eControl_StartY: - case eControl_StartZ: - case eControl_EndX: - case eControl_EndY: - case eControl_EndZ: - { - m_keyboardCallbackControl = static_cast(static_cast(controlId)); + navigateBack(); + } + break; + case eControl_Name: + case eControl_StartX: + case eControl_StartY: + case eControl_StartZ: + case eControl_EndX: + case eControl_EndY: + case eControl_EndZ: + { + m_keyboardCallbackControl = (eControls)((int)controlId); #ifdef _WINDOWS64 - if (g_KBMInput.IsKBMActive()) - { - UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl); - if (input) input->beginDirectEdit(25); - } - else - { - UIKeyboardInitData kbData; - kbData.title = L"Enter something"; - kbData.defaultText = L""; - kbData.maxChars = 25; - kbData.callback = &UIScene_DebugCreateSchematic::KeyboardCompleteCallback; - kbData.lpParam = this; - ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen); - } + if (g_KBMInput.IsKBMActive()) + { + UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl); + if (input) input->beginDirectEdit(25); + } + else + { + UIKeyboardInitData kbData; + kbData.title = L"Enter something"; + kbData.defaultText = L""; + kbData.maxChars = 25; + kbData.callback = &UIScene_DebugCreateSchematic::KeyboardCompleteCallback; + kbData.lpParam = this; + ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen); + } #else - InputManager.RequestKeyboard( - L"Enter something", - L"", - static_cast(0), - 25, - &UIScene_DebugCreateSchematic::KeyboardCompleteCallback, - this, - C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); #endif - } - break; - } + } + break; + }; } void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool selected) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_SaveMobs: m_data->bSaveMobs = selected; @@ -237,7 +223,7 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool sel int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - UIScene_DebugCreateSchematic *pClass=static_cast(lpParam); + UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam; #ifdef _WINDOWS64 uint16_t pchText[128]; diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index c997fb31..fafcea02 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -21,16 +21,16 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa // Setup all the Iggy references we need for this scene initialiseMovie(); - const Minecraft *pMinecraft = Minecraft::GetInstance(); - WCHAR tempString[256]; - const int fovSliderVal = app.GetGameSettings(m_iPad, eGameSetting_FOV); - const int fovDeg = 70 + fovSliderVal * 40 / 100; - swprintf( tempString, 256, L"Set fov (%d)", fovDeg); - m_sliderFov.init(tempString,eControl_FOV,0,100,fovSliderVal); + Minecraft *pMinecraft = Minecraft::GetInstance(); + WCHAR TempString[256]; + int fovSliderVal = app.GetGameSettings(m_iPad, eGameSetting_FOV); + int fovDeg = 70 + fovSliderVal * 40 / 100; + swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", fovDeg); + m_sliderFov.init(TempString,eControl_FOV,0,100,fovSliderVal); - const float currentTime = pMinecraft->level->getLevelData()->getGameTime() % 24000; - swprintf( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); - m_sliderTime.init(tempString,eControl_Time,0,240,currentTime/100); + float currentTime = pMinecraft->level->getLevelData()->getGameTime() % 24000; + swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + m_sliderTime.init(TempString,eControl_Time,0,240,currentTime/100); m_buttonRain.init(L"Toggle Rain",eControl_Rain); m_buttonThunder.init(L"Toggle Thunder",eControl_Thunder); @@ -46,7 +46,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa std::vector> sortedItems; for (size_t i = 0; i < Item::items.length; ++i) { - if (Item::items[i] != nullptr) + if (Item::items[i] != NULL) { sortedItems.emplace_back(std::wstring(app.GetString(Item::items[i]->getDescriptionId())), i); } @@ -138,19 +138,19 @@ wstring UIScene_DebugOverlay::getMoviePath() void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region) { - const Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + Minecraft *pMinecraft = Minecraft::GetInstance(); + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; int itemId = -1; - swscanf(static_cast(region->name),L"item_%d",&itemId); - if (itemId == -1 || itemId > Item::ITEM_NUM_COUNT || Item::items[itemId] == nullptr) + swscanf((wchar_t*)region->name,L"item_%d",&itemId); + if (itemId == -1 || itemId > Item::ITEM_NUM_COUNT || Item::items[itemId] == NULL) { app.DebugPrintf("This is not the control we are looking for\n"); } else { - const auto item = std::make_shared(itemId, 1, 0); - if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); + shared_ptr item = shared_ptr( new ItemInstance(itemId,1,0) ); + if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); } } @@ -183,7 +183,7 @@ void UIScene_DebugOverlay::handleInput(int iPad, int key, bool repeat, bool pres void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Items: { @@ -213,14 +213,14 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) case eControl_Schematic: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic,nullptr,eUILayer_Debug); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic,NULL,eUILayer_Debug); #endif } break; case eControl_SetCamera: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugSetCamera,nullptr,eUILayer_Debug); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugSetCamera,NULL,eUILayer_Debug); #endif } break; @@ -254,7 +254,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) { - switch(static_cast(sliderId)) + switch((int)sliderId) { case eControl_Time: { @@ -266,25 +266,25 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) MinecraftServer::SetTime(currentValue * 100); pMinecraft->level->getLevelData()->setGameTime(currentValue * 100); - WCHAR tempString[256]; + WCHAR TempString[256]; float currentTime = currentValue * 100; - swprintf( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); - m_sliderTime.setLabel(tempString); + swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + m_sliderTime.setLabel(TempString); } break; case eControl_FOV: { Minecraft *pMinecraft = Minecraft::GetInstance(); - int v = static_cast(currentValue); + int v = (int)currentValue; if (v < 0) v = 0; if (v > 100) v = 100; int fovDeg = 70 + v * 40 / 100; - pMinecraft->gameRenderer->SetFovVal(static_cast(fovDeg)); + pMinecraft->gameRenderer->SetFovVal((float)fovDeg); app.SetGameSettings(m_iPad, eGameSetting_FOV, v); - WCHAR tempString[256]; - swprintf( tempString, 256, L"Set fov (%d)", fovDeg); - m_sliderFov.setLabel(tempString); + WCHAR TempString[256]; + swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", fovDeg); + m_sliderFov.setLabel(TempString); } break; }; diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp index 51eab5aa..62ee60b1 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp @@ -17,7 +17,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer currentPosition->player = playerNo; Minecraft *pMinecraft = Minecraft::GetInstance(); - if (pMinecraft != nullptr) + if (pMinecraft != NULL) { Vec3 *vec = pMinecraft->localplayers[playerNo]->getPos(1.0); @@ -143,7 +143,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) #ifdef _WINDOWS64 if (isDirectEditBlocking()) return; #endif - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Teleport: app.SetXuiServerAction( ProfileManager.GetPrimaryPad(), @@ -155,7 +155,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) case eControl_CamZ: case eControl_YRot: case eControl_Elevation: - m_keyboardCallbackControl = static_cast(static_cast(controlId)); + m_keyboardCallbackControl = (eControls)((int)controlId); #ifdef _WINDOWS64 if (g_KBMInput.IsKBMActive()) { @@ -173,7 +173,6 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData, eUILayer_Fullscreen, eUIGroup_Fullscreen); } #else ->>>>>>> origin/main InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); #endif break; @@ -182,7 +181,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_LockPlayer: app.SetFreezePlayers(selected); @@ -192,19 +191,18 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected) int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - UIScene_DebugSetCamera *pClass=static_cast(lpParam); + UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam; uint16_t pchText[2048]; ZeroMemory(pchText, 2048 * sizeof(uint16_t)); #ifdef _WINDOWS64 Win64_GetKeyboardText(pchText, 2048); #else ->>>>>>> origin/main InputManager.GetText(pchText); #endif if(pchText[0]!=0) { - wstring value = reinterpret_cast(pchText); + wstring value = (wchar_t *)pchText; double val = 0; if(!value.empty()) val = _fromString( value ); switch(pClass->m_keyboardCallbackControl) diff --git a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp index 2e47dda4..97cf842a 100644 --- a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp @@ -10,14 +10,14 @@ UIScene_DispenserMenu::UIScene_DispenserMenu(int iPad, void *_initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - TrapScreenInput *initData = static_cast(_initData); + TrapScreenInput *initData = (TrapScreenInput *)_initData; m_labelDispenser.init(initData->trap->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trap_Menu, this); } @@ -156,7 +156,7 @@ void UIScene_DispenserMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionTrapTrap: @@ -177,7 +177,7 @@ void UIScene_DispenserMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_DispenserMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionTrapTrap: diff --git a/Minecraft.Client/Common/UI/UIScene_EULA.cpp b/Minecraft.Client/Common/UI/UIScene_EULA.cpp index 41195621..3177344d 100644 --- a/Minecraft.Client/Common/UI/UIScene_EULA.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EULA.cpp @@ -48,8 +48,8 @@ UIScene_EULA::UIScene_EULA(int iPad, void *initData, UILayer *parentLayer) : UIS #endif vector paragraphs; - size_t lastIndex = 0; - for ( size_t index = EULA.find(L"\r\n", lastIndex, 2); + int lastIndex = 0; + for ( int index = EULA.find(L"\r\n", lastIndex, 2); index != wstring::npos; index = EULA.find(L"\r\n", lastIndex, 2) ) @@ -132,7 +132,7 @@ void UIScene_EULA::handleInput(int iPad, int key, bool repeat, bool pressed, boo void UIScene_EULA::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Confirm: //CD - Added for audio diff --git a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp index f90c4b12..27459ccc 100644 --- a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp @@ -14,14 +14,14 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye m_enchantButton[1].init(1); m_enchantButton[2].init(2); - EnchantingScreenInput *initData = static_cast(_initData); + EnchantingScreenInput *initData = (EnchantingScreenInput *)_initData; m_labelEnchant.init( initData->name.empty() ? app.GetString(IDS_ENCHANT) : initData->name ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Enchanting_Menu, this); } @@ -194,7 +194,7 @@ void UIScene_EnchantingMenu::setSectionSelectedSlot(ESceneSection eSection, int int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionEnchantSlot: @@ -216,7 +216,7 @@ void UIScene_EnchantingMenu::setSectionSelectedSlot(ESceneSection eSection, int UIControl *UIScene_EnchantingMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionEnchantSlot: @@ -247,7 +247,7 @@ UIControl *UIScene_EnchantingMenu::getSection(ESceneSection eSection) void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; if(wcscmp((wchar_t *)region->name,L"EnchantmentBook")==0) @@ -264,7 +264,7 @@ void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion *region) else { int slotId = -1; - swscanf(static_cast(region->name),L"slot_Button%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_Button%d",&slotId); if(slotId >= 0) { // Setup GDraw, normal game render states and matrices diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index 5b10e8cf..2f43cada 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -50,7 +50,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) Minecraft *pMinecraft = Minecraft::GetInstance(); wstring playerName = L""; - if(pMinecraft->localplayers[ui.GetWinUserIndex()] != nullptr) + if(pMinecraft->localplayers[ui.GetWinUserIndex()] != NULL) { playerName = escapeXML( pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName() ); } @@ -159,14 +159,14 @@ void UIScene_EndPoem::handleInput(int iPad, int key, bool repeat, bool pressed, Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(pMinecraft->localplayers[i] != nullptr) + if(pMinecraft->localplayers[i] != NULL) { app.SetAction(i,eAppAction_Respawn); } } // This just allows it to be shown - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); updateTooltips(); navigateBack(); @@ -191,7 +191,7 @@ void UIScene_EndPoem::handleDestroy() void UIScene_EndPoem::handleRequestMoreData(F64 startIndex, bool up) { - m_requestedLabel = static_cast(startIndex); + m_requestedLabel = (int)startIndex; } void UIScene_EndPoem::updateNoise() @@ -221,13 +221,13 @@ void UIScene_EndPoem::updateNoise() { if (ui.UsingBitmapFont()) { - randomChar = SharedConstants::acceptableLetters[random->nextInt(static_cast(SharedConstants::acceptableLetters.length()))]; + randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; } else { // 4J-JEV: It'd be nice to avoid null characters when using asian languages. static wstring acceptableLetters = L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~"; - randomChar = acceptableLetters[ random->nextInt(static_cast(acceptableLetters.length())) ]; + randomChar = acceptableLetters[ random->nextInt((int)acceptableLetters.length()) ]; } wstring randomCharStr = L""; diff --git a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp index b33e086a..1d24f989 100644 --- a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp @@ -11,14 +11,14 @@ UIScene_FireworksMenu::UIScene_FireworksMenu(int iPad, void *_initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - FireworksScreenInput *initData = static_cast(_initData); + FireworksScreenInput *initData = (FireworksScreenInput *)_initData; m_labelFireworks.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS)); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Fireworks_Menu, this); } @@ -174,7 +174,7 @@ void UIScene_FireworksMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionFireworksIngredients: @@ -198,7 +198,7 @@ void UIScene_FireworksMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_FireworksMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionFireworksIngredients: diff --git a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp index e89c0626..fb17bda4 100644 --- a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp @@ -4,6 +4,7 @@ #include "..\..\Minecraft.h" #include "..\..\ProgressRenderer.h" + UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene @@ -26,7 +27,7 @@ UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, m_buttonConfirm.init( app.GetString( IDS_CONFIRM_OK ), eControl_Confirm ); m_buttonConfirm.setVisible(false); - LoadingInputParams *params = static_cast(initData); + LoadingInputParams *params = (LoadingInputParams *)initData; m_CompletionData = params->completionData; m_iPad=params->completionData->iPad; @@ -101,7 +102,7 @@ void UIScene_FullscreenProgress::handleDestroy() DWORD exitcode = *((DWORD *)&code); // If we're active, have a cancel func, and haven't already cancelled, call cancel func - if( exitcode == STILL_ACTIVE && m_cancelFunc != nullptr && !m_bWasCancelled) + if( exitcode == STILL_ACTIVE && m_cancelFunc != NULL && !m_bWasCancelled) { m_bWasCancelled = true; m_cancelFunc(m_cancelFuncParam); @@ -223,7 +224,7 @@ void UIScene_FullscreenProgress::tick() // This just allows it to be shown Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); ui.UpdatePlayerBasePositions(); navigateBack(); } @@ -285,7 +286,7 @@ void UIScene_FullscreenProgress::handleInput(int iPad, int key, bool repeat, boo break; case ACTION_MENU_B: case ACTION_MENU_CANCEL: - if( pressed && m_cancelFunc != nullptr && !m_bWasCancelled ) + if( pressed && m_cancelFunc != NULL && !m_bWasCancelled ) { m_bWasCancelled = true; m_cancelFunc( m_cancelFuncParam ); @@ -297,7 +298,7 @@ void UIScene_FullscreenProgress::handleInput(int iPad, int key, bool repeat, boo void UIScene_FullscreenProgress::handlePress(F64 controlId, F64 childId) { - if(m_threadCompleted && static_cast(controlId) == eControl_Confirm) + if(m_threadCompleted && (int)controlId == eControl_Confirm) { // This assumes all buttons can only be pressed with the A button ui.AnimateKeyPress(m_iPad, ACTION_MENU_A, false, true, false); diff --git a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp index 9dcbe45b..392221a6 100644 --- a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp @@ -10,7 +10,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par // Setup all the Iggy references we need for this scene initialiseMovie(); - FurnaceScreenInput *initData = static_cast(_initData); + FurnaceScreenInput *initData = (FurnaceScreenInput *)_initData; m_furnace = initData->furnace; m_labelFurnace.init(m_furnace->getName()); @@ -21,9 +21,9 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par m_progressFurnaceArrow.init(L"",0,0,24,0); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Furnace_Menu, this); } @@ -202,7 +202,7 @@ void UIScene_FurnaceMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionFurnaceResult: @@ -230,7 +230,7 @@ void UIScene_FurnaceMenu::setSectionSelectedSlot(ESceneSection eSection, int x, UIControl *UIScene_FurnaceMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionFurnaceResult: diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index 2773b874..5f401c39 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -114,7 +114,7 @@ void UIScene_HUD::tick() if(getMovie() && app.GetGameStarted()) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) { return; } @@ -155,10 +155,10 @@ void UIScene_HUD::tick() void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; int slot = -1; - swscanf(static_cast(region->name),L"slot_%d",&slot); + swscanf((wchar_t*)region->name,L"slot_%d",&slot); if (slot == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -167,7 +167,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot); shared_ptr item = invSlot->getItem(); - if(item != nullptr) + if(item != NULL) { unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); float fVal; @@ -180,8 +180,8 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -190,12 +190,12 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } customDrawSlotControl(region,m_iPad,item,fVal,item->isFoil(),true); } @@ -254,7 +254,7 @@ void UIScene_HUD::handleReload() int iGuiScale; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) { iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISize); } @@ -595,7 +595,7 @@ void UIScene_HUD::SetSelectedLabel(const wstring &label) void UIScene_HUD::HideSelectedLabel() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , NULL ); } @@ -679,15 +679,15 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = static_cast(ui.getScreenHeight() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = static_cast(ui.getScreenWidth() / 2); - yPos = static_cast(ui.getScreenHeight() / 2); + xPos = (S32)(ui.getScreenWidth() / 2); + yPos = (S32)(ui.getScreenHeight() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -701,14 +701,14 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - tileHeight = static_cast(ui.getScreenHeight()); + tileHeight = (S32)(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = static_cast(ui.getScreenWidth()); + tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: @@ -744,7 +744,7 @@ void UIScene_HUD::handleTimerComplete(int id) Minecraft *pMinecraft = Minecraft::GetInstance(); bool anyVisible = false; - if(pMinecraft->localplayers[m_iPad]!= nullptr) + if(pMinecraft->localplayers[m_iPad]!= NULL) { Gui *pGui = pMinecraft->gui; //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); @@ -802,11 +802,11 @@ void UIScene_HUD::repositionHud() { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - height = static_cast(ui.getScreenHeight()); + height = (S32)(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - width = static_cast(ui.getScreenWidth()); + width = (S32)(ui.getScreenWidth()); break; } @@ -865,7 +865,7 @@ void UIScene_HUD::handleGameTick() if(getMovie() && app.GetGameStarted()) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) { m_parentLayer->showComponent(m_iPad, eUIScene_HUD,false); return; diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index ab79b940..292b77af 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -8,7 +8,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); + m_bNotInGame=(Minecraft::GetInstance()->level==NULL); m_buttons[BUTTON_HAO_CHANGESKIN].init(IDS_CHANGE_SKIN,BUTTON_HAO_CHANGESKIN); m_buttons[BUTTON_HAO_HOWTOPLAY].init(IDS_HOW_TO_PLAY,BUTTON_HAO_HOWTOPLAY); @@ -41,7 +41,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) @@ -103,7 +103,7 @@ void UIScene_HelpAndOptionsMenu::updateTooltips() void UIScene_HelpAndOptionsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -128,7 +128,7 @@ void UIScene_HelpAndOptionsMenu::handleReload() #endif // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) @@ -207,7 +207,7 @@ void UIScene_HelpAndOptionsMenu::handleInput(int iPad, int key, bool repeat, boo void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case BUTTON_HAO_CHANGESKIN: ui.NavigateToScene(m_iPad, eUIScene_SkinSelectMenu); diff --git a/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp index 8c657c97..f0f6db18 100644 --- a/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp @@ -10,14 +10,14 @@ UIScene_HopperMenu::UIScene_HopperMenu(int iPad, void *_initData, UILayer *paren // Setup all the Iggy references we need for this scene initialiseMovie(); - HopperScreenInput *initData = static_cast(_initData); + HopperScreenInput *initData = (HopperScreenInput *)_initData; m_labelDispenser.init(initData->hopper->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Hopper_Menu, this); } @@ -156,7 +156,7 @@ void UIScene_HopperMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionHopperContents: @@ -177,7 +177,7 @@ void UIScene_HopperMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i UIControl *UIScene_HopperMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionHopperContents: diff --git a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp index c062df4e..ab98e30f 100644 --- a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp @@ -11,16 +11,16 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, void *_initData // Setup all the Iggy references we need for this scene initialiseMovie(); - HorseScreenInput *initData = static_cast(_initData); + HorseScreenInput *initData = (HorseScreenInput *)_initData; m_labelHorse.init( initData->container->getName() ); m_inventory = initData->inventory; m_horse = initData->horse; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != nullptr ) + if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Horse_Menu, this); } @@ -240,7 +240,7 @@ void UIScene_HorseInventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionHorseArmor: @@ -268,7 +268,7 @@ void UIScene_HorseInventoryMenu::setSectionSelectedSlot(ESceneSection eSection, UIControl *UIScene_HorseInventoryMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionHorseArmor: @@ -296,7 +296,7 @@ UIControl *UIScene_HorseInventoryMenu::getSection(ESceneSection eSection) void UIScene_HorseInventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; if(wcscmp((wchar_t *)region->name,L"horse")==0) { diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp index bc721802..e33e24fe 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp @@ -136,7 +136,7 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa // Extract pad and required page from init data. We just put the data into the pointer rather than using it as an address. size_t uiInitData = ( size_t )( initData ); - EHowToPlayPage eStartPage = static_cast((uiInitData >> 16) & 0xFFF); // Ignores MSB which is set to 1! + EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1! TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage); @@ -216,10 +216,10 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed if(pressed) { // Next page - int iNextPage = static_cast(m_eCurrPage) + 1; + int iNextPage = ( int )( m_eCurrPage ) + 1; if ( iNextPage != eHowToPlay_NumPages ) { - StartPage( static_cast(iNextPage) ); + StartPage( ( EHowToPlayPage )( iNextPage ) ); ui.PlayUISFX(eSFX_Press); } handled = true; @@ -229,7 +229,7 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed if(pressed) { // Previous page - int iPrevPage = static_cast(m_eCurrPage) - 1; + int iPrevPage = ( int )( m_eCurrPage ) - 1; // 4J Stu - Add back for future platforms #if 0 @@ -247,7 +247,7 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed { if ( iPrevPage >= 0 ) { - StartPage( static_cast(iPrevPage) ); + StartPage( ( EHowToPlayPage )( iPrevPage ) ); ui.PlayUISFX(eSFX_Press); } @@ -300,8 +300,8 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) finalText = startTags + finalText; vector paragraphs; - size_t lastIndex = 0; - for ( size_t index = finalText.find(L"\r\n", lastIndex, 2); + int lastIndex = 0; + for ( int index = finalText.find(L"\r\n", lastIndex, 2); index != wstring::npos; index = finalText.find(L"\r\n", lastIndex, 2) ) @@ -318,7 +318,7 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) IggyStringUTF16 * stringVal = new IggyStringUTF16[paragraphs.size()]; value[0].type = IGGY_DATATYPE_number; - value[0].number = gs_pageToFlashMapping[static_cast(ePage)]; + value[0].number = gs_pageToFlashMapping[(int)ePage]; for(unsigned int i = 0; i < paragraphs.size(); ++i) { diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp index 728bd4c0..92e8bdef 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp @@ -122,7 +122,7 @@ void UIScene_HowToPlayMenu::updateTooltips() void UIScene_HowToPlayMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -191,13 +191,13 @@ void UIScene_HowToPlayMenu::handleInput(int iPad, int key, bool repeat, bool pre void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId) { - if( static_cast(controlId) == eControl_Buttons) + if( (int)controlId == eControl_Buttons) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); unsigned int uiInitData; - uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[static_cast(childId)] << 16 ) | static_cast(m_iPad) ); + uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) ); ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, ( void* )( uiInitData ) ); } } diff --git a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp index 51992e32..68ac537e 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp @@ -126,7 +126,7 @@ void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat, shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player->connection) { - player->connection->send(std::make_shared(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions)); + player->connection->send( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); } } @@ -153,7 +153,7 @@ void UIScene_InGameHostOptionsMenu::handlePress(F64 controlId, F64 childId) TeleportMenuInitData *initData = new TeleportMenuInitData(); initData->iPad = m_iPad; initData->teleportToPlayer = false; - if( static_cast(controlId) == eControl_TeleportToPlayer ) + if( (int)controlId == eControl_TeleportToPlayer ) { initData->teleportToPlayer = true; } diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index 7fc3d035..57acf345 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -23,7 +23,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { PlayerInfo *info = BuildPlayerInfo(player); @@ -36,7 +36,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); m_isHostPlayer = false; - if(thisPlayer != nullptr) m_isHostPlayer = thisPlayer->IsHost() == TRUE; + if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; @@ -109,7 +109,7 @@ void UIScene_InGameInfoMenu::updateTooltips() { keyA = IDS_TOOLTIPS_SELECT; } - else if( selectedPlayer != nullptr) + else if( selectedPlayer != NULL) { bool editingHost = selectedPlayer->IsHost(); if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost)) @@ -134,7 +134,7 @@ void UIScene_InGameInfoMenu::updateTooltips() if(!m_buttonGameOptions.hasFocus()) { // if the player is me, then view gamer profile - if(selectedPlayer != nullptr && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad) + if(selectedPlayer != NULL && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad) { ikeyY = IDS_TOOLTIPS_VIEW_GAMERPROFILE; } @@ -172,7 +172,7 @@ void UIScene_InGameInfoMenu::handleReload() { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { PlayerInfo *info = BuildPlayerInfo(player); @@ -183,7 +183,7 @@ void UIScene_InGameInfoMenu::handleReload() INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); m_isHostPlayer = false; - if(thisPlayer != nullptr) m_isHostPlayer = thisPlayer->IsHost() == TRUE; + if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; @@ -209,7 +209,7 @@ void UIScene_InGameInfoMenu::tick() { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if(player != nullptr) + if(player != NULL) { PlayerInfo *info = BuildPlayerInfo(player); @@ -283,7 +283,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr if(pressed && m_playerList.hasFocus() && (m_playerList.getItemCount() > 0) && (m_playerList.getCurrentSelection() < m_players.size()) ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); - if( player != nullptr ) + if( player != NULL ) { PlayerUID uid = player->GetUID(); if( uid != INVALID_XUID ) @@ -327,14 +327,14 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) { - app.DebugPrintf("Pressed = %d, %d\n", static_cast(controlId), static_cast(childId)); - switch(static_cast(controlId)) + app.DebugPrintf("Pressed = %d, %d\n", (int)controlId, (int)childId); + switch((int)controlId) { case eControl_GameOptions: ui.NavigateToScene(m_iPad,eUIScene_InGameHostOptionsMenu); break; case eControl_GamePlayers: - int currentSelection = static_cast(childId); + int currentSelection = (int)childId; INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId); Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -344,7 +344,7 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; - if( isOp && selectedPlayer != nullptr) + if( isOp && selectedPlayer != NULL) { bool editingHost = selectedPlayer->IsHost(); if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost)) @@ -377,10 +377,10 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) void UIScene_InGameInfoMenu::handleFocusChange(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_GamePlayers: - m_playerList.updateChildFocus( static_cast(childId) ); + m_playerList.updateChildFocus( (int) childId ); }; updateTooltips(); } @@ -389,7 +389,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer { app.DebugPrintf(" Player \"%ls\" %s (smallId: %d)\n", pPlayer->GetOnlineName(), leaving ? "leaving" : "joining", pPlayer->GetSmallId()); - UIScene_InGameInfoMenu *scene = static_cast(callbackParam); + UIScene_InGameInfoMenu *scene = (UIScene_InGameInfoMenu *)callbackParam; bool playerFound = false; int foundIndex = 0; for(int i = 0; i < scene->m_players.size(); ++i) @@ -439,7 +439,7 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *static_cast(pParam); + BYTE smallId = *(BYTE *)pParam; delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -448,7 +448,7 @@ int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage: shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer->connection) { - localPlayer->connection->send(std::make_shared(smallId)); + localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } } @@ -473,7 +473,7 @@ UIScene_InGameInfoMenu::PlayerInfo *UIScene_InGameInfoMenu::BuildPlayerInfo(INet } int voiceStatus = 0; - if(player != nullptr && player->HasVoice() ) + if(player != NULL && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 57937543..db9c1d4d 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -6,6 +6,7 @@ #include "..\..\ClientConnection.h" #include "..\..\..\Minecraft.World\net.minecraft.network.packet.h" + #define CHECKBOXES_TIMER_ID 0 #define CHECKBOXES_TIMER_TIME 100 @@ -16,21 +17,21 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void m_bShouldNavBack = false; - InGamePlayerOptionsInitData *initData = static_cast(_initData); + InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)_initData; m_networkSmallId = initData->networkSmallId; m_playerPrivileges = initData->playerPrivileges; INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(editingPlayer != nullptr) + if(editingPlayer != NULL) { m_labelGamertag.init(editingPlayer->GetDisplayName()); } bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; - m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer); + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) { @@ -240,7 +241,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload() bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; - m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer); + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) { @@ -371,7 +372,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat else { INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) ) + if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) ) { Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked()); Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked()); @@ -404,7 +405,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player->connection) { - player->connection->send(std::make_shared(m_networkSmallId, -1, m_playerPrivileges)); + player->connection->send( shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); } } navigateBack(); @@ -427,7 +428,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Kick: { @@ -445,7 +446,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *static_cast(pParam); + BYTE smallId = *(BYTE *)pParam; delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -454,7 +455,7 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4 shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer->connection) { - localPlayer->connection->send(std::make_shared(smallId)); + localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } // Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game. @@ -469,12 +470,12 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4 void UIScene_InGamePlayerOptionsMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { app.DebugPrintf("UIScene_InGamePlayerOptionsMenu::OnPlayerChanged"); - UIScene_InGamePlayerOptionsMenu *scene = static_cast(callbackParam); + UIScene_InGamePlayerOptionsMenu *scene = (UIScene_InGamePlayerOptionsMenu *)callbackParam; - UIScene_InGameInfoMenu *infoScene = static_cast(scene->getBackScene()); - if(infoScene != nullptr) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); + UIScene_InGameInfoMenu *infoScene = (UIScene_InGameInfoMenu *)scene->getBackScene(); + if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); - if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId) + if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) { scene->m_bShouldNavBack = true; } @@ -496,7 +497,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes() void UIScene_InGamePlayerOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Op: // flag that the moderator state has changed diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp index fb118b15..fa2c7e61 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -8,7 +8,7 @@ int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_InGameSaveManagementMenu *pClass= static_cast(lpParam); + UIScene_InGameSaveManagementMenu *pClass= (UIScene_InGameSaveManagementMenu *)lpParam; app.DebugPrintf("Received data for save thumbnail\n"); @@ -20,9 +20,9 @@ int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(LPVOID lpPar } else { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = nullptr; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = NULL; pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = 0; - app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); + app.DebugPrintf("Save thumbnail data is NULL, or has size 0\n"); } pClass->m_bSaveThumbnailReady = true; @@ -55,9 +55,9 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu(int iPad, voi m_bRetrievingSaveThumbnails = false; m_bSaveThumbnailReady = false; m_bExitScene=false; - m_pSaveDetails=nullptr; + m_pSaveDetails=NULL; m_bSavesDisplayed=false; - m_saveDetails = nullptr; + m_saveDetails = NULL; m_iSaveDetailsCount = 0; #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) @@ -198,17 +198,17 @@ void UIScene_InGameSaveManagementMenu::tick() if(!m_bSavesDisplayed) { m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails!=nullptr) + if(m_pSaveDetails!=NULL) { m_spaceIndicatorSaves.reset(); m_bSavesDisplayed=true; - if(m_saveDetails!=nullptr) + if(m_saveDetails!=NULL) { for(unsigned int i = 0; i < m_pSaveDetails->iSaveC; ++i) { - if(m_saveDetails[i].pbThumbnailData!=nullptr) + if(m_saveDetails[i].pbThumbnailData!=NULL) { delete m_saveDetails[i].pbThumbnailData; } @@ -371,9 +371,9 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo( ) m_controlSavesTimer.setVisible(true); m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==nullptr) + if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,nullptr,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } @@ -418,12 +418,12 @@ void UIScene_InGameSaveManagementMenu::handleInput(int iPad, int key, bool repea void UIScene_InGameSaveManagementMenu::handleInitFocus(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId); } void UIScene_InGameSaveManagementMenu::handleFocusChange(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); m_iSaveListIndex = childId; if(m_bSavesDisplayed) m_bUpdateSaveSize = true; updateTooltips(); @@ -431,7 +431,7 @@ void UIScene_InGameSaveManagementMenu::handleFocusChange(F64 controlId, F64 chil void UIScene_InGameSaveManagementMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_SavesList: { @@ -452,7 +452,7 @@ void UIScene_InGameSaveManagementMenu::handlePress(F64 controlId, F64 childId) int UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_InGameSaveManagementMenu* pClass = static_cast(pParam); + UIScene_InGameSaveManagementMenu* pClass = (UIScene_InGameSaveManagementMenu*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -477,7 +477,7 @@ int UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned(void *pParam,int int UIScene_InGameSaveManagementMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) { - UIScene_InGameSaveManagementMenu* pClass = static_cast(lpParam); + UIScene_InGameSaveManagementMenu* pClass = (UIScene_InGameSaveManagementMenu*)lpParam; if(bRes) { diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp index 4e217c77..4a9dab43 100644 --- a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp @@ -23,17 +23,17 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - InventoryScreenInput *initData = static_cast(_initData); + InventoryScreenInput *initData = (InventoryScreenInput *)_initData; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this); } - InventoryMenu *menu = static_cast(initData->player->inventoryMenu); + InventoryMenu *menu = (InventoryMenu *)initData->player->inventoryMenu; initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory()); @@ -182,7 +182,7 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = nullptr; + UIControl_SlotList *slotList = NULL; switch( eSection ) { case eSectionInventoryArmor: @@ -201,7 +201,7 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection) { - UIControl *control = nullptr; + UIControl *control = NULL; switch( eSection ) { case eSectionInventoryArmor: @@ -220,7 +220,7 @@ UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection) void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; if(wcscmp((wchar_t *)region->name,L"player")==0) { @@ -253,7 +253,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay() Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player == nullptr) return; + if(player == NULL) return; vector *activeEffects = player->getActiveEffects(); diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 5ea5dd32..6e354922 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -16,7 +16,7 @@ UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLay // Setup all the Iggy references we need for this scene initialiseMovie(); - JoinMenuInitData *initData = static_cast(_initData); + JoinMenuInitData *initData = (JoinMenuInitData *)_initData; m_selectedSession = initData->selectedSession; m_friendInfoUpdatedOK = false; m_friendInfoUpdatedERROR = false; @@ -62,7 +62,7 @@ void UIScene_JoinMenu::tick() #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) { - if( m_selectedSession->data.players[i] != nullptr ) + if( m_selectedSession->data.players[i] != NULL ) { #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<(pParam); + UIScene_JoinMenu *scene = (UIScene_JoinMenu *)pParam; ui.NavigateBack(scene->m_iPad); if( success ) { @@ -238,7 +238,7 @@ void UIScene_JoinMenu::friendSessionUpdated(bool success, void *pParam) int UIScene_JoinMenu::ErrorDialogReturned(void *pParam, int iPad, const C4JStorage::EMessageResult) { - UIScene_JoinMenu *scene = static_cast(pParam); + UIScene_JoinMenu *scene = (UIScene_JoinMenu *)pParam; ui.NavigateBack(scene->m_iPad); return 0; @@ -272,7 +272,7 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, break; #ifdef _DURANGO case ACTION_MENU_Y: - if(m_selectedSession != nullptr && getControlFocus() == eControl_GamePlayers && m_buttonListPlayers.getItemCount() > 0) + if(m_selectedSession != NULL && getControlFocus() == eControl_GamePlayers && m_buttonListPlayers.getItemCount() > 0) { PlayerUID uid = m_selectedSession->searchResult.m_playerXuids[m_buttonListPlayers.getCurrentSelection()]; if( uid != INVALID_XUID ) ProfileManager.ShowProfileCard(ProfileManager.GetLockedProfile(),uid); @@ -301,7 +301,7 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, void UIScene_JoinMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_JoinGame: { @@ -324,10 +324,10 @@ void UIScene_JoinMenu::handlePress(F64 controlId, F64 childId) void UIScene_JoinMenu::handleFocusChange(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_GamePlayers: - m_buttonListPlayers.updateChildFocus( static_cast(childId) ); + m_buttonListPlayers.updateChildFocus( (int) childId ); }; updateTooltips(); } @@ -370,7 +370,7 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_JoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)pParam)); + UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); if(pClass) { @@ -473,7 +473,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) #if defined(__PS3__) || defined(__PSVITA__) if(isSignedInLive) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,NULL,NULL); } #else ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); @@ -511,7 +511,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -608,7 +608,7 @@ void UIScene_JoinMenu::handleTimerComplete(int id) int selectedIndex = 0; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if( m_selectedSession->data.players[i] != nullptr ) + if( m_selectedSession->data.players[i] != NULL ) { if(m_selectedSession->data.players[i] == selectedPlayerXUID) selectedIndex = i; playersList.InsertItems(i,1); @@ -625,7 +625,7 @@ void UIScene_JoinMenu::handleTimerComplete(int id) } else { - // Leave the loop when we hit the first nullptr player + // Leave the loop when we hit the first NULL player break; } } diff --git a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp index 352f2b7b..b28564c3 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp @@ -17,8 +17,8 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye initialiseMovie(); #ifdef _WINDOWS64 - m_win64Callback = nullptr; - m_win64CallbackParam = nullptr; + m_win64Callback = NULL; + m_win64CallbackParam = NULL; m_win64TextBuffer = L""; m_win64MaxChars = 25; @@ -28,7 +28,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye m_bPCMode = false; if (initData) { - UIKeyboardInitData* kbData = static_cast(initData); + UIKeyboardInitData* kbData = (UIKeyboardInitData*)initData; m_win64Callback = kbData->callback; m_win64CallbackParam = kbData->lpParam; if (kbData->title) titleText = kbData->title; @@ -105,11 +105,11 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye }; IggyName nameVisible = registerFastName(L"visible"); IggyValuePath* root = IggyPlayerRootPath(getMovie()); - for (int i = 0; i < static_cast(sizeof(s_keyNames) / sizeof(s_keyNames[0])); ++i) + for (int i = 0; i < (int)(sizeof(s_keyNames) / sizeof(s_keyNames[0])); ++i) { IggyValuePath keyPath; if (IggyValuePathMakeNameRef(&keyPath, root, s_keyNames[i])) - IggyValueSetBooleanRS(&keyPath, nameVisible, nullptr, false); + IggyValueSetBooleanRS(&keyPath, nameVisible, NULL, false); } } #endif @@ -192,7 +192,7 @@ void UIScene_Keyboard::tick() m_bKeyboardDonePressed = true; } } - else if (static_cast(m_win64TextBuffer.length()) < m_win64MaxChars) + else if ((int)m_win64TextBuffer.length() < m_win64MaxChars) { m_win64TextBuffer += ch; changed = true; @@ -229,33 +229,33 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, handled = true; break; case ACTION_MENU_X: // X - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcBackspaceButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcBackspaceButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_PAGEUP: // LT - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSymbolButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSymbolButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_Y: // Y - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSpaceButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSpaceButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_STICK_PRESS: // LS - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCapsButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCapsButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_LEFT_SCROLL: // LB - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorLeftButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorLeftButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_RIGHT_SCROLL: // RB - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorRightButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorRightButtonPressed, 0 , NULL ); handled = true; break; case ACTION_MENU_PAUSEMENU: // Start if(!m_bKeyboardDonePressed) { - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcDoneButtonPressed, 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcDoneButtonPressed, 0 , NULL ); // kick off done timer addTimer(KEYBOARD_DONE_TIMER_ID,KEYBOARD_DONE_TIMER_TIME); @@ -281,7 +281,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, void UIScene_Keyboard::handlePress(F64 controlId, F64 childId) { - if(static_cast(controlId) == 0) + if((int)controlId == 0) { // Done has been pressed. At this point we can query for the input string and pass it on to wherever it is needed. // we can not query for m_KeyboardTextInput.getLabel() here because we're in an iggy callback so we need to wait a frame. diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp index c2a30d3c..07039135 100644 --- a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp @@ -58,7 +58,7 @@ void UIScene_LanguageSelector::updateTooltips() void UIScene_LanguageSelector::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -112,14 +112,14 @@ void UIScene_LanguageSelector::handleInput(int iPad, int key, bool repeat, bool void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId) { - if( static_cast(controlId) == eControl_Buttons ) + if( (int)controlId == eControl_Buttons ) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); int newLanguage, newLocale; - newLanguage = uiLangMap[static_cast(childId)]; - newLocale = uiLocaleMap[static_cast(childId)]; + newLanguage = uiLangMap[(int)childId]; + newLocale = uiLocaleMap[(int)childId]; app.SetMinecraftLanguage(m_iPad, newLanguage); app.SetMinecraftLocale(m_iPad, newLocale); diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index b2981ebf..96dd744e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -20,7 +20,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini // Setup all the Iggy references we need for this scene initialiseMovie(); - m_params = static_cast(initData); + m_params = (LaunchMoreOptionsMenuInitData *)initData; m_labelWorldOptions.init(app.GetString(IDS_WORLD_OPTIONS)); @@ -116,9 +116,9 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini if(m_params->currentWorldSize != e_worldSize_Unknown) { m_labelWorldResize.init(app.GetString(IDS_INCREASE_WORLD_SIZE)); - int min= static_cast(m_params->currentWorldSize)-1; + int min= int(m_params->currentWorldSize)-1; int max=3; - int curr = static_cast(m_params->newWorldSize)-1; + int curr = int(m_params->newWorldSize)-1; m_sliderWorldResize.init(app.GetString(m_iWorldSizeTitleA[curr]),eControl_WorldResize,min,max,curr); m_checkboxes[eLaunchCheckbox_WorldResizeType].init(app.GetString(IDS_INCREASE_WORLD_SIZE_OVERWRITE_EDGES),eLaunchCheckbox_WorldResizeType,m_params->newWorldSizeOverwriteEdges); } @@ -308,7 +308,7 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, m_tabIndex = m_tabIndex == 0 ? 1 : 0; updateTooltips(); IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , NULL ); } break; } @@ -330,7 +330,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S m_tabIndex = iNewTabIndex; updateTooltips(); IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , NULL ); } ui.TouchBoxRebuild(this); break; @@ -354,7 +354,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch(static_cast((int)controlId)) + switch((EControls)((int)controlId)) { case eLaunchCheckbox_Online: m_params->bOnlineGame = selected; @@ -428,7 +428,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId) { int stringId = 0; - switch(static_cast(controlId)) + switch((int)controlId) { case eLaunchCheckbox_Online: stringId = IDS_GAMEOPTION_ONLINE; @@ -549,7 +549,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes) { - UIScene_LaunchMoreOptionsMenu *pClass=static_cast(lpParam); + UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam; pClass->m_bIgnoreInput=false; if (bRes) { @@ -595,7 +595,7 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) if (isDirectEditBlocking()) return; #endif - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_EditSeed: { @@ -642,8 +642,8 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_WorldSize: #ifdef _LARGE_WORLDS @@ -654,11 +654,11 @@ void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentVa break; case eControl_WorldResize: #ifdef _LARGE_WORLDS - EGameHostOptionWorldSize changedSize = static_cast(value + 1); + EGameHostOptionWorldSize changedSize = EGameHostOptionWorldSize(value+1); if(changedSize >= m_params->currentWorldSize) { m_sliderWorldResize.handleSliderMove(value); - m_params->newWorldSize = static_cast(value + 1); + m_params->newWorldSize = EGameHostOptionWorldSize(value+1); m_sliderWorldResize.setLabel(app.GetString(m_iWorldSizeTitleA[value])); } #endif diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index ed0b3151..12b21905 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -9,12 +9,12 @@ #define PLAYER_ONLINE_TIMER_TIME 100 // if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon -const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] = +const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] = { - {UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, -1}, - {Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id}, - {Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, -1}, - {UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME}, + { UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, NULL }, + { Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id }, + { Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, NULL }, + { UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME }, }; const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = { { @@ -438,7 +438,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) } else { - m_newEntryIndex = static_cast(startIndex); + m_newEntryIndex = (unsigned int)startIndex; // m_newReadSize = min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); } @@ -462,7 +462,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { m_interface.ReadStats_TopRank( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, m_newEntryIndex, m_newReadSize ); } @@ -472,7 +472,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) PlayerUID uid; ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(),&uid, true); m_interface.ReadStats_MyScore( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, uid /*ignored on PS3*/, m_newReadSize ); @@ -483,7 +483,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) PlayerUID uid; ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(),&uid, true); m_interface.ReadStats_Friends( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, uid /*ignored on PS3*/, m_newEntryIndex, m_newReadSize ); @@ -558,7 +558,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() else { m_leaderboard.m_entries[entryIndex].m_columns[i] = UINT_MAX; - swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", static_cast(m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); + swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", ((float)m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); } } @@ -576,7 +576,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() return true; } - //assert( LeaderboardManager::Instance()->GetStats() != nullptr ); + //assert( LeaderboardManager::Instance()->GetStats() != NULL ); //PXUSER_STATS_READ_RESULTS stats = LeaderboardManager::Instance()->GetStats(); //if( m_currentFilter == LeaderboardManager::eFM_Friends ) LeaderboardManager::Instance()->SortFriendStats(); @@ -781,7 +781,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor else if(iDigitC<8) { // km with a .X - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", ((float)leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG //app.DebugPrintf("Display - %.1fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif @@ -789,7 +789,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor else { // bigger than that, so no decimal point - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", ((float)leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG //app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif @@ -964,14 +964,14 @@ int UIScene_LeaderboardsMenu::SetLeaderboardTitleIcons() void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int slotId = -1; - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if (slotId == -1) { //app.DebugPrintf("This is not the control we are looking for\n"); } else { - shared_ptr item = std::make_shared(TitleIcons[m_currentLeaderboard][slotId], 1, 0); + shared_ptr item = shared_ptr( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) ); customDrawSlotControl(region,m_iPad,item,1.0f,false,false); } } @@ -979,14 +979,14 @@ void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene_LeaderboardsMenu::handleSelectionChanged(F64 selectedId) { ui.PlayUISFX(eSFX_Focus); - m_newSel = static_cast(selectedId); + m_newSel = (int)selectedId; updateTooltips(); } // Handle a request from Iggy for more data void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { - unsigned int item = static_cast(startIndex); + unsigned int item = (int)startIndex; if( m_leaderboard.m_totalEntryCount > 0 && (item+1) < GetEntryStartIndex() ) { @@ -995,7 +995,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) int readIndex = (GetEntryStartIndex() + 1) - READ_SIZE; if( readIndex <= 0 ) readIndex = 1; - assert( readIndex >= 1 && readIndex <= static_cast(m_leaderboard.m_totalEntryCount)); + assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount ); ReadStats(readIndex); } } @@ -1004,7 +1004,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) if( LeaderboardManager::Instance()->isIdle() ) { int readIndex = (GetEntryStartIndex() + 1) + m_leaderboard.m_entries.size(); - assert( readIndex >= 1 && readIndex <= static_cast(m_leaderboard.m_totalEntryCount)); + assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount ); ReadStats(readIndex); } } @@ -1033,7 +1033,7 @@ void UIScene_LeaderboardsMenu::handleTimerComplete(int id) int UIScene_LeaderboardsMenu::ExitLeaderboards(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LeaderboardsMenu* pClass = static_cast(pParam); + UIScene_LeaderboardsMenu* pClass = (UIScene_LeaderboardsMenu*)pParam; pClass->navigateBack(); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index d61a7902..ed3c8137 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -34,7 +34,7 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_LoadMenu *pClass= static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); + UIScene_LoadMenu *pClass= (UIScene_LoadMenu *)ui.GetSceneFromCallbackId((size_t)lpParam); if(pClass) { @@ -50,7 +50,7 @@ int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumb } else { - app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); + app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); pClass->m_bThumbnailGetFailed = true; } pClass->m_bRetrievingSaveThumbnail = false; @@ -64,7 +64,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye // Setup all the Iggy references we need for this scene initialiseMovie(); - LoadMenuInitData *params = static_cast(initData); + LoadMenuInitData *params = (LoadMenuInitData *)initData; m_labelGameName.init(app.GetString(IDS_WORLD_NAME)); m_labelSeed.init(L""); @@ -102,7 +102,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_bSaveThumbnailReady = false; m_bRetrievingSaveThumbnail = true; m_bShowTimer = false; - m_pDLCPack = nullptr; + m_pDLCPack = NULL; m_bAvailableTexturePacksChecked=false; m_bRequestQuadrantSignin = false; m_iTexturePacksNotInstalled=0; @@ -249,7 +249,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #endif #endif #ifdef _WINDOWS64 - if (params->saveDetails != nullptr && params->saveDetails->UTF8SaveName[0] != '\0') + if (params->saveDetails != NULL && params->saveDetails->UTF8SaveName[0] != '\0') { wchar_t wSaveName[128]; ZeroMemory(wSaveName, sizeof(wSaveName)); @@ -305,7 +305,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye if(!m_bAvailableTexturePacksChecked) #endif { - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -451,9 +451,9 @@ void UIScene_LoadMenu::tick() // #ifdef _DEBUG // // dump out the thumbnail - // HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); + // HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); // DWORD dwBytes; - // WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,nullptr); + // WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,NULL); // XCloseHandle(hThumbnail); // #endif @@ -477,7 +477,7 @@ void UIScene_LoadMenu::tick() m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions,eGameHostOption_TNT)>0?TRUE:FALSE; m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions,eGameHostOption_CheatsEnabled)>0?TRUE:FALSE; m_MoreOptionsParams.bDisableSaving = app.GetGameHostOption(uiHostOptions,eGameHostOption_DisableSaving)>0?TRUE:FALSE; - m_MoreOptionsParams.currentWorldSize = static_cast(app.GetGameHostOption(uiHostOptions, eGameHostOption_WorldSize)); + m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)app.GetGameHostOption(uiHostOptions,eGameHostOption_WorldSize); m_MoreOptionsParams.newWorldSize = m_MoreOptionsParams.currentWorldSize; m_MoreOptionsParams.bMobGriefing = app.GetGameHostOption(uiHostOptions, eGameHostOption_MobGriefing); @@ -696,7 +696,7 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_GameMode: switch(m_iGameModeId) @@ -725,7 +725,7 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) break; case eControl_TexturePackList: { - UpdateCurrentTexturePack(static_cast(childId)); + UpdateCurrentTexturePack((int)childId); } break; case eControl_LoadWorld: @@ -771,7 +771,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack==nullptr) + if(pTexturePack==NULL) { #if TO_BE_IMPLEMENTED // They've selected a texture pack they don't have yet @@ -821,7 +821,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() { // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - DLCTexturePack *pDLCTexPack=static_cast(pTexturePack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack; m_pDLCPack=pDLCTexPack->getDLCInfoParentPack(); // do we have a license? @@ -849,7 +849,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -946,8 +946,8 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_Difficulty: m_sliderDifficulty.handleSliderMove(value); @@ -1107,7 +1107,7 @@ void UIScene_LoadMenu::LaunchGame(void) // inform them that leaderboard writes and achievements will be disabled //ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::ConfirmLoadReturned,this,app.GetStringTable()); - if(m_levelGen != nullptr) + if(m_levelGen != NULL) { m_bIsCorrupt = false; LoadDataComplete(this); @@ -1150,7 +1150,7 @@ void UIScene_LoadMenu::LaunchGame(void) } else { - if(m_levelGen != nullptr) + if(m_levelGen != NULL) { m_bIsCorrupt = false; LoadDataComplete(this); @@ -1182,7 +1182,7 @@ void UIScene_LoadMenu::LaunchGame(void) int UIScene_LoadMenu::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -1206,11 +1206,11 @@ int UIScene_LoadMenu::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage: int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { - if(pClass->m_levelGen != nullptr) + if(pClass->m_levelGen != NULL) { pClass->m_bIsCorrupt = false; pClass->LoadDataComplete(pClass); @@ -1246,7 +1246,7 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes int UIScene_LoadMenu::LoadDataComplete(void *pParam) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if(!pClass->m_bIsCorrupt) { @@ -1312,7 +1312,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) #if defined(__PS3__) || defined(__PSVITA__) if(isOnlineGame) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,NULL,&bContentRestricted,NULL); } #endif @@ -1362,7 +1362,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return 0; } @@ -1381,7 +1381,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),NULL,0,false); } #endif @@ -1392,7 +1392,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1431,7 +1431,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return 0; } @@ -1450,7 +1450,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),NULL,0,false); } #endif else @@ -1484,7 +1484,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; pClass->m_bIsCorrupt=bIsCorrupt; @@ -1520,13 +1520,13 @@ int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bI int UIScene_LoadMenu::TrophyDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } int UIScene_LoadMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -1543,7 +1543,7 @@ int UIScene_LoadMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage: int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; app.SetCorruptSaveDeleted(true); pClass->navigateBack(); @@ -1554,7 +1554,7 @@ int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask) { - if(pClass->m_levelGen == nullptr) + if(pClass->m_levelGen == NULL) { INT saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); @@ -1582,7 +1582,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal NetworkGameInitData *param = new NetworkGameInitData(); param->seed = pClass->m_seed; - param->saveData = nullptr; + param->saveData = NULL; param->levelGen = pClass->m_levelGen; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; param->levelName = pClass->m_levelName; @@ -1642,7 +1642,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1676,7 +1676,7 @@ void UIScene_LoadMenu::checkStateAndStartGame() int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_LoadMenu* pClass = static_cast(pParam); + UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if(bContinue==true) { @@ -1779,7 +1779,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int if(ProfileManager.IsSignedInLive(i)) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, i ); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index c4829350..00462a90 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -36,13 +36,13 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) if (slashPos != wstring::npos) { wstring sidecarPath = filePath.substr(0, slashPos + 1) + L"worldname.txt"; - FILE *fr = nullptr; + FILE *fr = NULL; if (_wfopen_s(&fr, sidecarPath.c_str(), L"r") == 0 && fr) { char buf[128] = {}; if (fgets(buf, sizeof(buf), fr)) { - int len = static_cast(strlen(buf)); + int len = (int)strlen(buf); while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r' || buf[len-1] == ' ')) buf[--len] = '\0'; fclose(fr); @@ -57,15 +57,15 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } } - HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (hFile == INVALID_HANDLE_VALUE) return L""; - DWORD fileSize = GetFileSize(hFile, nullptr); + DWORD fileSize = GetFileSize(hFile, NULL); if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) { CloseHandle(hFile); return L""; } unsigned char *rawData = new unsigned char[fileSize]; DWORD bytesRead = 0; - if (!ReadFile(hFile, rawData, fileSize, &bytesRead, nullptr) || bytesRead != fileSize) + if (!ReadFile(hFile, rawData, fileSize, &bytesRead, NULL) || bytesRead != fileSize) { CloseHandle(hFile); delete[] rawData; @@ -73,7 +73,7 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } CloseHandle(hFile); - unsigned char *saveData = nullptr; + unsigned char *saveData = NULL; unsigned int saveSize = 0; bool freeSaveData = false; @@ -120,10 +120,10 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) ba.data = (byte*)(saveData + off); ba.length = len; CompoundTag *root = NbtIo::decompress(ba); - if (root != nullptr) + if (root != NULL) { CompoundTag *dataTag = root->getCompound(L"Data"); - if (dataTag != nullptr) + if (dataTag != NULL) result = dataTag->getString(L"LevelName"); delete root; } @@ -172,7 +172,7 @@ C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDet int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_LoadOrJoinMenu *pClass= static_cast(lpParam); + UIScene_LoadOrJoinMenu *pClass= (UIScene_LoadOrJoinMenu *)lpParam; app.DebugPrintf("Received data for save thumbnail\n"); @@ -184,9 +184,9 @@ int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE p } else { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = nullptr; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = NULL; pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = 0; - app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); + app.DebugPrintf("Save thumbnail data is NULL, or has size 0\n"); } pClass->m_bSaveThumbnailReady = true; @@ -215,7 +215,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_bIgnoreInput = false; m_bShowingPartyGamesOnly = false; m_bInParty = false; - m_currentSessions = nullptr; + m_currentSessions = NULL; m_iState=e_SavesIdle; //m_bRetrievingSaveInfo=false; @@ -239,9 +239,9 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_bRetrievingSaveThumbnails = false; m_bSaveThumbnailReady = false; m_bExitScene=false; - m_pSaveDetails=nullptr; + m_pSaveDetails=NULL; m_bSavesDisplayed=false; - m_saveDetails = nullptr; + m_saveDetails = NULL; m_iSaveDetailsCount = 0; m_iTexturePacksNotInstalled = 0; m_bCopying = false; @@ -320,7 +320,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer #ifdef _XBOX // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -399,11 +399,11 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() { - g_NetworkManager.SetSessionsUpdatedCallback( nullptr, nullptr ); + g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL ); app.SetLiveLinkRequired( false ); delete m_currentSessions; - m_currentSessions = nullptr; + m_currentSessions = NULL; #if TO_BE_IMPLEMENTED // Reset the background downloading, in case we changed it by attempting to download a texture pack @@ -705,7 +705,7 @@ void UIScene_LoadOrJoinMenu::tick() if(!m_bSavesDisplayed) { m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails!=nullptr) + if(m_pSaveDetails!=NULL) { //CD - Fix - Adding define for ORBIS/XBOXONE #if defined(_XBOX_ONE) || defined(__ORBIS__) @@ -716,11 +716,11 @@ void UIScene_LoadOrJoinMenu::tick() m_bSavesDisplayed=true; UpdateGamesList(); - if(m_saveDetails!=nullptr) + if(m_saveDetails!=NULL) { for(unsigned int i = 0; i < m_iSaveDetailsCount; ++i) { - if(m_saveDetails[i].pbThumbnailData!=nullptr) + if(m_saveDetails[i].pbThumbnailData!=NULL) { delete m_saveDetails[i].pbThumbnailData; } @@ -1000,9 +1000,9 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() #ifdef __ORBIS__ // We need to make sure this is non-null so that we have an idea of free space m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==nullptr) + if(m_pSaveDetails==NULL) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,nullptr,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); } #endif @@ -1015,7 +1015,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() if( savesDir.exists() ) { m_saves = savesDir.listFiles(); - uiSaveC = static_cast(m_saves->size()); + uiSaveC = (unsigned int)m_saves->size(); } // add the New Game and Tutorial after the saves list is retrieved, if there are any saves @@ -1049,10 +1049,10 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_controlSavesTimer.setVisible(true); m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==nullptr) + if(m_pSaveDetails==NULL) { char savename[] = "save"; - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, nullptr, this, savename); + C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, NULL, this, savename); } #if TO_BE_IMPLEMENTED @@ -1391,7 +1391,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled - UIScene_LoadOrJoinMenu *pClass=static_cast(lpParam); + UIScene_LoadOrJoinMenu *pClass=(UIScene_LoadOrJoinMenu *)lpParam; pClass->m_bIgnoreInput=false; if (bRes) { @@ -1416,7 +1416,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo // Convert the ui16Text input to a wide string wchar_t wNewName[128] = {}; for (int k = 0; k < 127 && ui16Text[k]; k++) - wNewName[k] = static_cast(ui16Text[k]); + wNewName[k] = (wchar_t)ui16Text[k]; // Convert to narrow for storage and in-memory update char narrowName[128] = {}; @@ -1427,7 +1427,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo mbstowcs(wFilename, pClass->m_saveDetails[listPos].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); wstring sidecarPath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\worldname.txt"); - FILE *fw = nullptr; + FILE *fw = NULL; if (_wfopen_s(&fw, sidecarPath.c_str(), L"w") == 0 && fw) { fputs(narrowName, fw); @@ -1460,18 +1460,18 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo } void UIScene_LoadOrJoinMenu::handleInitFocus(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", (int)controlId, (int)childId); } void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_GamesList: m_iGameListIndex = childId; - m_buttonListGames.updateChildFocus( static_cast(childId) ); + m_buttonListGames.updateChildFocus( (int) childId ); break; case eControl_SavesList: m_iSaveListIndex = childId; @@ -1493,18 +1493,18 @@ void UIScene_LoadOrJoinMenu::remoteStorageGetSaveCallback(LPVOID lpParam, SonyRe void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_SavesList: { m_bIgnoreInput=true; - int lGenID = static_cast(childId) - 1; + int lGenID = (int)childId - 1; //CD - Added for audio ui.PlayUISFX(eSFX_Press); - if(static_cast(childId) == JOIN_LOAD_CREATE_BUTTON_INDEX) + if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX) { app.SetTutorialMode( false ); @@ -1535,7 +1535,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) params->iSaveGameInfoIndex=-1; //params->pbSaveRenamed=&m_bSaveRenamed; params->levelGen = levelGen; - params->saveDetails = nullptr; + params->saveDetails = NULL; // navigate to the settings scene ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LoadMenu, params); @@ -1546,7 +1546,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) #ifdef __ORBIS__ // check if this is a damaged save PSAVE_INFO pSaveInfo = &m_pSaveDetails->SaveInfoA[((int)childId)-m_iDefaultButtonsC]; - if(pSaveInfo->thumbnailData == nullptr && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files + if(pSaveInfo->thumbnailData == NULL && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files { // give the option to delete the save UINT uiIDA[2]; @@ -1562,17 +1562,17 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { - LoadSaveFromDisk(m_saves->at(static_cast(childId)-m_iDefaultButtonsC)); + LoadSaveFromDisk(m_saves->at((int)childId-m_iDefaultButtonsC)); } else { LoadMenuInitData *params = new LoadMenuInitData(); params->iPad = m_iPad; // need to get the iIndex from the list item, since the position in the list doesn't correspond to the GetSaveGameInfo list because of sorting - params->iSaveGameInfoIndex=m_saveDetails[static_cast(childId)-m_iDefaultButtonsC].saveId; + params->iSaveGameInfoIndex=m_saveDetails[((int)childId)-m_iDefaultButtonsC].saveId; //params->pbSaveRenamed=&m_bSaveRenamed; - params->levelGen = nullptr; - params->saveDetails = &m_saveDetails[ static_cast(childId)-m_iDefaultButtonsC ]; + params->levelGen = NULL; + params->saveDetails = &m_saveDetails[ ((int)childId)-m_iDefaultButtonsC ]; #ifdef _XBOX_ONE // On XB1, saves might need syncing, in which case inform the user so they can decide whether they want to wait for this to happen @@ -1606,7 +1606,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); { - int nIndex = static_cast(childId); + int nIndex = (int)childId; m_iGameListIndex = nIndex; CheckAndJoinGame(nIndex); } @@ -1626,7 +1626,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) bool bContentRestricted=false; // we're online, since we are joining a game - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,NULL); #ifdef __ORBIS__ // 4J Stu - On PS4 we don't restrict playing multiplayer based on chat restriction, so remove this check @@ -1670,7 +1670,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; // Not allowed to play online - ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,nullptr,this); + ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,NULL,this); #else // Not allowed to play online ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0 ); @@ -1715,7 +1715,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); return; } @@ -1735,7 +1735,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // UINT uiIDA[2]; // uiIDA[0]=IDS_CONFIRM_OK; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; - // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); + // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); m_bIgnoreInput=false; return; @@ -1837,7 +1837,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ); param->levelGen = levelGen; @@ -1856,7 +1856,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1870,9 +1870,9 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(LPVOID pParam) { - if(pParam != nullptr) + if(pParam != NULL) { - UIScene_LoadOrJoinMenu *pScene = static_cast(pParam); + UIScene_LoadOrJoinMenu *pScene = (UIScene_LoadOrJoinMenu *)pParam; pScene->UpdateGamesList(); } } @@ -1892,7 +1892,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() } - FriendSessionInfo *pSelectedSession = nullptr; + FriendSessionInfo *pSelectedSession = NULL; if(DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { unsigned int nIndex = m_buttonListGames.getCurrentSelection(); @@ -1901,8 +1901,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() SessionID selectedSessionId; ZeroMemory(&selectedSessionId,sizeof(SessionID)); - if( pSelectedSession != nullptr )selectedSessionId = pSelectedSession->sessionId; - pSelectedSession = nullptr; + if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId; + pSelectedSession = NULL; m_controlJoinTimer.setVisible( false ); @@ -1917,7 +1917,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // Update the xui list displayed unsigned int xuiListSize = m_buttonListGames.getItemCount(); - unsigned int filteredListSize = static_cast(m_currentSessions->size()); + unsigned int filteredListSize = (unsigned int)m_currentSessions->size(); BOOL gamesListHasFocus = DoesGamesListHaveFocus(); @@ -1968,12 +1968,12 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() HRESULT hr; DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; - if(tp==nullptr) + if(tp==NULL) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? @@ -2174,7 +2174,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save int64_t fileSize = saveFile->length(); FileInputStream fis(*saveFile); - byteArray ba(static_cast(fileSize)); + byteArray ba(fileSize); fis.read(ba); fis.close(); @@ -2208,7 +2208,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2314,7 +2314,7 @@ static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu* pClass = static_cast(pParam); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog // Check that we have a valid save selected (can get a bad index if the save list has been refreshed) @@ -2336,7 +2336,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) { wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; - mbstowcs_s(nullptr, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + mbstowcs_s(NULL, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); wchar_t wFolderPath[MAX_PATH] = {}; swprintf_s(wFolderPath, MAX_PATH, L"Windows64\\GameHDD\\%s", wFilename); bSuccess = Win64_DeleteSaveDirectory(wFolderPath); @@ -2360,7 +2360,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) { ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); if(pClass) { @@ -2380,7 +2380,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) { - UIScene_LoadOrJoinMenu* pClass = static_cast(lpParam); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)lpParam; if(bRes) { @@ -2412,7 +2412,7 @@ void UIScene_LoadOrJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu* pClass = static_cast(pParam); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog // EMessage_ResultAccept means cancel @@ -2425,7 +2425,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS { wchar_t wSaveName[128]; ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); - mbstowcs_s(nullptr, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); + mbstowcs_s(NULL, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); UIKeyboardInitData kbData; kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE); kbData.defaultText = wSaveName; @@ -2542,7 +2542,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon if(bContinue==true) { SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chKeyName[20]; @@ -2551,7 +2551,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -2583,7 +2583,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu *pClass = static_cast(pParam); + UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; // Exit with or without saving if(result==C4JStorage::EMessage_ResultAccept) @@ -2605,7 +2605,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS #endif SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chKeyName[20]; @@ -2614,7 +2614,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -2648,7 +2648,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS wstring ProductId; app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); + StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); } else { @@ -2840,7 +2840,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD ); - ConsoleSaveFile* pSave = nullptr; + ConsoleSaveFile* pSave = NULL; pClass->m_eSaveTransferState = eSaveTransfer_GetRemoteSaveInfo; @@ -2895,10 +2895,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null StorageManager.SetSaveTitle(wSaveName); - PBYTE pbThumbnailData=nullptr; + PBYTE pbThumbnailData=NULL; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=nullptr; + PBYTE pbDataSaveImage=NULL; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t @@ -3059,10 +3059,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter StorageManager.ResetSaveData(); { - PBYTE pbThumbnailData=nullptr; + PBYTE pbThumbnailData=NULL; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=nullptr; + PBYTE pbDataSaveImage=NULL; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t @@ -3270,7 +3270,7 @@ void UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStor } ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() { - return nullptr; + return NULL; } void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) @@ -3493,7 +3493,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) SaveTransferStateContainer *pStateContainer = (SaveTransferStateContainer *) lpParameter; Minecraft *pMinecraft=Minecraft::GetInstance(); - ConsoleSaveFile* pSave = nullptr; + ConsoleSaveFile* pSave = NULL; while(StorageManager.SaveTransferClearState()!=C4JStorage::eSaveTransfer_Idle) { @@ -3595,7 +3595,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); // set the icon and save image - StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); + StorageManager.SetSaveImages(ba.data, ba.length, NULL, 0, bTextMetadata, iTextMetadataBytes); delete ba.data; } @@ -3758,12 +3758,12 @@ void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); if(targetFile.exists()) { - HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, nullptr); + HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); m_debugTransferDetails.pbData = new BYTE[m_debugTransferDetails.ulFileLen]; DWORD numberOfBytesRead = 0; - ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,nullptr); + ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,NULL); assert(numberOfBytesRead == m_debugTransferDetails.ulFileLen); CloseHandle(hSaveFile); @@ -3791,7 +3791,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVE app.DebugPrintf("Save Transfer - size is %d\n",pSaveTransferDetails->ulFileLen); // if the file data is null, then assume this is the file size retrieval - if(pSaveTransferDetails->pbData==nullptr) + if(pSaveTransferDetails->pbData==NULL) { pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileSizeRetrieved; UIScene_LoadOrJoinMenu::s_ulFileSize=pSaveTransferDetails->ulFileLen; diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index a1cbc144..fe743adc 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -12,7 +12,7 @@ Random *UIScene_MainMenu::random = new Random(); -EUIScene UIScene_MainMenu::eNavigateWhenReady = static_cast(-1); +EUIScene UIScene_MainMenu::eNavigateWhenReady = (EUIScene) -1; UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { @@ -33,29 +33,29 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye m_bIgnorePress=false; - m_buttons[static_cast(eControl_PlayGame)].init(IDS_PLAY_GAME,eControl_PlayGame); + m_buttons[(int)eControl_PlayGame].init(IDS_PLAY_GAME,eControl_PlayGame); #ifdef _XBOX_ONE if(!ProfileManager.IsFullVersion()) m_buttons[(int)eControl_PlayGame].setLabel(IDS_PLAY_TRIAL_GAME); app.SetReachedMainMenu(); #endif - m_buttons[static_cast(eControl_Leaderboards)].init(IDS_LEADERBOARDS,eControl_Leaderboards); - m_buttons[static_cast(eControl_Achievements)].init( (UIString)IDS_ACHIEVEMENTS,eControl_Achievements); - m_buttons[static_cast(eControl_HelpAndOptions)].init(IDS_HELP_AND_OPTIONS,eControl_HelpAndOptions); + m_buttons[(int)eControl_Leaderboards].init(IDS_LEADERBOARDS,eControl_Leaderboards); + m_buttons[(int)eControl_Achievements].init( (UIString)IDS_ACHIEVEMENTS,eControl_Achievements); + m_buttons[(int)eControl_HelpAndOptions].init(IDS_HELP_AND_OPTIONS,eControl_HelpAndOptions); if(ProfileManager.IsFullVersion()) { m_bTrialVersion=false; - m_buttons[static_cast(eControl_UnlockOrDLC)].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); + m_buttons[(int)eControl_UnlockOrDLC].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); } else { m_bTrialVersion=true; - m_buttons[static_cast(eControl_UnlockOrDLC)].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); + m_buttons[(int)eControl_UnlockOrDLC].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); } #ifndef _DURANGO - m_buttons[static_cast(eControl_Exit)].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); + m_buttons[(int)eControl_Exit].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); #else m_buttons[(int)eControl_XboxHelp].init(IDS_XBOX_HELP_APP, eControl_XboxHelp); #endif @@ -104,7 +104,7 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye m_bLoadTrialOnNetworkManagerReady = false; // 4J Stu - Clear out any loaded game rules - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // 4J Stu - Reset the leaving game flag so that we correctly handle signouts while in the menus g_NetworkManager.ResetLeavingGame(); @@ -182,7 +182,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) if(navBack && ProfileManager.IsFullVersion()) { // Replace the Unlock Full Game with Downloadable Content - m_buttons[static_cast(eControl_UnlockOrDLC)].setLabel(IDS_DOWNLOADABLECONTENT); + m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT); } #if TO_BE_IMPLEMENTED @@ -196,7 +196,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) #ifdef __PSVITA__ int splashIndex = eSplashRandomStart + 2 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 2) ); #else - int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast(m_splashes.size()) - (eSplashRandomStart + 1) ); + int splashIndex = eSplashRandomStart + 1 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 1) ); #endif // Override splash text on certain dates @@ -303,12 +303,12 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) int primaryPad = ProfileManager.GetPrimaryPad(); #ifdef _XBOX_ONE - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = nullptr; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = NULL; #else - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; #endif - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_PlayGame: #ifdef __ORBIS__ @@ -396,7 +396,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) bool confirmUser = false; // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != nullptr) + if (signInReturnedFunc != NULL) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -466,10 +466,10 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion *region) // 4J Stu - Move this to the ctor when the main menu is not the first scene we navigate to ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; // Setup GDraw, normal game render states and matrices @@ -513,7 +513,7 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion *region) int UIScene_MainMenu::MustSignInReturned(void *pParam, int iPad, C4JStorage::EMessageResult result) { - UIScene_MainMenu* pClass = static_cast(pParam); + UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -643,7 +643,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad) #endif { - UIScene_MainMenu *pClass = static_cast(pParam); + UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; if(bContinue) { @@ -714,7 +714,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, int iPad) #endif { - UIScene_MainMenu* pClass = static_cast(pParam); + UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if(bContinue) { @@ -916,7 +916,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad) #endif { - UIScene_MainMenu *pClass = static_cast(pParam); + UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; if(bContinue) { @@ -940,7 +940,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); #endif if(bContentRestricted) { @@ -986,7 +986,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad) #endif { - UIScene_MainMenu *pClass = static_cast(pParam); + UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; if (bContinue) { @@ -1020,7 +1020,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue, int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad) #endif { - UIScene_MainMenu* pClass = static_cast(pParam); + UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -1098,7 +1098,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); @@ -1141,7 +1141,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,pClass); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); } // Check if PSN is unavailable because of age restriction @@ -1157,7 +1157,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * bool confirmUser = false; // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != nullptr) + if (signInReturnedFunc != NULL) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -1187,7 +1187,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); @@ -1228,7 +1228,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,pClass); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); } bool confirmUser = false; @@ -1247,7 +1247,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo } // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != nullptr) + if (signInReturnedFunc != NULL) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -1600,7 +1600,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); #endif if(bContentRestricted) { @@ -1608,7 +1608,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,this); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); #endif } else @@ -1669,7 +1669,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,this); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,this); return; } @@ -1704,7 +1704,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); #endif if(bContentRestricted) { @@ -1713,7 +1713,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,this); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); #endif } else @@ -1898,7 +1898,7 @@ void UIScene_MainMenu::tick() { app.DebugPrintf("[MainMenu] Navigating away from MainMenu.\n"); ui.NavigateToScene(lockedProfile, eNavigateWhenReady); - eNavigateWhenReady = static_cast(-1); + eNavigateWhenReady = (EUIScene) -1; } #ifdef _DURANGO else @@ -1925,7 +1925,7 @@ void UIScene_MainMenu::tick() // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -2102,7 +2102,7 @@ void UIScene_MainMenu::LoadTrial(void) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ) | app.GetGameHostOption(eGameHostOption_DisableSaving); vector *generators = app.getLevelGenerators(); @@ -2110,7 +2110,7 @@ void UIScene_MainMenu::LoadTrial(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2129,7 +2129,7 @@ void UIScene_MainMenu::LoadTrial(void) void UIScene_MainMenu::handleUnlockFullVersion() { - m_buttons[static_cast(eControl_UnlockOrDLC)].setLabel(IDS_DOWNLOADABLECONTENT,true); + m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT,true); } diff --git a/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp b/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp index 7a0749d4..6b8dc552 100644 --- a/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp @@ -7,7 +7,7 @@ UIScene_MessageBox::UIScene_MessageBox(int iPad, void *initData, UILayer *parent // Setup all the Iggy references we need for this scene initialiseMovie(); - MessageBoxInfo *param = static_cast(initData); + MessageBoxInfo *param = (MessageBoxInfo *)initData; m_buttonCount = param->uiOptionC; @@ -41,7 +41,7 @@ UIScene_MessageBox::UIScene_MessageBox(int iPad, void *initData, UILayer *parent m_labelTitle.init(app.GetString(param->uiTitle)); m_labelContent.init(app.GetString(param->uiText)); - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); m_Func = param->Func; m_lpParam = param->lpParam; @@ -84,10 +84,10 @@ void UIScene_MessageBox::handleReload() value[0].number = m_buttonCount; value[1].type = IGGY_DATATYPE_number; - value[1].number = static_cast(getControlFocus()); + value[1].number = (F64)getControlFocus(); IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInit , 2 , value ); - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); } void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) @@ -120,7 +120,7 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, bool presse void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { C4JStorage::EMessageResult result = C4JStorage::EMessage_Cancelled; - switch(static_cast(controlId)) + switch((int)controlId) { case 0: result = C4JStorage::EMessage_ResultAccept; diff --git a/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp index 118712a4..998679ca 100644 --- a/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp @@ -19,8 +19,8 @@ UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void *initData, UIL message=app.FormatHTMLString(m_iPad,message); vector paragraphs; - size_t lastIndex = 0; - for ( size_t index = message.find(L"\r\n", lastIndex, 2); + int lastIndex = 0; + for ( int index = message.find(L"\r\n", lastIndex, 2); index != wstring::npos; index = message.find(L"\r\n", lastIndex, 2) ) @@ -100,7 +100,7 @@ void UIScene_NewUpdateMessage::handleInput(int iPad, int key, bool repeat, bool void UIScene_NewUpdateMessage::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Confirm: { diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 7cec38b3..6f502db8 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -101,9 +101,9 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa TelemetryManager->RecordPauseOrInactive(m_iPad); Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(false); @@ -114,9 +114,9 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa UIScene_PauseMenu::~UIScene_PauseMenu() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(true); @@ -506,7 +506,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { if(m_bIgnoreInput) return; - switch(static_cast(controlId)) + switch((int)controlId) { case BUTTON_PAUSE_RESUMEGAME: if( m_iPad == ProfileManager.GetPrimaryPad() && g_NetworkManager.IsLocalGame() ) @@ -593,7 +593,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,NULL,&bContentRestricted,NULL); #endif if(bContentRestricted) { @@ -654,9 +654,9 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(m_iPad==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != nullptr ) + if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); } #if defined(_XBOX_ONE) || defined(__ORBIS__) @@ -723,9 +723,9 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) else { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != nullptr ) + if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); } TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); @@ -741,9 +741,9 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(m_iPad==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != nullptr ) + if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); } // adjust the trial time played @@ -759,9 +759,9 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) else { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != nullptr ) + if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); } TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); @@ -839,7 +839,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); @@ -979,7 +979,7 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage:: // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -1003,7 +1003,7 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage:: int UIScene_PauseMenu::SaveGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_PauseMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)pParam)); + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); if(pClass) pClass->SetIgnoreInput(false); if(bContinue==true) @@ -1112,7 +1112,7 @@ int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContin { #ifndef __ORBIS__ bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(pClass->m_iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(pClass->m_iPad,true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { // you can't see leaderboards @@ -1183,7 +1183,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J #ifndef __ORBIS__ // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -1203,7 +1203,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chKeyName[20]; @@ -1214,7 +1214,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -1260,7 +1260,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue #ifndef __ORBIS__ // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; @@ -1280,7 +1280,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=nullptr) + if(pSONYDLCInfo!=NULL) { char chName[42]; char chKeyName[20]; @@ -1291,7 +1291,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp index 76676561..0cb6cf2b 100644 --- a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp @@ -11,7 +11,7 @@ UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void *_initData, UILaye // Setup all the Iggy references we need for this scene initialiseMovie(); - m_signInInfo = *static_cast(_initData); + m_signInInfo = *((SignInInfo *)_initData); m_bIgnoreInput = false; @@ -167,7 +167,7 @@ int UIScene_QuadrantSignin::SignInReturned(void *pParam,bool bContinue, int iPad { app.DebugPrintf("SignInReturned for pad %d\n", iPad); - UIScene_QuadrantSignin *pClass = static_cast(pParam); + UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)pParam; #ifdef _XBOX_ONE if(bContinue && pClass->m_signInInfo.requireOnline && ProfileManager.IsSignedIn(iPad)) @@ -264,7 +264,7 @@ void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus stat value[0].number = iPad; value[1].type = IGGY_DATATYPE_number; - value[1].number = static_cast(state); + value[1].number = (int)state; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetControllerStatus , 2 , value ); } @@ -272,9 +272,9 @@ void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus stat int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_QuadrantSignin *pClass = static_cast(lpParam); + UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)lpParam; app.DebugPrintf(app.USER_SR,"AvatarReturned callback\n"); - if(pbThumbnail != nullptr) + if(pbThumbnail != NULL) { // 4J-JEV - Added to ensure each new texture gets a unique name. static unsigned int quadrantImageCount = 0; diff --git a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp index c713a390..3b67f79e 100644 --- a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp @@ -36,7 +36,7 @@ void UIScene_ReinstallMenu::updateTooltips() void UIScene_ReinstallMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp index 0b8e0ca4..b58f86fd 100644 --- a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp @@ -19,7 +19,7 @@ UIScene_SaveMessage::UIScene_SaveMessage(int iPad, void *initData, UILayer *pare IggyDataValue result; // Russian needs to resize the box - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); // 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) @@ -101,7 +101,7 @@ void UIScene_SaveMessage::handleInput(int iPad, int key, bool repeat, bool press void UIScene_SaveMessage::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Confirm: diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index 083fbd35..6d892d70 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -47,7 +47,7 @@ void UIScene_SettingsAudioMenu::updateTooltips() void UIScene_SettingsAudioMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -93,8 +93,8 @@ void UIScene_SettingsAudioMenu::handleInput(int iPad, int key, bool repeat, bool void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_Music: m_sliderMusic.handleSliderMove(value); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp index 7dbd243b..d5447f77 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp @@ -47,7 +47,7 @@ void UIScene_SettingsControlMenu::updateTooltips() void UIScene_SettingsControlMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -93,8 +93,8 @@ void UIScene_SettingsControlMenu::handleInput(int iPad, int key, bool repeat, bo void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_SensitivityInGame: m_sliderSensitivityInGame.handleSliderMove(value); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index b258d8c3..423c8f4b 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -7,21 +7,20 @@ namespace { - constexpr int FOV_MIN = 70; - constexpr int FOV_MAX = 110; - constexpr int FOV_SLIDER_MAX = 100; + const int FOV_MIN = 70; + const int FOV_MAX = 110; + const int FOV_SLIDER_MAX = 100; - int ClampFov(int value) + int clampFov(int value) { if (value < FOV_MIN) return FOV_MIN; if (value > FOV_MAX) return FOV_MAX; return value; } - [[maybe_unused]] - int FovToSliderValue(float fov) + int fovToSliderValue(float fov) { - const int clampedFov = ClampFov(static_cast(fov + 0.5f)); + int clampedFov = clampFov((int)(fov + 0.5f)); return ((clampedFov - FOV_MIN) * FOV_SLIDER_MAX) / (FOV_MAX - FOV_MIN); } @@ -57,7 +56,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD initialiseMovie(); Minecraft* pMinecraft = Minecraft::GetInstance(); - m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); + m_bNotInGame=(Minecraft::GetInstance()->level==NULL); m_checkboxClouds.init(app.GetString(IDS_CHECKBOX_RENDER_CLOUDS),eControl_Clouds,(app.GetGameSettings(m_iPad,eGameSetting_Clouds)!=0)); m_checkboxBedrockFog.init(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG),eControl_BedrockFog,(app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)!=0)); @@ -66,24 +65,24 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD WCHAR TempString[256]; - swprintf(TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); + swprintf((WCHAR*)TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,5,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); - const int initialFovSlider = app.GetGameSettings(m_iPad, eGameSetting_FOV); - const int initialFovDeg = sliderValueToFov(initialFovSlider); - swprintf(TempString, 256, L"FOV: %d", initialFovDeg); + int initialFovSlider = app.GetGameSettings(m_iPad, eGameSetting_FOV); + int initialFovDeg = sliderValueToFov(initialFovSlider); + swprintf((WCHAR*)TempString, 256, L"FOV: %d", initialFovDeg); m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, initialFovSlider); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); doHorizontalResizeCheck(); - - const bool bInGame=(Minecraft::GetInstance()->level!=nullptr); - const bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); + + bool bInGame=(Minecraft::GetInstance()->level!=NULL); + bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); // if we're not in the game, we need to use basescene 0 if(bInGame) { @@ -137,7 +136,7 @@ void UIScene_SettingsGraphicsMenu::updateTooltips() void UIScene_SettingsGraphicsMenu::updateComponents() { - const bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -188,20 +187,20 @@ void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, b void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - const int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_RenderDistance: { m_sliderRenderDistance.handleSliderMove(value); - const int dist = LevelToDistance(value); + int dist = LevelToDistance(value); app.SetGameSettings(m_iPad,eGameSetting_RenderDistance,dist); - const Minecraft* mc = Minecraft::GetInstance(); + Minecraft* mc = Minecraft::GetInstance(); mc->options->viewDistance = 3 - value; - swprintf(TempString,256,L"Render Distance: %d",dist); + swprintf((WCHAR*)TempString,256,L"Render Distance: %d",dist); m_sliderRenderDistance.setLabel(TempString); } break; @@ -210,7 +209,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderGamma.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Gamma,value); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); m_sliderGamma.setLabel(TempString); break; @@ -218,13 +217,13 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal case eControl_FOV: { m_sliderFOV.handleSliderMove(value); - const Minecraft* pMinecraft = Minecraft::GetInstance(); - const int fovValue = sliderValueToFov(value); - pMinecraft->gameRenderer->SetFovVal(static_cast(fovValue)); + Minecraft* pMinecraft = Minecraft::GetInstance(); + int fovValue = sliderValueToFov(value); + pMinecraft->gameRenderer->SetFovVal((float)fovValue); app.SetGameSettings(m_iPad, eGameSetting_FOV, value); - WCHAR tempString[256]; - swprintf(tempString, 256, L"FOV: %d", fovValue); - m_sliderFOV.setLabel(tempString); + WCHAR TempString[256]; + swprintf((WCHAR*)TempString, 256, L"FOV: %d", fovValue); + m_sliderFOV.setLabel(TempString); } break; @@ -232,7 +231,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderInterfaceOpacity.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,value); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); m_sliderInterfaceOpacity.setLabel(TempString); break; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp index 2ae9c897..39a0b7c6 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp @@ -8,7 +8,7 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *pa // Setup all the Iggy references we need for this scene initialiseMovie(); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); m_buttons[BUTTON_ALL_OPTIONS].init(IDS_OPTIONS,BUTTON_ALL_OPTIONS); m_buttons[BUTTON_ALL_AUDIO].init(IDS_AUDIO,BUTTON_ALL_AUDIO); @@ -51,7 +51,7 @@ wstring UIScene_SettingsMenu::getMoviePath() void UIScene_SettingsMenu::handleReload() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(ProfileManager.GetPrimaryPad()!=m_iPad) { removeControl( &m_buttons[BUTTON_ALL_AUDIO], bNotInGame); @@ -68,7 +68,7 @@ void UIScene_SettingsMenu::updateTooltips() void UIScene_SettingsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -119,7 +119,7 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch(static_cast(controlId)) + switch((int)controlId) { case BUTTON_ALL_OPTIONS: ui.NavigateToScene(m_iPad, eUIScene_SettingsOptionsMenu); @@ -151,7 +151,7 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) int UIScene_SettingsMenu::ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_SettingsMenu* pClass = static_cast(pParam); + UIScene_SettingsMenu* pClass = (UIScene_SettingsMenu*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index 7b4d3d9d..6898d489 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -29,7 +29,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); + m_bNotInGame=(Minecraft::GetInstance()->level==NULL); m_checkboxViewBob.init(IDS_VIEW_BOBBING,eControl_ViewBob,(app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0)); m_checkboxShowHints.init(IDS_HINTS,eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); @@ -99,7 +99,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat bool bRemoveAutosave=false; bool bRemoveInGameGamertags=false; - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; if(!bPrimaryPlayer) { @@ -196,7 +196,7 @@ void UIScene_SettingsOptionsMenu::updateTooltips() void UIScene_SettingsOptionsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -243,7 +243,7 @@ void UIScene_SettingsOptionsMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Languages: m_bNavigateToLanguageSelector = true; @@ -324,7 +324,7 @@ void UIScene_SettingsOptionsMenu::handleReload() bool bRemoveAutosave=false; bool bRemoveInGameGamertags=false; - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; if(!bPrimaryPlayer) { @@ -378,8 +378,8 @@ void UIScene_SettingsOptionsMenu::handleReload() void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_Autosave: m_sliderAutosave.handleSliderMove(value); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 873564f6..917012d6 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -7,7 +7,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); + m_bNotInGame=(Minecraft::GetInstance()->level==NULL); m_checkboxDisplayHUD.init(app.GetString(IDS_CHECKBOX_DISPLAY_HUD),eControl_DisplayHUD,(app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0)); m_checkboxDisplayHand.init(app.GetString(IDS_CHECKBOX_DISPLAY_HAND),eControl_DisplayHand,(app.GetGameSettings(m_iPad,eGameSetting_DisplayHand)!=0)); @@ -26,7 +26,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer doHorizontalResizeCheck(); - bool bInGame=(Minecraft::GetInstance()->level!=nullptr); + bool bInGame=(Minecraft::GetInstance()->level!=NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; // if we're not in the game, we need to use basescene 0 @@ -57,7 +57,7 @@ void UIScene_SettingsUIMenu::updateTooltips() void UIScene_SettingsUIMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -146,8 +146,8 @@ void UIScene_SettingsUIMenu::handleInput(int iPad, int key, bool repeat, bool pr void UIScene_SettingsUIMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = static_cast(currentValue); - switch(static_cast(sliderId)) + int value = (int)currentValue; + switch((int)sliderId) { case eControl_UISize: m_sliderUISize.handleSliderMove(value); diff --git a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp index 5ef783d3..9f049c8c 100644 --- a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp @@ -13,7 +13,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - SignEntryScreenInput* initData = static_cast(_initData); + SignEntryScreenInput* initData = (SignEntryScreenInput*)_initData; m_sign = initData->sign; m_bConfirmed = false; @@ -175,9 +175,9 @@ void UIScene_SignEntryMenu::tick() if (pMinecraft->level->isClientSide) { shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != nullptr && player->connection && player->connection->isStarted()) + if(player != NULL && player->connection && player->connection->isStarted()) { - player->connection->send(std::make_shared(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages())); + player->connection->send( shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } } ui.CloseUIScenes(m_iPad); @@ -309,7 +309,7 @@ bool UIScene_SignEntryMenu::handleMouseClick(F32 x, F32 y) int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - const auto pClass=static_cast(lpParam); + UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam; pClass->m_bIgnoreInput = false; if (bRes) { @@ -317,7 +317,7 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); - pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(reinterpret_cast(pchText)); + pClass->m_textInputLines[pClass->m_iEditingLine].setLabel((wchar_t *)pchText); #else uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t) ); @@ -333,7 +333,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) #ifdef _WINDOWS64 if (isDirectEditBlocking()) return; #endif - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Confirm: { @@ -345,7 +345,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) case eControl_Line3: case eControl_Line4: { - m_iEditingLine = static_cast(controlId); + m_iEditingLine = (int)controlId; #ifdef _WINDOWS64 if (g_KBMInput.IsKBMActive()) { @@ -384,7 +384,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),static_cast(m_iPad),15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); + InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); #endif #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index a3482a24..9e0059f3 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -40,7 +40,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_bIgnoreInput=false; m_bNoSkinsToShow = false; - m_currentPack = nullptr; + m_currentPack = NULL; m_packIndex = SKIN_SELECT_PACK_DEFAULT; m_skinIndex = 0; @@ -48,7 +48,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_currentSkinPath = app.GetPlayerSkinName(iPad); m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = nullptr; + m_vAdditionalSkinBoxes = NULL; m_bSlidingSkins = false; m_bAnimatingMove = false; @@ -107,7 +107,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer // Change to display the favorites if there are any. The current skin will be in there (probably) - need to check for it m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); bool bFound; - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; } @@ -436,7 +436,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) } break; default: - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { bool renableInputAfterOperation = true; m_bIgnoreInput = true; @@ -520,7 +520,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -534,7 +534,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) #endif bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,NULL,&bContentRestricted,NULL); #endif if(bContentRestricted) { @@ -599,7 +599,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int characterId = -1; - swscanf(static_cast(region->name),L"Character%d",&characterId); + swscanf((wchar_t*)region->name,L"Character%d",&characterId); if (characterId == -1) { app.DebugPrintf("Invalid character to render found\n"); @@ -635,8 +635,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; - DLCSkinFile *skinFile=nullptr; - DLCPack *Pack=nullptr; + DLCSkinFile *skinFile=NULL; + DLCPack *Pack=NULL; BYTE sidePreviewControlsL,sidePreviewControlsR; m_bNoSkinsToShow=false; @@ -646,7 +646,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() m_controlSkinNamePlate.setVisible( false ); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(m_skinIndex); m_selectedSkinPath = skinFile->getPath(); @@ -673,7 +673,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = nullptr; + m_vAdditionalSkinBoxes = NULL; switch(m_packIndex) { @@ -758,13 +758,13 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() // add the boxes to the humanoid model, but only if we've not done this already vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes); } } - if(skinFile!=nullptr) + if(skinFile!=NULL) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -779,7 +779,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() wstring otherSkinPath = L""; wstring otherCapePath = L""; - vector *othervAdditionalSkinBoxes=nullptr; + vector *othervAdditionalSkinBoxes=NULL; wchar_t chars[256]; // turn off all displays @@ -824,11 +824,11 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { if(showNext) { - skinFile=nullptr; + skinFile=NULL; m_characters[eCharacter_Next1 + i].setVisible(true); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(nextIndex); otherSkinPath = skinFile->getPath(); @@ -840,7 +840,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=nullptr; + othervAdditionalSkinBoxes=NULL; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -872,13 +872,13 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } } // 4J-PB - anim override needs set before SetTexture - if(skinFile!=nullptr) + if(skinFile!=NULL) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -895,11 +895,11 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { if(showPrevious) { - skinFile=nullptr; + skinFile=NULL; m_characters[eCharacter_Previous1 + i].setVisible(true); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(previousIndex); otherSkinPath = skinFile->getPath(); @@ -911,7 +911,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=nullptr; + othervAdditionalSkinBoxes=NULL; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -943,7 +943,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } @@ -1021,7 +1021,7 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(DWORD sourceIndex) { nextSkin = eDefaultSkins_ServerSelected; } - else if(m_currentPack != nullptr && nextSkin>=m_currentPack->getSkinCount()) + else if(m_currentPack != NULL && nextSkin>=m_currentPack->getSkinCount()) { nextSkin = 0; } @@ -1055,7 +1055,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(DWORD sourceIndex) { previousSkin = eDefaultSkins_Count - 1; } - else if(m_currentPack != nullptr) + else if(m_currentPack != NULL) { previousSkin = m_currentPack->getSkinCount()-1; } @@ -1079,10 +1079,10 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() } else { - m_currentPack = nullptr; + m_currentPack = NULL; } m_skinIndex = 0; - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { bool found; DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); @@ -1099,7 +1099,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { - m_skinIndex = static_cast(defaultSkinIndex); + m_skinIndex = (EDefaultSkins) defaultSkinIndex; } } break; @@ -1130,7 +1130,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() std::wstring fakeWideToRealWide(const wchar_t* original) { const char* name = reinterpret_cast(original); - int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, nullptr, 0); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); std::wstring wName(len, 0); MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); return wName.c_str(); @@ -1500,7 +1500,7 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin)>0) { m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { bool bFound = false; m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; @@ -1520,7 +1520,7 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() m_bIgnoreInput=false; app.m_dlcManager.checkForCorruptDLCAndAlert(); - bool bInGame=(Minecraft::GetInstance()->level!=nullptr); + bool bInGame=(Minecraft::GetInstance()->level!=NULL); #if TO_BE_IMPLEMENTED if(bInGame) XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); @@ -1534,7 +1534,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { // need to be signed in to live. get them to sign in to online #if defined(__PS3__) - SQRNetworkManager_PS3::AttemptPSNSignIn(nullptr, this); + SQRNetworkManager_PS3::AttemptPSNSignIn(NULL, this); #elif defined(__PSVITA__) if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) @@ -1543,15 +1543,15 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_CANCEL; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,nullptr); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,NULL); } else { - SQRNetworkManager_Vita::AttemptPSNSignIn(nullptr, this); + SQRNetworkManager_Vita::AttemptPSNSignIn(NULL, this); } #elif defined(__ORBIS__) - SQRNetworkManager_Orbis::AttemptPSNSignIn(nullptr, this, false, iPad); + SQRNetworkManager_Orbis::AttemptPSNSignIn(NULL, this, false, iPad); #elif defined(_DURANGO) @@ -1563,7 +1563,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_SkinSelectMenu* pScene = static_cast(pParam); + UIScene_SkinSelectMenu* pScene = (UIScene_SkinSelectMenu*)pParam; if ( (result == C4JStorage::EMessage_ResultAccept) && ProfileManager.IsSignedIn(iPad) @@ -1579,7 +1579,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: const char *pchPackName=wstringtofilename(wStrPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if (pSONYDLCInfo != nullptr) + if (pSONYDLCInfo != NULL) { char chName[42]; char chKeyName[20]; @@ -1593,7 +1593,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // while the store is screwed, hardcode the sku //sprintf(chName,"%s-%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname,"EURO"); - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -1623,7 +1623,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // need to re-enable input because the user can back out of the store purchase, and we'll be stuck pScene->m_bIgnoreInput = false; // MGH - moved this to outside the pSONYDLCInfo, so we don't get stuck #elif defined _XBOX_ONE - StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, nullptr); + StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, NULL); #endif } else // Is signed in, but not live. @@ -1642,7 +1642,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: int UIScene_SkinSelectMenu::RenableInput(LPVOID lpVoid, int, int) { - static_cast(lpVoid)->m_bIgnoreInput = false; + ((UIScene_SkinSelectMenu*) lpVoid)->m_bIgnoreInput = false; return 0; } diff --git a/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp index 017af93e..f6916d13 100644 --- a/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp @@ -12,7 +12,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa // Setup all the Iggy references we need for this scene initialiseMovie(); - TeleportMenuInitData *initParam = static_cast(initData); + TeleportMenuInitData *initParam = (TeleportMenuInitData *)initData; m_teleportToPlayer = initParam->teleportToPlayer; @@ -41,7 +41,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) + if( player != NULL && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) { m_players[m_playersCount] = player->GetSmallId(); ++m_playersCount; @@ -59,7 +59,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa } int voiceStatus = 0; - if(player != nullptr && player->HasVoice() ) + if(player != NULL && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { @@ -131,7 +131,7 @@ void UIScene_TeleportMenu::handleReload() { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) + if( player != NULL && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) { m_players[m_playersCount] = player->GetSmallId(); ++m_playersCount; @@ -149,7 +149,7 @@ void UIScene_TeleportMenu::handleReload() } int voiceStatus = 0; - if(player != nullptr && player->HasVoice() ) + if(player != NULL && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { @@ -189,7 +189,7 @@ void UIScene_TeleportMenu::tick() { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[i] ); - if( player != nullptr ) + if( player != NULL ) { m_players[i] = player->GetSmallId(); @@ -250,11 +250,11 @@ void UIScene_TeleportMenu::handleInput(int iPad, int key, bool repeat, bool pres void UIScene_TeleportMenu::handlePress(F64 controlId, F64 childId) { - app.DebugPrintf("Pressed = %d, %d\n", static_cast(controlId), static_cast(childId)); - switch(static_cast(controlId)) + app.DebugPrintf("Pressed = %d, %d\n", (int)controlId, (int)childId); + switch((int)controlId) { case eControl_GamePlayers: - int currentSelection = static_cast(childId); + int currentSelection = (int)childId; INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ currentSelection ] ); INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(m_iPad); @@ -275,7 +275,7 @@ void UIScene_TeleportMenu::handlePress(F64 controlId, F64 childId) void UIScene_TeleportMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - UIScene_TeleportMenu *scene = static_cast(callbackParam); + UIScene_TeleportMenu *scene = (UIScene_TeleportMenu *)callbackParam; bool playerFound = false; int foundIndex = 0; for(int i = 0; i < scene->m_playersCount; ++i) @@ -320,7 +320,7 @@ void UIScene_TeleportMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer * } int voiceStatus = 0; - if(pPlayer != nullptr && pPlayer->HasVoice() ) + if(pPlayer != NULL && pPlayer->HasVoice() ) { if( pPlayer->IsMutedByLocalUser(scene->m_iPad) ) { diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp index bb9e30af..0a35c8e5 100644 --- a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp @@ -25,13 +25,13 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void *_initData, UILayer *par m_labelRequest1.init(L""); m_labelRequest2.init(L""); - TradingScreenInput *initData = static_cast(_initData); + TradingScreenInput *initData = (TradingScreenInput *)_initData; m_merchant = initData->trader; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != nullptr ) + if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trading_Menu, this); } @@ -87,15 +87,15 @@ void UIScene_TradingMenu::handleDestroy() { app.DebugPrintf("UIScene_TradingMenu::handleDestroy\n"); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(pMinecraft->localplayers[m_iPad] != nullptr) pMinecraft->localplayers[m_iPad]->closeContainer(); + if(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer(); ui.OverrideSFX(m_iPad,ACTION_MENU_A,false); ui.OverrideSFX(m_iPad,ACTION_MENU_OK,false); @@ -155,11 +155,11 @@ void UIScene_TradingMenu::handleInput(int iPad, int key, bool repeat, bool press void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if(slotId < MerchantMenu::USE_ROW_SLOT_END) { @@ -190,7 +190,7 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) }; } } - if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); + if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); } void UIScene_TradingMenu::showScrollRightArrow(bool show) diff --git a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp index 9338daba..9ef8f189 100644 --- a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp @@ -50,7 +50,7 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat, bool p // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); if(bContentRestricted) { UINT uiIDA[1]; diff --git a/Minecraft.Client/Common/UI/UIString.cpp b/Minecraft.Client/Common/UI/UIString.cpp index 04d8b8e3..288fa87a 100644 --- a/Minecraft.Client/Common/UI/UIString.cpp +++ b/Minecraft.Client/Common/UI/UIString.cpp @@ -139,7 +139,7 @@ UIString::~UIString() bool UIString::empty() { - return m_core.get() == nullptr; + return m_core.get() == NULL; } bool UIString::compare(const UIString &uiString) @@ -149,19 +149,19 @@ bool UIString::compare(const UIString &uiString) bool UIString::needsUpdating() { - if (m_core != nullptr) return m_core->needsUpdating(); + if (m_core != NULL) return m_core->needsUpdating(); else return false; } void UIString::setUpdated() { - if (m_core != nullptr) m_core->setUpdated(); + if (m_core != NULL) m_core->setUpdated(); } wstring &UIString::getString() { static wstring blank(L""); - if (m_core != nullptr) return m_core->getString(); + if (m_core != NULL) return m_core->getString(); else return blank; } diff --git a/Minecraft.Client/Common/UI/UIStructs.h b/Minecraft.Client/Common/UI/UIStructs.h index e5f5a833..ac83458f 100644 --- a/Minecraft.Client/Common/UI/UIStructs.h +++ b/Minecraft.Client/Common/UI/UIStructs.h @@ -196,8 +196,8 @@ typedef struct _ConnectionProgressParams showTooltips = false; setFailTimer = false; timerTime = 0; - cancelFunc = nullptr; - cancelFuncParam = nullptr; + cancelFunc = NULL; + cancelFuncParam = NULL; } } ConnectionProgressParams; @@ -250,7 +250,7 @@ typedef struct _SaveListDetails _SaveListDetails() { saveId = 0; - pbThumbnailData = nullptr; + pbThumbnailData = NULL; dwThumbnailSize = 0; #ifdef _DURANGO ZeroMemory(UTF16SaveName,sizeof(wchar_t)*128); @@ -403,15 +403,15 @@ typedef struct _LoadingInputParams _LoadingInputParams() { - func = nullptr; - lpParam = nullptr; - completionData = nullptr; + func = NULL; + lpParam = NULL; + completionData = NULL; cancelText = -1; - cancelFunc = nullptr; - completeFunc = nullptr; - m_cancelFuncParam = nullptr; - m_completeFuncParam = nullptr; + cancelFunc = NULL; + completeFunc = NULL; + m_cancelFuncParam = NULL; + m_completeFuncParam = NULL; waitForThreadToDelete = false; } } LoadingInputParams; @@ -439,7 +439,7 @@ typedef struct _TutorialPopupInfo _TutorialPopupInfo() { - interactScene = nullptr; + interactScene = NULL; desc = L""; title = L""; icon = -1; @@ -447,7 +447,7 @@ typedef struct _TutorialPopupInfo isFoil = false; allowFade = true; isReminder = false; - tutorial = nullptr; + tutorial = NULL; } } TutorialPopupInfo; diff --git a/Minecraft.Client/Common/UI/UITTFFont.cpp b/Minecraft.Client/Common/UI/UITTFFont.cpp index 359ac76b..5d72ed97 100644 --- a/Minecraft.Client/Common/UI/UITTFFont.cpp +++ b/Minecraft.Client/Common/UI/UITTFFont.cpp @@ -11,9 +11,9 @@ UITTFFont::UITTFFont(const string &name, const string &path, S32 fallbackCharact #ifdef _UNICODE wstring wPath = convStringToWstring(path); - HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -30,7 +30,7 @@ UITTFFont::UITTFFont(const string &name, const string &path, S32 fallbackCharact DWORD bytesRead; pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); diff --git a/Minecraft.Client/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Common/XUI/XUI_Chat.cpp index 64005621..3e3faa77 100644 --- a/Minecraft.Client/Common/XUI/XUI_Chat.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Chat.cpp @@ -5,7 +5,7 @@ HRESULT CScene_Chat::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); @@ -37,7 +37,7 @@ HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled) m_Labels[i].SetOpacity(0); } } - if(pMinecraft->localplayers[m_iPad]!= nullptr) + if(pMinecraft->localplayers[m_iPad]!= NULL) { m_Jukebox.SetText( pGui->getJukeboxMessage(m_iPad).c_str() ); m_Jukebox.SetOpacity( pGui->getJukeboxOpacity(m_iPad) ); diff --git a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp index 5ae736a3..9a82a7b3 100644 --- a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp @@ -12,7 +12,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_ConnectingProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - ConnectionProgressParams *param = static_cast(pInitData->pvInitData); + ConnectionProgressParams *param = (ConnectionProgressParams *)pInitData->pvInitData; m_iPad = param->iPad; MapChildControls(); @@ -203,7 +203,7 @@ HRESULT CScene_ConnectingProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; #ifdef _XBOX - StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); #endif exitReasonStringId = -1; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp index 576b7557..cc3afeca 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp @@ -10,7 +10,7 @@ HRESULT CXuiCtrl4JEdit::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled) // set a limit for the text box m_uTextLimit=XUI_4JEDIT_MAX_CHARS-1; XuiEditSetTextLimit(m_hObj,m_uTextLimit); - // Find the text limit. (Add one for nullptr terminator) + // Find the text limit. (Add one for NULL terminator) //m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); ZeroMemory( wchText , sizeof(WCHAR)*(m_uTextLimit+1) ); @@ -127,7 +127,7 @@ HRESULT CXuiCtrl4JEdit::OnChar(XUIMessageChar* pInputData, BOOL& rfHandled) XuiSendMessage( hBaseObj, &xuiMsg ); rfHandled = TRUE; - SendNotifyValueChanged(static_cast(pInputData->wch)); + SendNotifyValueChanged((int)pInputData->wch); return hr; } @@ -145,7 +145,7 @@ HRESULT CXuiCtrl4JEdit::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled) if( pThis->m_bReadOnly ) return hr; - // Find the text limit. (Add one for nullptr terminator) + // Find the text limit. (Add one for NULL terminator) //m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS); if((((pInputData->dwKeyCode == VK_PAD_A) && (pInputData->wch == 0)) || (pInputData->dwKeyCode == VK_PAD_START)) && !(pInputData->dwFlags & XUI_INPUT_FLAG_REPEAT)) @@ -185,14 +185,14 @@ HRESULT CXuiCtrl4JEdit::SendNotifyValueChanged(int iValue) int CXuiCtrl4JEdit::KeyboardReturned(void *pParam,bool bSet) { - CXuiCtrl4JEdit* pClass = static_cast(pParam); + CXuiCtrl4JEdit* pClass = (CXuiCtrl4JEdit*)pParam; HRESULT hr = S_OK; if(bSet) { pClass->SetText(pClass->wchText); // need to move the caret to the end of the newly set text - XuiEditSetCaretPosition(pClass->m_hObj, static_cast(wcsnlen(pClass->wchText, 50))); + XuiEditSetCaretPosition(pClass->m_hObj, (int)wcsnlen(pClass->wchText, 50)); pClass->SendNotifyValueChanged(10); // 10 for a return } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp index a4ff8d37..8895b60e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp @@ -3,7 +3,7 @@ HRESULT CXuiCtrl4JIcon::OnInit(XUIMessageInit *pInitData, BOOL& bHandled) { - m_hBrush=nullptr; + m_hBrush=NULL; return S_OK; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp index 7523c523..4c615979 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp @@ -7,7 +7,7 @@ HRESULT CXuiCtrl4JList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled) { InitializeCriticalSection(&m_AccessListData); - m_hSelectionChangedHandlerObj = nullptr; + m_hSelectionChangedHandlerObj = NULL; return S_OK; } @@ -22,13 +22,13 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom if(ItemInfo.pwszText) { - dwLen1=static_cast(wcslen(ItemInfo.pwszText))*sizeof(WCHAR); + dwLen1=(int)wcslen(ItemInfo.pwszText)*sizeof(WCHAR); dwBytes+=dwLen1+sizeof(WCHAR); } if(ItemInfo.pwszImage) { - dwLen2=static_cast(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR); + dwLen2=(int)(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR); dwBytes+=dwLen2+sizeof(WCHAR); } @@ -59,11 +59,11 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom // need to remember the original index of this addition before it gets sorted - this will get used to load the game if(iSortListFromIndex!=-1) { - pItemInfo->iIndex=static_cast(m_vListData.size())-iSortListFromIndex; + pItemInfo->iIndex=(int)m_vListData.size()-iSortListFromIndex; } else { - pItemInfo->iIndex=static_cast(m_vListData.size()); + pItemInfo->iIndex=(int)m_vListData.size(); } // added to force a sort order for DLC @@ -110,7 +110,7 @@ void CXuiCtrl4JList::RemoveAllData( ) { EnterCriticalSection(&m_AccessListData); - int iSize=static_cast(m_vListData.size()); + int iSize=(int)m_vListData.size(); for(int i=0;icItems = static_cast(m_vListData.size()); + pGetItemCountData->cItems = (int)m_vListData.size(); bHandled = TRUE; return S_OK; } @@ -315,7 +315,7 @@ HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourc { // Check for a brush EnterCriticalSection(&m_AccessListData); - if(GetData(pGetSourceImageData->iItem).hXuiBrush!=nullptr) + if(GetData(pGetSourceImageData->iItem).hXuiBrush!=NULL) { pGetSourceImageData->hBrush=GetData(pGetSourceImageData->iItem).hXuiBrush; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp index e74b92b4..074b7300 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp @@ -10,9 +10,9 @@ int CXuiCtrlBrewProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != nullptr ) + if( pvUserData != NULL ) { - BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(pvUserData); + BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData; return pBrewingStandTileEntity->getBrewTime(); } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp index 48a130c4..cc5d996f 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp @@ -8,9 +8,9 @@ int CXuiCtrlBubblesProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != nullptr ) + if( pvUserData != NULL ) { - BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(pvUserData); + BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData; int value = 0; int bubbleStep = (pBrewingStandTileEntity->getBrewTime() / 2) % 7; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp index 5a1a3674..8e514094 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp @@ -10,9 +10,9 @@ int CXuiCtrlBurnProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != nullptr ) + if( pvUserData != NULL ) { - FurnaceTileEntity *pFurnaceTileEntity = static_cast(pvUserData); + FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData; // TODO This param is a magic number in Java but we should really define it somewhere with a name // I think it is the number of states of the progress display (ie the max value) diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp index 46bcc983..82b6c3ed 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp @@ -11,7 +11,7 @@ CXuiCtrlCraftIngredientSlot::CXuiCtrlCraftIngredientSlot() { m_iID=0; - m_Desc=nullptr; + m_Desc=NULL; m_isFoil = false; m_isDirty = false; m_item = nullptr; @@ -29,7 +29,7 @@ HRESULT CXuiCtrlCraftIngredientSlot::OnInit(XUIMessageInit* pInitData, BOOL& rfH //----------------------------------------------------------------------------- HRESULT CXuiCtrlCraftIngredientSlot::OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) { - if( m_iID != 0 || m_item != nullptr ) + if( m_iID != 0 || m_item != NULL ) { pData->item = m_item; pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(m_iID,m_iAuxVal,m_isFoil); @@ -94,7 +94,7 @@ void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCo void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, shared_ptr item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow) { - if(item == nullptr) SetIcon(iPad, 0,0,0,0,0,false,false,bShow); + if(item == NULL) SetIcon(iPad, 0,0,0,0,0,false,false,bShow); else { m_item = item; @@ -118,6 +118,6 @@ void CXuiCtrlCraftIngredientSlot::SetDescription(LPCWSTR Desc) hr=GetVisual(&hObj); XuiElementGetChildById(hObj,L"text_name",&hObjChild); XuiControlSetText(hObjChild,Desc); - XuiElementSetShow(hObjChild,Desc==nullptr?FALSE:TRUE); + XuiElementSetShow(hObjChild,Desc==NULL?FALSE:TRUE); m_Desc=Desc; } \ No newline at end of file diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp index 9a312287..6c7876c9 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp @@ -15,10 +15,10 @@ HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHan Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; HXUIOBJ parent = m_hObj; HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" ); @@ -28,13 +28,13 @@ HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHan { XuiElementGetParent(parent,&parent); currentClass = XuiGetObjectClass( parent ); - } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); + } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); - assert( parent != nullptr ); + assert( parent != NULL ); VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = static_cast(pObj); + m_containerScene = (CXuiSceneEnchant *)pObj; m_index = 0; m_lastCost = 0; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp index a83b7811..8a56a0ea 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp @@ -30,12 +30,12 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() : Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; - model = nullptr; + model = NULL; time = 0; flip = oFlip = flipT = flipA = 0.0f; @@ -44,7 +44,7 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() : CXuiCtrlEnchantmentBook::~CXuiCtrlEnchantmentBook() { - //if(model != nullptr) delete model; + //if(model != NULL) delete model; } //----------------------------------------------------------------------------- @@ -60,13 +60,13 @@ HRESULT CXuiCtrlEnchantmentBook::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl { XuiElementGetParent(parent,&parent); currentClass = XuiGetObjectClass( parent ); - } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); + } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); - assert( parent != nullptr ); + assert( parent != NULL ); VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = static_cast(pObj); + m_containerScene = (CXuiSceneEnchant *)pObj; last = nullptr; @@ -166,12 +166,12 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b glEnable(GL_CULL_FACE); - if(model == nullptr) + if(model == NULL) { // Share the model the the EnchantTableRenderer EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY); - if(etr != nullptr) + if(etr != NULL) { model = etr->bookModel; } @@ -181,7 +181,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b } } - model->render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f,true); + model->render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true); glDisable(GL_CULL_FACE); glPopMatrix(); @@ -281,7 +281,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b // // glEnable(GL_RESCALE_NORMAL); // -// model.render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f,true); +// model.render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true); // // glDisable(GL_RESCALE_NORMAL); // Lighting::turnOff(); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp index ecb6132d..60156a0a 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp @@ -25,10 +25,10 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& r Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; HXUIOBJ parent = m_hObj; HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiCtrlEnchantmentButton" ); @@ -38,13 +38,13 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& r { XuiElementGetParent(parent,&parent); currentClass = XuiGetObjectClass( parent ); - } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); + } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); - assert( parent != nullptr ); + assert( parent != NULL ); VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_parentControl = static_cast(pObj); + m_parentControl = (CXuiCtrlEnchantmentButton *)pObj; m_lastCost = 0; m_enchantmentString = L""; @@ -75,10 +75,10 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B // Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it. // Clear just the region required for this control. D3DRECT clearRect; - clearRect.x1 = static_cast(matrix._41) - 2; - clearRect.y1 = static_cast(matrix._42) - 2; - clearRect.x2 = static_cast(matrix._41 + (bwidth * matrix._11)) + 2; - clearRect.y2 = static_cast(matrix._42 + (bheight * matrix._22)) + 2; + clearRect.x1 = (int)(matrix._41) - 2; + clearRect.y1 = (int)(matrix._42) - 2; + clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2; + clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2; RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &clearRect); // glClear(GL_DEPTH_BUFFER_BIT); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp index 3d55db19..b125af39 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp @@ -10,9 +10,9 @@ int CXuiCtrlFireProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != nullptr ) + if( pvUserData != NULL ) { - FurnaceTileEntity *pFurnaceTileEntity = static_cast(pvUserData); + FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData; // TODO This param is a magic number in Java but we should really define it somewhere with a name // I think it is the number of states of the progress display (ie the max value) diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp index 98ff1c26..02ee7c93 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp @@ -22,10 +22,10 @@ CXuiCtrlMinecraftPlayer::CXuiCtrlMinecraftPlayer() : Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; } //----------------------------------------------------------------------------- @@ -41,13 +41,13 @@ HRESULT CXuiCtrlMinecraftPlayer::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl { XuiElementGetParent(parent,&parent); currentClass = XuiGetObjectClass( parent ); - } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); + } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) ); - assert( parent != nullptr ); + assert( parent != NULL ); VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = static_cast(pObj); + m_containerScene = (CXuiSceneInventory *)pObj; m_iPad = m_containerScene->getPad(); @@ -116,7 +116,7 @@ HRESULT CXuiCtrlMinecraftPlayer::OnRender(XUIMessageRender *pRenderData, BOOL &b // // for(int i=0;ilocalplayers[i] != nullptr) +// if(pMinecraft->localplayers[i] != NULL) // { // iPlayerC++; // } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp index 1fa44d3f..0acd250f 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp @@ -30,10 +30,10 @@ CXuiCtrlMinecraftSkinPreview::CXuiCtrlMinecraftSkinPreview() : Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; m_customTextureUrl = L"default"; m_backupTexture = TN_MOB_CHAR; @@ -62,7 +62,7 @@ CXuiCtrlMinecraftSkinPreview::CXuiCtrlMinecraftSkinPreview() : m_fOriginalRotation = 0.0f; m_framesAnimatingRotation = 0; m_bAnimatingToFacing = false; - m_pvAdditionalModelParts=nullptr; + m_pvAdditionalModelParts=NULL; m_uiAnimOverrideBitmask=0L; } @@ -137,7 +137,7 @@ void CXuiCtrlMinecraftSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAn void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation() { - m_currentAnimation = static_cast(m_currentAnimation + 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1); if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking; m_swingTime = 0.0f; @@ -145,8 +145,8 @@ void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation() void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation() { - m_currentAnimation = static_cast(m_currentAnimation - 1); - if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast(e_SkinPreviewAnimation_Count - 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); + if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); m_swingTime = 0.0f; } @@ -241,7 +241,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO Lighting::turnOn(); //glRotatef(-45 - 90, 0, 1, 0); - glRotatef(-static_cast(m_xRot), 1, 0, 0); + glRotatef(-(float)m_xRot, 1, 0, 0); // 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen bool wasHidingGui = pMinecraft->options->hideGui; @@ -249,7 +249,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO //EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1); EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER); - if (renderer != nullptr) + if (renderer != NULL) { // 4J-PB - any additional parts to turn on for this player (skin dependent) //vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); @@ -294,12 +294,12 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do glPushMatrix(); glDisable(GL_CULL_FACE); - HumanoidModel *model = static_cast(renderer->getModel()); + HumanoidModel *model = (HumanoidModel *)renderer->getModel(); //getAttackAnim(mob, a); - //if (armor != nullptr) armor->attackTime = model->attackTime; + //if (armor != NULL) armor->attackTime = model->attackTime; //model->riding = mob->isRiding(); - //if (armor != nullptr) armor->riding = model->riding; + //if (armor != NULL) armor->riding = model->riding; // 4J Stu - Remember to reset these values once the rendering is done if you add another one model->attackTime = 0; @@ -329,7 +329,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do { m_swingTime = 0; } - model->attackTime = m_swingTime / static_cast(Player::SWING_DURATION * 3); + model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3); break; default: break; @@ -343,7 +343,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do //setupPosition(mob, x, y, z); // is equivalent to - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); //float bob = getBob(mob, a); #ifdef SKIN_PREVIEW_BOB_ANIM @@ -415,11 +415,11 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do double xa = sin(yr * PI / 180); double za = -cos(yr * PI / 180); - float flap = static_cast(yd) * 10; + float flap = (float) yd * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = static_cast(xd * xa + zd * za) * 100; - float lean2 = static_cast(xd * za - zd * xa) * 100; + float lean = (float) (xd * xa + zd * za) * 100; + float lean2 = (float) (xd * za - zd * xa) * 100; if (lean < 0) lean = 0; //float pow = 1;//mob->oBob + (bob - mob->oBob) * a; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp index 9b64dbcb..84273eb5 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp @@ -40,7 +40,7 @@ LPCWSTR CXuiCtrlMinecraftSlot::xzpIcons[15]= //----------------------------------------------------------------------------- CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() : - //m_hBrush(nullptr), + //m_hBrush(NULL), m_bDirty(FALSE), m_iPassThroughDataAssociation(0), m_iPassThroughIdAssociation(0), @@ -60,10 +60,10 @@ CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() : Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != nullptr) + if(pMinecraft != NULL) { - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fScreenHeight=static_cast(pMinecraft->height_phys); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fScreenHeight=(float)pMinecraft->height_phys; m_bScreenWidthSetup = true; } } @@ -109,14 +109,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData, pData->szPath = MsgGetSlotItem.szPath; pData->bDirty = MsgGetSlotItem.bDirty; - if(MsgGetSlotItem.item != nullptr) + if(MsgGetSlotItem.item != NULL) { m_item = MsgGetSlotItem.item; m_iID = m_item->id; m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fAlpha = static_cast(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; + m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fScale = static_cast(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; + m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; } else { @@ -128,10 +128,10 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData, // 4J Stu - Some parent controls may overide this, others will leave it as what we passed in m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fAlpha = static_cast(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; + m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); m_iCount = GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fScale = static_cast(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; + m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; m_popTime = GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); m_iAuxVal = GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField); @@ -145,7 +145,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData, pData->szPath = xzpIcons[m_iID-32000]; } - if(m_item != nullptr && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr; + if(m_item != NULL && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr; } @@ -184,11 +184,11 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa hr = XuiSendMessage(m_hObj, &Message); // We cannot have an Item with id 0 - if(m_item != nullptr || (m_iID > 0 && m_iID<32000) ) + if(m_item != NULL || (m_iID > 0 && m_iID<32000) ) { HXUIDC hDC = pRenderData->hDC; CXuiControl xuiControl(m_hObj); - if(m_item == nullptr) m_item = std::make_shared(m_iID, m_iCount, m_iAuxVal); + if(m_item == NULL) m_item = shared_ptr( new ItemInstance(m_iID, m_iCount, m_iAuxVal) ); // build and render with the game call @@ -217,18 +217,18 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa // Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it. // Clear just the region required for this control. D3DRECT clearRect; - clearRect.x1 = static_cast(matrix._41) - 2; - clearRect.y1 = static_cast(matrix._42) - 2; - clearRect.x2 = static_cast(matrix._41 + (bwidth * matrix._11)) + 2; - clearRect.y2 = static_cast(matrix._42 + (bheight * matrix._22)) + 2; + clearRect.x1 = (int)(matrix._41) - 2; + clearRect.y1 = (int)(matrix._42) - 2; + clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2; + clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2; if(!m_bScreenWidthSetup) { Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != nullptr) + if(pMinecraft != NULL) { - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fScreenHeight=static_cast(pMinecraft->height_phys); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fScreenHeight=(float)pMinecraft->height_phys; m_bScreenWidthSetup = true; } } @@ -261,14 +261,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); + float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; float sx = x; float sy = y; float sxoffs = 8 * scaleX; float syoffs = 12 * scaleY; - glTranslatef(static_cast(sx + sxoffs), static_cast(sy + syoffs), 0); + glTranslatef((float)(sx + sxoffs), (float)(sy + syoffs), 0); glScalef(1 / squeeze, (squeeze + 1) / 2, 1); - glTranslatef(static_cast(-(sx + sxoffs)), static_cast(-(sy + syoffs)), 0); + glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0); } m_pItemRenderer->renderAndDecorateItem(pMinecraft->font, pMinecraft->textures, m_item, x, y,scaleX,scaleY,m_fAlpha,m_isFoil,false); @@ -284,15 +284,15 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa { glPushMatrix(); glScalef(scaleX, scaleY, 1.0f); - int iX= static_cast(0.5f + ((float)x) / scaleX); - int iY= static_cast(0.5f + ((float)y) / scaleY); + int iX= (int)(0.5f+((float)x)/scaleX); + int iY= (int)(0.5f+((float)y)/scaleY); m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, iX, iY, m_fAlpha); glPopMatrix(); } else { - m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, static_cast(x), static_cast(y), m_fAlpha); + m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, (int)x, (int)y, m_fAlpha); } } @@ -329,9 +329,9 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, i m_iAuxVal = 0; m_iCount=iCount; - m_fScale = static_cast(iScale)/10.0f; + m_fScale = (float)(iScale)/10.0f; //m_uiAlpha=uiAlpha; - m_fAlpha =static_cast(uiAlpha) / 255.0f; + m_fAlpha =((float)(uiAlpha)) / 255.0f; m_bDecorations = bDecorations; // mif(bDecorations) m_iDecorations=1; // else m_iDecorations=0; @@ -348,8 +348,8 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, shared_ptr item, int m_item = item; m_isFoil = item->isFoil(); m_iPad = iPad; - m_fScale = static_cast(iScale)/10.0f; - m_fAlpha =static_cast(uiAlpha) / 31; + m_fScale = (float)(iScale)/10.0f; + m_fAlpha =((float)(uiAlpha)) / 31; m_bDecorations = bDecorations; m_bDirty = TRUE; XuiElementSetShow(m_hObj,bShow); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp index 6a76980d..23b22573 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp @@ -38,9 +38,9 @@ HRESULT CXuiCtrlMobEffect::OnGetSourceDataText(XUIMessageGetSourceText *pGetSour pGetSourceTextData->szText = m_name.c_str(); pGetSourceTextData->bDisplay = TRUE; - if(FAILED(PlayVisualRange(iconFrameNames[m_icon],nullptr,iconFrameNames[m_icon]))) + if(FAILED(PlayVisualRange(iconFrameNames[m_icon],NULL,iconFrameNames[m_icon]))) { - PlayVisualRange(L"Normal",nullptr,L"Normal"); + PlayVisualRange(L"Normal",NULL,L"Normal"); } bHandled = TRUE; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp index 18995854..a4e9f6be 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp @@ -10,11 +10,11 @@ HRESULT CXuiCtrlSliderWrapper::OnInit( XUIMessageInit* pInitData, BOOL& bHandled XuiElementGetChildById(m_hObj,L"FocusSink",&hObjChild); XuiObjectFromHandle( hObjChild, &pObj ); - m_pFocusSink = static_cast(pObj); + m_pFocusSink = (CXuiControl *)pObj; XuiElementGetChildById(m_hObj,L"XuiSlider",&hObjChild); XuiObjectFromHandle( hObjChild, &pObj ); - m_pSlider = static_cast(pObj); + m_pSlider = (CXuiSlider *)pObj; m_sliderActive = false; m_bDisplayVal=true; @@ -119,7 +119,7 @@ HRESULT CXuiCtrlSliderWrapper::SetValueDisplay( BOOL bShow ) hr=XuiControlGetVisual(pThis->m_pSlider->m_hObj,&hVisual); hr=XuiElementGetChildById(hVisual,L"Text_Value",&hText); - if(hText!=nullptr) + if(hText!=NULL) { XuiElementSetShow(hText,bShow); } @@ -132,7 +132,7 @@ LPCWSTR CXuiCtrlSliderWrapper::GetText( ) CXuiCtrlSliderWrapper *pThis; HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis); if (FAILED(hr)) - return nullptr; + return NULL; return pThis->m_pSlider->GetText(); //return S_OK; } @@ -159,7 +159,7 @@ HXUIOBJ CXuiCtrlSliderWrapper::GetSlider() CXuiCtrlSliderWrapper *pThis; HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis); if (FAILED(hr)) - return nullptr; + return NULL; return pThis->m_pSlider->m_hObj; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp index 8a45d6fc..f8ceeb69 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp @@ -12,7 +12,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnInit( HXUIOBJ hObj, XUIMessageInit* pInitDat { HRESULT hr = S_OK; SlotControlUserDataContainer* pvUserData = new SlotControlUserDataContainer(); - hr = XuiElementSetUserData(hObj, static_cast(pvUserData) ); + hr = XuiElementSetUserData(hObj, (void *)pvUserData ); // 4J WESTY : Pointer Prototype : Added to support prototype only. m_bSkipDefaultNavigation = false; @@ -26,7 +26,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnDestroy( HXUIOBJ hObj ) void* pvUserData; hr = XuiElementGetUserData( hObj, &pvUserData ); - if( pvUserData != nullptr ) + if( pvUserData != NULL ) { delete pvUserData; } @@ -41,19 +41,19 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - if( pUserDataContainer->slot != nullptr ) + if( pUserDataContainer->slot != NULL ) { item = pUserDataContainer->slot->getItem(); } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != nullptr) item = player->inventory->getCarried(); + if(player != NULL) item = player->inventory->getCarried(); } - if( item != nullptr ) + if( item != NULL ) { pData->item = item; pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(item->id,item->getAuxValue(),item->isFoil()); @@ -64,7 +64,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust // 11 bits - auxval // 6 bits - count // 6 bits - scale - pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, static_cast(31 * pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime); + pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime); } else { @@ -82,7 +82,7 @@ void CXuiCtrlSlotItemCtrlBase::SetSlot( HXUIOBJ hObj, Slot* slot ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; pUserDataContainer->slot = slot; } @@ -92,7 +92,7 @@ void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; pUserDataContainer->m_iPad = iPad; } @@ -102,7 +102,7 @@ void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; pUserDataContainer->m_fAlpha = fAlpha; } @@ -111,16 +111,16 @@ bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - if(pUserDataContainer->slot != nullptr) + if(pUserDataContainer->slot != NULL) { return !pUserDataContainer->slot->hasItem(); } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != nullptr) return player->inventory->getCarried() == nullptr; + if(player != NULL) return player->inventory->getCarried() == NULL; } return true; @@ -130,9 +130,9 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - if(pUserDataContainer->slot != nullptr) + if(pUserDataContainer->slot != NULL) { wstring desc = L""; vector *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); @@ -167,10 +167,10 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vectorm_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != nullptr) + if(player != NULL) { shared_ptr item = player->inventory->getCarried(); - if(item != nullptr) return app.GetString( item->getDescriptionId() ); + if(item != NULL) return app.GetString( item->getDescriptionId() ); } } @@ -181,16 +181,16 @@ shared_ptr CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - if(pUserDataContainer->slot != nullptr) + if(pUserDataContainer->slot != NULL) { return pUserDataContainer->slot->getItem(); } else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != nullptr) return player->inventory->getCarried(); + if(player != NULL) return player->inventory->getCarried(); } return nullptr; @@ -200,7 +200,7 @@ Slot *CXuiCtrlSlotItemCtrlBase::getSlot( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; return pUserDataContainer->slot; } @@ -254,11 +254,11 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; int iCount = 0; - if(pUserDataContainer->slot != nullptr) + if(pUserDataContainer->slot != NULL) { if ( pUserDataContainer->slot->hasItem() ) { @@ -268,7 +268,7 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj ) else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != nullptr && player->inventory->getCarried() != nullptr) + if(player != NULL && player->inventory->getCarried() != NULL) { iCount = player->inventory->getCarried()->count; } @@ -294,9 +294,9 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj // Get the info on this item. void* pvThisUserData; XuiElementGetUserData( hThisObj, &pvThisUserData ); - SlotControlUserDataContainer* pThisUserDataContainer = static_cast(pvThisUserData); + SlotControlUserDataContainer* pThisUserDataContainer = (SlotControlUserDataContainer*)pvThisUserData; - if(pThisUserDataContainer->slot != nullptr) + if(pThisUserDataContainer->slot != NULL) { if ( pThisUserDataContainer->slot->hasItem() ) { @@ -309,7 +309,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj else if(pThisUserDataContainer->m_iPad >= 0 && pThisUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pThisUserDataContainer->m_iPad] ); - if(player != nullptr && player->inventory->getCarried() != nullptr) + if(player != NULL && player->inventory->getCarried() != NULL) { iThisID = player->inventory->getCarried()->id; iThisAux = player->inventory->getCarried()->getAuxValue(); @@ -322,9 +322,9 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj // Get the info on other item. void* pvOtherUserData; XuiElementGetUserData( hOtherObj, &pvOtherUserData ); - SlotControlUserDataContainer* pOtherUserDataContainer = static_cast(pvOtherUserData); + SlotControlUserDataContainer* pOtherUserDataContainer = (SlotControlUserDataContainer*)pvOtherUserData; - if(pOtherUserDataContainer->slot != nullptr) + if(pOtherUserDataContainer->slot != NULL) { if ( pOtherUserDataContainer->slot->hasItem() ) { @@ -336,7 +336,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj else if(pOtherUserDataContainer->m_iPad >= 0 && pOtherUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pOtherUserDataContainer->m_iPad] ); - if(player != nullptr && player->inventory->getCarried() != nullptr) + if(player != NULL && player->inventory->getCarried() != NULL) { iOtherID = player->inventory->getCarried()->id; iOtherAux = player->inventory->getCarried()->getAuxValue(); @@ -363,13 +363,13 @@ int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); + SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; int iCount = 0; int iMaxStackSize = 0; bool bStackable = false; - if(pUserDataContainer->slot != nullptr) + if(pUserDataContainer->slot != NULL) { if ( pUserDataContainer->slot->hasItem() ) { diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h index ac237ac9..2fd21749 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h @@ -9,7 +9,7 @@ class ItemInstance; class SlotControlUserDataContainer { public: - SlotControlUserDataContainer() : slot( nullptr ), hProgressBar( nullptr ), m_iPad( -1 ), m_fAlpha(1.0f) {}; + SlotControlUserDataContainer() : slot( NULL ), hProgressBar( NULL ), m_iPad( -1 ), m_fAlpha(1.0f) {}; Slot* slot; HXUIOBJ hProgressBar; float m_fAlpha; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp index a34f2a7e..7e51c885 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp @@ -103,7 +103,7 @@ void CXuiCtrlSlotList::SetData(int m_iPad, AbstractContainerMenu* menu, int rows slotControl->SetUserIndex( slotControl->m_hObj, m_iPad ); - slotControl = nullptr; + slotControl = NULL; } } @@ -226,6 +226,6 @@ void CXuiCtrlSlotList::GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListIt HXUIOBJ itemControl = this->GetItemControl(itemIndex); VOID *pObj; XuiObjectFromHandle( itemControl, &pObj ); - *CXuiCtrlSlotItem = static_cast(pObj); + *CXuiCtrlSlotItem = (CXuiCtrlSlotItemListItem *)pObj; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp index 874edc6f..2e971710 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp @@ -20,10 +20,10 @@ CXuiCtrlSplashPulser::CXuiCtrlSplashPulser() : Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=static_cast(pMinecraft->width_phys); - m_fRawWidth=static_cast(ssc.rawWidth); - m_fScreenHeight=static_cast(pMinecraft->height_phys); - m_fRawHeight=static_cast(ssc.rawHeight); + m_fScreenWidth=(float)pMinecraft->width_phys; + m_fRawWidth=(float)ssc.rawWidth; + m_fScreenHeight=(float)pMinecraft->height_phys; + m_fRawHeight=(float)ssc.rawHeight; } //----------------------------------------------------------------------------- diff --git a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h index e16f891c..888f8ad0 100644 --- a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h +++ b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h @@ -39,11 +39,11 @@ CustomMessage_GetSlotItem_Struct; static __declspec(noinline) void CustomMessage_GetSlotItem(XUIMessage *pMsg, CustomMessage_GetSlotItem_Struct* pData, int iDataBitField, int iItemBitField) { XuiMessage(pMsg,XM_GETSLOTITEM_MESSAGE); - _XuiMessageExtra(pMsg,static_cast(pData), sizeof(*pData)); + _XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData)); pData->item = nullptr; pData->iDataBitField = iDataBitField; pData->iItemBitField = iItemBitField; - pData->szPath = nullptr; + pData->szPath = NULL; pData->bDirty = false; } @@ -68,7 +68,7 @@ CustomMessage_Splitscreenplayer_Struct; static __declspec(noinline) void CustomMessage_Splitscreenplayer(XUIMessage *pMsg, CustomMessage_Splitscreenplayer_Struct* pData, bool bJoining) { XuiMessage(pMsg,XM_SPLITSCREENPLAYER_MESSAGE); - _XuiMessageExtra(pMsg,static_cast(pData), sizeof(*pData)); + _XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData)); pData->bJoining = bJoining; } diff --git a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp index c5150249..bd05ca14 100644 --- a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp @@ -24,7 +24,7 @@ HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - iPad = *static_cast(pInitData->pvInitData); + iPad = *(int *) pInitData->pvInitData; MapChildControls(); @@ -39,7 +39,7 @@ HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) VOID *pObj; XuiObjectFromHandle( xList, &pObj ); - list = static_cast(pObj); + list = (CXuiCtrl4JList *) pObj; ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK ); @@ -162,7 +162,7 @@ HRESULT CScene_DLCMain::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNo param->iType = iIndex; // promote the DLC content request type - app.AddDLCRequest(static_cast(iIndex), true); + app.AddDLCRequest((eDLCMarketplaceType)iIndex, true); app.NavigateToScene(iPad,eUIScene_DLCOffersMenu, param); } return S_OK; @@ -182,14 +182,14 @@ HRESULT CScene_DLCMain::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) //---------------------------------------------------------------------------------- HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - DLCOffersParam *param = static_cast(pInitData->pvInitData); + DLCOffersParam *param = (DLCOffersParam *) pInitData->pvInitData; m_iPad = param->iPad; m_iType = param->iType; m_iOfferC = app.GetDLCOffersCount(); m_bIsFemale = false; - m_pNoImageFor_DLC=nullptr; + m_pNoImageFor_DLC=NULL; bNoDLCToDisplay=true; - //hCostText=nullptr; + //hCostText=NULL; // 4J JEV: Deleting this here seems simpler. @@ -203,10 +203,10 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) HRESULT hRes; - hRes=XAvatarInitialize(XAVATAR_COORDINATE_SYSTEM_LEFT_HANDED,0,0,0,nullptr); + hRes=XAvatarInitialize(XAVATAR_COORDINATE_SYSTEM_LEFT_HANDED,0,0,0,NULL); // get the avatar gender - hRes=XAvatarGetMetadataLocalUser(m_iPad,&AvatarMetadata,nullptr); + hRes=XAvatarGetMetadataLocalUser(m_iPad,&AvatarMetadata,NULL); m_bIsFemale= (XAVATAR_BODY_TYPE_FEMALE == XAvatarMetadataGetBodyType(&AvatarMetadata)); // shutdown the avatar system @@ -223,10 +223,10 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_bIgnorePress=true; VOID *pObj; - m_hXuiBrush=nullptr; + m_hXuiBrush=NULL; XuiObjectFromHandle( m_List, &pObj ); - m_pOffersList = static_cast(pObj); + m_pOffersList = (CXuiCtrl4JList *)pObj; m_bAllDLCContentRetrieved=false; XuiElementInitUserFocus(m_hObj,ProfileManager.GetPrimaryPad(),TRUE); @@ -242,7 +242,7 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // Is the DLC we're looking for available? if(!m_bDLCRequiredIsRetrieved) { - if(app.DLCContentRetrieved(static_cast(m_iType))) + if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType)) { m_bDLCRequiredIsRetrieved=true; @@ -259,13 +259,13 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) { - CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo=nullptr; + CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo=NULL; //XMARKETPLACE_CONTENTOFFER_INFO xOffer; XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO xOffer; const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; ZeroMemory(szResourceLocator,sizeof(WCHAR)*LOCATOR_SIZE); - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); int iCount=0; if(bUpdateOnly) // Just update the info on the current list @@ -275,13 +275,13 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) xOffer = StorageManager.GetOffer(i); // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID); - if(pDLC==nullptr) + if(pDLC==NULL) { // try the trial version pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID); } - if(pDLC==nullptr) + if(pDLC==NULL) { // skip this one #ifdef _DEBUG @@ -301,7 +301,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // can't trust the offer type - partnernet is giving avatar items the CONTENT type //if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType)) - if(pDLC->eDLCType==static_cast(m_iType)) + if(pDLC->eDLCType==(eDLCContentType)m_iType) { if(xOffer.fUserHasPurchased) { @@ -343,13 +343,13 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID); - if(pDLC==nullptr) + if(pDLC==NULL) { // try the trial version pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID); } - if(pDLC==nullptr) + if(pDLC==NULL) { // skip this one #ifdef _DEBUG @@ -362,7 +362,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // can't trust the offer type - partnernet is giving avatar items the CONTENT type //if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType)) - if(pDLC->eDLCType==static_cast(m_iType)) + if(pDLC->eDLCType==(eDLCContentType)m_iType) { wstring wstrTemp=xOffer.wszOfferName; @@ -395,7 +395,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // store the offer index pListInfo[iCount].iData=i; - pListInfo[iCount].iSortIndex=static_cast(pDLC->uiSortIndex); + pListInfo[iCount].iSortIndex=(int)pDLC->uiSortIndex; #ifdef _DEBUG app.DebugPrintf("Adding "); OutputDebugStringW(pListInfo[iCount].pwszText); @@ -447,9 +447,9 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) m_pOffersList->SetCurSelVisible(0); DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID); - if (dlc != nullptr) + if (dlc != NULL) { - BYTE *pData=nullptr; + BYTE *pData=NULL; UINT uiSize=0; DWORD dwSize=0; @@ -460,7 +460,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) if(iIndex!=-1) { // it's in the xzp - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory @@ -480,7 +480,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly ) } else { - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory @@ -568,7 +568,7 @@ HRESULT CScene_DLCOffers::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p // if it's already been purchased, we need to let the user download it anyway { ullIndexA[0]=StorageManager.GetOffer(ItemInfo.iData).qwOfferID; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } @@ -662,7 +662,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha // reset the image monitor, but not for the first selection if(pNotifySelChangedData->iOldItem!=-1) { - m_pNoImageFor_DLC=nullptr; + m_pNoImageFor_DLC=NULL; } if (m_List.TreeHasFocus())// && offerIndexes.size() > index) @@ -695,14 +695,14 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha m_PriceTag.SetText(xOffer.wszCurrencyPrice); DLC_INFO *dlc = app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID); - if(dlc==nullptr) + if(dlc==NULL) { dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID); } - if (dlc != nullptr) + if (dlc != NULL) { - BYTE *pImage=nullptr; + BYTE *pImage=NULL; UINT uiSize=0; DWORD dwSize=0; @@ -713,7 +713,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha if(iIndex!=-1) { // it's in the xzp - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory @@ -737,7 +737,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha } else { - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory @@ -750,13 +750,13 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha } else { - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory //app.FreeLocalTMSFiles(); - m_hXuiBrush=nullptr; + m_hXuiBrush=NULL; } } @@ -791,7 +791,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) // Is the DLC we're looking for available? if(!m_bDLCRequiredIsRetrieved) { - if(app.DLCContentRetrieved(static_cast(m_iType))) + if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType)) { m_bDLCRequiredIsRetrieved=true; @@ -802,7 +802,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) } // Check for any TMS image we're waiting for - if(m_pNoImageFor_DLC!=nullptr) + if(m_pNoImageFor_DLC!=NULL) { // Is it present now? WCHAR *cString = m_pNoImageFor_DLC->wchBanner; @@ -811,10 +811,10 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) if(bPresent) { - BYTE *pImage=nullptr; + BYTE *pImage=NULL; DWORD dwSize=0; - if(m_hXuiBrush!=nullptr) + if(m_hXuiBrush!=NULL) { XuiDestroyBrush(m_hXuiBrush); // clear the TMS XZP vector memory @@ -822,7 +822,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) } app.GetMemFileDetails(cString,&pImage,&dwSize); XuiCreateTextureBrushFromMemory(pImage,dwSize,&m_hXuiBrush); - m_pNoImageFor_DLC=nullptr; + m_pNoImageFor_DLC=NULL; } } diff --git a/Minecraft.Client/Common/XUI/XUI_Death.cpp b/Minecraft.Client/Common/XUI/XUI_Death.cpp index 1788ceff..83275c14 100644 --- a/Minecraft.Client/Common/XUI/XUI_Death.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Death.cpp @@ -26,7 +26,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_Death::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; m_bIgnoreInput = false; @@ -59,7 +59,7 @@ HRESULT CScene_Death::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChange XuiSetLocale( Languages[curSel].pszLanguagePath ); // Apply the locale to the main scene. - XuiApplyLocale( m_hObj, nullptr ); + XuiApplyLocale( m_hObj, NULL ); // Update the text for the current value. m_Value.SetText( m_List.GetText( curSel ) );*/ @@ -105,9 +105,9 @@ HRESULT CScene_Death::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNoti if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); } TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed); diff --git a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp index d8c06ae1..6b96a4e3 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp @@ -14,13 +14,13 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle { MapChildControls(); - ItemEditorInput *initData = static_cast(pInitData->pvInitData); + ItemEditorInput *initData = (ItemEditorInput *)pInitData->pvInitData; m_iPad = initData->iPad; m_slot = initData->slot; m_menu = initData->menu; - if(m_slot != nullptr) m_item = m_slot->getItem(); + if(m_slot != NULL) m_item = m_slot->getItem(); - if(m_item!=nullptr) + if(m_item!=NULL) { m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil()); m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) ); @@ -54,13 +54,13 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH case VK_PAD_START: case VK_PAD_BACK: // We need to send a packet to the server to update it's representation of this item - if(m_slot != nullptr && m_menu != nullptr) + if(m_slot != NULL && m_menu != NULL) { m_slot->set(m_item); Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != nullptr && player->connection) player->connection->send(std::make_shared(m_menu->containerId, m_slot->index, m_item)); + if(player != NULL && player->connection) player->connection->send( shared_ptr( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) ); } // kill the crafting xui app.NavigateBack(m_iPad); @@ -76,7 +76,7 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled) { - if(m_item == nullptr) m_item = std::make_shared(0, 1, 0); + if(m_item == NULL) m_item = shared_ptr( new ItemInstance(0,1,0) ); if(hObjSource == m_itemId) { int id = 0; @@ -84,7 +84,7 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot if(!value.empty()) id = _fromString( value ); // TODO Proper validation of the valid item ids - if(id > 0 && Item::items[id] != nullptr) m_item->id = id; + if(id > 0 && Item::items[id] != NULL) m_item->id = id; } else if(hObjSource == m_itemAuxValue) { diff --git a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp index 338eb853..e6db6a80 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp @@ -37,7 +37,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) for(unsigned int i = 0; i < Item::items.length; ++i) { - if(Item::items[i] != nullptr) + if(Item::items[i] != NULL) { //m_items.InsertItems(m_items.GetItemCount(),1); m_itemIds.push_back(i); @@ -102,7 +102,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 ); - m_setFov.SetValue( static_cast(pMinecraft->gameRenderer->GetFovVal())); + m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal()); XuiSetTimer(m_hObj,0,DEBUG_OVERLAY_UPDATE_TIME_PERIOD); @@ -148,7 +148,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress /*else if( hObjPressed == m_saveToDisc ) // 4J-JEV: Doesn't look like we use this debug option anymore. { #ifndef _CONTENT_PACKAGE - pMinecraft->level->save(true, nullptr); + pMinecraft->level->save(true, NULL); int radius; m_chunkRadius.GetValue(&radius); @@ -166,7 +166,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress { #ifndef _CONTENT_PACKAGE // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); HXUIOBJ hScene; HRESULT hr; @@ -175,7 +175,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); - hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugCreateSchematic,false, false), nullptr, &hScene); + hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugCreateSchematic,false, false), NULL, &hScene); this->NavigateForward(hScene); //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic); #endif @@ -184,7 +184,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress { #ifndef _CONTENT_PACKAGE // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); HXUIOBJ hScene; HRESULT hr; @@ -193,7 +193,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); - hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugSetCamera, false, false), nullptr, &hScene); + hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugSetCamera, false, false), NULL, &hScene); this->NavigateForward(hScene); //app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic); #endif @@ -266,7 +266,7 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify if( hObjSource == m_setFov ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->gameRenderer->SetFovVal(static_cast(pNotifyValueChangedData->nValue)); + pMinecraft->gameRenderer->SetFovVal((float)pNotifyValueChangedData->nValue); } return S_OK; } @@ -274,10 +274,10 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify HRESULT CScene_DebugOverlay::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->level != nullptr) + if(pMinecraft->level != NULL) { m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 ); - m_setFov.SetValue( static_cast(pMinecraft->gameRenderer->GetFovVal())); + m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal()); } return S_OK; } @@ -286,9 +286,9 @@ void CScene_DebugOverlay::SetSpawnToPlayerPos() { Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->level->getLevelData()->setXSpawn(static_cast(pMinecraft->player->x)); - pMinecraft->level->getLevelData()->setYSpawn(static_cast(pMinecraft->player->y)); - pMinecraft->level->getLevelData()->setZSpawn(static_cast(pMinecraft->player->z)); + pMinecraft->level->getLevelData()->setXSpawn((int)pMinecraft->player->x); + pMinecraft->level->getLevelData()->setYSpawn((int)pMinecraft->player->y); + pMinecraft->level->getLevelData()->setZSpawn((int)pMinecraft->player->z); } #ifndef _CONTENT_PACKAGE @@ -301,14 +301,14 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) ConsoleSaveFile *currentSave = pMinecraft->level->getLevelStorage()->getSaveFile(); // With a size of 0 but a value in the data pointer we should create a new save - ConsoleSaveFileOriginal newSave( currentSave->getFilename(), nullptr, 0, true ); + ConsoleSaveFileOriginal newSave( currentSave->getFilename(), NULL, 0, true ); // TODO Make this only happen for the new save //SetSpawnToPlayerPos(); FileEntry *origFileEntry = currentSave->createFile( wstring( L"level.dat" ) ); byteArray levelData( origFileEntry->getFileSize() ); DWORD bytesRead; - currentSave->setFilePointer(origFileEntry,0,nullptr,FILE_BEGIN); + currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN); currentSave->readFile( origFileEntry, levelData.data, // data buffer @@ -331,10 +331,10 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) { for(int zPos = playerChunkZ - chunkRadius; zPos < playerChunkZ + chunkRadius; ++zPos) { - CompoundTag *chunkData=nullptr; + CompoundTag *chunkData=NULL; DataInputStream *is = RegionFileCache::getChunkDataInputStream(currentSave, L"", xPos, zPos); - if (is != nullptr) + if (is != NULL) { chunkData = NbtIo::read((DataInput *)is); is->deleteChildStream(); @@ -342,7 +342,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) } app.DebugPrintf("Processing chunk (%d, %d)\n", xPos, zPos); DataOutputStream *os = getChunkDataOutputStream(newFileCache, &newSave, L"", xPos, zPos); - if(os != nullptr) + if(os != NULL) { NbtIo::write(chunkData, os); os->close(); @@ -352,7 +352,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) os->deleteChildStream(); delete os; } - if(chunkData != nullptr) + if(chunkData != NULL) { delete chunkData; } @@ -367,13 +367,13 @@ RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" ); - RegionFile *ref = nullptr; + RegionFile *ref = NULL; auto it = newFileCache.find(file); if( it != newFileCache.end() ) ref = it->second; // 4J Jev, put back in. - if (ref != nullptr) + if (ref != NULL) { return ref; } diff --git a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp index fb6339ce..f6335191 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp @@ -25,7 +25,7 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled currentPosition->player = playerNo; Minecraft *pMinecraft = Minecraft::GetInstance(); - if (pMinecraft != nullptr) + if (pMinecraft != NULL) { Vec3 *vec = pMinecraft->localplayers[playerNo]->getPos(1.0); @@ -43,12 +43,12 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full); m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full); - m_camX.SetText(static_cast(std::to_wstring(currentPosition->m_camX).c_str())); - m_camY.SetText(static_cast(std::to_wstring(currentPosition->m_camY + 1.62).c_str())); - m_camZ.SetText(static_cast(std::to_wstring(currentPosition->m_camZ).c_str())); + m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str()); + m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).c_str()); + m_camZ.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camZ).c_str()); - m_yRot.SetText(static_cast(std::to_wstring(currentPosition->m_yRot).c_str())); - m_elevation.SetText(static_cast(std::to_wstring(currentPosition->m_elev).c_str())); + m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str()); + m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str()); //fpp = new FreezePlayerParam(); //fpp->player = playerNo; @@ -94,7 +94,7 @@ HRESULT CScene_DebugSetCamera::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHa NavigateBack(); //delete currentPosition; - //currentPosition = nullptr; + //currentPosition = NULL; rfHandled = TRUE; break; diff --git a/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp b/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp index e8091bcb..aaa3b06f 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp @@ -9,7 +9,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_DebugTips::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; m_bIgnoreInput = false; diff --git a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp index cc235915..f66c0d70 100644 --- a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp @@ -18,7 +18,7 @@ HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHan m_buttonConfirm.SetText( app.GetString( IDS_CONFIRM_OK ) ); - LoadingInputParams *params = static_cast(pInitData->pvInitData); + LoadingInputParams *params = (LoadingInputParams *)pInitData->pvInitData; m_CompletionData = params->completionData; m_iPad=params->completionData->iPad; @@ -67,10 +67,10 @@ HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHan // The framework calls this handler when the object is to be destroyed. HRESULT CScene_FullscreenProgress::OnDestroy() { - if( thread != nullptr && thread != INVALID_HANDLE_VALUE ) + if( thread != NULL && thread != INVALID_HANDLE_VALUE ) delete thread; - if( m_CompletionData != nullptr ) + if( m_CompletionData != NULL ) delete m_CompletionData; return S_OK; @@ -86,7 +86,7 @@ HRESULT CScene_FullscreenProgress::OnKeyDown(XUIMessageInput* pInputData, BOOL& case VK_PAD_B: case VK_ESCAPE: // 4J-JEV: Fix for Xbox360 #162749 - TU17: Save Upload: Content: UI: Player is presented with non-functional Tooltips after the Upload Save For Xbox One is completed. - if( m_cancelFunc != nullptr && !m_threadCompleted ) + if( m_cancelFunc != NULL && !m_threadCompleted ) { m_cancelFunc( m_cancelFuncParam ); m_bWasCancelled=true; @@ -201,7 +201,7 @@ HRESULT CScene_FullscreenProgress::OnTransitionStart( XUIMessageTransition *pTra HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { int code = thread->GetExitCode(); - DWORD exitcode = *static_cast(&code); + DWORD exitcode = *((DWORD *)&code); //app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId); @@ -244,7 +244,7 @@ HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); app.NavigateToHomeMenu(); ui.UpdatePlayerBasePositions(); @@ -292,7 +292,7 @@ HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand CXuiSceneBase::ShowOtherPlayersBaseScene(iPad, true); // This just allows it to be shown Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); ui.UpdatePlayerBasePositions(); } break; diff --git a/Minecraft.Client/Common/XUI/XUI_HUD.cpp b/Minecraft.Client/Common/XUI/XUI_HUD.cpp index e188cbf6..286f06a7 100644 --- a/Minecraft.Client/Common/XUI/XUI_HUD.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HUD.cpp @@ -10,7 +10,7 @@ HRESULT CXuiSceneHud::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); @@ -33,7 +33,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHa HRESULT CXuiSceneHud::OnCustomMessage_TickScene() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return S_OK; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return S_OK; ++m_tickCount; @@ -145,7 +145,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) { int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel(); - int progress = static_cast(pMinecraft->localplayers[m_iPad]->experienceProgress * xpNeededForNextLevel); + int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel); m_ExperienceProgress.SetShow(TRUE); m_ExperienceProgress.SetRange(0,xpNeededForNextLevel); @@ -196,11 +196,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Full if(bHasPoison) { - m_healthIcon[icon].PlayVisualRange(L"FullPoisonFlash",nullptr,L"FullPoisonFlash"); + m_healthIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash"); } else { - m_healthIcon[icon].PlayVisualRange(L"FullFlash",nullptr,L"FullFlash"); + m_healthIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash"); } } else if (icon * 2 + 1 == iLastHealth || icon * 2 + 1 == iHealth) @@ -208,17 +208,17 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Half if(bHasPoison) { - m_healthIcon[icon].PlayVisualRange(L"HalfPoisonFlash",nullptr,L"HalfPoisonFlash"); + m_healthIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash"); } else { - m_healthIcon[icon].PlayVisualRange(L"HalfFlash",nullptr,L"HalfFlash"); + m_healthIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash"); } } else { // Empty - m_healthIcon[icon].PlayVisualRange(L"NormalFlash",nullptr,L"NormalFlash"); + m_healthIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash"); } } else @@ -228,11 +228,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Full if(bHasPoison) { - m_healthIcon[icon].PlayVisualRange(L"FullPoison",nullptr,L"FullPoison"); + m_healthIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison"); } else { - m_healthIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full"); + m_healthIcon[icon].PlayVisualRange(L"Full",NULL,L"Full"); } } else if (icon * 2 + 1 == iHealth) @@ -240,24 +240,24 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Half if(bHasPoison) { - m_healthIcon[icon].PlayVisualRange(L"HalfPoison",nullptr,L"HalfPoison"); + m_healthIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison"); } else { - m_healthIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half"); + m_healthIcon[icon].PlayVisualRange(L"Half",NULL,L"Half"); } } else { // Empty - m_healthIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal"); + m_healthIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal"); } } float yo = 0; if (iHealth <= 4) { - yo = static_cast(m_random.nextInt(2)) * (iGuiScale+1); + yo = (float)m_random.nextInt(2) * (iGuiScale+1); } if (icon == heartOffsetIndex) { @@ -288,11 +288,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Full if(hasHungerEffect) { - m_foodIcon[icon].PlayVisualRange(L"FullPoisonFlash",nullptr,L"FullPoisonFlash"); + m_foodIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash"); } else { - m_foodIcon[icon].PlayVisualRange(L"FullFlash",nullptr,L"FullFlash"); + m_foodIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash"); } } else if (icon * 2 + 1 == oldFood || icon * 2 + 1 == food) @@ -300,17 +300,17 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Half if(hasHungerEffect) { - m_foodIcon[icon].PlayVisualRange(L"HalfPoisonFlash",nullptr,L"HalfPoisonFlash"); + m_foodIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash"); } else { - m_foodIcon[icon].PlayVisualRange(L"HalfFlash",nullptr,L"HalfFlash"); + m_foodIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash"); } } else { // Empty - m_foodIcon[icon].PlayVisualRange(L"NormalFlash",nullptr,L"NormalFlash"); + m_foodIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash"); } } else @@ -320,11 +320,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Full if(hasHungerEffect) { - m_foodIcon[icon].PlayVisualRange(L"FullPoison",nullptr,L"FullPoison"); + m_foodIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison"); } else { - m_foodIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full"); + m_foodIcon[icon].PlayVisualRange(L"Full",NULL,L"Full"); } } else if (icon * 2 + 1 == food) @@ -332,11 +332,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Half if(hasHungerEffect) { - m_foodIcon[icon].PlayVisualRange(L"HalfPoison",nullptr,L"HalfPoison"); + m_foodIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison"); } else { - m_foodIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half"); + m_foodIcon[icon].PlayVisualRange(L"Half",NULL,L"Half"); } } else @@ -344,11 +344,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() // Empty if(hasHungerEffect) { - m_foodIcon[icon].PlayVisualRange(L"NormalPoison",nullptr,L"NormalPoison"); + m_foodIcon[icon].PlayVisualRange(L"NormalPoison",NULL,L"NormalPoison"); } else { - m_foodIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal"); + m_foodIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal"); } } } @@ -359,7 +359,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() { if ((m_tickCount % (food * 3 + 1)) == 0) { - yo = static_cast(m_random.nextInt(3) - 1) * (iGuiScale+1); + yo = (float)(m_random.nextInt(3) - 1) * (iGuiScale+1); } } @@ -377,9 +377,9 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() m_armourGroup.SetShow(TRUE); for (int icon = 0; icon < 10; icon++) { - if (icon * 2 + 1 < armor) m_armourIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full"); - else if (icon * 2 + 1 == armor) m_armourIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half"); - else if (icon * 2 + 1 > armor) m_armourIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal"); + if (icon * 2 + 1 < armor) m_armourIcon[icon].PlayVisualRange(L"Full",NULL,L"Full"); + else if (icon * 2 + 1 == armor) m_armourIcon[icon].PlayVisualRange(L"Half",NULL,L"Half"); + else if (icon * 2 + 1 > armor) m_armourIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal"); } } else @@ -391,20 +391,20 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(Material::water)) { m_airGroup.SetShow(TRUE); - int count = static_cast(ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY)); - int extra = static_cast(ceil((pMinecraft->localplayers[m_iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY)) - count; + int count = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY); + int extra = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count; for (int icon = 0; icon < 10; icon++) { // Air bubbles if (icon < count) { m_airIcon[icon].SetShow(TRUE); - m_airIcon[icon].PlayVisualRange(L"Bubble",nullptr,L"Bubble"); + m_airIcon[icon].PlayVisualRange(L"Bubble",NULL,L"Bubble"); } else if(icon < count + extra) { m_airIcon[icon].SetShow(TRUE); - m_airIcon[icon].PlayVisualRange(L"Pop",nullptr,L"Pop"); + m_airIcon[icon].PlayVisualRange(L"Pop",NULL,L"Pop"); } else m_airIcon[icon].SetShow(FALSE); } @@ -428,7 +428,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_DLCInstalled() { // mounted DLC may have changed bool bPauseMenuDisplayed=false; - bool bInGame=(Minecraft::GetInstance()->level!=nullptr); + bool bInGame=(Minecraft::GetInstance()->level!=NULL); // ignore this if we have menus up - they'll deal with it for(int i=0;i(pInitData->pvInitData); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + m_iPad = *(int *)pInitData->pvInitData; + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); MapChildControls(); XuiControlSetText(m_Buttons[BUTTON_HAO_CHANGESKIN],app.GetString(IDS_CHANGE_SKIN)); @@ -140,7 +140,7 @@ HRESULT CScene_HelpAndOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled /*HRESULT CScene_HelpAndOptions::OnTMSDLCFileRetrieved( ) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); m_Timer.SetShow(FALSE); m_bIgnoreInput=false; @@ -253,7 +253,7 @@ HRESULT CScene_HelpAndOptions::OnControlNavigate(XUIMessageControlNavigate *pCon { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -344,7 +344,7 @@ HRESULT CScene_HelpAndOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHa HRESULT CScene_HelpAndOptions::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { @@ -414,7 +414,7 @@ HRESULT CScene_HelpAndOptions::OnTransitionStart( XUIMessageTransition *pTransit // 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game) XUIRect xuiRect; - HXUIOBJ visual=nullptr; + HXUIOBJ visual=NULL; HXUIOBJ text; float fMaxTextLen=0.0f; float fTextVisualLen; diff --git a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp index 3c4e80a2..e7a8b0ca 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp @@ -91,9 +91,9 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiControlSetText(m_SouthPaw,app.GetString(IDS_SOUTHPAW)); XuiControlSetText(m_InvertLook,app.GetString(IDS_INVERT_LOOK)); - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bSplitscreen=(app.GetLocalPlayerCount()>1); m_iCurrentTextIndex=0; m_bCreativeMode = !bNotInGame && Minecraft::GetInstance()->localplayers[m_iPad] && Minecraft::GetInstance()->localplayers[m_iPad]->abilities.mayfly; @@ -159,20 +159,20 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) controlDetailsA[i].vPos.y/=2.0f; } m_FigA[i].SetShow(FALSE); - m_TextPresenterA[i] = nullptr; + m_TextPresenterA[i] = NULL; } // fill out the layouts list VOID *pObj; XuiObjectFromHandle( m_SchemeList, &pObj ); - m_pLayoutList = static_cast(pObj); + m_pLayoutList = (CXuiCtrl4JList *)pObj; CXuiCtrl4JList::LIST_ITEM_INFO ListInfo[3]; ZeroMemory(ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*3); for(int i=0;i<3;i++) { ListInfo[i].pwszText=m_LayoutNameA[i]; - ListInfo[i].hXuiBrush=nullptr; + ListInfo[i].hXuiBrush=NULL; ListInfo[i].fEnabled=TRUE; m_pLayoutList->AddData(ListInfo[i]); } @@ -325,9 +325,9 @@ void CScene_Controls::PositionText(int iPad,int iTextID, unsigned char ucAction) XuiElementGetScale(hFigGroup,&vScale); // check the width of the control with the text set in it - if(m_TextPresenterA[m_iCurrentTextIndex]==nullptr) + if(m_TextPresenterA[m_iCurrentTextIndex]==NULL) { - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]); } @@ -452,9 +452,9 @@ void CScene_Controls::PositionTextDirect(int iPad,int iTextID, int iControlDetai XuiElementGetScale(hFigGroup,&vScale); // check the width of the control with the text set in it - if(m_TextPresenterA[m_iCurrentTextIndex]==nullptr) + if(m_TextPresenterA[m_iCurrentTextIndex]==NULL) { - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]); } @@ -532,18 +532,18 @@ HRESULT CScene_Controls::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pN if ( hObjPressed == m_InvertLook.m_hObj ) { BOOL bIsChecked = m_InvertLook.IsChecked(); - app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,static_cast(bIsChecked) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,(unsigned char)( bIsChecked ) ); } else if ( hObjPressed == m_SouthPaw.m_hObj ) { BOOL bIsChecked = m_SouthPaw.IsChecked(); - app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,static_cast(bIsChecked) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,(unsigned char)( bIsChecked ) ); PositionAllText(m_iPad); } else if( hObjPressed == m_SchemeList) { // check what's been selected - app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast(m_SchemeList.GetCurSel())); + app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)m_SchemeList.GetCurSel()); LPWSTR layoutString = new wchar_t[ 128 ]; swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[m_SchemeList.GetCurSel()]) ); diff --git a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp index c0584e94..4a6ce55f 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp @@ -386,12 +386,12 @@ static const int gs_aNumTextElements[ eNumTextTypes ] = //---------------------------------------------------------------------------------- HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - int iPad = *static_cast(pInitData->pvInitData); + int iPad = *(int *)pInitData->pvInitData; MapChildControls(); // if we're not in the game, we need to use basescene 0 - if(Minecraft::GetInstance()->level==nullptr) + if(Minecraft::GetInstance()->level==NULL) { iPad=0; } @@ -441,7 +441,7 @@ HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) VOID* pTextObj; XuiObjectFromHandle( text, &pTextObj ); - m_aTextTypes[ i ].m_appTextElements[ j ] = static_cast(pTextObj); + m_aTextTypes[ i ].m_appTextElements[ j ] = (CXuiControl *)pTextObj; m_aTextTypes[ i ].m_appTextElements[ j ]->SetShow( false ); } } diff --git a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp index cd9e962d..5c750d03 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp @@ -39,12 +39,12 @@ static SHowToPlayPageDef gs_aPageDefs[ eHowToPlay_NumPages ] = HRESULT CScene_HowToPlay::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { // Extract pad and required page from init data. We just put the data into the pointer rather than using it as an address. - size_t uiInitData = static_cast(pInitData->pvInitData); + size_t uiInitData = ( size_t )( pInitData->pvInitData ); - m_iPad = static_cast((short)(uiInitData & 0xFFFF)); - EHowToPlayPage eStartPage = static_cast((uiInitData >> 16) & 0xFFF); // Ignores MSB which is set to 1! + m_iPad = ( int )( ( short )( uiInitData & 0xFFFF ) ); + EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1! - TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, static_cast(eStartPage)); + TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage); MapChildControls(); @@ -116,10 +116,10 @@ HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled case VK_PAD_A: { // Next page - int iNextPage = static_cast(m_eCurrPage) + 1; + int iNextPage = ( int )( m_eCurrPage ) + 1; if ( iNextPage != eHowToPlay_NumPages ) { - StartPage( static_cast(iNextPage) ); + StartPage( ( EHowToPlayPage )( iNextPage ) ); CXuiSceneBase::PlayUISFX(eSFX_Press); } rfHandled = TRUE; @@ -128,10 +128,10 @@ HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled case VK_PAD_X: { // Next page - int iPrevPage = static_cast(m_eCurrPage) - 1; + int iPrevPage = ( int )( m_eCurrPage ) - 1; if ( iPrevPage >= 0 ) { - StartPage( static_cast(iPrevPage) ); + StartPage( ( EHowToPlayPage )( iPrevPage ) ); CXuiSceneBase::PlayUISFX(eSFX_Press); } rfHandled = TRUE; @@ -146,7 +146,7 @@ void CScene_HowToPlay::StartPage( EHowToPlayPage ePage ) { int iBaseSceneUser; // if we're not in the game, we need to use basescene 0 - if(Minecraft::GetInstance()->level==nullptr) + if(Minecraft::GetInstance()->level==NULL) { iBaseSceneUser=DEFAULT_XUI_MENU_USER; } diff --git a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp index a99921e0..14046f20 100644 --- a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp @@ -65,11 +65,11 @@ unsigned int CScene_HowToPlayMenu::m_uiHTPSceneA[]= //---------------------------------------------------------------------------------- HRESULT CScene_HowToPlayMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bSplitscreen= app.GetLocalPlayerCount()>1; - m_ButtonList=nullptr; + m_ButtonList=NULL; //MapChildControls(); @@ -131,7 +131,7 @@ HRESULT CScene_HowToPlayMenu::OnGetSourceDataText(XUIMessageGetSourceText *pGetS { if( pGetSourceTextData->bItemData ) { - if( pGetSourceTextData->iItem < static_cast(eHTPButton_Max) ) + if( pGetSourceTextData->iItem < (int)eHTPButton_Max ) { pGetSourceTextData->szText = app.GetString(m_uiHTPButtonNameA[pGetSourceTextData->iItem]);//m_Buttons[pGetSourceTextData->iItem].GetText(); pGetSourceTextData->bDisplay = TRUE; @@ -173,7 +173,7 @@ HRESULT CScene_HowToPlayMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPres // 4J-PB - now using a list for all resolutions //if((!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) || app.GetLocalPlayerCount()>1) { - if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < static_cast(eHTPButton_Max)) ) + if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < (int)eHTPButton_Max) ) { uiButtonCounter=m_ButtonList.GetCurSel(); } @@ -186,7 +186,7 @@ HRESULT CScene_HowToPlayMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPres // Determine which button was pressed, // and call the appropriate function. - uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | static_cast(m_iPad) ); + uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | ( short )( m_iPad ) ); if(app.GetLocalPlayerCount()>1) { app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_HowToPlay, ( void* )( uiInitData ) ); diff --git a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp index 5030a792..f0561745 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp @@ -12,7 +12,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_InGameHostOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); @@ -76,9 +76,9 @@ HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& r { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != nullptr && player->connection) + if(player != NULL && player->connection) { - player->connection->send(std::make_shared(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions)); + player->connection->send( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) ); } } diff --git a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp index 35e08339..4839013c 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp @@ -25,7 +25,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { m_bIgnoreKeyPresses=true; - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); @@ -44,7 +44,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr ) + if( player != NULL ) { m_players[i] = player->GetSmallId(); ++m_playersCount; @@ -55,7 +55,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); m_isHostPlayer = false; - if(thisPlayer != nullptr) m_isHostPlayer = thisPlayer->IsHost() == TRUE; + if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE; Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[m_iPad]; @@ -140,9 +140,9 @@ HRESULT CScene_InGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle if(playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[playersList.GetCurSel()]); - if( player != nullptr ) + if( player != NULL ) { - PlayerUID xuid = static_cast(player)->GetUID(); + PlayerUID xuid = ((NetworkPlayerXbox *)player)->GetUID(); if( xuid != INVALID_XUID ) hr = XShowGamerCardUI(pInputData->UserIndex, xuid); } @@ -189,7 +189,7 @@ HRESULT CScene_InGameInfo::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; - if( isOp && selectedPlayer != nullptr && playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) ) + if( isOp && selectedPlayer != NULL && playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) ) { bool editingHost = selectedPlayer->IsHost(); if( (cheats && (m_isHostPlayer || !editingHost ) ) @@ -268,7 +268,7 @@ HRESULT CScene_InGameInfo::OnNotifySetFocus( HXUIOBJ hObjSource, XUINotifyFocus void CScene_InGameInfo::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - CScene_InGameInfo *scene = static_cast(callbackParam); + CScene_InGameInfo *scene = (CScene_InGameInfo *)callbackParam; bool playerFound = false; for(int i = 0; i < scene->m_playersCount; ++i) @@ -311,7 +311,7 @@ HRESULT CScene_InGameInfo::OnGetSourceDataText(XUIMessageGetSourceText *pGetSour if( pGetSourceTextData->iItem < m_playersCount ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[pGetSourceTextData->iItem] ); - if( player != nullptr ) + if( player != NULL ) { #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<HasVoice() ) + if(player != NULL && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { @@ -477,7 +477,7 @@ void CScene_InGameInfo::updateTooltips() { keyA = IDS_TOOLTIPS_SELECT; } - else if( selectedPlayer != nullptr) + else if( selectedPlayer != NULL) { bool editingHost = selectedPlayer->IsHost(); if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost)) @@ -499,7 +499,7 @@ void CScene_InGameInfo::updateTooltips() if(!m_gameOptionsButton.HasFocus()) { // if the player is me, then view gamer profile - if(selectedPlayer != nullptr && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad) + if(selectedPlayer != NULL && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad) { ikeyY = IDS_TOOLTIPS_VIEW_GAMERPROFILE; } @@ -520,16 +520,16 @@ HRESULT CScene_InGameInfo::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *static_cast(pParam); + BYTE smallId = *(BYTE *)pParam; delete pParam; if(result==C4JStorage::EMessage_ResultAccept) { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[iPad]; - if(localPlayer != nullptr && localPlayer->connection) + if(localPlayer != NULL && localPlayer->connection) { - localPlayer->connection->send(std::make_shared(smallId)); + localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } } diff --git a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp index 4ab2a54a..156cd092 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp @@ -16,9 +16,9 @@ //---------------------------------------------------------------------------------- HRESULT CScene_InGamePlayerOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; - InGamePlayerOptionsInitData *initData = static_cast(pInitData->pvInitData); + InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)pInitData->pvInitData; m_iPad = initData->iPad; m_networkSmallId = initData->networkSmallId; m_playerPrivileges = initData->playerPrivileges; @@ -32,14 +32,14 @@ HRESULT CScene_InGamePlayerOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHa INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(editingPlayer != nullptr) + if(editingPlayer != NULL) { m_Gamertag.SetText(editingPlayer->GetOnlineName()); } bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; - m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer); + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) { @@ -247,7 +247,7 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& else { INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) ) + if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) ) { Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked()); Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked()); @@ -278,9 +278,9 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != nullptr && player->connection) + if(player != NULL && player->connection) { - player->connection->send(std::make_shared(m_networkSmallId, -1, m_playerPrivileges)); + player->connection->send( shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); } } @@ -320,7 +320,7 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -330,16 +330,16 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *static_cast(pParam); + BYTE smallId = *(BYTE *)pParam; delete pParam; if(result==C4JStorage::EMessage_ResultAccept) { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[iPad]; - if(localPlayer != nullptr && localPlayer->connection) + if(localPlayer != NULL && localPlayer->connection) { - localPlayer->connection->send(std::make_shared(smallId)); + localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } // Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game. @@ -353,16 +353,16 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor void CScene_InGamePlayerOptions::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - CScene_InGamePlayerOptions *scene = static_cast(callbackParam); + CScene_InGamePlayerOptions *scene = (CScene_InGamePlayerOptions *)callbackParam; HXUIOBJ hBackScene = scene->GetBackScene(); CScene_InGameInfo* infoScene; VOID *pObj; XuiObjectFromHandle( hBackScene, &pObj ); - infoScene = static_cast(pObj); - if(infoScene != nullptr) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving); + infoScene = (CScene_InGameInfo *)pObj; + if(infoScene != NULL) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving); - if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId) + if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) { app.NavigateBack(scene->m_iPad); } @@ -373,59 +373,59 @@ HRESULT CScene_InGamePlayerOptions::OnTransitionStart( XUIMessageTransition *pTr if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) { INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(editingPlayer != nullptr) + if(editingPlayer != NULL) { short colourIndex = app.GetPlayerColour( m_networkSmallId ); switch(colourIndex) { case 1: - m_Icon.PlayVisualRange(L"P1",nullptr,L"P1"); + m_Icon.PlayVisualRange(L"P1",NULL,L"P1"); break; case 2: - m_Icon.PlayVisualRange(L"P2",nullptr,L"P2"); + m_Icon.PlayVisualRange(L"P2",NULL,L"P2"); break; case 3: - m_Icon.PlayVisualRange(L"P3",nullptr,L"P3"); + m_Icon.PlayVisualRange(L"P3",NULL,L"P3"); break; case 4: - m_Icon.PlayVisualRange(L"P4",nullptr,L"P4"); + m_Icon.PlayVisualRange(L"P4",NULL,L"P4"); break; case 5: - m_Icon.PlayVisualRange(L"P5",nullptr,L"P5"); + m_Icon.PlayVisualRange(L"P5",NULL,L"P5"); break; case 6: - m_Icon.PlayVisualRange(L"P6",nullptr,L"P6"); + m_Icon.PlayVisualRange(L"P6",NULL,L"P6"); break; case 7: - m_Icon.PlayVisualRange(L"P7",nullptr,L"P7"); + m_Icon.PlayVisualRange(L"P7",NULL,L"P7"); break; case 8: - m_Icon.PlayVisualRange(L"P8",nullptr,L"P8"); + m_Icon.PlayVisualRange(L"P8",NULL,L"P8"); break; case 9: - m_Icon.PlayVisualRange(L"P9",nullptr,L"P9"); + m_Icon.PlayVisualRange(L"P9",NULL,L"P9"); break; case 10: - m_Icon.PlayVisualRange(L"P10",nullptr,L"P10"); + m_Icon.PlayVisualRange(L"P10",NULL,L"P10"); break; case 11: - m_Icon.PlayVisualRange(L"P11",nullptr,L"P11"); + m_Icon.PlayVisualRange(L"P11",NULL,L"P11"); break; case 12: - m_Icon.PlayVisualRange(L"P12",nullptr,L"P12"); + m_Icon.PlayVisualRange(L"P12",NULL,L"P12"); break; case 13: - m_Icon.PlayVisualRange(L"P13",nullptr,L"P13"); + m_Icon.PlayVisualRange(L"P13",NULL,L"P13"); break; case 14: - m_Icon.PlayVisualRange(L"P14",nullptr,L"P14"); + m_Icon.PlayVisualRange(L"P14",NULL,L"P14"); break; case 15: - m_Icon.PlayVisualRange(L"P15",nullptr,L"P15"); + m_Icon.PlayVisualRange(L"P15",NULL,L"P15"); break; case 0: default: - m_Icon.PlayVisualRange(L"P0",nullptr,L"P0"); + m_Icon.PlayVisualRange(L"P0",NULL,L"P0"); break; }; } diff --git a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp index 7fde530b..428b3e88 100644 --- a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp @@ -33,9 +33,9 @@ LPCWSTR CScene_Leaderboards::m_TextColumnNameA[7]= // if the value is greater than 511, it's an xzp icon that needs displayed, rather than the game icon const int CScene_Leaderboards::TitleIcons[CScene_Leaderboards::NUM_LEADERBOARDS][7] = { - { XZP_ICON_WALKED, XZP_ICON_FALLEN, Item::minecart_Id, Item::boat_Id, nullptr }, + { XZP_ICON_WALKED, XZP_ICON_FALLEN, Item::minecart_Id, Item::boat_Id, NULL }, { Tile::dirt_Id, Tile::stoneBrick_Id, Tile::sand_Id, Tile::rock_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id }, - { Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, nullptr }, + { Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, NULL }, { XZP_ICON_ZOMBIE, XZP_ICON_SKELETON, XZP_ICON_CREEPER, XZP_ICON_SPIDER, XZP_ICON_SPIDERJOCKEY, XZP_ICON_ZOMBIEPIGMAN, XZP_ICON_SLIME }, }; @@ -43,44 +43,44 @@ const int CScene_Leaderboards::LEADERBOARD_HEADERS[CScene_Leaderboards::NUM_LEAD { SPASTRING_LB_TRAVELLING_PEACEFUL_NAME, SPASTRING_LB_TRAVELLING_EASY_NAME, SPASTRING_LB_TRAVELLING_NORMAL_NAME, SPASTRING_LB_TRAVELLING_HARD_NAME }, { SPASTRING_LB_MINING_BLOCKS_PEACEFUL_NAME, SPASTRING_LB_MINING_BLOCKS_EASY_NAME, SPASTRING_LB_MINING_BLOCKS_NORMAL_NAME, SPASTRING_LB_MINING_BLOCKS_HARD_NAME }, { SPASTRING_LB_FARMING_PEACEFUL_NAME, SPASTRING_LB_FARMING_EASY_NAME, SPASTRING_LB_FARMING_NORMAL_NAME, SPASTRING_LB_FARMING_HARD_NAME }, - { nullptr, SPASTRING_LB_KILLS_EASY_NAME, SPASTRING_LB_KILLS_NORMAL_NAME, SPASTRING_LB_KILLS_HARD_NAME }, + { NULL, SPASTRING_LB_KILLS_EASY_NAME, SPASTRING_LB_KILLS_NORMAL_NAME, SPASTRING_LB_KILLS_HARD_NAME }, }; const CScene_Leaderboards::LeaderboardDescriptor CScene_Leaderboards::LEADERBOARD_DESCRIPTORS[CScene_Leaderboards::NUM_LEADERBOARDS][4] = { { - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, nullptr, nullptr, nullptr,nullptr), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, nullptr, nullptr, nullptr,nullptr), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, nullptr, nullptr, nullptr,nullptr), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, nullptr, nullptr, nullptr,nullptr), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, NULL, NULL, NULL,NULL), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, NULL, NULL, NULL,NULL), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, NULL, NULL, NULL,NULL), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, NULL, NULL, NULL,NULL), }, { - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN,nullptr ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN,NULL ), }, { - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS, STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE, STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, nullptr,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, nullptr,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, nullptr,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, nullptr,nullptr ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS, STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE, STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, NULL,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, NULL,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, NULL,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, NULL,NULL ), }, { - CScene_Leaderboards::LeaderboardDescriptor( nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME,nullptr ), - CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME,nullptr ), + CScene_Leaderboards::LeaderboardDescriptor( NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME,NULL ), + CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME,NULL ), }, }; HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); m_bReady=false; // if we're not in the game, we need to use basescene 0 - if(Minecraft::GetInstance()->level==nullptr) + if(Minecraft::GetInstance()->level==NULL) { m_iPad=DEFAULT_XUI_MENU_USER; } @@ -90,9 +90,9 @@ HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled) ui.SetTooltips(m_iPad,-1, IDS_TOOLTIPS_BACK, IDS_TOOLTIPS_CHANGE_FILTER, -1); CXuiSceneBase::ShowLogo( m_iPad, FALSE ); - m_friends = nullptr; + m_friends = NULL; m_numFriends = 0; - m_filteredFriends = nullptr; + m_filteredFriends = NULL; m_numFilteredFriends = 0; m_newTop = m_newSel = -1; @@ -124,10 +124,10 @@ HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled) // title icons for(int i=0;i<7;i++) { - m_pHTitleIconSlots[i]=nullptr; + m_pHTitleIconSlots[i]=NULL; m_fTitleIconXPositions[i]=0.0f; m_fTextXPositions[i]=0.0f; - m_hTextEntryA[i]=nullptr; + m_hTextEntryA[i]=NULL; } @@ -143,13 +143,13 @@ void CScene_Leaderboards::Reposition(int iNumber) D3DXVECTOR3 vPos; fIconSize=(m_fTitleIconXPositions[6]-m_fTitleIconXPositions[0])/6.0f; - fNewIconIncrement=(fIconSize*7.0f)/static_cast(iNumber); + fNewIconIncrement=(fIconSize*7.0f)/(float)iNumber; // reposition the title icons based on the number there are for(int i=0;iGetPosition(&vPos); - vPos.x=m_fTitleIconXPositions[0]+(static_cast(i)*fNewIconIncrement)+(fNewIconIncrement-fIconSize)/2.0f; + vPos.x=m_fTitleIconXPositions[0]+(((float)i)*fNewIconIncrement)+(fNewIconIncrement-fIconSize)/2.0f; m_pHTitleIconSlots[i]->SetPosition(&vPos); } } @@ -161,14 +161,14 @@ void CScene_Leaderboards::RepositionText(int iNumber) D3DXVECTOR3 vPos; fTextSize=(m_fTextXPositions[6]-m_fTextXPositions[0])/6.0f; - fNewTextIncrement=(fTextSize*7.0f)/static_cast(iNumber); + fNewTextIncrement=(fTextSize*7.0f)/(float)iNumber; // reposition the title icons based on the number there are for(int i=0;i(i)*fNewTextIncrement); + vPos.x=m_fTextXPositions[0]+(((float)i)*fNewTextIncrement); XuiElementSetPosition(m_hTextEntryA[i],&vPos); // and change the size float fWidth,fHeight; @@ -190,10 +190,10 @@ HRESULT CScene_Leaderboards::OnDestroy() Sleep( 10 ); } - if( m_friends != nullptr ) + if( m_friends != NULL ) delete [] m_friends; - if( m_filteredFriends != nullptr ) + if( m_filteredFriends != NULL ) delete [] m_filteredFriends; return S_OK; @@ -222,7 +222,7 @@ void CScene_Leaderboards::UpdateTooltips() int iTooltipGamerCardOrProfile=-1; if( m_leaderboard.m_currentEntryCount > 0 ) { - unsigned int selection = static_cast(m_listGamers.GetCurSel()); + unsigned int selection = (unsigned int)m_listGamers.GetCurSel(); // if the selected user is me, don't show Send Friend Request, and show the gamer profile, not the gamer card @@ -368,7 +368,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl else { m_newTop = m_listGamers.GetTopItem() + 10; - if( m_newTop+10 > static_cast(m_leaderboard.m_totalEntryCount) ) + if( m_newTop+10 > (int)m_leaderboard.m_totalEntryCount ) { m_newTop = m_leaderboard.m_totalEntryCount - 10; if( m_newTop < 0 ) @@ -426,7 +426,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl //Show gamercard if( m_leaderboard.m_currentEntryCount > 0 ) { - unsigned int selection = static_cast(m_listGamers.GetCurSel()); + unsigned int selection = (unsigned int)m_listGamers.GetCurSel(); if( selection >= m_leaderboard.m_entryStartIndex-1 && selection < (m_leaderboard.m_entryStartIndex+m_leaderboard.m_currentEntryCount-1) ) { @@ -448,7 +448,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl { if( m_leaderboard.m_currentEntryCount > 0 ) { - unsigned int selection = static_cast(m_listGamers.GetCurSel()); + unsigned int selection = (unsigned int)m_listGamers.GetCurSel(); if( selection >= m_leaderboard.m_entryStartIndex-1 && selection < (m_leaderboard.m_entryStartIndex+m_leaderboard.m_currentEntryCount-1) ) { @@ -511,7 +511,7 @@ void CScene_Leaderboards::GetFriends() m_friends, resultsSize, &numFriends, - nullptr ); + NULL ); if( ret != ERROR_SUCCESS ) numFriends = 0; @@ -547,7 +547,7 @@ void CScene_Leaderboards::ReadStats(int startIndex) } else { - m_newEntryIndex = static_cast(startIndex); + m_newEntryIndex = (unsigned int)startIndex; m_newReadSize = min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); } @@ -574,20 +574,20 @@ void CScene_Leaderboards::ReadStats(int startIndex) { case LeaderboardManager::eFM_TopRank: LeaderboardManager::Instance()->ReadStats_TopRank( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, m_newEntryIndex, m_newReadSize ); break; case LeaderboardManager::eFM_MyScore: LeaderboardManager::Instance()->ReadStats_MyScore( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, INVALID_XUID/*ignored*/, m_newReadSize ); break; case LeaderboardManager::eFM_Friends: LeaderboardManager::Instance()->ReadStats_Friends( this, - m_currentDifficulty, static_cast(m_currentLeaderboard), + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, INVALID_XUID /*ignored*/, 0 /*ignored*/, 0 /*ignored*/ ); @@ -660,7 +660,7 @@ bool CScene_Leaderboards::RetrieveStats() else { m_leaderboard.m_entries[entryIndex].m_columns[i] = UINT_MAX; - swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", static_cast(m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); + swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", ((float)m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); } } @@ -675,7 +675,7 @@ bool CScene_Leaderboards::RetrieveStats() return true; } - //assert( LeaderboardManager::Instance()->GetStats() != nullptr ); + //assert( LeaderboardManager::Instance()->GetStats() != NULL ); //PXUSER_STATS_READ_RESULTS stats = LeaderboardManager::Instance()->GetStats(); //if( m_currentFilter == LeaderboardManager::eFM_Friends ) LeaderboardManager::Instance()->SortFriendStats(); @@ -822,7 +822,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo int readIndex = m_leaderboard.m_entryStartIndex - READ_SIZE; if( readIndex <= 0 ) readIndex = 1; - assert( readIndex >= 1 && readIndex <= static_cast(m_leaderboard.m_totalEntryCount)); + assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount ); ReadStats(readIndex); } } @@ -831,7 +831,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo if( LeaderboardManager::Instance()->isIdle() ) { int readIndex = m_leaderboard.m_entryStartIndex + m_leaderboard.m_currentEntryCount; - assert( readIndex >= 1 && readIndex <= static_cast(m_leaderboard.m_totalEntryCount)); + assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount ); ReadStats(readIndex); } } @@ -850,7 +850,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo } else if( pGetSourceTextData->iData >= 3 && pGetSourceTextData->iData <= 9 ) { - if( m_leaderboard.m_numColumns <= static_cast(pGetSourceTextData->iData - 3) ) + if( m_leaderboard.m_numColumns <= (unsigned int)(pGetSourceTextData->iData-3) ) pGetSourceTextData->szText = L""; else pGetSourceTextData->szText = m_leaderboard.m_entries[index].m_wcColumns[pGetSourceTextData->iData-3]; @@ -898,11 +898,11 @@ HRESULT CScene_Leaderboards::OnGetSourceDataImage(XUIMessageGetSourceImage* pGet void CScene_Leaderboards::PopulateLeaderboard(bool noResults) { HRESULT hr; - HXUIOBJ visual=nullptr; - HXUIOBJ hTemp=nullptr; + HXUIOBJ visual=NULL; + HXUIOBJ hTemp=NULL; hr=XuiControlGetVisual(m_listGamers.m_hObj,&visual); - if(m_pHTitleIconSlots[0]==nullptr) + if(m_pHTitleIconSlots[0]==NULL) { VOID *pObj; HXUIOBJ button; @@ -914,7 +914,7 @@ void CScene_Leaderboards::PopulateLeaderboard(bool noResults) hr=XuiElementGetChildById(visual,m_TitleIconNameA[i],&button); XuiObjectFromHandle( button, &pObj ); - m_pHTitleIconSlots[i] = static_cast(pObj); + m_pHTitleIconSlots[i] = (CXuiCtrlCraftIngredientSlot *)pObj; // store the default position, since we'll be repositioning these depending on how many are valid for each board m_pHTitleIconSlots[i]->GetPosition(&vPos); @@ -964,7 +964,7 @@ void CScene_Leaderboards::PopulateLeaderboard(bool noResults) // Really only the newly updated rows need changed, but this shouldn't cause any performance issues for(DWORD i = m_leaderboard.m_entryStartIndex - 1; i < (m_leaderboard.m_entryStartIndex - 1) + m_leaderboard.m_currentEntryCount; ++i) { - HXUIOBJ visual=nullptr; + HXUIOBJ visual=NULL; HXUIOBJ button; D3DXVECTOR3 vPos; // 4J-PB - fix for #13768 - Leaderboards: Player scores appear misaligned when viewed under the "My Score" leaderboard filter @@ -1088,24 +1088,24 @@ void CScene_Leaderboards::CopyLeaderboardEntry(PXUSER_STATS_ROW statsRow, Leader else if(iDigitC<8) { // km with a .X - swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", ((float)leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG - app.DebugPrintf("Display - %.1fkm\n", static_cast(leaderboardEntry->m_columns[i])/1000.f); + app.DebugPrintf("Display - %.1fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif } else { // bigger than that, so no decimal point - swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", ((float)leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG - app.DebugPrintf("Display - %.0fkm\n", static_cast(leaderboardEntry->m_columns[i])/1000.f); + app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif } } } //Is the player - if( statsRow->xuid == static_cast(LeaderboardManager::Instance())->GetMyXUID() ) + if( statsRow->xuid == ((XboxLeaderboardManager*)LeaderboardManager::Instance())->GetMyXUID() ) { leaderboardEntry->m_bPlayer = true; leaderboardEntry->m_bOnline = false; @@ -1150,7 +1150,7 @@ void CScene_Leaderboards::SetLeaderboardHeader() WCHAR buffer[40]; DWORD bufferLength = 40; - DWORD ret = XResourceGetString(LEADERBOARD_HEADERS[m_currentLeaderboard][m_currentDifficulty], buffer, &bufferLength, nullptr); + DWORD ret = XResourceGetString(LEADERBOARD_HEADERS[m_currentLeaderboard][m_currentDifficulty], buffer, &bufferLength, NULL); if( ret == ERROR_SUCCESS ) m_textLeaderboard.SetText(buffer); @@ -1184,8 +1184,8 @@ void CScene_Leaderboards::ClearLeaderboardTitlebar() m_pHTitleIconSlots[i]->SetShow(FALSE); } - HXUIOBJ visual=nullptr; - HXUIOBJ hTemp=nullptr; + HXUIOBJ visual=NULL; + HXUIOBJ hTemp=NULL; HRESULT hr; hr=XuiControlGetVisual(m_listGamers.m_hObj,&visual); diff --git a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp index e1295795..7f32ff89 100644 --- a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp @@ -42,14 +42,14 @@ int CScene_LoadGameSettings::m_iDifficultyTitleSettingA[4]= HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_hXuiBrush = nullptr; + m_hXuiBrush = NULL; m_bSetup = false; m_texturePackDescDisplayed = false; - m_iConfigA=nullptr; + m_iConfigA=NULL; WCHAR TempString[256]; - m_params = static_cast(pInitData->pvInitData); + m_params = (LoadMenuInitData *)pInitData->pvInitData; m_MoreOptionsParams.bGenerateOptions=FALSE; m_MoreOptionsParams.bPVP = TRUE; @@ -146,7 +146,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl else { // set the save icon - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; DWORD dwImageBytes=0; StorageManager.GetSaveCacheFileInfo(m_params->iSaveGameInfoIndex,m_XContentData); @@ -156,13 +156,13 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save bool bHostOptionsRead = false; unsigned int uiHostOptions = 0; - if(pbImageData==nullptr) + if(pbImageData==NULL) { - DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,nullptr,&dwImageBytes,nullptr); + DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,NULL,&dwImageBytes,NULL); if(dwResult==ERROR_SUCCESS) { pbImageData = new BYTE[dwImageBytes]; - XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,pbImageData,&dwImageBytes,nullptr); + XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,pbImageData,&dwImageBytes,NULL); XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hXuiBrush); } } @@ -175,9 +175,9 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // #ifdef _DEBUG // // dump out the thumbnail -// HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); +// HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); // DWORD dwBytes; -// WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,nullptr); +// WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,NULL); // XCloseHandle(hThumbnail); // #endif @@ -276,7 +276,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl if(dwImageBytes > 0 && pbImageData) { ListInfo.fEnabled = TRUE; - DLCTexturePack *pDLCTexPack=static_cast(tp); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -310,7 +310,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -376,7 +376,7 @@ HRESULT CScene_LoadGameSettings::OnControlNavigate(XUIMessageControlNavigate *pC { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -411,7 +411,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void) // inform them that leaderboard writes and achievements will be disabled //StorageManager.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::ConfirmLoadReturned,this,app.GetStringTable()); - if(m_levelGen != nullptr) + if(m_levelGen != NULL) { LoadLevelGen(m_levelGen); } @@ -445,7 +445,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void) } else { - if(m_levelGen != nullptr) + if(m_levelGen != NULL) { LoadLevelGen(m_levelGen); } @@ -469,7 +469,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void) int CScene_LoadGameSettings::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -503,7 +503,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack==nullptr) + if(pTexturePack==NULL) { // They've selected a texture pack they don't have yet // upsell @@ -572,7 +572,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack==nullptr) + if(pTexturePack==NULL) { // DLC corrupt, so use the default textures m_MoreOptionsParams.dwTexturePack=0; @@ -600,7 +600,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -703,11 +703,11 @@ HRESULT CScene_LoadGameSettings::OnFontRendererChange() int CScene_LoadGameSettings::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { - if(pClass->m_levelGen != nullptr) + if(pClass->m_levelGen != NULL) { pClass->LoadLevelGen(pClass->m_levelGen); } @@ -784,14 +784,14 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle if(m_iConfigA[i]!=-1) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)); if(dwBytes > 0 && pbData) { DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -840,7 +840,7 @@ int CScene_LoadGameSettings::Progress(void *pParam,float fProgress) int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; if(bContinue==true) { @@ -868,7 +868,7 @@ int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue) pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -903,7 +903,7 @@ int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue) int CScene_LoadGameSettings::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -921,7 +921,7 @@ int CScene_LoadGameSettings::DeleteSaveDialogReturned(void *pParam,int iPad,C4JS int CScene_LoadGameSettings::DeleteSaveDataReturned(void *pParam,bool bSuccess) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; app.SetCorruptSaveDeleted(true); app.NavigateBack(pClass->m_iPad); @@ -951,7 +951,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -983,7 +983,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave timer app.SetAutosaveTimerTime(); @@ -1000,7 +1000,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - CScene_LoadGameSettings* pClass = static_cast(pParam); + CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; if(bContinue==true) { @@ -1036,7 +1036,7 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu //pClass->m_bAbortSearch=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -1045,7 +1045,7 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu //pClass->m_bAbortSearch=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } } else @@ -1082,7 +1082,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINo if(hObjSource==m_SliderDifficulty.GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); + swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); m_SliderDifficulty.SetText(TempString); } return S_OK; @@ -1150,7 +1150,7 @@ HRESULT CScene_LoadGameSettings::OnTransitionEnd( XUIMessageTransition *pTransit int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pScene = static_cast(pParam); + CScene_LoadGameSettings* pScene = (CScene_LoadGameSettings*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -1159,7 +1159,7 @@ int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4J ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -1168,7 +1168,7 @@ int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4J ullIndexA[0]=pScene->m_pDLCPack->getPurchaseOfferId(); } - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -1238,11 +1238,11 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) int iTexPackId=m_pTexturePacksList->GetData(index).iData; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId); - if(tp==nullptr) + if(tp==NULL) { // this is probably a texture pack icon added from TMS DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=nullptr,pbFileData=nullptr; + PBYTE pbData=NULL,pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -1272,7 +1272,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); } } else @@ -1290,7 +1290,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) } else { - m_texturePackIcon->UseBrush(nullptr); + m_texturePackIcon->UseBrush(NULL); } pbImageData = tp->getPackComparison(dwImageBytes); @@ -1302,7 +1302,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); } } } @@ -1311,8 +1311,8 @@ void CScene_LoadGameSettings::ClearTexturePackDescription() { m_texturePackTitle.SetText(L" "); m_texturePackDescription.SetText(L" "); - m_texturePackComparison->UseBrush(nullptr); - m_texturePackIcon->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); + m_texturePackIcon->UseBrush(NULL); } void CScene_LoadGameSettings::UpdateCurrentTexturePack() @@ -1322,7 +1322,7 @@ void CScene_LoadGameSettings::UpdateCurrentTexturePack() TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId); // if the texture pack is null, you don't have it yet - if(tp==nullptr) + if(tp==NULL) { // Upsell @@ -1416,7 +1416,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); return; } } @@ -1438,7 +1438,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->levelGen = levelGen; if(levelGen->requiresTexturePack()) @@ -1482,7 +1482,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave timer app.SetAutosaveTimerTime(); @@ -1540,7 +1540,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() ListInfo.fEnabled = TRUE; hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); - DLCTexturePack *pDLCTexPack=static_cast(tp); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -1566,7 +1566,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() m_iTexturePacksNotInstalled=0; // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -1599,7 +1599,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() // add a TMS request for them app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n"); app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData); - if(m_iConfigA!=nullptr) + if(m_iConfigA!=NULL) { delete m_iConfigA; } @@ -1635,7 +1635,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings *pClass = static_cast(pParam); + CScene_LoadGameSettings *pClass = (CScene_LoadGameSettings *)pParam; #ifdef _XBOX pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel(); // Exit with or without saving @@ -1655,7 +1655,7 @@ int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4J if( result==C4JStorage::EMessage_ResultAccept ) // Full version { ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } else // trial version @@ -1665,7 +1665,7 @@ int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4J if(pDLCInfo->ullOfferID_Trial!=0LL) { ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } } diff --git a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp index 4126c559..7b9c1a56 100644 --- a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp @@ -72,7 +72,7 @@ HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) WCHAR szResourceLocator[ LOCATOR_SIZE ]; // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/splashes.txt"); BYTE *splashesData; @@ -119,7 +119,7 @@ HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_bIgnorePress=false; // 4J Stu - Clear out any loaded game rules - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); @@ -325,7 +325,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) { // 4J-PB - remove the "hobo humping" message legal (Sony) say we can't have - pretty sure Microsoft would say the same if they noticed it. - int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast(m_splashes.size()) - (eSplashRandomStart + 1) ); + int splashIndex = eSplashRandomStart + 1 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 1) ); // Override splash text on certain dates SYSTEMTIME LocalSysTime; @@ -359,7 +359,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& HRESULT hr=S_OK; float fWidth,fHeight; - HXUIOBJ visual=nullptr; + HXUIOBJ visual=NULL; HXUIOBJ pulser, subtitle, text; hr=XuiControlGetVisual(m_Subtitle.m_hObj,&visual); hr=XuiElementGetChildById(visual,L"Pulser",&pulser); @@ -436,7 +436,7 @@ HRESULT CScene_Main::OnControlNavigate(XUIMessageControlNavigate *pControlNaviga // added so we can skip greyed out items for Minecon pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -457,7 +457,7 @@ HRESULT CScene_Main::OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) int CScene_Main::SignInReturned(void *pParam,bool bContinue) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(bContinue==true) { @@ -470,7 +470,7 @@ int CScene_Main::SignInReturned(void *pParam,bool bContinue) int CScene_Main::DeviceSelectReturned(void *pParam,bool bContinue) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; //HRESULT hr; if(bContinue==true) @@ -506,7 +506,7 @@ int CScene_Main::DeviceSelectReturned(void *pParam,bool bContinue) int CScene_Main::CreateLoad_OfflineProfileReturned(void *pParam,bool bContinue, int iPad) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(bContinue==true) { @@ -555,7 +555,7 @@ int CScene_Main::CreateLoad_OfflineProfileReturned(void *pParam,bool bContinue, int CScene_Main::CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(bContinue==true) { @@ -662,7 +662,7 @@ int CScene_Main::CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad int CScene_Main::MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -787,7 +787,7 @@ int CScene_Main::Achievements_SignInReturned(void *pParam,bool bContinue,int iPa } int CScene_Main::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(bContinue==true) { @@ -834,7 +834,7 @@ int CScene_Main::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int i int CScene_Main::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; if(bContinue==true) { @@ -907,7 +907,7 @@ void CScene_Main::LoadTrial(void) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ); vector *generators = app.getLevelGenerators(); @@ -915,7 +915,7 @@ void CScene_Main::LoadTrial(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1228,7 +1228,7 @@ void CScene_Main::RunUnlockOrDLC(int iPad) int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILE_LIST pTmsFileList) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) @@ -1240,7 +1240,7 @@ int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSP int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) @@ -1252,7 +1252,7 @@ int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult) int CScene_Main::TMSFileReadReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILEDATA pData) { - CScene_Main* pClass = static_cast(pParam); + CScene_Main* pClass = (CScene_Main*)pParam; // push the file details in to a unordered map if they are not already in there // for(int i=0;iiCount;i++) diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp index b73f9305..b949aafa 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp @@ -38,7 +38,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle { m_bSetup = false; m_texturePackDescDisplayed = false; - m_iConfigA=nullptr; + m_iConfigA=NULL; WCHAR TempString[256]; MapChildControls(); @@ -52,7 +52,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle XuiControlSetText(m_labelRandomSeed,app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED)); XuiControlSetText(m_pTexturePacksList->m_hObj,app.GetString(IDS_DLC_MENU_TEXTUREPACKS)); - CreateWorldMenuInitData *params = static_cast(pInitData->pvInitData); + CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData; m_MoreOptionsParams.bGenerateOptions=TRUE; m_MoreOptionsParams.bStructures=TRUE; @@ -139,7 +139,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle wstring wWorldName = m_EditWorldName.GetText(); // set the caret to the end of the default text - m_EditWorldName.SetCaretPosition(static_cast(wWorldName.length())); + m_EditWorldName.SetCaretPosition((int)wWorldName.length()); // In the dashboard, there's room for about 30 W characters on two lines before they go over the top of things m_EditWorldName.SetTextLimit(25); @@ -189,8 +189,8 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle if(dwImageBytes > 0 && pbImageData) { - ListInfo.fEnabled = true; - DLCTexturePack *pDLCTexPack=static_cast(tp); + ListInfo.fEnabled = TRUE; + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -222,7 +222,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -322,7 +322,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack==nullptr) + if(pTexturePack==NULL) { // They've selected a texture pack they don't have yet // upsell @@ -391,7 +391,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr // texture pack hasn't been set yet, so check what it will be TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); - if(pTexturePack== nullptr) + if(pTexturePack==NULL) { // corrupt DLC so set it to the default textures m_MoreOptionsParams.dwTexturePack=0; @@ -419,7 +419,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -485,7 +485,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr SetShow( TRUE ); UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -522,7 +522,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameCreate* pScene = static_cast(pParam); + CScene_MultiGameCreate* pScene = (CScene_MultiGameCreate*)pParam; #ifdef _XBOX if(result==C4JStorage::EMessage_ResultAccept) { @@ -531,7 +531,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -540,7 +540,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS ullIndexA[0]=pScene->m_pDLCPack->getPurchaseOfferId(); } - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -558,7 +558,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameCreate* pScene = static_cast(pParam); + CScene_MultiGameCreate* pScene = (CScene_MultiGameCreate*)pParam; pScene->m_bIgnoreInput = false; pScene->SetShow( TRUE ); bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pScene->m_MoreOptionsParams.bOnlineGame; @@ -588,7 +588,7 @@ int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPa { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -634,7 +634,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot else if(hObjSource==m_SliderDifficulty.GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue])); + swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue])); m_SliderDifficulty.SetText(TempString); } @@ -645,7 +645,7 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest==nullptr) + if(pControlNavigateData->hObjDest==NULL) { pControlNavigateData->hObjDest=pControlNavigateData->hObjSource; } @@ -706,7 +706,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled if(m_iConfigA[i]!=-1) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); @@ -715,7 +715,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled if(dwBytes > 0 && pbData) { DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -754,7 +754,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameCreate* pClass = static_cast(pParam); + CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam; if(result==C4JStorage::EMessage_ResultAccept) { @@ -787,7 +787,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora pClass->SetShow( TRUE ); UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -808,7 +808,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - CScene_MultiGameCreate* pClass = static_cast(pParam); + CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam; if(bContinue==true) { @@ -844,7 +844,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue pClass->SetShow( TRUE ); UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -852,7 +852,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue pClass->SetShow( TRUE ); UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } } else @@ -889,7 +889,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw // Make our next save default to the name of the level StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str()); - BOOL bHasSeed = (pClass->m_EditSeed.GetText() != nullptr); + BOOL bHasSeed = (pClass->m_EditSeed.GetText() != NULL); wstring wSeed; if(bHasSeed) @@ -909,7 +909,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw if (wSeed.length() != 0) { int64_t value = 0; - const unsigned int len = static_cast(wSeed.length()); + unsigned int len = (unsigned int)wSeed.length(); //Check if the input string contains a numerical value bool isNumber = true; @@ -946,7 +946,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -979,7 +979,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1095,12 +1095,12 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) int iTexPackId=m_pTexturePacksList->GetData(index).iData; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId); - if(tp==nullptr) + if(tp==NULL) { // this is probably a texture pack icon added from TMS DWORD dwBytes=0,dwFileBytes=0; - PBYTE pbData=nullptr,pbFileData=nullptr; + PBYTE pbData=NULL,pbFileData=NULL; CXuiCtrl4JList::LIST_ITEM_INFO ListItem; // get the current index of the list, and then get the data @@ -1130,7 +1130,7 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); } } else @@ -1156,7 +1156,7 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); } } } @@ -1168,7 +1168,7 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack() TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId); // if the texture pack is null, you don't have it yet - if(tp==nullptr) + if(tp==NULL) { // Upsell @@ -1217,7 +1217,7 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack() int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameCreate *pClass = static_cast(pParam); + CScene_MultiGameCreate *pClass = (CScene_MultiGameCreate *)pParam; pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel(); // Exit with or without saving // Decline means install full version of the texture pack in this dialog @@ -1236,7 +1236,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS if( result==C4JStorage::EMessage_ResultAccept ) // Full version { ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } else // trial version @@ -1246,7 +1246,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS if(pDLCInfo->ullOfferID_Trial!=0LL) { ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } } @@ -1295,7 +1295,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() ListInfo.fEnabled = TRUE; hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); - DLCTexturePack *pDLCTexPack=static_cast(tp); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -1319,7 +1319,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this // REMOVE UNTIL WORKING - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -1352,7 +1352,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() // add a TMS request for them app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n"); app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData); - if(m_iConfigA!=nullptr) + if(m_iConfigA!=NULL) { delete m_iConfigA; } @@ -1392,6 +1392,6 @@ void CScene_MultiGameCreate::ClearTexturePackDescription() { m_texturePackTitle.SetText(L" "); m_texturePackDescription.SetText(L" "); - m_texturePackComparison->UseBrush(nullptr); - m_texturePackIcon->UseBrush(nullptr); + m_texturePackComparison->UseBrush(NULL); + m_texturePackIcon->UseBrush(NULL); } \ No newline at end of file diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp index c1dba282..bbfa243b 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp @@ -31,7 +31,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled XuiControlSetText(m_labelTNTOn,app.GetString(IDS_LABEL_TNT)); XuiControlSetText(m_labelFireOn,app.GetString(IDS_LABEL_FIRE_SPREADS)); - JoinMenuInitData *initData = static_cast(pInitData->pvInitData); + JoinMenuInitData *initData = (JoinMenuInitData *)pInitData->pvInitData; m_selectedSession = initData->selectedSession; m_iPad = initData->iPad; // 4J-PB - don't delete this - it's part of the joinload structure @@ -39,7 +39,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if( m_selectedSession->data.players[i] != nullptr ) + if( m_selectedSession->data.players[i] != NULL ) { playersList.InsertItems(i,1); #ifndef _CONTENT_PACKAGE @@ -55,7 +55,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled } else { - // Leave the loop when we hit the first nullptr player + // Leave the loop when we hit the first NULL player break; } } @@ -185,7 +185,7 @@ HRESULT CScene_MultiGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHan rfHandled = TRUE; break; case VK_PAD_Y: - if(m_selectedSession != nullptr && playersList.TreeHasFocus() && playersList.GetItemCount() > 0) + if(m_selectedSession != NULL && playersList.TreeHasFocus() && playersList.GetItemCount() > 0) { PlayerUID xuid = m_selectedSession->data.players[playersList.GetCurSel()]; if( xuid != INVALID_XUID ) @@ -237,7 +237,7 @@ HRESULT CScene_MultiGameInfo::OnNotifyKillFocus(HXUIOBJ hObjSource, XUINotifyFoc int CScene_MultiGameInfo::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - CScene_MultiGameInfo* pClass = static_cast(pParam); + CScene_MultiGameInfo* pClass = (CScene_MultiGameInfo*)pParam; if(bContinue==true) { @@ -302,7 +302,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; if(dwSignedInUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; - StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, messageText, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, messageText, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else if(noPrivileges) @@ -311,7 +311,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); } else { @@ -338,7 +338,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); exitReasonStringId = -1; app.NavigateToHomeMenu(); @@ -361,7 +361,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) int selectedIndex = 0; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { - if( m_selectedSession->data.players[i] != nullptr ) + if( m_selectedSession->data.players[i] != NULL ) { if(m_selectedSession->data.players[i] == selectedPlayerXUID) selectedIndex = i; playersList.InsertItems(i,1); @@ -378,7 +378,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) } else { - // Leave the loop when we hit the first nullptr player + // Leave the loop when we hit the first NULL player break; } } diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp index fab4a4fd..5894519d 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -36,12 +36,12 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; m_bReady=false; MapChildControls(); m_iTexturePacksNotInstalled=0; - m_iConfigA=nullptr; + m_iConfigA=NULL; XuiControlSetText(m_LabelNoGames,app.GetString(IDS_NO_GAMES_FOUND)); XuiControlSetText(m_GamesList,app.GetString(IDS_JOIN_GAME)); @@ -51,7 +51,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); m_DefaultMinecraftIconSize = 0; @@ -95,10 +95,10 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand VOID *pObj; XuiObjectFromHandle( m_SavesList, &pObj ); - m_pSavesList = static_cast(pObj); + m_pSavesList = (CXuiCtrl4JList *)pObj; XuiObjectFromHandle( m_GamesList, &pObj ); - m_pGamesList = static_cast(pObj); + m_pGamesList = (CXuiCtrl4JList *)pObj; // block input if we're waiting for DLC to install, and wipe the saves list. The end of dlc mounting custom message will fill the list again if(app.StartInstallDLCProcess(m_iPad)==true) @@ -185,7 +185,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - DLC_INFO *pDLCInfo=nullptr; + DLC_INFO *pDLCInfo=NULL; // first pass - look to see if there are any that are not in the list bool bTexturePackAlreadyListed; @@ -326,7 +326,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( ) if( savesDir.exists() ) { m_saves = savesDir.listFiles(); - uiSaveC = static_cast(m_saves->size()); + uiSaveC = (unsigned int)m_saves->size(); } // add the New Game and Tutorial after the saves list is retrieved, if there are any saves @@ -384,7 +384,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( ) HRESULT CScene_MultiGameJoinLoad::OnDestroy() { - g_NetworkManager.SetSessionsUpdatedCallback( nullptr, nullptr ); + g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL ); for (auto& it : currentSessions ) { @@ -415,7 +415,7 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy() int CScene_MultiGameJoinLoad::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -543,7 +543,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify CreateWorldMenuInitData *params = new CreateWorldMenuInitData(); params->iPad = m_iPad; - app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_CreateWorldMenu,static_cast(params)); + app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_CreateWorldMenu,(void *)params); } else if(info.iData >= 0) { @@ -594,7 +594,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify // need to get the iIndex from the list item, since the position in the list doesn't correspond to the GetSaveGameInfo list because of sorting params->iSaveGameInfoIndex=m_pSavesList->GetData(iIndex).iIndex-m_iDefaultButtonsC; //params->pbSaveRenamed=&m_bSaveRenamed; - params->levelGen = nullptr; + params->levelGen = NULL; // kill the texture pack timer XuiKillTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID); @@ -1050,7 +1050,7 @@ bool CScene_MultiGameJoinLoad::DoesSavesListHaveFocus() { HXUIOBJ hParentObj,hObj=TreeGetFocus(); - if(hObj!=nullptr) + if(hObj!=NULL) { // get the parent and see if it's the saves list XuiElementGetParent(hObj,&hParentObj); @@ -1070,7 +1070,7 @@ bool CScene_MultiGameJoinLoad::DoesMashUpWorldHaveFocus() { HXUIOBJ hParentObj,hObj=TreeGetFocus(); - if(hObj!=nullptr) + if(hObj!=NULL) { // get the parent and see if it's the saves list XuiElementGetParent(hObj,&hParentObj); @@ -1097,7 +1097,7 @@ bool CScene_MultiGameJoinLoad::DoesGamesListHaveFocus() { HXUIOBJ hParentObj,hObj=TreeGetFocus(); - if(hObj!=nullptr) + if(hObj!=NULL) { // get the parent and see if it's the saves list XuiElementGetParent(hObj,&hParentObj); @@ -1111,9 +1111,9 @@ bool CScene_MultiGameJoinLoad::DoesGamesListHaveFocus() void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam) { - if(lpParam != nullptr) + if(lpParam != NULL) { - CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; // check this there's no save transfer in progress if(!pClass->m_bSaveTransferInProgress) { @@ -1133,7 +1133,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() } DWORD nIndex = -1; - FriendSessionInfo *pSelectedSession = nullptr; + FriendSessionInfo *pSelectedSession = NULL; if(m_pGamesList->TreeHasFocus() && m_pGamesList->GetItemCount() > 0) { nIndex = m_pGamesList->GetCurSel(); @@ -1141,8 +1141,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() } SessionID selectedSessionId; - if( pSelectedSession != nullptr )selectedSessionId = pSelectedSession->sessionId; - pSelectedSession = nullptr; + if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId; + pSelectedSession = NULL; for (auto& it : currentSessions ) { @@ -1213,7 +1213,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() // Update the xui list displayed unsigned int xuiListSize = m_pGamesList->GetItemCount(); - unsigned int filteredListSize = static_cast(currentSessions.size()); + unsigned int filteredListSize = (unsigned int)currentSessions.size(); BOOL gamesListHasFocus = m_pGamesList->TreeHasFocus(); @@ -1269,12 +1269,12 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() HRESULT hr; DWORD dwImageBytes=0; - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; - if(tp==nullptr) + if(tp==NULL) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes); // is it in the tpd data ? @@ -1386,7 +1386,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear if(pSearchResult->dwOpenPublicSlots < m_localPlayers) continue; - FriendSessionInfo *sessionInfo = nullptr; + FriendSessionInfo *sessionInfo = NULL; bool foundSession = false; for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it) { @@ -1481,8 +1481,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear XUIRect xuiRect; HXUIOBJ item = XuiListGetItemControl(m_GamesList,0); - HXUIOBJ hObj=nullptr; - HXUIOBJ hTextPres=nullptr; + HXUIOBJ hObj=NULL; + HXUIOBJ hTextPres=NULL; HRESULT hr=XuiControlGetVisual(item,&hObj); hr=XuiElementGetChildById(hObj,L"text_Label",&hTextPres); @@ -1491,7 +1491,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear { FriendSessionInfo *sessionInfo = currentSessions.at(i); - if(hTextPres != nullptr ) + if(hTextPres != NULL ) { hr=XuiTextPresenterMeasureText(hTextPres, sessionInfo->displayLabel, &xuiRect); @@ -1528,7 +1528,7 @@ void CScene_MultiGameJoinLoad::SearchForGameCallback(void *param, DWORD dwNumRes int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; //HRESULT hr; if(bContinue==true) @@ -1741,7 +1741,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl if(m_iConfigA[i]!=-1) { DWORD dwBytes=0; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; //app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]); app.GetTPD(m_iConfigA[i],&pbData,&dwBytes); @@ -1814,7 +1814,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue) int CScene_MultiGameJoinLoad::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; if(bContinue==true) { @@ -1852,7 +1852,7 @@ void CScene_MultiGameJoinLoad::StartGameFromSave(CScene_MultiGameJoinLoad* pClas LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = nullptr; + loadingParams->lpParam = NULL; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1866,7 +1866,7 @@ void CScene_MultiGameJoinLoad::StartGameFromSave(CScene_MultiGameJoinLoad* pClas int CScene_MultiGameJoinLoad::DeleteSaveDataReturned(void *pParam,bool bSuccess) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; if(bSuccess==true) { @@ -1909,7 +1909,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = nullptr; + param->saveData = NULL; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ); param->levelGen = levelGen; @@ -1924,7 +1924,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1974,7 +1974,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1988,7 +1988,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile) int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) { @@ -2013,7 +2013,7 @@ int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4J int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog if(result==C4JStorage::EMessage_ResultAccept) { @@ -2039,7 +2039,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter ) { - CScene_MultiGameJoinLoad* pClass = static_cast(lpParameter); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParameter; Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE); @@ -2083,7 +2083,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter { // set the save icon - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; DWORD dwImageBytes=0; XCONTENT_DATA XContentData; int iIndex=pClass->m_pSavesList->GetData(pClass->m_pSavesList->GetCurSel()).iIndex-pClass->m_iDefaultButtonsC; @@ -2092,14 +2092,14 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter // if there is no thumbnail, retrieve the default one from the file. // Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save - if(pbImageData==nullptr) + if(pbImageData==NULL) { - DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,nullptr,&dwImageBytes,nullptr); + DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,NULL,&dwImageBytes,NULL); if(dwResult==ERROR_SUCCESS) { pClass->m_pbSaveTransferData = new BYTE[dwImageBytes]; pbImageData = pClass->m_pbSaveTransferData; // Copy pointer so that we can use the same name as the library owned one, but m_pbSaveTransferData will get deleted when done - XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,nullptr); + XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,NULL); } } @@ -2159,7 +2159,7 @@ void CScene_MultiGameJoinLoad::DeleteFile(CScene_MultiGameJoinLoad *pClass, char C4JStorage::TMS_FILETYPE_BINARY, &CScene_MultiGameJoinLoad::DeleteComplete, pClass, - nullptr); + NULL); if(result != C4JStorage::ETMSStatus_DeleteInProgress) { @@ -2178,7 +2178,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char C4JStorage::TMS_FILETYPE_BINARY, C4JStorage::TMS_UGCTYPE_NONE, filename, - static_cast(data), + (CHAR *)data, size, &CScene_MultiGameJoinLoad::TransferComplete,pClass, 0, &CScene_MultiGameJoinLoad::Progress,pClass); @@ -2189,10 +2189,10 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char File targetFileDir(L"GAME:\\FakeTMSPP"); if(!targetFileDir.exists()) targetFileDir.mkdir(); string path = string( wstringtofilename( targetFileDir.getPath() ) ).append("\\").append(filename); - HANDLE hSaveFile = CreateFile( path.c_str(), GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); + HANDLE hSaveFile = CreateFile( path.c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); DWORD numberOfBytesWritten = 0; - WriteFile( hSaveFile,data,size,&numberOfBytesWritten,nullptr); + WriteFile( hSaveFile,data,size,&numberOfBytesWritten,NULL); assert(numberOfBytesWritten == size); CloseHandle(hSaveFile); @@ -2219,7 +2219,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad } Sleep(50); // update the progress - pMinecraft->progressRenderer->progressStagePercentage(static_cast(pClass->m_fProgress * 100.0f)); + pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f)); } // was there a transfer error? @@ -2229,7 +2229,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog // EMessage_ResultAccept means cancel @@ -2261,7 +2261,7 @@ int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4 int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; if(bContinue==true) { @@ -2310,7 +2310,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue) int CScene_MultiGameJoinLoad::Progress(void *pParam,float fProgress) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; app.DebugPrintf("Progress - %f\n",fProgress); pClass->m_fProgress=fProgress; @@ -2319,17 +2319,17 @@ int CScene_MultiGameJoinLoad::Progress(void *pParam,float fProgress) int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResult) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; delete [] pClass->m_pbSaveTransferData; - pClass->m_pbSaveTransferData = nullptr; + pClass->m_pbSaveTransferData = NULL; if(iResult!=0) { // There was a transfer fail // Display a dialog UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,nullptr,app.GetStringTable()); + StorageManager.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL,app.GetStringTable()); pClass->m_bTransferFail=true; } else @@ -2343,14 +2343,14 @@ int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResul int CScene_MultiGameJoinLoad::DeleteComplete(void *pParam,int iPad, int iResult) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; pClass->m_bTransferComplete=true; return 0; } int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; HRESULT hr = S_OK; // if the user has left the name empty, treat this as backing out @@ -2386,12 +2386,12 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bContinue) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; #ifdef _XBOX if(bContinue==true) { // set the save icon - PBYTE pbImageData=nullptr; + PBYTE pbImageData=NULL; DWORD dwImageBytes=0; HXUIBRUSH hXuiBrush; XCONTENT_DATA XContentData; @@ -2400,13 +2400,13 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC // if there is no thumbnail, retrieve the default one from the file. // Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save - if(pbImageData==nullptr) + if(pbImageData==NULL) { - DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,nullptr,&dwImageBytes,nullptr); + DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,NULL,&dwImageBytes,NULL); if(dwResult==ERROR_SUCCESS) { pbImageData = new BYTE[dwImageBytes]; - XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,nullptr); + XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,NULL); XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); } } @@ -2428,7 +2428,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC int CScene_MultiGameJoinLoad::CopySaveReturned(void *pParam,bool bResult) { - CScene_MultiGameJoinLoad* pClass = static_cast(pParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; #ifdef _XBOX if(bResult) { @@ -2450,7 +2450,7 @@ int CScene_MultiGameJoinLoad::CopySaveReturned(void *pParam,bool bResult) int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad *pClass = static_cast(pParam); + CScene_MultiGameJoinLoad *pClass = (CScene_MultiGameJoinLoad *)pParam; // Exit with or without saving // Decline means install full version of the texture pack in this dialog @@ -2466,7 +2466,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4 if( result==C4JStorage::EMessage_ResultAccept ) // Full version { ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } else // trial version @@ -2476,7 +2476,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4 if(pDLCInfo->ullOfferID_Trial!=0LL) { ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } } @@ -2510,7 +2510,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete() VOID *pObj; XuiObjectFromHandle( m_SavesList, &pObj ); - m_pSavesList = static_cast(pObj); + m_pSavesList = (CXuiCtrl4JList *)pObj; m_iChangingSaveGameInfoIndex = 0; @@ -2698,7 +2698,7 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave // we could put in a damaged save icon here const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/MinecraftBrokenIcon.png"); @@ -2738,7 +2738,7 @@ int CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID lpParam,const bool) void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam) { - CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; StorageManager.TMSPP_CancelWriteFileWithProgress(pClass->m_iPad); @@ -2750,12 +2750,12 @@ void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam) // pClass->m_eSaveUploadState = eSaveUpload_Idle; UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestMessageBox(IDS_XBONE_CANCEL_UPLOAD_TITLE, IDS_XBONE_CANCEL_UPLOAD_TEXT, uiIDA, 1, pClass->m_iPad, nullptr, nullptr, app.GetStringTable()); + ui.RequestMessageBox(IDS_XBONE_CANCEL_UPLOAD_TITLE, IDS_XBONE_CANCEL_UPLOAD_TEXT, uiIDA, 1, pClass->m_iPad, NULL, NULL, app.GetStringTable()); } void CScene_MultiGameJoinLoad::SaveUploadCompleteCallback(LPVOID lpParam) { - CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); + CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; pClass->m_bSaveTransferInProgress=false; // change back to the normal title group id diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp index 63d28498..08656111 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp @@ -28,7 +28,7 @@ HRESULT CScene_MultiGameLaunchMoreOptions::OnInit( XUIMessageInit* pInitData, BO XuiControlSetText(m_CheckboxFlatWorld,app.GetString(IDS_SUPERFLAT_WORLD)); XuiControlSetText(m_CheckboxBonusChest,app.GetString(IDS_BONUS_CHEST)); - m_params = static_cast(pInitData->pvInitData); + m_params = (LaunchMoreOptionsMenuInitData *)pInitData->pvInitData; if(m_params->bGenerateOptions) { @@ -231,7 +231,7 @@ HRESULT CScene_MultiGameLaunchMoreOptions::OnControlNavigate(XUIMessageControlNa { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } diff --git a/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp b/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp index fa6da21e..49b524ff 100644 --- a/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp +++ b/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp @@ -8,7 +8,7 @@ HRESULT CScene_NewUpdateMessage::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *) pInitData->pvInitData; m_bIsSD=!RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp index 0879ba27..4de74d1f 100644 --- a/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp @@ -31,7 +31,7 @@ HRESULT UIScene_PauseMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { m_bIgnoreInput=true; - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; bool bUserisClientSide = ProfileManager.IsSignedInLive(m_iPad); app.DebugPrintf("PAUSE PRESS PROCESSING - ipad = %d, UIScene_PauseMenu::OnInit\n",m_iPad); @@ -247,7 +247,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); @@ -256,7 +256,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* // upsell ULONGLONG ullOfferID_Full; // get the dlc texture pack - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full); @@ -317,9 +317,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); } if(StorageManager.GetSaveDisabled()) @@ -357,9 +357,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* else { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); } TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited); @@ -375,9 +375,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); } // adjust the trial time played @@ -392,9 +392,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* else { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); + playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); } TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited); @@ -596,7 +596,7 @@ HRESULT UIScene_PauseMenu::OnControlNavigate(XUIMessageControlNavigate *pControl { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -623,7 +623,7 @@ int UIScene_PauseMenu::DeviceSelectReturned(void *pParam,bool bContinue) return 0; } - UIScene_PauseMenu* pClass = static_cast(pParam); + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; bool bIsisPrimaryHost=g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad()==pClass->m_iPad); bool bDisplayBanTip = !g_NetworkManager.IsLocalGame() && !bIsisPrimaryHost && !ProfileManager.IsGuest(pClass->m_iPad); bool bUserisClientSide = ProfileManager.IsSignedInLive(pClass->m_iPad); @@ -721,7 +721,7 @@ int UIScene_PauseMenu::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStor // Has someone pulled the ethernet cable and caused the pause menu to be closed before this callback returns? if(app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { - UIScene_PauseMenu* pClass = static_cast(pParam); + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; // use the device select returned function to wipe the saves list and change the tooltip pClass->DeviceSelectReturned(pClass,true); @@ -732,7 +732,7 @@ int UIScene_PauseMenu::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStor // Change device if(app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { - UIScene_PauseMenu* pClass = static_cast(pParam); + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; StorageManager.SetSaveDevice(&UIScene_PauseMenu::DeviceSelectReturned,pClass,true); } } @@ -770,7 +770,7 @@ void UIScene_PauseMenu::ShowScene(bool show) int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu* pScene = static_cast(pParam); + UIScene_PauseMenu* pScene = (UIScene_PauseMenu*)pParam; //pScene->m_bIgnoreInput = false; pScene->ShowScene( true ); @@ -782,7 +782,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); // get the dlc texture pack - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; // Need to get the parent packs id, since this may be one of many child packs with their own ids app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullIndexA[0]); @@ -790,7 +790,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J // need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } } else @@ -804,7 +804,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu *pClass = static_cast(pParam); + UIScene_PauseMenu *pClass = (UIScene_PauseMenu *)pParam; // Exit with or without saving // Decline means save in this dialog if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) @@ -815,7 +815,7 @@ int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStora if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) @@ -890,7 +890,7 @@ int UIScene_PauseMenu::ExitGameDeclineSaveReturned(void *pParam,int iPad,C4JStor // has someone disconnected the ethernet here, causing the pause menu to shut? if(ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { - IUIScene_PauseMenu* pClass = static_cast(pParam); + IUIScene_PauseMenu* pClass = (IUIScene_PauseMenu*)pParam; UINT uiIDA[3]; // you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. uiIDA[0]=IDS_CONFIRM_CANCEL; @@ -927,7 +927,7 @@ int UIScene_PauseMenu::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage: // has someone disconnected the ethernet here, causing the pause menu to shut? if(ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { - UIScene_PauseMenu* pClass = static_cast(pParam); + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; UINT uiIDA[3]; // you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. uiIDA[0]=IDS_CONFIRM_CANCEL; @@ -971,7 +971,7 @@ int UIScene_PauseMenu::ExitGameDialogReturned(void *pParam,int iPad,C4JStorage:: int UIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) { - bool bAutosave=static_cast(lpParameter); + bool bAutosave=(bool)lpParameter; if(bAutosave) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); @@ -1036,7 +1036,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) bool saveStats = true; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { - if(lpParameter != nullptr ) + if(lpParameter != NULL ) { // 4J-PB - check if we have lost connection to Live if(ProfileManager.GetLiveConnectionStatus()!=XONLINE_S_LOGON_CONNECTION_ESTABLISHED ) @@ -1104,21 +1104,21 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) uiIDA[0]=IDS_CONFIRM_OK; // 4J Stu - Fix for #48669 - TU5: Code: Compliance: TCR #15: Incorrect/misleading messages after signing out a profile during online game session. // If the primary player is signed out, then that is most likely the cause of the disconnection so don't display a message box. This will allow the message box requested by the libraries to be brought up - if( ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + if( ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); exitReasonStringId = -1; // 4J - Force a disconnection, this handles the situation that the server has already disconnected - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false); - if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(false); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false); + if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(false); } else { exitReasonStringId = IDS_EXITING_GAME; pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); - if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(); - if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(); - if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(); + if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(); + if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(); + if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(); } // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks @@ -1134,7 +1134,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) } else { - if(lpParameter != nullptr && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) + if(lpParameter != NULL && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) { switch( app.GetDisconnectReason() ) { @@ -1180,7 +1180,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable()); + ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); exitReasonStringId = -1; } } @@ -1189,7 +1189,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) { Sleep(1); } - pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats); + pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats); TelemetryManager->Flush(); diff --git a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp index c0650335..c1e06c0d 100644 --- a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp @@ -26,7 +26,7 @@ HRESULT CScene_Reinstall::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { // We'll only be in this menu from the main menu, not in game - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; m_bIgnoreInput=false; MapChildControls(); @@ -224,7 +224,7 @@ HRESULT CScene_Reinstall::OnControlNavigate(XUIMessageControlNavigate *pControlN { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -241,7 +241,7 @@ HRESULT CScene_Reinstall::OnTransitionStart( XUIMessageTransition *pTransition, // 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game) XUIRect xuiRect; - HXUIOBJ visual=nullptr; + HXUIOBJ visual=NULL; HXUIOBJ text; float fMaxTextLen=0.0f; float fTextVisualLen; @@ -283,7 +283,7 @@ HRESULT CScene_Reinstall::OnTransitionStart( XUIMessageTransition *pTransition, int CScene_Reinstall::DeviceSelectReturned(void *pParam,bool bContinue) { - CScene_Reinstall* pClass = static_cast(pParam); + CScene_Reinstall* pClass = (CScene_Reinstall*)pParam; if(!StorageManager.GetSaveDeviceSelected(pClass->m_iPad)) { @@ -300,7 +300,7 @@ int CScene_Reinstall::DeviceSelectReturned(void *pParam,bool bContinue) int CScene_Reinstall::DeviceSelectReturned_AndReinstall(void *pParam,bool bContinue) { - CScene_Reinstall* pClass = static_cast(pParam); + CScene_Reinstall* pClass = (CScene_Reinstall*)pParam; if(!StorageManager.GetSaveDeviceSelected(pClass->m_iPad)) { diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp index 2692c8f1..03e783f4 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp @@ -71,8 +71,8 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex) m_fPointerMaxX = fPanelWidth + fPointerWidth; m_fPointerMaxY = fPanelHeight + (fPointerHeight/2); -// m_hPointerText=nullptr; -// m_hPointerTextBkg=nullptr; +// m_hPointerText=NULL; +// m_hPointerTextBkg=NULL; UIVec2D itemPos; UIVec2D itemSize; @@ -113,7 +113,7 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex) // Disable the default navigation behaviour for all slot lsit items (prevent old style cursor navigation). for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection ) { - ESceneSection eSection = static_cast(iSection); + ESceneSection eSection = ( ESceneSection )( iSection ); if(!IsSectionSlotList(eSection)) continue; @@ -170,7 +170,7 @@ HRESULT CXuiSceneAbstractContainer::OnTransitionStart( XUIMessageTransition *pTr InitDataAssociations(m_iPad, m_menu); } - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; HRESULT hr=XuiControlGetVisual(m_pointerControl->m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"text_measurer",&m_hPointerTextMeasurer); hr=XuiElementGetChildById(hObj,L"text_name",&m_hPointerText); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp index 36a12757..4a8617b4 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp @@ -28,7 +28,7 @@ HRESULT CXuiSceneAnvil::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - AnvilScreenInput* initData = static_cast(pInitData->pvInitData); + AnvilScreenInput* initData = (AnvilScreenInput*)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; m_inventory = initData->inventory; @@ -40,9 +40,9 @@ HRESULT CXuiSceneAnvil::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); } - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Anvil_Menu, this); } @@ -67,15 +67,15 @@ HRESULT CXuiSceneAnvil::OnDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -89,8 +89,8 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue // strip leading spaces wstring b; - size_t start = newValue.find_first_not_of(L" "); - size_t end = newValue.find_last_not_of(L" "); + int start = (int)newValue.find_first_not_of(L" "); + int end = (int)newValue.find_last_not_of(L" "); if( start == wstring::npos ) { @@ -99,7 +99,7 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue } else { - if( end == wstring::npos ) end = newValue.size() - 1; + if( end == wstring::npos ) end = (int)newValue.size()-1; b = newValue.substr(start,(end-start)+1); newValue=b; } @@ -158,7 +158,7 @@ CXuiControl* CXuiSceneAnvil::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneAnvil::GetSectionSlotList( ESceneSection eSection ) @@ -184,7 +184,7 @@ CXuiCtrlSlotList* CXuiSceneAnvil::GetSectionSlotList( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp index c9a57f21..1a679f58 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp @@ -22,14 +22,14 @@ #define PRESS_START_TIMER 0 -CXuiSceneBase *CXuiSceneBase::Instance = nullptr; +CXuiSceneBase *CXuiSceneBase::Instance = NULL; DWORD CXuiSceneBase::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; //---------------------------------------------------------------------------------- // Performs initialization tasks - retrieves controls. //---------------------------------------------------------------------------------- HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - ASSERT( CXuiSceneBase::Instance == nullptr ); + ASSERT( CXuiSceneBase::Instance == NULL ); CXuiSceneBase::Instance = this; m_iWrongTexturePackTickC=20*5; // default 5 seconds before bringing up the upsell for not having the texture pack @@ -41,7 +41,7 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) HXUIOBJ hTemp; - m_hEmptyQuadrantLogo=nullptr; + m_hEmptyQuadrantLogo=NULL; XuiElementGetChildById(m_hObj,L"EmptyQuadrantLogo",&m_hEmptyQuadrantLogo); D3DXVECTOR3 lastPos; @@ -51,8 +51,8 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { m_visible[idx][ i ] = FALSE; m_iCurrentTooltipTextID[idx][i]=-1; - hTooltipText[idx][i]=nullptr; - hTooltipTextSmall[idx][i]=nullptr; + hTooltipText[idx][i]=NULL; + hTooltipTextSmall[idx][i]=NULL; // set all tooltips to shown FALSE by default m_Buttons[idx][i].SetShow( FALSE ); m_ButtonsSmall[idx][i].SetShow( FALSE ); @@ -106,7 +106,7 @@ HRESULT CXuiSceneBase::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) // clear the quadrants m_iQuadrantsMask=0; - HXUIOBJ hObj=nullptr,hQuadrant; + HXUIOBJ hObj=NULL,hQuadrant; HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj); @@ -144,8 +144,8 @@ HRESULT CXuiSceneBase::OnSkinChanged(BOOL& bHandled) { for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i ) { - hTooltipText[idx][i]=nullptr; - hTooltipTextSmall[idx][i]=nullptr; + hTooltipText[idx][i]=NULL; + hTooltipTextSmall[idx][i]=NULL; } } @@ -178,7 +178,7 @@ void CXuiSceneBase::_TickAllBaseScenes() //Is it available? TexturePack * pRequiredTPack=pMinecraft->skins->getTexturePackById(app.GetRequiredTexturePackID()); - if(pRequiredTPack!=nullptr) + if(pRequiredTPack!=NULL) { // we can switch to the required pack // reset the timer @@ -206,7 +206,7 @@ void CXuiSceneBase::_TickAllBaseScenes() } } - if (EnderDragonRenderer::bossInstance == nullptr) + if (EnderDragonRenderer::bossInstance == NULL) { if(m_ticksWithNoBoss<=20) { @@ -221,7 +221,7 @@ void CXuiSceneBase::_TickAllBaseScenes() for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(pMinecraft->localplayers[i] != nullptr && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD)) + if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD)) { int iGuiScale; @@ -245,7 +245,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(TRUE); m_BossHealthProgress2[i].SetShow(FALSE); m_BossHealthProgress3[i].SetShow(FALSE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -259,7 +259,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(FALSE); m_BossHealthProgress2[i].SetShow(TRUE); m_BossHealthProgress3[i].SetShow(FALSE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -272,7 +272,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(FALSE); m_BossHealthProgress2[i].SetShow(FALSE); m_BossHealthProgress3[i].SetShow(TRUE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -295,7 +295,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(TRUE); m_BossHealthProgress2[i].SetShow(FALSE); m_BossHealthProgress3[i].SetShow(FALSE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -308,7 +308,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(FALSE); m_BossHealthProgress2[i].SetShow(TRUE); m_BossHealthProgress3[i].SetShow(FALSE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -320,7 +320,7 @@ void CXuiSceneBase::_TickAllBaseScenes() m_BossHealthProgress1[i].SetShow(FALSE); m_BossHealthProgress2[i].SetShow(FALSE); m_BossHealthProgress3[i].SetShow(TRUE); - if(m_BossHealthProgress1_small[i]!=nullptr) + if(m_BossHealthProgress1_small[i]!=NULL) { m_BossHealthProgress1_small[i].SetShow(FALSE); m_BossHealthProgress2_small[i].SetShow(FALSE); @@ -401,7 +401,7 @@ void CXuiSceneBase::_TickAllBaseScenes() if(uiOpacityTimer < (SharedConstants::TICKS_PER_SECOND * 1) ) { float fStep=(80.0f)/10.0f; - float fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); XuiElementSetOpacity(m_selectedItemA[i],fVal); XuiElementSetOpacity(m_selectedItemSmallA[i],fVal); @@ -441,8 +441,8 @@ void CXuiSceneBase::_TickAllBaseScenes() { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -451,7 +451,7 @@ void CXuiSceneBase::_TickAllBaseScenes() } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else @@ -461,7 +461,7 @@ void CXuiSceneBase::_TickAllBaseScenes() { ucAlpha=15; } - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } XuiElementSetOpacity(app.GetCurrentHUDScene(i),fVal); @@ -470,7 +470,7 @@ void CXuiSceneBase::_TickAllBaseScenes() XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg ); bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0; - if(bDisplayGui && pMinecraft->localplayers[i] != nullptr) + if(bDisplayGui && pMinecraft->localplayers[i] != NULL) { XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE); } @@ -498,7 +498,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti XUIRect xuiRect, xuiRectSmall; HRESULT hr=S_OK; - LPCWSTR pString=nullptr; + LPCWSTR pString=NULL; float fWidth,fHeight; // Want to be able to show just a button (for RB LB) @@ -506,17 +506,18 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti { pString=app.GetString(iTextID); } - if(hTooltipText[iPad][uiTooltip]==nullptr) + + if(hTooltipText[iPad][uiTooltip]==NULL) { - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; hr=XuiControlGetVisual(m_Buttons[iPad][uiTooltip].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]); hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]); } - - if(hTooltipTextSmall[iPad][uiTooltip]==nullptr) + + if(hTooltipTextSmall[iPad][uiTooltip]==NULL) { - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; hr=XuiControlGetVisual(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipTextSmall[iPad][uiTooltip]); hr=XuiElementGetPosition(hTooltipTextSmall[iPad][uiTooltip],&m_vPosTextInTooltipSmall[uiTooltip]); @@ -626,8 +627,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -636,7 +637,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else @@ -646,7 +647,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { ucAlpha=15; } - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } m_Buttons[iPad][tooltip].SetOpacity(fVal); @@ -677,8 +678,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -687,12 +688,12 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } XuiElementSetOpacity(m_hGamerTagA[iPad],fVal); } @@ -700,7 +701,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo if(iPad==ProfileManager.GetPrimaryPad()) { unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); - XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast(ucAlpha)); + XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha); } } } @@ -857,7 +858,7 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow ) hr=XuiElementGetChildById(hVisual,L"NightGroup",&hNight); hr=XuiElementGetChildById(hVisual,L"DayGroup",&hDay); - if(bShow && pMinecraft->level!=nullptr) + if(bShow && pMinecraft->level!=NULL) { int64_t i64TimeOfDay =0; // are we in the Nether? - Leave the time as 0 if we are, so we show daylight @@ -910,7 +911,7 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad) m_PressStart.SetShow(TRUE); // retrieve the visual for this quadrant - HXUIOBJ hObj=nullptr,hQuadrant; + HXUIOBJ hObj=NULL,hQuadrant; HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hQuadrant); memset(&xuiRect, 0, sizeof(xuiRect)); @@ -975,7 +976,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) { WCHAR wcTime[20]; - DWORD dwTimeTicks=static_cast(app.getTrialTimer()); + DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -1013,7 +1014,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) void CXuiSceneBase::_ReduceTrialTimerValue() { - DWORD dwTimeTicks=static_cast(app.getTrialTimer()); + DWORD dwTimeTicks=(int)app.getTrialTimer(); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -1037,7 +1038,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad) HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position ) { // turn off the empty quadrant logo - if(m_hEmptyQuadrantLogo!=nullptr) + if(m_hEmptyQuadrantLogo!=NULL) { XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE); } @@ -1267,7 +1268,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen // 4J Stu - If we already have some scenes open, then call this to update their positions // Fix for #10960 - All Lang: UI: Split-screen: Changing split screen mode (vertical/horizontal) make window layout strange - if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!=nullptr) + if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) { // 4J-PB - Can only do this once we know what the player's UI settings are, so we need to have the player game settings read _UpdateSelectedItemPos(iPad); @@ -1338,7 +1339,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad) unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2; - if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) + if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) { // SURVIVAL MODE - Move up further because of hearts, shield and xp switch(ucGuiScale) @@ -1427,7 +1428,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad) { float scale=0.5f; selectedItemPos.y -= (scale * 88.0f); - if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) + if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) { selectedItemPos.y -= (scale * 80.0f); } @@ -1470,7 +1471,7 @@ CXuiSceneBase::EBaseScenePosition CXuiSceneBase::_GetPlayerBasePosition(int iPad void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos) { - if(m_hEmptyQuadrantLogo!=nullptr) + if(m_hEmptyQuadrantLogo!=NULL) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -1511,7 +1512,7 @@ void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos) if(ProfileManager.GetLockedProfile()!=-1) { unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); - XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast(ucAlpha)); + XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha); } XuiElementSetPosition(m_hEmptyQuadrantLogo, &pos ); @@ -1606,7 +1607,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) // The host decides whether these are on or off if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) { - if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!= nullptr) + if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) { wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad)); XuiControlSetText(m_hGamerTagA[iPad],wsGamertag.c_str()); @@ -1637,8 +1638,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) { if(uiOpacityTimer<10) { - float fStep=(80.0f-static_cast(ucAlpha))/10.0f; - fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); + float fStep=(80.0f-(float)ucAlpha)/10.0f; + fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); } else { @@ -1647,12 +1648,12 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } } else { - fVal=0.01f*static_cast(ucAlpha); + fVal=0.01f*(float)ucAlpha; } XuiElementSetOpacity(m_hGamerTagA[iPad],0.01f*fVal); } @@ -1863,7 +1864,7 @@ void CXuiSceneBase::ReLayout( unsigned int iPad ) void CXuiSceneBase::TickAllBaseScenes() { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { CXuiSceneBase::Instance->_TickAllBaseScenes(); } @@ -1871,7 +1872,7 @@ void CXuiSceneBase::TickAllBaseScenes() HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_SetEnableTooltips(iPad, bVal ); } @@ -1880,7 +1881,7 @@ HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal ) HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_SetTooltipText(iPad, tooltip, iTextID ); } @@ -1889,7 +1890,7 @@ HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip, HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_RefreshTooltips(iPad); } @@ -1898,7 +1899,7 @@ HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad) HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_ShowTooltip(iPad, tooltip, show ); } @@ -1907,7 +1908,7 @@ HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, boo HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_ShowSafeArea(bShow ); } @@ -1916,7 +1917,7 @@ HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow ) HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY , int iLT, int iRT, int iRB, int iLB, int iLS, bool forceUpdate /*= false*/ ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { // Enable all the tooltips. We should disable them in the scenes as required CXuiSceneBase::Instance->_SetTooltipsEnabled( iPad ); @@ -1977,7 +1978,7 @@ HRESULT CXuiSceneBase::AnimateKeyPress(DWORD userIndex, DWORD dwKeyCode) HRESULT CXuiSceneBase::ShowSavingMessage( unsigned int iPad, C4JStorage::ESavingMessage eVal ) { - if( CXuiSceneBase::Instance != nullptr ) + if( CXuiSceneBase::Instance != NULL ) { return CXuiSceneBase::Instance->_ShowSavingMessage(iPad, eVal); } @@ -2077,7 +2078,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions() Minecraft *pMinecraft = Minecraft::GetInstance(); // If the game is not started (or is being held paused for a bit) then display all scenes fullscreen - if( pMinecraft == nullptr ) + if( pMinecraft == NULL ) { for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) { @@ -2104,7 +2105,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions() for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(pMinecraft->localplayers[idx] != nullptr) + if(pMinecraft->localplayers[idx] != NULL) { if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN) { @@ -2185,7 +2186,7 @@ void CXuiSceneBase::SetEmptyQuadrantLogo(int iScreenSection) // find the empty player for( iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) { - if(pMinecraft->localplayers[iPad] == nullptr) + if(pMinecraft->localplayers[iPad] == NULL) { switch( iScreenSection) { @@ -2237,6 +2238,6 @@ void CXuiSceneBase::CreateBaseSceneInstance() { CXuiSceneBase *sceneBase = new CXuiSceneBase(); BOOL handled; - sceneBase->OnInit(nullptr,handled); + sceneBase->OnInit(NULL,handled); } #endif \ No newline at end of file diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp index a55e8f77..cf600966 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp @@ -24,7 +24,7 @@ HRESULT CXuiSceneBrewingStand::OnInit( XUIMessageInit* pInitData, BOOL& bHandled Minecraft *pMinecraft = Minecraft::GetInstance(); - BrewingScreenInput* initData = static_cast(pInitData->pvInitData); + BrewingScreenInput* initData = (BrewingScreenInput*)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -36,7 +36,7 @@ HRESULT CXuiSceneBrewingStand::OnInit( XUIMessageInit* pInitData, BOOL& bHandled } #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -67,16 +67,16 @@ HRESULT CXuiSceneBrewingStand::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -106,7 +106,7 @@ CXuiControl* CXuiSceneBrewingStand::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneBrewingStand::GetSectionSlotList( ESceneSection eSection ) @@ -135,7 +135,7 @@ CXuiCtrlSlotList* CXuiSceneBrewingStand::GetSectionSlotList( ESceneSection eSect assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp index 25f5cffc..39b836d2 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp @@ -29,7 +29,7 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - ContainerScreenInput* initData = static_cast(pInitData->pvInitData); + ContainerScreenInput* initData = (ContainerScreenInput*)pInitData->pvInitData; XuiControlSetText(m_ChestText,app.GetString(initData->container->getName())); @@ -40,7 +40,7 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_bSplitscreen=initData->bSplitscreen; #ifdef _XBOX - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -75,9 +75,9 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // to get it into actual back buffer coordinates, and we need those to remain whole numbers to avoid issues with point sampling if(!RenderManager.IsHiDef()) { - int iY = static_cast(vPos.y); + int iY = (int)(vPos.y); iY &= 0xfffffffe; - vPos.y = static_cast(iY); + vPos.y = (float)iY; } this->SetPosition( &vPos ); @@ -95,16 +95,16 @@ HRESULT CXuiSceneContainer::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -125,7 +125,7 @@ CXuiControl* CXuiSceneContainer::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneContainer::GetSectionSlotList( ESceneSection eSection ) @@ -145,7 +145,7 @@ CXuiCtrlSlotList* CXuiSceneContainer::GetSectionSlotList( ESceneSection eSection assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp index f1c51ff0..a5dc6584 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp @@ -40,7 +40,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle D3DXVECTOR3 vec; VOID *pObj; - CraftingPanelScreenInput* pCraftingPanelData = static_cast(pInitData->pvInitData); + CraftingPanelScreenInput* pCraftingPanelData = (CraftingPanelScreenInput*)pInitData->pvInitData; m_iContainerType=pCraftingPanelData->iContainerType; m_pPlayer=pCraftingPanelData->player; m_iPad=pCraftingPanelData->iPad; @@ -89,12 +89,12 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle for(int i=0;i(pObj); + m_pCraftingIngredientA[i] = (CXuiCtrlCraftIngredientSlot *)pObj; } XuiObjectFromHandle( m_hCraftOutput, &pObj ); - m_pCraftingOutput = static_cast(pObj); - m_pGroupA=static_cast(&m_GroupTypeMapping9GridA); - m_pGroupTabA=static_cast(&m_GroupTabBkgMapping3x3A); + m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj; + m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping9GridA; + m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping3x3A; m_iCraftablesMaxHSlotC=m_iMaxHSlot3x3C; @@ -102,7 +102,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle for(int i=0;i<4;i++) { XuiObjectFromHandle( m_hCraftIngredientDescA[i], &pObj ); - m_pCraftIngredientDescA[i] = static_cast(pObj); + m_pCraftIngredientDescA[i] = (CXuiCtrlCraftIngredientSlot *)pObj; } } else @@ -113,13 +113,13 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle for(int i=0;i(pObj); + m_pCraftingIngredientA[i] = (CXuiCtrlCraftIngredientSlot *)pObj; } XuiObjectFromHandle( m_hCraftOutput, &pObj ); - m_pCraftingOutput = static_cast(pObj); - m_pGroupA=static_cast(&m_GroupTypeMapping4GridA); - m_pGroupTabA=static_cast(&m_GroupTabBkgMapping2x2A); + m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj; + m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping4GridA; + m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping2x2A; m_iCraftablesMaxHSlotC=m_iMaxHSlot2x2C; @@ -127,7 +127,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle for(int i=0;i<4;i++) { XuiObjectFromHandle( m_hCraftIngredientDescA[i], &pObj ); - m_pCraftIngredientDescA[i] = static_cast(pObj); + m_pCraftIngredientDescA[i] = (CXuiCtrlCraftIngredientSlot *)pObj; } } @@ -165,7 +165,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -206,7 +206,7 @@ HRESULT CXuiSceneCraftingPanel::OnTransitionEnd( XUIMessageTransition *pTransDat { for(int i=0;iiItem; int iId=(pData->iData>>22)&0x1FF; - pData->szPath = nullptr; + pData->szPath = NULL; pData->bDirty=true; rfHandled = TRUE; return hr; @@ -352,15 +352,15 @@ HRESULT CXuiSceneCraftingPanel::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -433,7 +433,7 @@ void CXuiSceneCraftingPanel::setCraftVSlotItem(int iPad, int iIndex, shared_ptr< void CXuiSceneCraftingPanel::setCraftingOutputSlotItem(int iPad, shared_ptr item) { - if(item == nullptr) + if(item == NULL) { m_pCraftingOutput->SetIcon(iPad, 0,0,0,0,0,false); } @@ -450,7 +450,7 @@ void CXuiSceneCraftingPanel::setCraftingOutputSlotRedBox(bool show) void CXuiSceneCraftingPanel::setIngredientSlotItem(int iPad, int index, shared_ptr item) { - if(item == nullptr) + if(item == NULL) { m_pCraftingIngredientA[index]->SetIcon(iPad, 0,0,0,0,0,false); } diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp index dabe6d6d..5b3c7226 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp @@ -30,7 +30,7 @@ HRESULT CXuiSceneEnchant::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - EnchantingScreenInput *initData = static_cast(pInitData->pvInitData); + EnchantingScreenInput *initData = (EnchantingScreenInput *) pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -42,7 +42,7 @@ HRESULT CXuiSceneEnchant::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) } #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -73,16 +73,16 @@ HRESULT CXuiSceneEnchant::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -112,7 +112,7 @@ CXuiControl* CXuiSceneEnchant::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneEnchant::GetSectionSlotList( ESceneSection eSection ) @@ -132,7 +132,7 @@ CXuiCtrlSlotList* CXuiSceneEnchant::GetSectionSlotList( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp index c5e2d22c..832d6b4c 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp @@ -26,7 +26,7 @@ HRESULT CXuiSceneFurnace::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - FurnaceScreenInput* initData = static_cast(pInitData->pvInitData); + FurnaceScreenInput* initData = (FurnaceScreenInput*)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -38,7 +38,7 @@ HRESULT CXuiSceneFurnace::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) } #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -69,16 +69,16 @@ HRESULT CXuiSceneFurnace::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -105,7 +105,7 @@ CXuiControl* CXuiSceneFurnace::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneFurnace::GetSectionSlotList( ESceneSection eSection ) @@ -131,7 +131,7 @@ CXuiCtrlSlotList* CXuiSceneFurnace::GetSectionSlotList( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp index e86ff67e..6024b8d6 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp @@ -23,7 +23,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - InventoryScreenInput *initData = static_cast(pInitData->pvInitData); + InventoryScreenInput *initData = (InventoryScreenInput *)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -38,7 +38,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) } #ifdef _XBOX - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -79,15 +79,15 @@ HRESULT CXuiSceneInventory::OnDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -118,7 +118,7 @@ CXuiControl* CXuiSceneInventory::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneInventory::GetSectionSlotList( ESceneSection eSection ) @@ -138,7 +138,7 @@ CXuiCtrlSlotList* CXuiSceneInventory::GetSectionSlotList( ESceneSection eSection assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back @@ -156,12 +156,12 @@ void CXuiSceneInventory::updateEffectsDisplay() Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player == nullptr) return; + if(player == NULL) return; vector *activeEffects = player->getActiveEffects(); // Work out how to arrange the effects - int effectCount = static_cast(activeEffects->size()); + int effectCount = (int)activeEffects->size(); // Total size of all effects + spacing, minus spacing for the last effect float fHeight = (effectCount * m_effectDisplaySpacing) - (m_effectDisplaySpacing - m_effectDisplayHeight); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp index 0fa3e780..0793fc9e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp @@ -33,7 +33,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa Minecraft *pMinecraft = Minecraft::GetInstance(); - InventoryScreenInput *initData = static_cast(pInitData->pvInitData); + InventoryScreenInput *initData = (InventoryScreenInput *)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -48,7 +48,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa } #ifdef _XBOX - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -60,7 +60,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs()); // 4J JEV - Item Picker Menu - shared_ptr creativeContainer = std::make_shared(0, TabSpec::MAX_SIZE + 9); + shared_ptr creativeContainer = shared_ptr(new SimpleContainer( 0, TabSpec::MAX_SIZE + 9 )); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); // 4J JEV - InitDataAssociations. @@ -95,16 +95,16 @@ HRESULT CXuiSceneInventoryCreative::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -126,7 +126,7 @@ HRESULT CXuiSceneInventoryCreative::OnTransitionEnd( XUIMessageTransition *pTran { for(int i=0;im_icon,nullptr,specs[i]->m_icon); + m_hGroupIconA[i].PlayVisualRange(specs[i]->m_icon,NULL,specs[i]->m_icon); XuiElementSetShow(m_hGroupIconA[i].m_hObj,TRUE); } } @@ -139,16 +139,16 @@ CXuiControl* CXuiSceneInventoryCreative::GetSectionControl( ESceneSection eSecti switch( eSection ) { case eSectionInventoryCreativeUsing: - return static_cast(m_useRowControl); + return (CXuiControl *)m_useRowControl; break; case eSectionInventoryCreativeSelector: - return static_cast(m_containerControl); + return (CXuiControl *)m_containerControl; break; default: assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneInventoryCreative::GetSectionSlotList( ESceneSection eSection ) @@ -165,7 +165,7 @@ CXuiCtrlSlotList* CXuiSceneInventoryCreative::GetSectionSlotList( ESceneSection assert( false ); break; } - return nullptr; + return NULL; } void CXuiSceneInventoryCreative::updateTabHighlightAndText(ECreativeInventoryTabs tab) diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp index 3fbca979..8738e683 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp @@ -27,7 +27,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - TradingScreenInput* initData = static_cast(pInitData->pvInitData); + TradingScreenInput* initData = (TradingScreenInput *)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; m_merchant = initData->trader; @@ -39,9 +39,9 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); } - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trading_Menu, this); } @@ -79,15 +79,15 @@ HRESULT CXuiSceneTrading::OnDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -97,7 +97,7 @@ HRESULT CXuiSceneTrading::OnTransitionStart( XUIMessageTransition *pTransition, if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) { - HXUIOBJ hObj=nullptr; + HXUIOBJ hObj=NULL; HRESULT hr=XuiControlGetVisual(m_offerInfoControl.m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"text_measurer",&m_hOfferInfoTextMeasurer); hr=XuiElementGetChildById(hObj,L"text_name",&m_hOfferInfoText); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp index 326e6263..99dc6e4c 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp @@ -22,12 +22,12 @@ HRESULT CXuiSceneTrap::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - TrapScreenInput* initData = static_cast(pInitData->pvInitData); + TrapScreenInput* initData = (TrapScreenInput*)pInitData->pvInitData; m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; #ifdef _XBOX - if( pMinecraft->localgameModes[initData->iPad] != nullptr ) + if( pMinecraft->localgameModes[initData->iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -57,16 +57,16 @@ HRESULT CXuiSceneTrap::OnDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); #ifdef _XBOX - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } #endif // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); + if(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -87,7 +87,7 @@ CXuiControl* CXuiSceneTrap::GetSectionControl( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } CXuiCtrlSlotList* CXuiSceneTrap::GetSectionSlotList( ESceneSection eSection ) @@ -107,7 +107,7 @@ CXuiCtrlSlotList* CXuiSceneTrap::GetSectionSlotList( ESceneSection eSection ) assert( false ); break; } - return nullptr; + return NULL; } // 4J Stu - Added to support auto-save. Need to re-associate on a navigate back diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp index c4c279a6..19e6b016 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp @@ -21,7 +21,7 @@ const float CScene_Win::PLAYER_SCROLL_SPEED = 3.0f; //---------------------------------------------------------------------------------- HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; m_bIgnoreInput = false; @@ -57,18 +57,18 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) noNoiseString = app.FormatHTMLString(m_iPad, noNoiseString, 0xff000000); Random random(8124371); - size_t found=noNoiseString.find_first_of(L"{"); - size_t length; + int found=(int)noNoiseString.find_first_of(L"{"); + int length; while (found!=string::npos) { length = random.nextInt(4) + 3; m_noiseLengths.push_back(length); - found=noNoiseString.find_first_of(L"{", found + 1); + found=(int)noNoiseString.find_first_of(L"{",found+1); } Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[s_winUserIndex] != nullptr) + if(pMinecraft->localplayers[s_winUserIndex] != NULL) { noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",pMinecraft->localplayers[s_winUserIndex]->name); } @@ -134,7 +134,7 @@ HRESULT CScene_Win::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled) app.CloseAllPlayersXuiScenes(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(pMinecraft->localplayers[i] != nullptr) + if(pMinecraft->localplayers[i] != NULL) { app.SetAction(i,eAppAction_Respawn); } @@ -143,7 +143,7 @@ HRESULT CScene_Win::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled) // Show the other players scenes CXuiSceneBase::ShowOtherPlayersBaseScene(pInputData->UserIndex, true); // This just allows it to be shown - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true); ui.UpdatePlayerBasePositions(); rfHandled = TRUE; @@ -277,7 +277,7 @@ HRESULT CScene_Win::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) CXuiSceneBase::ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); // This just allows it to be shown - if(Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + if(Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); // Temporarily make this scene fullscreen CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen ); diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp index 3c37b8d8..c6dc7118 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp @@ -10,9 +10,9 @@ HRESULT CScene_SettingsAll::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { //WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); MapChildControls(); @@ -112,7 +112,7 @@ HRESULT CScene_SettingsAll::OnControlNavigate(XUIMessageControlNavigate *pContro // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -181,7 +181,7 @@ HRESULT CScene_SettingsAll::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* HRESULT CScene_SettingsAll::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // if we're not in the game, we need to use basescene 0 if(bNotInGame) diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp index 6f399d55..0f0fe2e3 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp @@ -7,9 +7,9 @@ HRESULT CScene_SettingsAudio::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); MapChildControls(); @@ -86,13 +86,13 @@ HRESULT CScene_SettingsAudio::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotif if(hObjSource==m_SliderA[SLIDER_SETTINGS_MUSIC].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_MusicVolume,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_MUSIC].SetText(TempString); } else if(hObjSource==m_SliderA[SLIDER_SETTINGS_SOUND].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_SoundFXVolume,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_SOUND].SetText(TempString); } @@ -141,7 +141,7 @@ HRESULT CScene_SettingsAudio::OnControlNavigate(XUIMessageControlNavigate *pCont // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -240,7 +240,7 @@ HRESULT CScene_SettingsAudio::OnTransitionStart( XUIMessageTransition *pTransiti HRESULT CScene_SettingsAudio::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // if we're not in the game, we need to use basescene 0 if(bNotInGame) diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp index 4fa335fb..7e2835a2 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp @@ -10,9 +10,9 @@ HRESULT CScene_SettingsControl::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); MapChildControls(); @@ -66,13 +66,13 @@ HRESULT CScene_SettingsControl::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot if(hObjSource==m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INGAME].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INGAME].SetText(TempString); } else if(hObjSource==m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INMENU].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INMENU].SetText(TempString); } @@ -120,7 +120,7 @@ HRESULT CScene_SettingsControl::OnControlNavigate(XUIMessageControlNavigate *pCo // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -218,7 +218,7 @@ HRESULT CScene_SettingsControl::OnTransitionStart( XUIMessageTransition *pTransi HRESULT CScene_SettingsControl::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // if we're not in the game, we need to use basescene 0 if(bNotInGame) diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp index d73baa0b..48a933e2 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp @@ -10,9 +10,9 @@ HRESULT CScene_SettingsGraphics::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); MapChildControls(); @@ -139,13 +139,13 @@ HRESULT CScene_SettingsGraphics::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINo if(hObjSource==m_SliderA[SLIDER_SETTINGS_GAMMA].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Gamma,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_GAMMA].SetText(TempString); } else if(hObjSource==m_SliderA[SLIDER_SETTINGS_INTERFACE_OPACITY].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_INTERFACE_OPACITY].SetText(TempString); } @@ -198,7 +198,7 @@ HRESULT CScene_SettingsGraphics::OnControlNavigate(XUIMessageControlNavigate *pC // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -310,7 +310,7 @@ HRESULT CScene_SettingsGraphics::OnTransitionStart( XUIMessageTransition *pTrans HRESULT CScene_SettingsGraphics::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // if we're not in the game, we need to use basescene 0 if(bNotInGame) diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp index 683ee175..526847c7 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp @@ -26,9 +26,9 @@ int CScene_SettingsOptions::m_iDifficultyTitleSettingA[4]= HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; MapChildControls(); @@ -274,14 +274,14 @@ HRESULT CScene_SettingsOptions::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot else { app.SetAutosaveTimerTime(); - swprintf( static_cast(TempString), 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),pNotifyValueChanged->nValue*15, app.GetString( IDS_MINUTES )); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),pNotifyValueChanged->nValue*15, app.GetString( IDS_MINUTES )); } m_SliderA[SLIDER_SETTINGS_AUTOSAVE].SetText(TempString); } else if(hObjSource==m_SliderA[SLIDER_SETTINGS_DIFFICULTY].GetSlider() ) { app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pNotifyValueChanged->nValue); - swprintf( static_cast(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); + swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); m_SliderA[SLIDER_SETTINGS_DIFFICULTY].SetText(TempString); wstring wsText=app.GetString(m_iDifficultySettingA[pNotifyValueChanged->nValue]); @@ -353,7 +353,7 @@ HRESULT CScene_SettingsOptions::OnControlNavigate(XUIMessageControlNavigate *pCo // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -467,7 +467,7 @@ HRESULT CScene_SettingsOptions::OnTransitionStart( XUIMessageTransition *pTransi // Need to refresh the scenes visual since the object size has now changed XuiControlAttachVisual(m_hObj); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp index ab9cc53b..da95d084 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp @@ -10,9 +10,9 @@ HRESULT CScene_SettingsUI::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; MapChildControls(); @@ -115,7 +115,7 @@ HRESULT CScene_SettingsUI::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyVa // slider is 1 to 3 // is this different from the current value? - swprintf( static_cast(TempString), 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_UISIZE].SetText(TempString); if(pNotifyValueChanged->nValue != app.GetGameSettings(m_iPad,eGameSetting_UISize)+1) { @@ -126,7 +126,7 @@ HRESULT CScene_SettingsUI::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyVa } else if(hObjSource==m_SliderA[SLIDER_SETTINGS_UISIZESPLITSCREEN].GetSlider() ) { - swprintf( static_cast(TempString), 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),pNotifyValueChanged->nValue); + swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_UISIZESPLITSCREEN].SetText(TempString); if(pNotifyValueChanged->nValue != app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1) @@ -210,7 +210,7 @@ HRESULT CScene_SettingsUI::OnControlNavigate(XUIMessageControlNavigate *pControl // added so we can skip greyed out items pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest!=nullptr) + if(pControlNavigateData->hObjDest!=NULL) { bHandled=TRUE; } @@ -353,7 +353,7 @@ HRESULT CScene_SettingsUI::OnTransitionStart( XUIMessageTransition *pTransition, HRESULT CScene_SettingsUI::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) { - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); // if we're not in the game, we need to use basescene 0 if(bNotInGame) diff --git a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp index 963d8f10..378ac147 100644 --- a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp @@ -15,7 +15,7 @@ HRESULT CScene_SignEntry::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiControlSetText(m_ButtonDone,app.GetString(IDS_DONE)); XuiControlSetText(m_labelEditSign,app.GetString(IDS_EDIT_SIGN_MESSAGE)); - SignEntryScreenInput* initData = static_cast(pInitData->pvInitData); + SignEntryScreenInput* initData = (SignEntryScreenInput*)pInitData->pvInitData; m_sign = initData->sign; CXuiSceneBase::ShowDarkOverlay( initData->iPad, TRUE ); @@ -75,9 +75,9 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p if (pMinecraft->level->isClientSide) { shared_ptr player = pMinecraft->localplayers[pNotifyPressData->UserIndex]; - if(player != nullptr && player->connection && player->connection->isStarted()) + if(player != NULL && player->connection && player->connection->isStarted()) { - player->connection->send(std::make_shared(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages())); + player->connection->send( shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } } app.CloseXuiScenes(pNotifyPressData->UserIndex); diff --git a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp index b92159c0..ee706610 100644 --- a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp @@ -26,9 +26,9 @@ WCHAR *CScene_SkinSelect::wchDefaultNamesA[]= //---------------------------------------------------------------------------------- HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); m_bIgnoreInput=false; // 4J Stu - Added this so that we have skins loaded @@ -46,7 +46,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_skinIndex = 0; m_currentSkinPath = app.GetPlayerSkinName(m_iPad); m_originalSkinId = app.GetPlayerSkinId(m_iPad); - m_currentPack = nullptr; + m_currentPack = NULL; m_bSlidingSkins = false; m_bAnimatingMove = false; currentPackCount = 0; @@ -86,7 +86,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // Change to display the favorites if there are any. The current skin will be in there (probably) - need to check for it m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); bool bFound; - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; } @@ -232,7 +232,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle } break; default: - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex); @@ -266,7 +266,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -626,8 +626,8 @@ void CScene_SkinSelect::handleSkinIndexChanged() wstring skinOrigin = L""; bool bSkinIsFree=false; bool bLicensed=false; - DLCSkinFile *skinFile=nullptr; - DLCPack *Pack=nullptr; + DLCSkinFile *skinFile=NULL; + DLCPack *Pack=NULL; BYTE sidePreviewControlsL,sidePreviewControlsR; bool bNoSkinsToShow=false; @@ -635,7 +635,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() m_selectedGroup.SetShow( FALSE ); m_skinDetails.SetShow( FALSE ); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(m_skinIndex); m_selectedSkinPath = skinFile->getPath(); @@ -665,7 +665,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = nullptr; + m_vAdditionalSkinBoxes = NULL; switch(m_packIndex) { @@ -753,13 +753,13 @@ void CScene_SkinSelect::handleSkinIndexChanged() { // add the boxes to the humanoid model, but only if we've not done this already vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes); } } - if(skinFile!=nullptr) + if(skinFile!=NULL) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -774,7 +774,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() wstring otherSkinPath = L""; wstring otherCapePath = L""; - vector *othervAdditionalSkinBoxes=nullptr; + vector *othervAdditionalSkinBoxes=NULL; wchar_t chars[256]; // turn off all displays @@ -820,10 +820,10 @@ void CScene_SkinSelect::handleSkinIndexChanged() { if(showNext) { - skinFile=nullptr; + skinFile=NULL; m_previewNextControls[i]->SetShow(TRUE); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(nextIndex); otherSkinPath = skinFile->getPath(); @@ -835,7 +835,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=nullptr; + othervAdditionalSkinBoxes=NULL; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -867,13 +867,13 @@ void CScene_SkinSelect::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } } // 4J-PB - anim override needs set before SetTexture - if(skinFile!=nullptr) + if(skinFile!=NULL) { app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask()); } @@ -892,10 +892,10 @@ void CScene_SkinSelect::handleSkinIndexChanged() { if(showPrevious) { - skinFile=nullptr; + skinFile=NULL; m_previewPreviousControls[i]->SetShow(TRUE); - if( m_currentPack != nullptr ) + if( m_currentPack != NULL ) { skinFile = m_currentPack->getSkinFile(previousIndex); otherSkinPath = skinFile->getPath(); @@ -907,7 +907,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=nullptr; + othervAdditionalSkinBoxes=NULL; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -939,7 +939,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==nullptr) + if(pAdditionalModelParts==NULL) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } @@ -957,7 +957,7 @@ void CScene_SkinSelect::handleSkinIndexChanged() } // update the tooltips - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNoSkinsToShow) { @@ -1001,10 +1001,10 @@ void CScene_SkinSelect::handlePackIndexChanged() } else { - m_currentPack = nullptr; + m_currentPack = NULL; } m_skinIndex = 0; - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { bool found; DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found); @@ -1021,7 +1021,7 @@ void CScene_SkinSelect::handlePackIndexChanged() DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { - m_skinIndex = static_cast(defaultSkinIndex); + m_skinIndex = (EDefaultSkins) defaultSkinIndex; } } break; @@ -1199,7 +1199,7 @@ int CScene_SkinSelect::getNextSkinIndex(DWORD sourceIndex) { nextSkin = eDefaultSkins_ServerSelected; } - else if(m_currentPack != nullptr && nextSkin>=m_currentPack->getSkinCount()) + else if(m_currentPack != NULL && nextSkin>=m_currentPack->getSkinCount()) { nextSkin = 0; } @@ -1233,7 +1233,7 @@ int CScene_SkinSelect::getPreviousSkinIndex(DWORD sourceIndex) { previousSkin = eDefaultSkins_Count - 1; } - else if(m_currentPack != nullptr) + else if(m_currentPack != NULL) { previousSkin = m_currentPack->getSkinCount()-1; } @@ -1311,7 +1311,7 @@ void CScene_SkinSelect::updateClipping() int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_SkinSelect* pScene = static_cast(pParam); + CScene_SkinSelect* pScene = (CScene_SkinSelect*)pParam; #ifdef _XBOX if(result==C4JStorage::EMessage_ResultAccept) { @@ -1320,7 +1320,7 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_currentPack->getPurchaseOfferId()); - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -1330,13 +1330,13 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes } // If we're in-game, then we need to enable DLC downloads. They'll be set back to Auto on leaving the pause menu - if(Minecraft::GetInstance()->level!=nullptr) + if(Minecraft::GetInstance()->level!=NULL) { // need to allow downloads here, or the player would need to quit the game to let the download of a skin pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); } - StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); + StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -1380,7 +1380,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete() if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin)>0) { m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); - if(m_currentPack != nullptr) + if(m_currentPack != NULL) { bool bFound = false; m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; @@ -1400,7 +1400,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete() updateCurrentFocus(); m_bIgnoreInput=false; app.m_dlcManager.checkForCorruptDLCAndAlert(); - bool bInGame=(Minecraft::GetInstance()->level!=nullptr); + bool bInGame=(Minecraft::GetInstance()->level!=NULL); if(bInGame) XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); diff --git a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp index 2bd84263..f237e7d8 100644 --- a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp @@ -21,7 +21,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *static_cast(pInitData->pvInitData); + m_iPad = *(int *)pInitData->pvInitData; MapChildControls(); @@ -48,8 +48,8 @@ HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) wstring wDesc = m_EditDesc.GetText(); // set the caret to the end of the default text - m_EditCaption.SetCaretPosition(static_cast(wCaption.length())); - m_EditDesc.SetCaretPosition(static_cast(wDesc.length())); + m_EditCaption.SetCaretPosition((int)wCaption.length()); + m_EditDesc.SetCaretPosition((int)wDesc.length()); BOOL bHasAllText = /*( wTitle.length()!=0) && */(wCaption.length()!=0) && (wDesc.length()!=0); @@ -89,7 +89,7 @@ HRESULT CScene_SocialPost::OnControlNavigate(XUIMessageControlNavigate *pControl { pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE); - if(pControlNavigateData->hObjDest==nullptr) + if(pControlNavigateData->hObjDest==NULL) { pControlNavigateData->hObjDest=pControlNavigateData->hObjSource; } diff --git a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp index bbf0005e..1d6ac3bf 100644 --- a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp @@ -21,7 +21,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_Teleport::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - TeleportMenuInitData *initParam = static_cast(pInitData->pvInitData); + TeleportMenuInitData *initParam = (TeleportMenuInitData *)pInitData->pvInitData; m_iPad = initParam->iPad; m_teleportToPlayer = initParam->teleportToPlayer; @@ -51,7 +51,7 @@ HRESULT CScene_Teleport::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != nullptr && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) + if( player != NULL && !(player->IsLocal() && player->GetUserIndex() == m_iPad) ) { m_players[m_playersCount] = player->GetSmallId(); ++m_playersCount; @@ -125,7 +125,7 @@ HRESULT CScene_Teleport::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pN void CScene_Teleport::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - CScene_Teleport *scene = static_cast(callbackParam); + CScene_Teleport *scene = (CScene_Teleport *)callbackParam; bool playerFound = false; for(int i = 0; i < scene->m_playersCount; ++i) @@ -167,7 +167,7 @@ HRESULT CScene_Teleport::OnGetSourceDataText(XUIMessageGetSourceText *pGetSource if( pGetSourceTextData->iItem < m_playersCount ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[pGetSourceTextData->iItem] ); - if( player != nullptr ) + if( player != NULL ) { #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<HasVoice() ) + if(player != NULL && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { diff --git a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp index 5eff65e8..0369928b 100644 --- a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp @@ -24,7 +24,7 @@ HRESULT CScene_TextEntry::Init_Commands() HRESULT CScene_TextEntry::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { MapChildControls(); - XuiTextInputParams *params = static_cast(pInitData->pvInitData); + XuiTextInputParams *params = (XuiTextInputParams *)pInitData->pvInitData; m_iPad=params->iPad; m_wchInitialChar=params->wch; delete params; diff --git a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp index da224f7a..5a2e67b4 100644 --- a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp @@ -16,7 +16,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { m_iX=-1; - m_params = static_cast(pInitData->pvInitData); + m_params = (LoadMenuInitData *)pInitData->pvInitData; m_iPad=m_params->iPad; @@ -26,9 +26,9 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand VOID *pObj; XuiObjectFromHandle( m_SavesSlotList, &pObj ); - m_pSavesSlotList = static_cast(pObj); + m_pSavesSlotList = (CXuiCtrl4JList *)pObj; - m_pbImageData=nullptr; + m_pbImageData=NULL; m_dwImageBytes=0; StorageManager.GetSaveCacheFileInfo(m_params->iSaveGameInfoIndex,m_XContentData); @@ -48,7 +48,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand // saves will be called slot1 to slotx // there will be a details file with the names and png of each slot - m_pbSlotListFile=nullptr; + m_pbSlotListFile=NULL; m_uiSlotListFileBytes=0; if(StorageManager.TMSPP_InFileList(C4JStorage::eGlobalStorage_TitleUser,m_iPad,L"XboxOne/SlotList")) @@ -86,7 +86,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand //---------------------------------------------------------------------------------- int CScene_TransferToXboxOne::TMSPPWriteReturned(LPVOID pParam,int iPad,int iUserData) { - CScene_TransferToXboxOne* pClass = static_cast(pParam); + CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam; pClass->m_bWaitingForWrite=false; return 0; @@ -97,13 +97,13 @@ int CScene_TransferToXboxOne::TMSPPWriteReturned(LPVOID pParam,int iPad,int iUse //---------------------------------------------------------------------------------- int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUserData) { - CScene_TransferToXboxOne* pClass = static_cast(pParam); + CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam; pClass->m_SavesSlotListTimer.SetShow(FALSE); pClass->m_bIgnoreInput=false; // update the slots delete pClass->m_pbSlotListFile; - pClass->m_pbSlotListFile=nullptr; + pClass->m_pbSlotListFile=NULL; pClass->m_uiSlotListFileBytes=0; pClass->m_pSavesSlotList->RemoveAllData(); CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; @@ -129,7 +129,7 @@ int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUs //---------------------------------------------------------------------------------- int CScene_TransferToXboxOne::TMSPPSlotListReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename) { - CScene_TransferToXboxOne* pClass = static_cast(pParam); + CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam; unsigned int uiSlotListFileSlots=*((unsigned int *)pFileData->pbData); pClass->m_pbSlotListFile=pFileData->pbData; pClass->m_uiSlotListFileBytes=pFileData->dwSize; @@ -220,7 +220,7 @@ HRESULT CScene_TransferToXboxOne::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify // check if there is a save there CXuiCtrl4JList::LIST_ITEM_INFO info = m_pSavesSlotList->GetData(iIndex); - if(info.pwszImage!=nullptr) + if(info.pwszImage!=NULL) { // we have a save here // Are you sure, etc. @@ -252,10 +252,10 @@ HRESULT CScene_TransferToXboxOne::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbImageData,DWORD dwImageBytes ) { - SLOTDATA *pCurrentSlotData=nullptr; - PBYTE pbCurrentSlotDataPtr=nullptr; + SLOTDATA *pCurrentSlotData=NULL; + PBYTE pbCurrentSlotDataPtr=NULL; // there may be no slot file yet - if(m_pbSlotListFile!=nullptr) + if(m_pbSlotListFile!=NULL) { pCurrentSlotData=(SLOTDATA *)(m_pbSlotListFile+sizeof(unsigned int)); pbCurrentSlotDataPtr=m_pbSlotListFile + sizeof(unsigned int) + sizeof(SLOTDATA)*m_MaxSlotC; @@ -298,7 +298,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI } else { - if(pbCurrentSlotDataPtr!=nullptr) + if(pbCurrentSlotDataPtr!=NULL) { memcpy(pbNewSlotImageDataPtr,pbCurrentSlotDataPtr,pCurrentSlotData[i].uiImageLength); pbNewSlotImageDataPtr+=pCurrentSlotData[i].uiImageLength; @@ -307,7 +307,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI } // move to the next image data in the current slot file - if(pbCurrentSlotDataPtr!=nullptr) + if(pbCurrentSlotDataPtr!=NULL) { pbCurrentSlotDataPtr+=pCurrentSlotData[i].uiImageLength; } @@ -323,7 +323,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc; - loadingParams->lpParam = static_cast(this); + loadingParams->lpParam = (LPVOID)this; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -342,7 +342,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter { HRESULT hr = S_OK; char szFilename[32]; - CScene_TransferToXboxOne* pClass = static_cast(lpParameter); + CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) lpParameter; Minecraft *pMinecraft = Minecraft::GetInstance(); unsigned int uiComplete=0; pClass->m_bWaitingForWrite=true; @@ -415,7 +415,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter for(int i=0;i<(pClass->m_uiStorageLength/uiChunkSize)+1;i++) { sprintf( szFilename, "XboxOne/Slot%.2d%.2d", pClass->m_uiSlotID,i ); - PCHAR pchData=static_cast(pClass->m_pvSaveMem)+i*uiChunkSize; + PCHAR pchData=((PCHAR)pClass->m_pvSaveMem)+i*uiChunkSize; pClass->m_bWaitingForWrite=true; if(uiBytesLeft>=uiChunkSize) @@ -461,7 +461,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter int CScene_TransferToXboxOne::LoadSaveDataReturned(void *pParam,bool bContinue) { - CScene_TransferToXboxOne* pClass = static_cast(pParam); + CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne*)pParam; if(bContinue==true) { @@ -502,7 +502,7 @@ HRESULT CScene_TransferToXboxOne::OnKeyDown(XUIMessageInput* pInputData, BOOL& r break; case VK_PAD_X: // wipe the save slots - if(m_pbSlotListFile!=nullptr) + if(m_pbSlotListFile!=NULL) { m_SavesSlotListTimer.SetShow(TRUE); m_bIgnoreInput=true; diff --git a/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp b/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp index d99df998..51121099 100644 --- a/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp @@ -19,7 +19,7 @@ WCHAR *CScene_TrialExitUpsell::wchImages[]= //---------------------------------------------------------------------------------- HRESULT CScene_TrialExitUpsell::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp index 29893d04..98951d81 100644 --- a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp @@ -14,7 +14,7 @@ HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled { HRESULT hr = S_OK; - tutorial = static_cast(pInitData->pvInitData); + tutorial = (Tutorial *)pInitData->pvInitData; m_iPad = tutorial->getPad(); MapChildControls(); @@ -29,7 +29,7 @@ HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled m_textFontSize = _fromString( m_fontSizeControl.GetText() ); m_fontSizeControl.SetShow(false); - m_interactScene = nullptr; + m_interactScene = NULL; m_lastSceneMovedLeft = false; m_bAllowFade = false; @@ -63,7 +63,7 @@ HRESULT CScene_TutorialPopup::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) void CScene_TutorialPopup::UpdateInteractScenePosition(bool visible) { - if( m_interactScene == nullptr ) return; + if( m_interactScene == NULL ) return; // 4J-PB - check this players screen section to see if we should allow the animation bool bAllowAnim=false; @@ -146,8 +146,8 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR { HRESULT hr = S_OK; m_interactScene = interactScene; - if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = nullptr; - if(desc == nullptr) + if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL; + if(desc == NULL) { SetShow( false ); XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME); @@ -195,7 +195,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR hr = XuiElementGetPosition( m_title, &titlePos ); BOOL titleShowAtStart = m_title.IsShown(); - if( title != nullptr && title[0] != 0 ) + if( title != NULL && title[0] != 0 ) { m_title.SetText( title ); m_title.SetShow(TRUE); @@ -241,7 +241,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR SetBounds(fWidth, fHeight + heightDiff); m_description.GetBounds(&fWidth,&fHeight); - m_description.SetBounds(fWidth, static_cast(contentDims.nPageHeight + heightDiff)); + m_description.SetBounds(fWidth, (float)(contentDims.nPageHeight + heightDiff)); } return hr; } @@ -269,7 +269,7 @@ HRESULT CScene_TutorialPopup::SetDescription(int iPad, TutorialPopupInfo *info) parsed = CScene_TutorialPopup::ParseDescription(iPad, parsed); if(parsed.empty()) { - hr = pThis->_SetDescription( info->interactScene, nullptr, nullptr, info->allowFade, info->isReminder ); + hr = pThis->_SetDescription( info->interactScene, NULL, NULL, info->allowFade, info->isReminder ); } else { @@ -289,7 +289,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS if( icon != TUTORIAL_NO_ICON ) { bool itemIsFoil = false; - itemIsFoil = (std::make_shared(icon, 1, iAuxVal))->isFoil(); + itemIsFoil = (shared_ptr(new ItemInstance(icon,1,iAuxVal)))->isFoil(); if(!itemIsFoil) itemIsFoil = isFoil; m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil); @@ -298,13 +298,13 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS { wstring openTag(L"{*ICON*}"); wstring closeTag(L"{*/ICON*}"); - size_t iconTagStartPos = temp.find(openTag); - size_t iconStartPos = iconTagStartPos + openTag.length(); - if( iconTagStartPos > 0 && iconStartPos < temp.length() ) + int iconTagStartPos = (int)temp.find(openTag); + int iconStartPos = iconTagStartPos + (int)openTag.length(); + if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) { - size_t iconEndPos = temp.find(closeTag, iconStartPos); + int iconEndPos = (int)temp.find( closeTag, iconStartPos ); - if(iconEndPos > iconStartPos && iconEndPos < temp.length() ) + if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) { wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); @@ -322,7 +322,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS } bool itemIsFoil = false; - itemIsFoil = (std::make_shared(iconId, 1, iAuxVal))->isFoil(); + itemIsFoil = (shared_ptr(new ItemInstance(iconId,1,iAuxVal)))->isFoil(); if(!itemIsFoil) itemIsFoil = isFoil; m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil); @@ -443,13 +443,13 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc) wstring openTag(L"{*IMAGE*}"); wstring closeTag(L"{*/IMAGE*}"); - size_t imageTagStartPos = desc.find(openTag); - size_t imageStartPos = imageTagStartPos + openTag.length(); - if( imageTagStartPos > 0 && imageStartPos < desc.length() ) + int imageTagStartPos = (int)desc.find(openTag); + int imageStartPos = imageTagStartPos + (int)openTag.length(); + if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) { - size_t imageEndPos = desc.find(closeTag, imageStartPos); + int imageEndPos = (int)desc.find( closeTag, imageStartPos ); - if(imageEndPos > imageStartPos && imageEndPos < desc.length() ) + if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) { wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); m_image.SetImagePath( id.c_str() ); @@ -564,7 +564,7 @@ HRESULT CScene_TutorialPopup::SetSceneVisible(int iPad, bool show) if( XuiClassDerivesFrom( objClass, thisClass ) ) { CScene_TutorialPopup *pThis; - hr = XuiObjectFromHandle(hObj, static_cast(&pThis)); + hr = XuiObjectFromHandle(hObj, (void **) &pThis); if (FAILED(hr)) return hr; @@ -593,7 +593,7 @@ bool CScene_TutorialPopup::IsSceneVisible(int iPad) if( XuiClassDerivesFrom( objClass, thisClass ) ) { CScene_TutorialPopup *pThis; - hr = XuiObjectFromHandle(hObj, static_cast(&pThis)); + hr = XuiObjectFromHandle(hObj, (void **) &pThis); if (FAILED(hr)) return false; diff --git a/Minecraft.Client/Common/XUI/XUI_debug.cpp b/Minecraft.Client/Common/XUI/XUI_debug.cpp index 9aee3888..61b818a0 100644 --- a/Minecraft.Client/Common/XUI/XUI_debug.cpp +++ b/Minecraft.Client/Common/XUI/XUI_debug.cpp @@ -50,7 +50,7 @@ LPCWSTR CScene_Debug::m_DebugButtonTextA[eDebugButton_Max+1]= //---------------------------------------------------------------------------------- HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*static_cast(pInitData->pvInitData); + m_iPad=*(int *)pInitData->pvInitData; // set text and enable any debug options required int iCheckboxIndex=0; @@ -89,7 +89,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiCreateObject( XUI_CLASS_CHECKBOX, &m_DebugCheckboxDataA[iCheckboxIndex].hXuiObj ); XuiObjectFromHandle( m_DebugCheckboxDataA[iCheckboxIndex].hXuiObj, &m_DebugCheckboxDataA[iCheckboxIndex].pvData ); - pCheckbox = static_cast(m_DebugCheckboxDataA[iCheckboxIndex].pvData); + pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[iCheckboxIndex].pvData; //m_phXuiObjA[iElementIndex] = pCheckbox->m_hObj; pCheckbox->SetText(m_DebugCheckboxTextA[iCheckboxIndex]); pCheckbox->SetShow(TRUE); @@ -139,7 +139,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiCreateObject( XUI_CLASS_BUTTON, &m_DebugButtonDataA[iButtonIndex].hXuiObj ); XuiObjectFromHandle( m_DebugButtonDataA[iButtonIndex].hXuiObj, &m_DebugButtonDataA[iButtonIndex].pvData ); - pButton = static_cast(m_DebugButtonDataA[iButtonIndex].pvData); + pButton = (CXuiControl *)m_DebugButtonDataA[iButtonIndex].pvData; //m_phXuiObjA[iElementIndex] = pCheckbox->m_hObj; pButton->SetText(m_DebugButtonTextA[iButtonIndex]); pButton->SetShow(TRUE); @@ -171,7 +171,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) for(int i=0;i(m_DebugCheckboxDataA[i].pvData); + CXuiCheckbox *pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[i].pvData; pCheckbox->SetCheck( (uiDebugBitmask&(1<(m_DebugCheckboxDataA[i].pvData); + CXuiCheckbox *pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[i].pvData; uiDebugBitmask|=pCheckbox->IsChecked()?(1< -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif -#endif -#ifdef DYNAMIC_CRC_TABLE -# define Z_ONCE -#endif - -#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ - -#ifdef HAVE_S390X_VX -# include "contrib/crc32vx/crc32_vx_hooks.h" -#endif - - /* - A CRC of a message is computed on N braids of words in the message, where - each word consists of W bytes (4 or 8). If N is 3, for example, then three - running sparse CRCs are calculated respectively on each braid, at these - indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... - This is done starting at a word boundary, and continues until as many blocks - of N * W bytes as are available have been processed. The results are combined - into a single CRC at the end. For this code, N must be in the range 1..6 and - W must be 4 or 8. The upper limit on N can be increased if desired by adding - more #if blocks, extending the patterns apparent in the code. In addition, - crc32.h would need to be regenerated, if the maximum N value is increased. - - N and W are chosen empirically by benchmarking the execution time on a given - processor. The choices for N and W below were based on testing on Intel Kaby - Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 - Octeon II processors. The Intel, AMD, and ARM processors were all fastest - with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. - They were all tested with either gcc or clang, all using the -O3 optimization - level. Your mileage may vary. - */ - -/* Define N */ -#ifdef Z_TESTN -# define N Z_TESTN -#else -# define N 5 -#endif -#if N < 1 || N > 6 -# error N must be in 1..6 -#endif - -/* - z_crc_t must be at least 32 bits. z_word_t must be at least as long as - z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and - that bytes are eight bits. - */ - -/* - Define W and the associated z_word_t type. If W is not defined, then a - braided calculation is not used, and the associated tables and code are not - compiled. - */ -#ifdef Z_TESTW -# if Z_TESTW-1 != -1 -# define W Z_TESTW -# endif -#else -# ifdef MAKECRCH -# define W 8 /* required for MAKECRCH */ -# else -# if defined(__x86_64__) || defined(__aarch64__) -# define W 8 -# else -# define W 4 -# endif -# endif -#endif -#ifdef W -# if W == 8 && defined(Z_U8) - typedef Z_U8 z_word_t; -# elif defined(Z_U4) -# undef W -# define W 4 - typedef Z_U4 z_word_t; -# else -# undef W -# endif -#endif - -/* If available, use the ARM processor CRC32 instruction. */ -#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && \ - defined(W) && W == 8 -# define ARMCRC32 -#endif - -#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) -/* - Swap the bytes in a z_word_t to convert between little and big endian. Any - self-respecting compiler will optimize this to a single machine byte-swap - instruction, if one is available. This assumes that word_t is either 32 bits - or 64 bits. - */ -local z_word_t byte_swap(z_word_t word) { -# if W == 8 - return - (word & 0xff00000000000000) >> 56 | - (word & 0xff000000000000) >> 40 | - (word & 0xff0000000000) >> 24 | - (word & 0xff00000000) >> 8 | - (word & 0xff000000) << 8 | - (word & 0xff0000) << 24 | - (word & 0xff00) << 40 | - (word & 0xff) << 56; -# else /* W == 4 */ - return - (word & 0xff000000) >> 24 | - (word & 0xff0000) >> 8 | - (word & 0xff00) << 8 | - (word & 0xff) << 24; -# endif -} -#endif - -#ifdef DYNAMIC_CRC_TABLE -/* ========================================================================= - * Table of powers of x for combining CRC-32s, filled in by make_crc_table() - * below. - */ - local z_crc_t FAR x2n_table[32]; -#else -/* ========================================================================= - * Tables for byte-wise and braided CRC-32 calculations, and a table of powers - * of x for combining CRC-32s, all made by make_crc_table(). - */ -# include "crc32.h" -#endif - -/* CRC polynomial. */ -#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ - -/* - Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, - reflected. For speed, this requires that a not be zero. - */ -local uLong multmodp(uLong a, uLong b) { - uLong m, p; - - m = (uLong)1 << 31; - p = 0; - for (;;) { - if (a & m) { - p ^= b; - if ((a & (m - 1)) == 0) - break; - } - m >>= 1; - b = b & 1 ? (b >> 1) ^ POLY : b >> 1; - } - return p; -} - -/* - Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been - initialized. n must not be negative. - */ -local uLong x2nmodp(z_off64_t n, unsigned k) { - uLong p; - - p = (uLong)1 << 31; /* x^0 == 1 */ - while (n) { - if (n & 1) - p = multmodp(x2n_table[k & 31], p); - n >>= 1; - k++; - } - return p; -} - -#ifdef DYNAMIC_CRC_TABLE -/* ========================================================================= - * Build the tables for byte-wise and braided CRC-32 calculations, and a table - * of powers of x for combining CRC-32s. - */ -local z_crc_t FAR crc_table[256]; -#ifdef W - local z_word_t FAR crc_big_table[256]; - local z_crc_t FAR crc_braid_table[W][256]; - local z_word_t FAR crc_braid_big_table[W][256]; - local void braid(z_crc_t [][256], z_word_t [][256], int, int); -#endif -#ifdef MAKECRCH - local void write_table(FILE *, const z_crc_t FAR *, int); - local void write_table32hi(FILE *, const z_word_t FAR *, int); - local void write_table64(FILE *, const z_word_t FAR *, int); -#endif /* MAKECRCH */ - -/* State for once(). */ -local z_once_t made = Z_ONCE_INIT; - -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x - (which is shifting right by one and adding x^32 mod p if the bit shifted out - is a one). We start with the highest power (least significant bit) of q and - repeat for all eight bits of q. - - The table is simply the CRC of all possible eight bit values. This is all the - information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. - */ - -local void make_crc_table(void) { - unsigned i, j, n; - z_crc_t p; - - /* initialize the CRC of bytes tables */ - for (i = 0; i < 256; i++) { - p = i; - for (j = 0; j < 8; j++) - p = p & 1 ? (p >> 1) ^ POLY : p >> 1; - crc_table[i] = p; -#ifdef W - crc_big_table[i] = byte_swap(p); -#endif - } - - /* initialize the x^2^n mod p(x) table */ - p = (z_crc_t)1 << 30; /* x^1 */ - x2n_table[0] = p; - for (n = 1; n < 32; n++) - x2n_table[n] = p = (z_crc_t)multmodp(p, p); - -#ifdef W - /* initialize the braiding tables -- needs x2n_table[] */ - braid(crc_braid_table, crc_braid_big_table, N, W); -#endif - -#ifdef MAKECRCH - { - /* - The crc32.h header file contains tables for both 32-bit and 64-bit - z_word_t's, and so requires a 64-bit type be available. In that case, - z_word_t must be defined to be 64-bits. This code then also generates - and writes out the tables for the case that z_word_t is 32 bits. - */ -#if !defined(W) || W != 8 -# error Need a 64-bit integer type in order to generate crc32.h. -#endif - FILE *out; - int k, n; - z_crc_t ltl[8][256]; - z_word_t big[8][256]; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - - /* write out little-endian CRC table to crc32.h */ - fprintf(out, - "/* crc32.h -- tables for rapid CRC calculation\n" - " * Generated automatically by crc32.c\n */\n" - "\n" - "local const z_crc_t FAR crc_table[] = {\n" - " "); - write_table(out, crc_table, 256); - fprintf(out, - "};\n"); - - /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ - fprintf(out, - "\n" - "#ifdef W\n" - "\n" - "#if W == 8\n" - "\n" - "local const z_word_t FAR crc_big_table[] = {\n" - " "); - write_table64(out, crc_big_table, 256); - fprintf(out, - "};\n"); - - /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ - fprintf(out, - "\n" - "#else /* W == 4 */\n" - "\n" - "local const z_word_t FAR crc_big_table[] = {\n" - " "); - write_table32hi(out, crc_big_table, 256); - fprintf(out, - "};\n" - "\n" - "#endif\n"); - - /* write out braid tables for each value of N */ - for (n = 1; n <= 6; n++) { - fprintf(out, - "\n" - "#if N == %d\n", n); - - /* compute braid tables for this N and 64-bit word_t */ - braid(ltl, big, n, 8); - - /* write out braid tables for 64-bit z_word_t to crc32.h */ - fprintf(out, - "\n" - "#if W == 8\n" - "\n" - "local const z_crc_t FAR crc_braid_table[][256] = {\n"); - for (k = 0; k < 8; k++) { - fprintf(out, " {"); - write_table(out, ltl[k], 256); - fprintf(out, "}%s", k < 7 ? ",\n" : ""); - } - fprintf(out, - "};\n" - "\n" - "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); - for (k = 0; k < 8; k++) { - fprintf(out, " {"); - write_table64(out, big[k], 256); - fprintf(out, "}%s", k < 7 ? ",\n" : ""); - } - fprintf(out, - "};\n"); - - /* compute braid tables for this N and 32-bit word_t */ - braid(ltl, big, n, 4); - - /* write out braid tables for 32-bit z_word_t to crc32.h */ - fprintf(out, - "\n" - "#else /* W == 4 */\n" - "\n" - "local const z_crc_t FAR crc_braid_table[][256] = {\n"); - for (k = 0; k < 4; k++) { - fprintf(out, " {"); - write_table(out, ltl[k], 256); - fprintf(out, "}%s", k < 3 ? ",\n" : ""); - } - fprintf(out, - "};\n" - "\n" - "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); - for (k = 0; k < 4; k++) { - fprintf(out, " {"); - write_table32hi(out, big[k], 256); - fprintf(out, "}%s", k < 3 ? ",\n" : ""); - } - fprintf(out, - "};\n" - "\n" - "#endif\n" - "\n" - "#endif\n"); - } - fprintf(out, - "\n" - "#endif\n"); - - /* write out zeros operator table to crc32.h */ - fprintf(out, - "\n" - "local const z_crc_t FAR x2n_table[] = {\n" - " "); - write_table(out, x2n_table, 32); - fprintf(out, - "};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH - -/* - Write the 32-bit values in table[0..k-1] to out, five per line in - hexadecimal separated by commas. - */ -local void write_table(FILE *out, const z_crc_t FAR *table, int k) { - int n; - - for (n = 0; n < k; n++) - fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", - (unsigned long)(table[n]), - n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); -} - -/* - Write the high 32-bits of each value in table[0..k-1] to out, five per line - in hexadecimal separated by commas. - */ -local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) { - int n; - - for (n = 0; n < k; n++) - fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", - (unsigned long)(table[n] >> 32), - n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); -} - -/* - Write the 64-bit values in table[0..k-1] to out, three per line in - hexadecimal separated by commas. This assumes that if there is a 64-bit - type, then there is also a long long integer type, and it is at least 64 - bits. If not, then the type cast and format string can be adjusted - accordingly. - */ -local void write_table64(FILE *out, const z_word_t FAR *table, int k) { - int n; - - for (n = 0; n < k; n++) - fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", - (unsigned long long)(table[n]), - n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); -} - -/* Actually do the deed. */ -int main(void) { - make_crc_table(); - return 0; -} - -#endif /* MAKECRCH */ - -#ifdef W -/* - Generate the little and big-endian braid tables for the given n and z_word_t - size w. Each array must have room for w blocks of 256 elements. - */ -local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) { - int k; - z_crc_t i, p, q; - for (k = 0; k < w; k++) { - p = (z_crc_t)x2nmodp((n * w + 3 - k) << 3, 0); - ltl[k][0] = 0; - big[w - 1 - k][0] = 0; - for (i = 1; i < 256; i++) { - ltl[k][i] = q = (z_crc_t)multmodp(i << 24, p); - big[w - 1 - k][i] = byte_swap(q); - } - } -} -#endif - -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32(), and to force the - * generation of the CRC tables in a threaded application. - */ -const z_crc_t FAR * ZEXPORT get_crc_table(void) { -#ifdef DYNAMIC_CRC_TABLE - z_once(&made, make_crc_table); -#endif /* DYNAMIC_CRC_TABLE */ - return (const z_crc_t FAR *)crc_table; -} - -/* ========================================================================= - * Use ARM machine instructions if available. This will compute the CRC about - * ten times faster than the braided calculation. This code does not check for - * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will - * only be defined if the compilation specifies an ARM processor architecture - * that has the instructions. For example, compiling with -march=armv8.1-a or - * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 - * instructions. - */ -#ifdef ARMCRC32 - -/* - Constants empirically determined to maximize speed. These values are from - measurements on a Cortex-A57. Your mileage may vary. - */ -#define Z_BATCH 3990 /* number of words in a batch */ -#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ -#define Z_BATCH_MIN 800 /* fewest words in a final batch */ - -uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) { - uLong val; - z_word_t crc1, crc2; - const z_word_t *word; - z_word_t val0, val1, val2; - z_size_t last, last2, i; - z_size_t num; - - /* Return initial CRC, if requested. */ - if (buf == Z_NULL) return 0; - -#ifdef DYNAMIC_CRC_TABLE - z_once(&made, make_crc_table); -#endif /* DYNAMIC_CRC_TABLE */ - - /* Pre-condition the CRC */ - crc = (~crc) & 0xffffffff; - - /* Compute the CRC up to a word boundary. */ - while (len && ((z_size_t)buf & 7) != 0) { - len--; - val = *buf++; - __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); - } - - /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ - word = (z_word_t const *)buf; - num = len >> 3; - len &= 7; - - /* Do three interleaved CRCs to realize the throughput of one crc32x - instruction per cycle. Each CRC is calculated on Z_BATCH words. The - three CRCs are combined into a single CRC after each set of batches. */ - while (num >= 3 * Z_BATCH) { - crc1 = 0; - crc2 = 0; - for (i = 0; i < Z_BATCH; i++) { - val0 = word[i]; - val1 = word[i + Z_BATCH]; - val2 = word[i + 2 * Z_BATCH]; - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); - } - word += 3 * Z_BATCH; - num -= 3 * Z_BATCH; - crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; - crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; - } - - /* Do one last smaller batch with the remaining words, if there are enough - to pay for the combination of CRCs. */ - last = num / 3; - if (last >= Z_BATCH_MIN) { - last2 = last << 1; - crc1 = 0; - crc2 = 0; - for (i = 0; i < last; i++) { - val0 = word[i]; - val1 = word[i + last]; - val2 = word[i + last2]; - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); - } - word += 3 * last; - num -= 3 * last; - val = x2nmodp((int)last, 6); - crc = multmodp(val, crc) ^ crc1; - crc = multmodp(val, crc) ^ crc2; - } - - /* Compute the CRC on any remaining words. */ - for (i = 0; i < num; i++) { - val0 = word[i]; - __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); - } - word += num; - - /* Complete the CRC on any remaining bytes. */ - buf = (const unsigned char FAR *)word; - while (len) { - len--; - val = *buf++; - __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); - } - - /* Return the CRC, post-conditioned. */ - return crc ^ 0xffffffff; -} - -#else - -#ifdef W - -/* - Return the CRC of the W bytes in the word_t data, taking the - least-significant byte of the word as the first byte of data, without any pre - or post conditioning. This is used to combine the CRCs of each braid. - */ -local z_crc_t crc_word(z_word_t data) { - int k; - for (k = 0; k < W; k++) - data = (data >> 8) ^ crc_table[data & 0xff]; - return (z_crc_t)data; -} - -local z_word_t crc_word_big(z_word_t data) { - int k; - for (k = 0; k < W; k++) - data = (data << 8) ^ - crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; - return data; -} - -#endif - -/* ========================================================================= */ -uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) { - /* Return initial CRC, if requested. */ - if (buf == Z_NULL) return 0; - -#ifdef DYNAMIC_CRC_TABLE - z_once(&made, make_crc_table); -#endif /* DYNAMIC_CRC_TABLE */ - - /* Pre-condition the CRC */ - crc = (~crc) & 0xffffffff; - -#ifdef W - - /* If provided enough bytes, do a braided CRC calculation. */ - if (len >= N * W + W - 1) { - z_size_t blks; - z_word_t const *words; - unsigned endian; - int k; - - /* Compute the CRC up to a z_word_t boundary. */ - while (len && ((z_size_t)buf & (W - 1)) != 0) { - len--; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - } - - /* Compute the CRC on as many N z_word_t blocks as are available. */ - blks = len / (N * W); - len -= blks * N * W; - words = (z_word_t const *)buf; - - /* Do endian check at execution time instead of compile time, since ARM - processors can change the endianness at execution time. If the - compiler knows what the endianness will be, it can optimize out the - check and the unused branch. */ - endian = 1; - if (*(unsigned char *)&endian) { - /* Little endian. */ - - z_crc_t crc0; - z_word_t word0; -#if N > 1 - z_crc_t crc1; - z_word_t word1; -#if N > 2 - z_crc_t crc2; - z_word_t word2; -#if N > 3 - z_crc_t crc3; - z_word_t word3; -#if N > 4 - z_crc_t crc4; - z_word_t word4; -#if N > 5 - z_crc_t crc5; - z_word_t word5; -#endif -#endif -#endif -#endif -#endif - - /* Initialize the CRC for each braid. */ - crc0 = crc; -#if N > 1 - crc1 = 0; -#if N > 2 - crc2 = 0; -#if N > 3 - crc3 = 0; -#if N > 4 - crc4 = 0; -#if N > 5 - crc5 = 0; -#endif -#endif -#endif -#endif -#endif - - /* - Process the first blks-1 blocks, computing the CRCs on each braid - independently. - */ - while (--blks) { - /* Load the word for each braid into registers. */ - word0 = crc0 ^ words[0]; -#if N > 1 - word1 = crc1 ^ words[1]; -#if N > 2 - word2 = crc2 ^ words[2]; -#if N > 3 - word3 = crc3 ^ words[3]; -#if N > 4 - word4 = crc4 ^ words[4]; -#if N > 5 - word5 = crc5 ^ words[5]; -#endif -#endif -#endif -#endif -#endif - words += N; - - /* Compute and update the CRC for each word. The loop should - get unrolled. */ - crc0 = crc_braid_table[0][word0 & 0xff]; -#if N > 1 - crc1 = crc_braid_table[0][word1 & 0xff]; -#if N > 2 - crc2 = crc_braid_table[0][word2 & 0xff]; -#if N > 3 - crc3 = crc_braid_table[0][word3 & 0xff]; -#if N > 4 - crc4 = crc_braid_table[0][word4 & 0xff]; -#if N > 5 - crc5 = crc_braid_table[0][word5 & 0xff]; -#endif -#endif -#endif -#endif -#endif - for (k = 1; k < W; k++) { - crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; -#if N > 1 - crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; -#if N > 2 - crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; -#if N > 3 - crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; -#if N > 4 - crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; -#if N > 5 - crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; -#endif -#endif -#endif -#endif -#endif - } - } - - /* - Process the last block, combining the CRCs of the N braids at the - same time. - */ - crc = crc_word(crc0 ^ words[0]); -#if N > 1 - crc = crc_word(crc1 ^ words[1] ^ crc); -#if N > 2 - crc = crc_word(crc2 ^ words[2] ^ crc); -#if N > 3 - crc = crc_word(crc3 ^ words[3] ^ crc); -#if N > 4 - crc = crc_word(crc4 ^ words[4] ^ crc); -#if N > 5 - crc = crc_word(crc5 ^ words[5] ^ crc); -#endif -#endif -#endif -#endif -#endif - words += N; - } - else { - /* Big endian. */ - - z_word_t crc0, word0, comb; -#if N > 1 - z_word_t crc1, word1; -#if N > 2 - z_word_t crc2, word2; -#if N > 3 - z_word_t crc3, word3; -#if N > 4 - z_word_t crc4, word4; -#if N > 5 - z_word_t crc5, word5; -#endif -#endif -#endif -#endif -#endif - - /* Initialize the CRC for each braid. */ - crc0 = byte_swap(crc); -#if N > 1 - crc1 = 0; -#if N > 2 - crc2 = 0; -#if N > 3 - crc3 = 0; -#if N > 4 - crc4 = 0; -#if N > 5 - crc5 = 0; -#endif -#endif -#endif -#endif -#endif - - /* - Process the first blks-1 blocks, computing the CRCs on each braid - independently. - */ - while (--blks) { - /* Load the word for each braid into registers. */ - word0 = crc0 ^ words[0]; -#if N > 1 - word1 = crc1 ^ words[1]; -#if N > 2 - word2 = crc2 ^ words[2]; -#if N > 3 - word3 = crc3 ^ words[3]; -#if N > 4 - word4 = crc4 ^ words[4]; -#if N > 5 - word5 = crc5 ^ words[5]; -#endif -#endif -#endif -#endif -#endif - words += N; - - /* Compute and update the CRC for each word. The loop should - get unrolled. */ - crc0 = crc_braid_big_table[0][word0 & 0xff]; -#if N > 1 - crc1 = crc_braid_big_table[0][word1 & 0xff]; -#if N > 2 - crc2 = crc_braid_big_table[0][word2 & 0xff]; -#if N > 3 - crc3 = crc_braid_big_table[0][word3 & 0xff]; -#if N > 4 - crc4 = crc_braid_big_table[0][word4 & 0xff]; -#if N > 5 - crc5 = crc_braid_big_table[0][word5 & 0xff]; -#endif -#endif -#endif -#endif -#endif - for (k = 1; k < W; k++) { - crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; -#if N > 1 - crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; -#if N > 2 - crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; -#if N > 3 - crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; -#if N > 4 - crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; -#if N > 5 - crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; -#endif -#endif -#endif -#endif -#endif - } - } - - /* - Process the last block, combining the CRCs of the N braids at the - same time. - */ - comb = crc_word_big(crc0 ^ words[0]); -#if N > 1 - comb = crc_word_big(crc1 ^ words[1] ^ comb); -#if N > 2 - comb = crc_word_big(crc2 ^ words[2] ^ comb); -#if N > 3 - comb = crc_word_big(crc3 ^ words[3] ^ comb); -#if N > 4 - comb = crc_word_big(crc4 ^ words[4] ^ comb); -#if N > 5 - comb = crc_word_big(crc5 ^ words[5] ^ comb); -#endif -#endif -#endif -#endif -#endif - words += N; - crc = byte_swap(comb); - } - - /* - Update the pointer to the remaining bytes to process. - */ - buf = (unsigned char const *)words; - } - -#endif /* W */ - - /* Complete the computation of the CRC on any remaining bytes. */ - while (len >= 8) { - len -= 8; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - } - while (len) { - len--; - crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; - } - - /* Return the CRC, post-conditioned. */ - return crc ^ 0xffffffff; -} - -#endif - -/* ========================================================================= */ -uLong ZEXPORT crc32(uLong crc, const unsigned char FAR *buf, uInt len) { - #ifdef HAVE_S390X_VX - return crc32_z_hook(crc, buf, len); - #endif - return crc32_z(crc, buf, len); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) { - if (len2 < 0) - return 0; -#ifdef DYNAMIC_CRC_TABLE - z_once(&made, make_crc_table); -#endif /* DYNAMIC_CRC_TABLE */ - return x2nmodp(len2, 3); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine_gen(z_off_t len2) { - return crc32_combine_gen64((z_off64_t)len2); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) { - if (op == 0) - return 0; - return multmodp(op, crc1 & 0xffffffff) ^ (crc2 & 0xffffffff); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) { - return crc32_combine_op(crc1, crc2, crc32_combine_gen64(len2)); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) { - return crc32_combine64(crc1, crc2, (z_off64_t)len2); -} +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2026 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + + MAKECRCH can be #defined to write out crc32.h. A main() routine is also + produced, so that this one source file can be compiled to an executable. + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif +#endif +#ifdef DYNAMIC_CRC_TABLE +# define Z_ONCE +#endif + +#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ + +#ifdef HAVE_S390X_VX +# include "contrib/crc32vx/crc32_vx_hooks.h" +#endif + + /* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32.h would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. + */ + +/* Define N */ +#ifdef Z_TESTN +# define N Z_TESTN +#else +# define N 5 +#endif +#if N < 1 || N > 6 +# error N must be in 1..6 +#endif + +/* + z_crc_t must be at least 32 bits. z_word_t must be at least as long as + z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and + that bytes are eight bits. + */ + +/* + Define W and the associated z_word_t type. If W is not defined, then a + braided calculation is not used, and the associated tables and code are not + compiled. + */ +#ifdef Z_TESTW +# if Z_TESTW-1 != -1 +# define W Z_TESTW +# endif +#else +# ifdef MAKECRCH +# define W 8 /* required for MAKECRCH */ +# else +# if defined(__x86_64__) || defined(__aarch64__) +# define W 8 +# else +# define W 4 +# endif +# endif +#endif +#ifdef W +# if W == 8 && defined(Z_U8) + typedef Z_U8 z_word_t; +# elif defined(Z_U4) +# undef W +# define W 4 + typedef Z_U4 z_word_t; +# else +# undef W +# endif +#endif + +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && \ + defined(W) && W == 8 +# define ARMCRC32 +#endif + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) +/* + Swap the bytes in a z_word_t to convert between little and big endian. Any + self-respecting compiler will optimize this to a single machine byte-swap + instruction, if one is available. This assumes that word_t is either 32 bits + or 64 bits. + */ +local z_word_t byte_swap(z_word_t word) { +# if W == 8 + return + (word & 0xff00000000000000) >> 56 | + (word & 0xff000000000000) >> 40 | + (word & 0xff0000000000) >> 24 | + (word & 0xff00000000) >> 8 | + (word & 0xff000000) << 8 | + (word & 0xff0000) << 24 | + (word & 0xff00) << 40 | + (word & 0xff) << 56; +# else /* W == 4 */ + return + (word & 0xff000000) >> 24 | + (word & 0xff0000) >> 8 | + (word & 0xff00) << 8 | + (word & 0xff) << 24; +# endif +} +#endif + +#ifdef DYNAMIC_CRC_TABLE +/* ========================================================================= + * Table of powers of x for combining CRC-32s, filled in by make_crc_table() + * below. + */ + local z_crc_t FAR x2n_table[32]; +#else +/* ========================================================================= + * Tables for byte-wise and braided CRC-32 calculations, and a table of powers + * of x for combining CRC-32s, all made by make_crc_table(). + */ +# include "crc32.h" +#endif + +/* CRC polynomial. */ +#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ + +/* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. + */ +local uLong multmodp(uLong a, uLong b) { + uLong m, p; + + m = (uLong)1 << 31; + p = 0; + for (;;) { + if (a & m) { + p ^= b; + if ((a & (m - 1)) == 0) + break; + } + m >>= 1; + b = b & 1 ? (b >> 1) ^ POLY : b >> 1; + } + return p; +} + +/* + Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been + initialized. n must not be negative. + */ +local uLong x2nmodp(z_off64_t n, unsigned k) { + uLong p; + + p = (uLong)1 << 31; /* x^0 == 1 */ + while (n) { + if (n & 1) + p = multmodp(x2n_table[k & 31], p); + n >>= 1; + k++; + } + return p; +} + +#ifdef DYNAMIC_CRC_TABLE +/* ========================================================================= + * Build the tables for byte-wise and braided CRC-32 calculations, and a table + * of powers of x for combining CRC-32s. + */ +local z_crc_t FAR crc_table[256]; +#ifdef W + local z_word_t FAR crc_big_table[256]; + local z_crc_t FAR crc_braid_table[W][256]; + local z_word_t FAR crc_braid_big_table[W][256]; + local void braid(z_crc_t [][256], z_word_t [][256], int, int); +#endif +#ifdef MAKECRCH + local void write_table(FILE *, const z_crc_t FAR *, int); + local void write_table32hi(FILE *, const z_word_t FAR *, int); + local void write_table64(FILE *, const z_word_t FAR *, int); +#endif /* MAKECRCH */ + +/* State for once(). */ +local z_once_t made = Z_ONCE_INIT; + +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x + (which is shifting right by one and adding x^32 mod p if the bit shifted out + is a one). We start with the highest power (least significant bit) of q and + repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all the + information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. + */ + +local void make_crc_table(void) { + unsigned i, j, n; + z_crc_t p; + + /* initialize the CRC of bytes tables */ + for (i = 0; i < 256; i++) { + p = i; + for (j = 0; j < 8; j++) + p = p & 1 ? (p >> 1) ^ POLY : p >> 1; + crc_table[i] = p; +#ifdef W + crc_big_table[i] = byte_swap(p); +#endif + } + + /* initialize the x^2^n mod p(x) table */ + p = (z_crc_t)1 << 30; /* x^1 */ + x2n_table[0] = p; + for (n = 1; n < 32; n++) + x2n_table[n] = p = (z_crc_t)multmodp(p, p); + +#ifdef W + /* initialize the braiding tables -- needs x2n_table[] */ + braid(crc_braid_table, crc_braid_big_table, N, W); +#endif + +#ifdef MAKECRCH + { + /* + The crc32.h header file contains tables for both 32-bit and 64-bit + z_word_t's, and so requires a 64-bit type be available. In that case, + z_word_t must be defined to be 64-bits. This code then also generates + and writes out the tables for the case that z_word_t is 32 bits. + */ +#if !defined(W) || W != 8 +# error Need a 64-bit integer type in order to generate crc32.h. +#endif + FILE *out; + int k, n; + z_crc_t ltl[8][256]; + z_word_t big[8][256]; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + + /* write out little-endian CRC table to crc32.h */ + fprintf(out, + "/* crc32.h -- tables for rapid CRC calculation\n" + " * Generated automatically by crc32.c\n */\n" + "\n" + "local const z_crc_t FAR crc_table[] = {\n" + " "); + write_table(out, crc_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#ifdef W\n" + "\n" + "#if W == 8\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table64(out, crc_big_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table32hi(out, crc_big_table, 256); + fprintf(out, + "};\n" + "\n" + "#endif\n"); + + /* write out braid tables for each value of N */ + for (n = 1; n <= 6; n++) { + fprintf(out, + "\n" + "#if N == %d\n", n); + + /* compute braid tables for this N and 64-bit word_t */ + braid(ltl, big, n, 8); + + /* write out braid tables for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#if W == 8\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table64(out, big[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n"); + + /* compute braid tables for this N and 32-bit word_t */ + braid(ltl, big, n, 4); + + /* write out braid tables for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table32hi(out, big[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "#endif\n" + "\n" + "#endif\n"); + } + fprintf(out, + "\n" + "#endif\n"); + + /* write out zeros operator table to crc32.h */ + fprintf(out, + "\n" + "local const z_crc_t FAR x2n_table[] = {\n" + " "); + write_table(out, x2n_table, 32); + fprintf(out, + "};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH + +/* + Write the 32-bit values in table[0..k-1] to out, five per line in + hexadecimal separated by commas. + */ +local void write_table(FILE *out, const z_crc_t FAR *table, int k) { + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n]), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the high 32-bits of each value in table[0..k-1] to out, five per line + in hexadecimal separated by commas. + */ +local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) { + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n] >> 32), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the 64-bit values in table[0..k-1] to out, three per line in + hexadecimal separated by commas. This assumes that if there is a 64-bit + type, then there is also a long long integer type, and it is at least 64 + bits. If not, then the type cast and format string can be adjusted + accordingly. + */ +local void write_table64(FILE *out, const z_word_t FAR *table, int k) { + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", + (unsigned long long)(table[n]), + n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); +} + +/* Actually do the deed. */ +int main(void) { + make_crc_table(); + return 0; +} + +#endif /* MAKECRCH */ + +#ifdef W +/* + Generate the little and big-endian braid tables for the given n and z_word_t + size w. Each array must have room for w blocks of 256 elements. + */ +local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) { + int k; + z_crc_t i, p, q; + for (k = 0; k < w; k++) { + p = (z_crc_t)x2nmodp((n * w + 3 - k) << 3, 0); + ltl[k][0] = 0; + big[w - 1 - k][0] = 0; + for (i = 1; i < 256; i++) { + ltl[k][i] = q = (z_crc_t)multmodp(i << 24, p); + big[w - 1 - k][i] = byte_swap(q); + } + } +} +#endif + +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32(), and to force the + * generation of the CRC tables in a threaded application. + */ +const z_crc_t FAR * ZEXPORT get_crc_table(void) { +#ifdef DYNAMIC_CRC_TABLE + z_once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return (const z_crc_t FAR *)crc_table; +} + +/* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for + * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will + * only be defined if the compilation specifies an ARM processor architecture + * that has the instructions. For example, compiling with -march=armv8.1-a or + * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 + * instructions. + */ +#ifdef ARMCRC32 + +/* + Constants empirically determined to maximize speed. These values are from + measurements on a Cortex-A57. Your mileage may vary. + */ +#define Z_BATCH 3990 /* number of words in a batch */ +#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ +#define Z_BATCH_MIN 800 /* fewest words in a final batch */ + +uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) { + uLong val; + z_word_t crc1, crc2; + const z_word_t *word; + z_word_t val0, val1, val2; + z_size_t last, last2, i; + z_size_t num; + + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; + +#ifdef DYNAMIC_CRC_TABLE + z_once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; + + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ + word = (z_word_t const *)buf; + num = len >> 3; + len &= 7; + + /* Do three interleaved CRCs to realize the throughput of one crc32x + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ + while (num >= 3 * Z_BATCH) { + crc1 = 0; + crc2 = 0; + for (i = 0; i < Z_BATCH; i++) { + val0 = word[i]; + val1 = word[i + Z_BATCH]; + val2 = word[i + 2 * Z_BATCH]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * Z_BATCH; + num -= 3 * Z_BATCH; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; + } + + /* Do one last smaller batch with the remaining words, if there are enough + to pay for the combination of CRCs. */ + last = num / 3; + if (last >= Z_BATCH_MIN) { + last2 = last << 1; + crc1 = 0; + crc2 = 0; + for (i = 0; i < last; i++) { + val0 = word[i]; + val1 = word[i + last]; + val2 = word[i + last2]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * last; + num -= 3 * last; + val = x2nmodp((int)last, 6); + crc = multmodp(val, crc) ^ crc1; + crc = multmodp(val, crc) ^ crc2; + } + + /* Compute the CRC on any remaining words. */ + for (i = 0; i < num; i++) { + val0 = word[i]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + } + word += num; + + /* Complete the CRC on any remaining bytes. */ + buf = (const unsigned char FAR *)word; + while (len) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; +} + +#else + +#ifdef W + +/* + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. + */ +local z_crc_t crc_word(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (z_crc_t)data; +} + +local z_word_t crc_word_big(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} + +#endif + +/* ========================================================================= */ +uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) { + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; + +#ifdef DYNAMIC_CRC_TABLE + z_once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; + +#ifdef W + + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + z_size_t blks; + z_word_t const *words; + unsigned endian; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((z_size_t)buf & (W - 1)) != 0) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + /* Do endian check at execution time instead of compile time, since ARM + processors can change the endianness at execution time. If the + compiler knows what the endianness will be, it can optimize out the + check and the unused branch. */ + endian = 1; + if (*(unsigned char *)&endian) { + /* Little endian. */ + + z_crc_t crc0; + z_word_t word0; +#if N > 1 + z_crc_t crc1; + z_word_t word1; +#if N > 2 + z_crc_t crc2; + z_word_t word2; +#if N > 3 + z_crc_t crc3; + z_word_t word3; +#if N > 4 + z_crc_t crc4; + z_word_t word4; +#if N > 5 + z_crc_t crc5; + z_word_t word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = crc; +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + crc = crc_word(crc0 ^ words[0]); +#if N > 1 + crc = crc_word(crc1 ^ words[1] ^ crc); +#if N > 2 + crc = crc_word(crc2 ^ words[2] ^ crc); +#if N > 3 + crc = crc_word(crc3 ^ words[3] ^ crc); +#if N > 4 + crc = crc_word(crc4 ^ words[4] ^ crc); +#if N > 5 + crc = crc_word(crc5 ^ words[5] ^ crc); +#endif +#endif +#endif +#endif +#endif + words += N; + } + else { + /* Big endian. */ + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = byte_swap(crc); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_big_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_big_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_big_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_big_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_big_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_big_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + comb = crc_word_big(crc0 ^ words[0]); +#if N > 1 + comb = crc_word_big(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word_big(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word_big(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word_big(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word_big(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + crc = byte_swap(comb); + } + + /* + Update the pointer to the remaining bytes to process. + */ + buf = (unsigned char const *)words; + } + +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + while (len) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; +} + +#endif + +/* ========================================================================= */ +uLong ZEXPORT crc32(uLong crc, const unsigned char FAR *buf, uInt len) { + #ifdef HAVE_S390X_VX + return crc32_z_hook(crc, buf, len); + #endif + return crc32_z(crc, buf, len); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) { + if (len2 < 0) + return 0; +#ifdef DYNAMIC_CRC_TABLE + z_once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return x2nmodp(len2, 3); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen(z_off_t len2) { + return crc32_combine_gen64((z_off64_t)len2); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) { + if (op == 0) + return 0; + return multmodp(op, crc1 & 0xffffffff) ^ (crc2 & 0xffffffff); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) { + return crc32_combine_op(crc1, crc2, crc32_combine_gen64(len2)); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) { + return crc32_combine64(crc1, crc2, (z_off64_t)len2); +} diff --git a/Minecraft.Client/Common/zlib/trees.c b/Minecraft.Client/Common/zlib/trees.c index 8e4da01e..fa31c0fa 100644 --- a/Minecraft.Client/Common/zlib/trees.c +++ b/Minecraft.Client/Common/zlib/trees.c @@ -1,1119 +1,1119 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2026 Jean-loup Gailly - * detect_data_type() function provided freely by Cosmin Truta, 2006 - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef ZLIB_DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -#ifdef NO_INIT_GLOBAL_POINTERS -# define TCONST -#else -# define TCONST const -#endif - -local TCONST static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local TCONST static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local TCONST static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(unsigned code, int len) { - unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(deflate_state *s) { - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(deflate_state *s) { - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_used = ((s->bi_valid - 1) & 7) + 1; - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent + 7) & ~(ulg)7; -#endif -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) { - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - unsigned code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits - 1]) << 1; - next_code[bits] = (ush)code; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, - "inconsistent bit counts"); - Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); - - for (n = 0; n <= max_code; n++) { - int len = tree[n].Len; - if (len == 0) continue; - /* Now reverse the bits */ - tree[n].Code = (ush)bi_reverse(next_code[len]++, len); - - Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", - n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1)); - } -} - -#ifdef GEN_TREES_H -local void gen_trees_header(void); -#endif - -#ifndef ZLIB_DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* !ZLIB_DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef ZLIB_DEBUG -local void send_bits(deflate_state *s, int value, int length) { - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (ush)value << s->bi_valid; - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= (ush)value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !ZLIB_DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = (int)value;\ - s->bi_buf |= (ush)val << s->bi_valid;\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (ush)(value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* ZLIB_DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init(void) { -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ -#ifdef NO_INIT_GLOBAL_POINTERS - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; -#endif - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = (uch)code; - } - } - Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = (uch)code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256 + dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Generate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef ZLIB_DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width) - 1 ? ",\n" : ", ")) - -void gen_trees_header(void) { - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, - "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(deflate_state *s) { - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->sym_next = s->matches = 0; -} - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void ZLIB_INTERNAL _tr_init(deflate_state *s) { - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->bi_used = 0; -#ifdef ZLIB_DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(deflate_state *s, ct_data *tree, int k) { - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(deflate_state *s, tree_desc *desc) { - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n - base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (unsigned)(bits + xbits); - if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); - } - if (overflow == 0) return; - - Tracev((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -#ifdef DUMP_BL_TREE -# include -#endif - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -local void build_tree(deflate_state *s, tree_desc *desc) { - ct_data *tree = desc->dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree(deflate_state *s, ct_data *tree, int max_code) { - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code + 1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n + 1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += (ush)count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree(deflate_state *s, ct_data *tree, int max_code) { - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code + 1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n + 1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(deflate_state *s) { - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except the - * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; - Tracev((stderr, "\ndyn trees: dyn %lu, stat %lu", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(deflate_state *s, int lcodes, int dcodes, - int blcodes) { - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, - ulg stored_len, int last) { - send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ - bi_windup(s); /* align on byte boundary */ - put_short(s, (ush)stored_len); - put_short(s, (ush)~stored_len); - if (stored_len) - zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); - s->pending += stored_len; -#ifdef ZLIB_DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; - s->bits_sent += 2*16; - s->bits_sent += stored_len << 3; -#endif -} - -/* =========================================================================== - * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) - */ -void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) { - bi_flush(s); -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -void ZLIB_INTERNAL _tr_align(deflate_state *s) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef ZLIB_DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(deflate_state *s, const ct_data *ltree, - const ct_data *dtree) { - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in symbol buffers */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->sym_next != 0) do { -#ifdef LIT_MEM - dist = s->d_buf[sx]; - lc = s->l_buf[sx++]; -#else - dist = s->sym_buf[sx++] & 0xff; - dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; - lc = s->sym_buf[sx++]; -#endif - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= (unsigned)base_dist[code]; - send_bits(s, (int)dist, extra); /* send the extra bits */ - } - } /* literal or match pair ? */ - - /* Check for no overlay of pending_buf on needed symbols */ -#ifdef LIT_MEM - Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); -#else - Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); -#endif - - } while (sx < s->sym_next); - - send_code(s, END_BLOCK, ltree); -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "block list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local int detect_data_type(deflate_state *s) { - /* block_mask is the bit mask of block-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long block_mask = 0xf3ffc07fUL; - int n; - - /* Check for non-textual ("block-listed") bytes. */ - for (n = 0; n <= 31; n++, block_mask >>= 1) - if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) - return Z_BINARY; - - /* Check for textual ("allow-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 - || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "block-listed" or "allow-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and write out the encoded block. - */ -void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, - ulg stored_len, int last) { - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (s->strm->data_type == Z_UNKNOWN) - s->strm->data_type = detect_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %lu, stat %lu", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %lu, stat %lu", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len + 3 + 7) >> 3; - static_lenb = (s->static_len + 3 + 7) >> 3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->sym_next / 3)); - -#ifndef FORCE_STATIC - if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) -#endif - opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len + 4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (static_lenb == opt_lenb) { - send_bits(s, (STATIC_TREES<<1) + last, 3); - compress_block(s, (const ct_data *)static_ltree, - (const ct_data *)static_dtree); -#ifdef ZLIB_DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1) + last, 3); - send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, - max_blindex + 1); - compress_block(s, (const ct_data *)s->dyn_ltree, - (const ct_data *)s->dyn_dtree); -#ifdef ZLIB_DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); -#ifdef ZLIB_DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, - s->compressed_len - 7*(ulg)last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { -#ifdef LIT_MEM - s->d_buf[s->sym_next] = (ush)dist; - s->l_buf[s->sym_next++] = (uch)lc; -#else - s->sym_buf[s->sym_next++] = (uch)dist; - s->sym_buf[s->sym_next++] = (uch)(dist >> 8); - s->sym_buf[s->sym_next++] = (uch)lc; -#endif - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - return (s->sym_next == s->sym_end); -} +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2026 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef ZLIB_DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +#ifdef NO_INIT_GLOBAL_POINTERS +# define TCONST +#else +# define TCONST const +#endif + +local TCONST static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local TCONST static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local TCONST static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(unsigned code, int len) { + unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(deflate_state *s) { + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(deflate_state *s) { + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_used = ((s->bi_valid - 1) & 7) + 1; + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef ZLIB_DEBUG + s->bits_sent = (s->bits_sent + 7) & ~(ulg)7; +#endif +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) { + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + unsigned code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + code = (code + bl_count[bits - 1]) << 1; + next_code[bits] = (ush)code; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, + "inconsistent bit counts"); + Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); + + for (n = 0; n <= max_code; n++) { + int len = tree[n].Len; + if (len == 0) continue; + /* Now reverse the bits */ + tree[n].Code = (ush)bi_reverse(next_code[len]++, len); + + Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", + n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1)); + } +} + +#ifdef GEN_TREES_H +local void gen_trees_header(void); +#endif + +#ifndef ZLIB_DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* !ZLIB_DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef ZLIB_DEBUG +local void send_bits(deflate_state *s, int value, int length) { + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !ZLIB_DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = (int)value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* ZLIB_DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init(void) { +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1 << extra_lbits[code]); n++) { + _length_code[length++] = (uch)code; + } + } + Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length - 1] = (uch)code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1 << extra_dbits[code]); n++) { + _dist_code[dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256 + dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Generate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef ZLIB_DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width) - 1 ? ",\n" : ", ")) + +void gen_trees_header(void) { + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(deflate_state *s) { + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->sym_next = s->matches = 0; +} + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(deflate_state *s) { + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->bi_used = 0; +#ifdef ZLIB_DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(deflate_state *s, ct_data *tree, int k) { + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(deflate_state *s, tree_desc *desc) { + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n - base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (unsigned)(bits + xbits); + if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); + } + if (overflow == 0) return; + + Tracev((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length - 1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +#ifdef DUMP_BL_TREE +# include +#endif + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +local void build_tree(deflate_state *s, tree_desc *desc) { + ct_data *tree = desc->dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree(deflate_state *s, ct_data *tree, int max_code) { + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code + 1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n + 1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += (ush)count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree(deflate_state *s, ct_data *tree, int max_code) { + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code + 1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n + 1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(deflate_state *s) { + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except the + * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; + Tracev((stderr, "\ndyn trees: dyn %lu, stat %lu", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(deflate_state *s, int lcodes, int dcodes, + int blcodes) { + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, + ulg stored_len, int last) { + send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ + bi_windup(s); /* align on byte boundary */ + put_short(s, (ush)stored_len); + put_short(s, (ush)~stored_len); + if (stored_len) + zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); + s->pending += stored_len; +#ifdef ZLIB_DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; + s->bits_sent += 2*16; + s->bits_sent += stored_len << 3; +#endif +} + +/* =========================================================================== + * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) + */ +void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) { + bi_flush(s); +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +void ZLIB_INTERNAL _tr_align(deflate_state *s) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef ZLIB_DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(deflate_state *s, const ct_data *ltree, + const ct_data *dtree) { + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned sx = 0; /* running index in symbol buffers */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else + dist = s->sym_buf[sx++] & 0xff; + dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; + lc = s->sym_buf[sx++]; +#endif + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= (unsigned)base_dist[code]; + send_bits(s, (int)dist, extra); /* send the extra bits */ + } + } /* literal or match pair ? */ + + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else + Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif + + } while (sx < s->sym_next); + + send_code(s, END_BLOCK, ltree); +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "block list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(deflate_state *s) { + /* block_mask is the bit mask of block-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long block_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("block-listed") bytes. */ + for (n = 0; n <= 31; n++, block_mask >>= 1) + if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("allow-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "block-listed" or "allow-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and write out the encoded block. + */ +void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, + ulg stored_len, int last) { + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %lu, stat %lu", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %lu, stat %lu", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len + 3 + 7) >> 3; + static_lenb = (s->static_len + 3 + 7) >> 3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->sym_next / 3)); + +#ifndef FORCE_STATIC + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) +#endif + opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len + 4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (static_lenb == opt_lenb) { + send_bits(s, (STATIC_TREES<<1) + last, 3); + compress_block(s, (const ct_data *)static_ltree, + (const ct_data *)static_dtree); +#ifdef ZLIB_DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1) + last, 3); + send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, + max_blindex + 1); + compress_block(s, (const ct_data *)s->dyn_ltree, + (const ct_data *)s->dyn_dtree); +#ifdef ZLIB_DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef ZLIB_DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, + s->compressed_len - 7*(ulg)last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; +#endif + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + return (s->sym_next == s->sym_end); +} diff --git a/Minecraft.Client/Common/zlib/zlib.h b/Minecraft.Client/Common/zlib/zlib.h index 0a9e7909..398a431a 100644 --- a/Minecraft.Client/Common/zlib/zlib.h +++ b/Minecraft.Client/Common/zlib/zlib.h @@ -1,2057 +1,2057 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3.2.1, February xxth, 2026 - - Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#ifdef ZLIB_BUILD -# include -#else -# include "zconf.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.3.2.1-motley" -#define ZLIB_VERNUM 0x1321 -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 2 -#define ZLIB_VER_SUBREVISION 1 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip and raw deflate streams in - memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in the case of corrupted input. -*/ - -typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); -typedef void (*free_func)(voidpf opaque, voidpf address); - -struct internal_state; - -typedef struct z_stream_s { - z_const Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total number of input bytes read so far */ - - Bytef *next_out; /* next output byte will go here */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total number of bytes output so far */ - - z_const char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text - for deflate, or the decoding state for inflate */ - uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. In that case, zlib is thread-safe. When zalloc and zfree are - Z_NULL on entry to the initialization function, they are set to internal - routines that use the standard library functions malloc() and free(). - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this if - the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers - returned by zalloc for objects of exactly 65536 bytes *must* have their - offset normalized to zero. The default allocation function provided by this - library ensures this (see zutil.c). To reduce memory requirements and avoid - any allocation of 64K objects, at the expense of compression ratio, compile - the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use by the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field for deflate() */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion(void); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. total_in, total_out, adler, and msg are initialized. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more output - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six when the flush marker begins, in order to avoid - repeated flush markers upon calling deflate() again when avail_out == 0. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit(z_streamp strm); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. total_in, total_out, adler, and - msg are initialized. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ - - -ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the input taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress was possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ - - -ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state - was inconsistent. -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy); - - This is another version of deflateInit with more compression options. The - fields zalloc, zfree and opaque must be initialized before by the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_RLE to limit match distances to one (run-length - encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string - matching). Filtered data consists mostly of small values with a somewhat - random distribution, as produced by the PNG filters. In this case, the - compression algorithm is tuned to compress them better. The effect of - Z_FILTERED is to force more Huffman coding and less string matching than the - default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. - Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better - compression for PNG image data than Huffman only. The degree of string - matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then - Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but - never the correctness of the compressed output, even if it is not set - optimally for the given data. Z_FIXED uses the default string matching, but - prevents the use of dynamic Huffman codes, allowing for a simpler decoder - for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, - const Bytef *dictionary, - uInt dictLength); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, - Bytef *dictionary, - uInt *dictLength); -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If deflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similarly, if dictLength is Z_NULL, then it is not set. - - deflateGetDictionary() may return a length less than the window size, even - when more than the window size in input has been provided. It may return up - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, - z_streamp source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset(z_streamp strm); -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. total_in, total_out, adler, and msg are initialized. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams(z_streamp strm, - int level, - int strategy); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression approach (which is a function of the level) or the - strategy is changed, and if there have been any deflate() calls since the - state was initialized or reset, then the input available so far is - compressed with the old level and strategy using deflate(strm, Z_BLOCK). - There are three approaches for the compression levels 0, 1..3, and 4..9 - respectively. The new level and strategy will take effect at the next call - of deflate(). - - If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does - not have enough output space to complete, then the parameter change will not - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ - -ZEXTERN int ZEXPORT deflateTune(z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen); -ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. - - delfateBound_z() is the same, but takes and returns a size_t length. Note - that a long is 32 bits on Windows. -*/ - -ZEXTERN int ZEXPORT deflatePending(z_streamp strm, - unsigned *pending, - int *bits); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are Z_NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. If an int is 16 bits and memLevel is 9, then - it is possible for the number of pending bytes to not fit in an unsigned. In - that case Z_BUF_ERROR is returned and *pending is set to the maximum value - of an unsigned. - */ - -ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, - int *bits); -/* - deflateUsed() returns in *bits the most recent number of deflate bits used - in the last byte when flushing to a byte boundary. The result is in 1..8, or - 0 if there has not yet been a flush. This helps determine the location of - the last bit of a deflate stream. - - deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, - int bits, - int value); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, - gz_headerp head); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to the current operating system, with no - extra, name, or comment fields. The gzip header is returned to the default - state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, - int windowBits); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will *not* automatically decode concatenated gzip members. - inflate() will return Z_STREAM_END at the end of the gzip member. The state - would need to be reset to continue decoding a subsequent gzip member. This - *must* be done if there is more data after a gzip member, in order for the - decompression to be compliant with the gzip standard (RFC 1952). - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, - const Bytef *dictionary, - uInt dictLength); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, - Bytef *dictionary, - uInt *dictLength); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similarly, if dictLength is Z_NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateSync(z_streamp strm); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current value of total_in - which indicates where valid compressed data was found. In the error case, - the application may repeatedly call inflateSync, providing more input each - time, until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, - z_streamp source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset(z_streamp strm); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - total_in, total_out, adler, and msg are initialized. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, - int windowBits); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ - -ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, - int bits, - int value); -/* - This function inserts bits in the inflate input stream. The intent is to - use inflatePrime() to start inflating at a bit position in the middle of a - byte. The provided bits will be used before any bytes are used from - next_in. This function should be used with raw inflate, before the first - inflate() call, after inflateInit2() or inflateReset(). It can also be used - after an inflate() return indicates the end of a deflate block or header - when using Z_BLOCK. bits must be less than or equal to 16, and that many of - the least significant bits of value will be inserted in the input. The - other bits in value can be non-zero, and will be ignored. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent, or if bits is out of range. If inflate was - in the middle of processing a header, trailer, or stored block lengths, then - it is possible for there to be only eight bits available in the bit buffer. - In that case, bits > 8 is considered out of range. However, when used as - outlined above, there will always be 16 bits available in the buffer for - insertion. As noted in its documentation above, inflate records the number - of bits in the bit buffer on return in data_type. 32 minus that is the - number of bits available for insertion. inflatePrime does not update - data_type with the new number of bits in buffer. -*/ - -ZEXTERN long ZEXPORT inflateMark(z_streamp strm); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, - gz_headerp head); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) The extra, name, and comment pointers - much each be either Z_NULL or point to space to store that information from - the header. If extra is not Z_NULL, then extra_max contains the maximum - number of bytes that can be written to extra. Once done is true, extra_len - contains the actual extra field length, and extra contains the extra field, - or that field truncated if extra_max is less than extra_len. If name is not - Z_NULL, then up to name_max characters, including the terminating zero, are - written there. If comment is not Z_NULL, then up to comm_max characters, - including the terminating zero, are written there. The application can tell - that the name or comment did not fit in the provided space by the absence of - a terminating zero. If any of extra, name, or comment are not present in - the header, then that field's pointer is set to Z_NULL. This allows the use - of deflateSetHeader() with the returned structure to duplicate the header. - Note that if those fields initially pointed to allocated memory, then the - application will need to save them elsewhere so that they can be eventually - freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, - unsigned char FAR *window); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef unsigned (*in_func)(void FAR *, - z_const unsigned char FAR * FAR *); -typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); - -ZEXTERN int ZEXPORT inflateBack(z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags(void); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: ZLIB_DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (all zeros is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - 27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error - - Remainder: - 28-31: 0 (reserved) - */ - -#ifndef Z_SOLO - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. The _z versions of the functions use the size_t - type for lengths. Note that a long is 32 bits on Windows. -*/ - -ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen); -ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, - const Bytef *source, z_size_t sourceLen); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level); -ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, - const Bytef *source, z_size_t sourceLen, - int level); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); -ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen); -ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, - const Bytef *source, z_size_t sourceLen); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. On entry, *destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) On exit, *destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - -ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong *sourceLen); -ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, - const Bytef *source, z_size_t *sourceLen); -/* - Same as uncompress, except that sourceLen is a pointer, where the - length of the source is *sourceLen. On return, *sourceLen is the number of - source bytes consumed. -*/ - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -/* -ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); - - Open the gzip (.gz) file at path for reading and decompressing, or - compressing and writing. The mode parameter is as in fopen ("rb" or "wb") - but can also include a compression level ("wb9") or a strategy: 'f' for - filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", - 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression - as in "wb9F". (See the description of deflateInit2 for more information - about the strategy parameter.) 'T' will request transparent writing or - appending with no compression and not using the gzip format. 'T' cannot be - used to force transparent reading. Transparent reading is automatically - performed if there is no gzip header at the start. Transparent reading can - be disabled with the 'G' option, which will instead return an error if there - is no gzip header. 'N' will open the file in non-blocking mode. - - 'a' can be used instead of 'w' to request that the gzip stream that will - be written be appended to the file. '+' will result in an error, since - reading and writing to the same gzip file is not supported. The addition of - 'x' when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of 'e' when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. Note that if 'N' is in mode for non-blocking, the - open() itself can fail in order to not block. In that case gzopen() will - return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can - then be re-tried. If the application would like to block on opening the - file, then it can use open() without O_NONBLOCK, and then gzdopen() with the - resulting file descriptor and 'N' in the mode, which will set it to non- - blocking. -*/ - -ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); -/* - Associate a gzFile with the file descriptor fd. File descriptors are - obtained from calls like open, dup, creat, pipe or fileno (if the file has - been previously opened with fopen). The mode parameter is as in gzopen. An - 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' - in mode will set fd's non-blocking flag. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); -/* - Set the internal buffer size used by this library's functions for file to - size. The default buffer size is 8192 bytes. This function must be called - after gzopen() or gzdopen(), and before any other calls that read or write - the file. The buffer memory allocation is always deferred to the first read - or write. Three times that size in buffer space is allocated. A larger - buffer size of, for example, 64K or 128K bytes will noticeably increase the - speed of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); -/* - Dynamically update the compression level and strategy for file. See the - description of deflateInit2 for the meaning of these parameters. Previously - provided data is flushed before applying the parameter changes. - - gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not - opened for writing, Z_ERRNO if there is an error writing the flushed data, - or Z_MEM_ERROR if there is a memory allocation error. -*/ - -ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); -/* - Read and decompress up to len uncompressed bytes from file into buf. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread can be used to read a gzip file on a non-blocking device. If the - input stalls and there is no uncompressed data to return, then gzread() will - return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be - called again. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. If some data was read before an error, then that data is - returned until exhausted, after which the next call will signal the error. -*/ - -ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, - gzFile file); -/* - Read and decompress up to nitems items of size size from file into buf, - otherwise operating as gzread() does. This duplicates the interface of - stdio's fread(), with size_t request and return types. If the library - defines size_t, then z_size_t is identical to size_t. If not, then z_size_t - is an unsigned integer type that can contain a pointer. - - gzfread() returns the number of full items read of size size, or zero if - the end of the file was reached and a full item could not be read, or if - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a z_size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - In the event that the end of file is reached and only a partial item is - available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevertheless read into buf - and the end-of-file flag is set. The length of the partial item read is not - provided, but could be inferred from the result of gztell(). This behavior - is the same as that of fread() implementations in common libraries. This - could result in data loss if used with size != 1 when reading a concurrently - written file or a non-blocking file. In that case, use size == 1 or gzread() - instead. -*/ - -ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); -/* - Compress and write the len uncompressed bytes at buf to file. gzwrite - returns the number of uncompressed bytes written, or 0 in case of error or - if len is 0. If the write destination is non-blocking, then gzwrite() may - return a number of bytes written that is not 0 and less than len. - - If len does not fit in an int, then 0 is returned and nothing is written. -*/ - -ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, - z_size_t nitems, gzFile file); -/* - Compress and write nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. If - the library defines size_t, then z_size_t is identical to size_t. If not, - then z_size_t is an unsigned integer type that can contain a pointer. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a z_size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. - - If writing a concurrently read file or a non-blocking file with size != 1, - a partial item could be written, with no way of knowing how much of it was - not written, resulting in data loss. In that case, use size == 1 or - gzwrite() instead. -*/ - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); -#else -ZEXTERN int ZEXPORTVA gzprintf(); -#endif -/* - Convert, format, compress, and write the arguments (...) to file under - control of the string format, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or a negative zlib error code in case - of error. The number of uncompressed bytes written is limited to 8191, or - one less than the buffer size given to gzbuffer(). The caller should assure - that this limit is not exceeded. If it is exceeded, then gzprintf() will - return an error (0) with nothing written. - - In that last case, there may also be a buffer overflow with unpredictable - consequences, which is possible only if zlib was compiled with the insecure - functions sprintf() or vsprintf(), because the secure snprintf() and - vsnprintf() functions were not available. That would only be the case for - a non-ANSI C compiler. zlib may have been built without gzprintf() because - secure functions were not available and having gzprintf() be insecure was - not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of - these possibilities can be determined using zlibCompileFlags(). - - If a Z_BUF_ERROR is returned, then nothing was written due to a stall on - the non-blocking write destination. -*/ - -ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); -/* - Compress and write the given null-terminated string s to file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. - The number of characters written may be less than the length of the string - if the write destination is non-blocking. - - If the length of the string does not fit in an int, then -1 is returned - and nothing is written. -*/ - -ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); -/* - Read and decompress bytes from file into buf, until len-1 characters are - read, or until a newline character is read and transferred to buf, or an - end-of-file condition is encountered. If any characters are read or if len - is one, the string is terminated with a null character. If no characters - are read due to an end-of-file or len is less than one, then the buffer is - left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If some data was read before an error, - then that data is returned until exhausted, after which the next call will - return NULL to signal the error. - - gzgets can be used on a file being concurrently written, and on a non- - blocking device, both as for gzread(). However lines may be broken in the - middle, leaving it up to the application to reassemble them as needed. -*/ - -ZEXTERN int ZEXPORT gzputc(gzFile file, int c); -/* - Compress and write c, converted to an unsigned char, into file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc(gzFile file); -/* - Read and decompress one byte from file. gzgetc returns this byte or -1 in - case of end of file or error. If some data was read before an error, then - that data is returned until exhausted, after which the next call will return - -1 to signal the error. - - This is implemented as a macro for speed. As such, it does not do all of - the checking the other functions do. I.e. it does not check to see if file - is NULL, nor whether the structure file points to has been clobbered or not. - - gzgetc can be used to read a gzip file on a non-blocking device. If the - input stalls and there is no uncompressed data to return, then gzgetc() will - return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be - called again. -*/ - -ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); -/* - Push c back onto the stream for file to be read as the first character on - the next read. At least one character of push-back is always allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). - - gzungetc(-1, file) will force any pending seek to execute. Then gztell() - will report the position, even if the requested seek reached end of file. - This can be used to determine the number of uncompressed bytes in a gzip - file without having to read it into a buffer. -*/ - -ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); -/* - Flush all pending output to file. The parameter flush is as in the - deflate() function. The return value is the zlib error number (see function - gzerror below). gzflush is only permitted when writing. - - If the flush parameter is Z_FINISH, the remaining data is written and the - gzip stream is completed in the output. If gzwrite() is called again, a new - gzip stream will be started in the output. gzread() is able to read such - concatenated gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, - z_off_t offset, int whence); - - Set the starting position to offset relative to whence for the next gzread - or gzwrite on file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. For reading or writing, any actual seeking is deferred - until the next read or write operation, or close operation when writing. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind(gzFile file); -/* - Rewind file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). -*/ - -/* -ZEXTERN z_off_t ZEXPORT gztell(gzFile file); - - Return the starting position for the next gzread or gzwrite on file. - This position represents a number of bytes in the uncompressed data stream, - and is zero when starting, even if appending or reading a gzip stream from - the middle of a file using gzdopen(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); - - Return the current compressed (actual) read or write offset of file. This - offset includes the count of bytes that precede the gzip stream, for example - when appending or when using gzdopen() for reading. When reading, the - offset does not include as yet unused buffered input. This information can - be used for a progress indicator. On error, gzoffset() returns -1. -*/ - -ZEXTERN int ZEXPORT gzeof(gzFile file); -/* - Return true (1) if the end-of-file indicator for file has been set while - reading, false (0) otherwise. Note that the end-of-file indicator is set - only if the read tried to go past the end of the input, but came up short. - Therefore, just like feof(), gzeof() may return false even if there is no - more data to read, in the event that the last read request was for the exact - number of bytes remaining in the input file. This will happen if the input - file size is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ - -ZEXTERN int ZEXPORT gzdirect(gzFile file); -/* - Return true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). If the input is being written concurrently or the device is non- - blocking, then gzdirect() may give a different answer once four bytes of - input have been accumulated, which is what is needed to confirm or deny a - gzip header. Before this, gzdirect() will return true (1). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -ZEXTERN int ZEXPORT gzclose(gzFile file); -/* - Flush all pending output for file, if necessary, close file and - deallocate the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -ZEXTERN int ZEXPORT gzclose_r(gzFile file); -ZEXTERN int ZEXPORT gzclose_w(gzFile file); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); -/* - Return the error message for the last error which occurred on file. - If errnum is not NULL, *errnum is set to zlib error number. If an error - occurred in the file system and not in the compression library, *errnum is - set to Z_ERRNO and the application may consult errno to get the exact error - code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -ZEXTERN void ZEXPORT gzclearerr(gzFile file); -/* - Clear the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - -#endif /* !Z_SOLO */ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. An Adler-32 value is in the range of a 32-bit - unsigned integer. If buf is Z_NULL, this function returns the required - initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, - z_size_t len); -/* - Same as adler32(), but with a size_t length. Note that a long is 32 bits - on Windows. -*/ - -/* -ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, - z_off_t len2); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. - If buf is Z_NULL, this function returns the required initial value for the - crc. Pre- and post-conditioning (one's complement) is performed within this - function so it shouldn't be done by the application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, - z_size_t len); -/* - Same as crc32(), but with a size_t length. Note that a long is 32 bits on - Windows. -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. len2 must be non-negative, otherwise zero is returned. -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); - - Return the operator corresponding to length len2, to be used with - crc32_combine_op(). len2 must be non-negative, otherwise zero is returned. -*/ - -ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); -/* - Give the same result as crc32_combine(), using op in place of len2. op is - is generated from len2 by crc32_combine_gen(). This will be faster than - crc32_combine() if the generated op is used more than once. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, - const char *version, int stream_size); -ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, - const char *version, int stream_size); -ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size); -ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, - const char *version, int stream_size); -ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size); -#ifdef Z_PREFIX_SET -# define z_deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define z_inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#else -# define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#endif - -#ifndef Z_SOLO - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -# define z_gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#else -# define gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#endif - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); - ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); - ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); - ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); - ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); -#endif - -#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# ifdef Z_PREFIX_SET -# define z_gzopen z_gzopen64 -# define z_gzseek z_gzseek64 -# define z_gztell z_gztell64 -# define z_gzoffset z_gzoffset64 -# define z_adler32_combine z_adler32_combine64 -# define z_crc32_combine z_crc32_combine64 -# define z_crc32_combine_gen z_crc32_combine_gen64 -# else -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# define crc32_combine_gen crc32_combine_gen64 -# endif -# ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); - ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); - ZEXTERN z_off_t ZEXPORT gztell64(gzFile); - ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); - ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); -# endif -#else - ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); - ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); - ZEXTERN z_off_t ZEXPORT gztell(gzFile); - ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); - ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); - ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); - ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); -#endif - -#else /* Z_SOLO */ - - ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); - ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); - ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); - -#endif /* !Z_SOLO */ - -/* undocumented functions */ -ZEXTERN const char * ZEXPORT zError(int); -ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); -ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); -ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); -ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); -ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); -#if defined(_WIN32) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, - const char *mode); -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, - const char *format, - va_list va); -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.3.2.1, February xxth, 2026 + + Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#ifdef ZLIB_BUILD +# include +#else +# include "zconf.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.3.2.1-motley" +#define ZLIB_VERNUM 0x1321 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 3 +#define ZLIB_VER_REVISION 2 +#define ZLIB_VER_SUBREVISION 1 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); +typedef void (*free_func)(voidpf opaque, voidpf address); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion(void); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. total_in, total_out, adler, and msg are initialized. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more output + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit(z_streamp strm); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. total_in, total_out, adler, and + msg are initialized. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the input taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + + +ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy); + + This is another version of deflateInit with more compression options. The + fields zalloc, zfree and opaque must be initialized before by the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_RLE to limit match distances to one (run-length + encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string + matching). Filtered data consists mostly of small values with a somewhat + random distribution, as produced by the PNG filters. In this case, the + compression algorithm is tuned to compress them better. The effect of + Z_FILTERED is to force more Huffman coding and less string matching than the + default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. + Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better + compression for PNG image data than Huffman only. The degree of string + matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then + Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but + never the correctness of the compressed output, even if it is not set + optimally for the given data. Z_FIXED uses the default string matching, but + prevents the use of dynamic Huffman codes, allowing for a simpler decoder + for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset(z_streamp strm); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. total_in, total_out, adler, and msg are initialized. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams(z_streamp strm, + int level, + int strategy); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune(z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen); +ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. + + delfateBound_z() is the same, but takes and returns a size_t length. Note + that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT deflatePending(z_streamp strm, + unsigned *pending, + int *bits); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. If an int is 16 bits and memLevel is 9, then + it is possible for the number of pending bytes to not fit in an unsigned. In + that case Z_BUF_ERROR is returned and *pending is set to the maximum value + of an unsigned. + */ + +ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, + int *bits); +/* + deflateUsed() returns in *bits the most recent number of deflate bits used + in the last byte when flushing to a byte boundary. The result is in 1..8, or + 0 if there has not yet been a flush. This helps determine the location of + the last bit of a deflate stream. + + deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, + int bits, + int value); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, + gz_headerp head); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to the current operating system, with no + extra, name, or comment fields. The gzip header is returned to the default + state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, + int windowBits); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similarly, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync(z_streamp strm); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, + z_streamp source); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset(z_streamp strm); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + total_in, total_out, adler, and msg are initialized. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, + int windowBits); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, + int bits, + int value); +/* + This function inserts bits in the inflate input stream. The intent is to + use inflatePrime() to start inflating at a bit position in the middle of a + byte. The provided bits will be used before any bytes are used from + next_in. This function should be used with raw inflate, before the first + inflate() call, after inflateInit2() or inflateReset(). It can also be used + after an inflate() return indicates the end of a deflate block or header + when using Z_BLOCK. bits must be less than or equal to 16, and that many of + the least significant bits of value will be inserted in the input. The + other bits in value can be non-zero, and will be ignored. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent, or if bits is out of range. If inflate was + in the middle of processing a header, trailer, or stored block lengths, then + it is possible for there to be only eight bits available in the bit buffer. + In that case, bits > 8 is considered out of range. However, when used as + outlined above, there will always be 16 bits available in the buffer for + insertion. As noted in its documentation above, inflate records the number + of bits in the bit buffer on return in data_type. 32 minus that is the + number of bits available for insertion. inflatePrime does not update + data_type with the new number of bits in buffer. +*/ + +ZEXTERN long ZEXPORT inflateMark(z_streamp strm); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, + gz_headerp head); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) The extra, name, and comment pointers + much each be either Z_NULL or point to space to store that information from + the header. If extra is not Z_NULL, then extra_max contains the maximum + number of bytes that can be written to extra. Once done is true, extra_len + contains the actual extra field length, and extra contains the extra field, + or that field truncated if extra_max is less than extra_len. If name is not + Z_NULL, then up to name_max characters, including the terminating zero, are + written there. If comment is not Z_NULL, then up to comm_max characters, + including the terminating zero, are written there. The application can tell + that the name or comment did not fit in the provided space by the absence of + a terminating zero. If any of extra, name, or comment are not present in + the header, then that field's pointer is set to Z_NULL. This allows the use + of deflateSetHeader() with the returned structure to duplicate the header. + Note that if those fields initially pointed to allocated memory, then the + application will need to save them elsewhere so that they can be eventually + freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, + unsigned char FAR *window); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func)(void FAR *, + z_const unsigned char FAR * FAR *); +typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); + +ZEXTERN int ZEXPORT inflateBack(z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags(void); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (all zeros is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + 27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error + + Remainder: + 28-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. The _z versions of the functions use the size_t + type for lengths. Note that a long is 32 bits on Windows. +*/ + +ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level); +ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen, + int level); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); +ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. On entry, *destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) On exit, *destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen); +ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t *sourceLen); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); + + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. 'T' cannot be + used to force transparent reading. Transparent reading is automatically + performed if there is no gzip header at the start. Transparent reading can + be disabled with the 'G' option, which will instead return an error if there + is no gzip header. 'N' will open the file in non-blocking mode. + + 'a' can be used instead of 'w' to request that the gzip stream that will + be written be appended to the file. '+' will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + 'x' when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of 'e' when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. Note that if 'N' is in mode for non-blocking, the + open() itself can fail in order to not block. In that case gzopen() will + return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can + then be re-tried. If the application would like to block on opening the + file, then it can use open() without O_NONBLOCK, and then gzdopen() with the + resulting file descriptor and 'N' in the mode, which will set it to non- + blocking. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); +/* + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. An + 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' + in mode will set fd's non-blocking flag. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); +/* + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); +/* + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); +/* + Read and decompress up to len uncompressed bytes from file into buf. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzread() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. If some data was read before an error, then that data is + returned until exhausted, after which the next call will signal the error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, + gzFile file); +/* + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevertheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as that of fread() implementations in common libraries. This + could result in data loss if used with size != 1 when reading a concurrently + written file or a non-blocking file. In that case, use size == 1 or gzread() + instead. +*/ + +ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); +/* + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written, or 0 in case of error or + if len is 0. If the write destination is non-blocking, then gzwrite() may + return a number of bytes written that is not 0 and less than len. + + If len does not fit in an int, then 0 is returned and nothing is written. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, + z_size_t nitems, gzFile file); +/* + Compress and write nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. + + If writing a concurrently read file or a non-blocking file with size != 1, + a partial item could be written, with no way of knowing how much of it was + not written, resulting in data loss. In that case, use size == 1 or + gzwrite() instead. +*/ + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); +#else +ZEXTERN int ZEXPORTVA gzprintf(); +#endif +/* + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. + + In that last case, there may also be a buffer overflow with unpredictable + consequences, which is possible only if zlib was compiled with the insecure + functions sprintf() or vsprintf(), because the secure snprintf() and + vsnprintf() functions were not available. That would only be the case for + a non-ANSI C compiler. zlib may have been built without gzprintf() because + secure functions were not available and having gzprintf() be insecure was + not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of + these possibilities can be determined using zlibCompileFlags(). + + If a Z_BUF_ERROR is returned, then nothing was written due to a stall on + the non-blocking write destination. +*/ + +ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); +/* + Compress and write the given null-terminated string s to file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. + The number of characters written may be less than the length of the string + if the write destination is non-blocking. + + If the length of the string does not fit in an int, then -1 is returned + and nothing is written. +*/ + +ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); +/* + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If some data was read before an error, + then that data is returned until exhausted, after which the next call will + return NULL to signal the error. + + gzgets can be used on a file being concurrently written, and on a non- + blocking device, both as for gzread(). However lines may be broken in the + middle, leaving it up to the application to reassemble them as needed. +*/ + +ZEXTERN int ZEXPORT gzputc(gzFile file, int c); +/* + Compress and write c, converted to an unsigned char, into file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc(gzFile file); +/* + Read and decompress one byte from file. gzgetc returns this byte or -1 in + case of end of file or error. If some data was read before an error, then + that data is returned until exhausted, after which the next call will return + -1 to signal the error. + + This is implemented as a macro for speed. As such, it does not do all of + the checking the other functions do. I.e. it does not check to see if file + is NULL, nor whether the structure file points to has been clobbered or not. + + gzgetc can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzgetc() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. +*/ + +ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); +/* + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). + + gzungetc(-1, file) will force any pending seek to execute. Then gztell() + will report the position, even if the requested seek reached end of file. + This can be used to determine the number of uncompressed bytes in a gzip + file without having to read it into a buffer. +*/ + +ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); +/* + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, + z_off_t offset, int whence); + + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. For reading or writing, any actual seeking is deferred + until the next read or write operation, or close operation when writing. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind(gzFile file); +/* + Rewind file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell(gzFile file); + + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); + + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof(gzFile file); +/* + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect(gzFile file); +/* + Return true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). If the input is being written concurrently or the device is non- + blocking, then gzdirect() may give a different answer once four bytes of + input have been accumulated, which is what is needed to confirm or deny a + gzip header. Before this, gzdirect() will return true (1). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose(gzFile file); +/* + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r(gzFile file); +ZEXTERN int ZEXPORT gzclose_w(gzFile file); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); +/* + Return the error message for the last error which occurred on file. + If errnum is not NULL, *errnum is set to zlib error number. If an error + occurred in the file system and not in the compression library, *errnum is + set to Z_ERRNO and the application may consult errno to get the exact error + code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr(gzFile file); +/* + Clear the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, + z_size_t len); +/* + Same as adler32(), but with a size_t length. Note that a long is 32 bits + on Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, + z_off_t len2); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, + z_size_t len); +/* + Same as crc32(), but with a size_t length. Note that a long is 32 bits on + Windows. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. len2 must be non-negative, otherwise zero is returned. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). len2 must be non-negative, otherwise zero is returned. +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, + const char *version, int stream_size); +ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size); +ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError(int); +ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); +ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); +ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, + const char *mode); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, + const char *format, + va_list va); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/Minecraft.Client/Common/zlib/zutil.c b/Minecraft.Client/Common/zlib/zutil.c index 0e30c566..22f29aea 100644 --- a/Minecraft.Client/Common/zlib/zutil.c +++ b/Minecraft.Client/Common/zlib/zutil.c @@ -1,312 +1,312 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2026 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" -#ifndef Z_SOLO -# include "gzguts.h" -#endif - -z_const char * const z_errmsg[10] = { - (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ - (z_const char *)"stream end", /* Z_STREAM_END 1 */ - (z_const char *)"", /* Z_OK 0 */ - (z_const char *)"file error", /* Z_ERRNO (-1) */ - (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ - (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ - (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ - (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ - (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ - (z_const char *)"" -}; - - -const char * ZEXPORT zlibVersion(void) { - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags(void) { - uLong flags; - - flags = 0; - switch ((int)(sizeof(uInt))) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch ((int)(sizeof(uLong))) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch ((int)(sizeof(voidpf))) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch ((int)(sizeof(z_off_t))) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef ZLIB_DEBUG - flags += 1 << 8; -#endif - /* -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif - */ -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifdef NO_vsnprintf -# ifdef ZLIB_INSECURE - flags += 1L << 25; -# else - flags += 1L << 27; -# endif -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf -# ifdef ZLIB_INSECURE - flags += 1L << 25; -# else - flags += 1L << 27; -# endif -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef ZLIB_DEBUG -#include -# ifndef verbose -# define verbose 0 -# endif -int ZLIB_INTERNAL z_verbose = verbose; - -void ZLIB_INTERNAL z_error(char *m) { - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(int err) { - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 - /* The older Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void ZLIB_INTERNAL zmemcpy(void FAR *dst, const void FAR *src, z_size_t n) { - uchf *p = dst; - const uchf *q = src; - while (n) { - *p++ = *q++; - n--; - } -} - -int ZLIB_INTERNAL zmemcmp(const void FAR *s1, const void FAR *s2, z_size_t n) { - const uchf *p = s1, *q = s2; - while (n) { - if (*p++ != *q++) - return (int)p[-1] - (int)q[-1]; - n--; - } - return 0; -} - -void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) { - uchf *p = b; - while (len) { - *p++ = 0; - len--; - } -} - -#endif - -#ifndef Z_SOLO - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { - voidpf buf; - ulg bsize = (ulg)items*size; - - (void)opaque; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { - int n; - - (void)opaque; - - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { - (void)opaque; - return _halloc((long)items, size); -} - -void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { - (void)opaque; - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc(uInt size); -extern voidp calloc(uInt items, uInt size); -extern void free(voidpf ptr); -#endif - -voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { - (void)opaque; - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { - (void)opaque; - free(ptr); -} - -#endif /* MY_ZCALLOC */ - -#endif /* !Z_SOLO */ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2026 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" +#ifndef Z_SOLO +# include "gzguts.h" +#endif + +z_const char * const z_errmsg[10] = { + (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ + (z_const char *)"stream end", /* Z_STREAM_END 1 */ + (z_const char *)"", /* Z_OK 0 */ + (z_const char *)"file error", /* Z_ERRNO (-1) */ + (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ + (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ + (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ + (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ + (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ + (z_const char *)"" +}; + + +const char * ZEXPORT zlibVersion(void) { + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags(void) { + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef ZLIB_DEBUG + flags += 1 << 8; +#endif + /* +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif + */ +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifdef NO_vsnprintf +# ifdef ZLIB_INSECURE + flags += 1L << 25; +# else + flags += 1L << 27; +# endif +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf +# ifdef ZLIB_INSECURE + flags += 1L << 25; +# else + flags += 1L << 27; +# endif +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef ZLIB_DEBUG +#include +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error(char *m) { + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(int err) { + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + /* The older Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(void FAR *dst, const void FAR *src, z_size_t n) { + uchf *p = dst; + const uchf *q = src; + while (n) { + *p++ = *q++; + n--; + } +} + +int ZLIB_INTERNAL zmemcmp(const void FAR *s1, const void FAR *s2, z_size_t n) { + const uchf *p = s1, *q = s2; + while (n) { + if (*p++ != *q++) + return (int)p[-1] - (int)q[-1]; + n--; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) { + uchf *p = b; + while (len) { + *p++ = 0; + len--; + } +} + +#endif + +#ifndef Z_SOLO + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { + voidpf buf; + ulg bsize = (ulg)items*size; + + (void)opaque; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { + int n; + + (void)opaque; + + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { + (void)opaque; + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { + (void)opaque; + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc(uInt size); +extern voidp calloc(uInt items, uInt size); +extern void free(voidpf ptr); +#endif + +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { + (void)opaque; + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { + (void)opaque; + free(ptr); +} + +#endif /* MY_ZCALLOC */ + +#endif /* !Z_SOLO */ diff --git a/Minecraft.Client/Common/zlib/zutil.h b/Minecraft.Client/Common/zlib/zutil.h index a9bc23ca..179ca92c 100644 --- a/Minecraft.Client/Common/zlib/zutil.h +++ b/Minecraft.Client/Common/zlib/zutil.h @@ -1,331 +1,331 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include "zlib.h" - -#if defined(STDC) && !defined(Z_SOLO) -# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) -# include -# endif -# include -# include -#endif - -#ifndef local -# define local static -#endif -/* since "static" is used to mean two completely different things in C, we - define "local" for the non-static meaning of "static", for readability - (compile with -Dlocal if your debugger can't find static symbols) */ - -extern const char deflate_copyright[]; -extern const char inflate_copyright[]; -extern const char inflate9_copyright[]; - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) -# include -# if (ULONG_MAX == 0xffffffffffffffff) -# define Z_U8 unsigned long -# elif (ULLONG_MAX == 0xffffffffffffffff) -# define Z_U8 unsigned long long -# elif (ULONG_LONG_MAX == 0xffffffffffffffff) -# define Z_U8 unsigned long long -# elif (UINT_MAX == 0xffffffffffffffff) -# define Z_U8 unsigned -# endif -#endif - -extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ -#if MAX_WBITS < 9 || MAX_WBITS > 15 -# error MAX_WBITS must be in 9..15 -#endif -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# ifndef Z_SOLO -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 1 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 2 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#ifdef __370__ -# if __TARGET_LIB__ < 0x20000000 -# define OS_CODE 4 -# elif __TARGET_LIB__ < 0x40000000 -# define OS_CODE 11 -# else -# define OS_CODE 8 -# endif -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 5 -#endif - -#ifdef OS2 -# define OS_CODE 6 -# if defined(M_I86) && !defined(Z_SOLO) -# include -# endif -#endif - -#if defined(MACOS) -# define OS_CODE 7 -#endif - -#if defined(__acorn) || defined(__riscos) -# define OS_CODE 13 -#endif - -#if defined(WIN32) && !defined(__CYGWIN__) -# define OS_CODE 10 -#endif - -#ifdef _BEOS_ -# define OS_CODE 16 -#endif - -#ifdef __TOS_OS400__ -# define OS_CODE 18 -#endif - -#ifdef __APPLE__ -# define OS_CODE 19 -#endif - -#if defined(__BORLANDC__) && !defined(MSDOS) - #pragma warn -8004 - #pragma warn -8008 - #pragma warn -8066 -#endif - -/* provide prototypes for these when building zlib without LFS */ -#ifndef Z_LARGE64 - ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); - ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 3 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(pyr) || defined(Z_SOLO) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - void ZLIB_INTERNAL zmemcpy(void FAR *, const void FAR *, z_size_t); - int ZLIB_INTERNAL zmemcmp(const void FAR *, const void FAR *, z_size_t); - void ZLIB_INTERNAL zmemzero(void FAR *, z_size_t); -#endif - -/* Diagnostic functions */ -#ifdef ZLIB_DEBUG -# include - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error(char *m); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - -#ifndef Z_SOLO - voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, - unsigned size); - void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr); -#endif - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a 32-bit value */ -#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -#ifdef Z_ONCE -/* - Create a local z_once() function depending on the availability of atomics. - */ - -/* Check for the availability of atomics. */ -#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ - !defined(__STDC_NO_ATOMICS__) - -#include -typedef struct { - atomic_flag begun; - atomic_int done; -} z_once_t; -#define Z_ONCE_INIT {ATOMIC_FLAG_INIT, 0} - -/* - Run the provided init() function exactly once, even if multiple threads - invoke once() at the same time. The state must be a once_t initialized with - Z_ONCE_INIT. - */ -local void z_once(z_once_t *state, void (*init)(void)) { - if (!atomic_load(&state->done)) { - if (atomic_flag_test_and_set(&state->begun)) - while (!atomic_load(&state->done)) - ; - else { - init(); - atomic_store(&state->done, 1); - } - } -} - -#else /* no atomics */ - -#warning zlib not thread-safe - -typedef struct z_once_s { - volatile int begun; - volatile int done; -} z_once_t; -#define Z_ONCE_INIT {0, 0} - -/* Test and set. Alas, not atomic, but tries to limit the period of - vulnerability. */ -local int test_and_set(int volatile *flag) { - int was; - - was = *flag; - *flag = 1; - return was; -} - -/* Run the provided init() function once. This is not thread-safe. */ -local void z_once(z_once_t *state, void (*init)(void)) { - if (!state->done) { - if (test_and_set(&state->begun)) - while (!state->done) - ; - else { - init(); - state->done = 1; - } - } -} - -#endif /* ?atomics */ - -#endif /* Z_ONCE */ - -#endif /* ZUTIL_H */ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#ifdef HAVE_HIDDEN +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#if defined(STDC) && !defined(Z_SOLO) +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifndef local +# define local static +#endif +/* since "static" is used to mean two completely different things in C, we + define "local" for the non-static meaning of "static", for readability + (compile with -Dlocal if your debugger can't find static symbols) */ + +extern const char deflate_copyright[]; +extern const char inflate_copyright[]; +extern const char inflate9_copyright[]; + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# include +# if (ULONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long +# elif (ULLONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (ULONG_LONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (UINT_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned +# endif +#endif + +extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ +#if MAX_WBITS < 9 || MAX_WBITS > 15 +# error MAX_WBITS must be in 9..15 +#endif +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# ifndef Z_SOLO +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 1 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 2 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#ifdef __370__ +# if __TARGET_LIB__ < 0x20000000 +# define OS_CODE 4 +# elif __TARGET_LIB__ < 0x40000000 +# define OS_CODE 11 +# else +# define OS_CODE 8 +# endif +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 5 +#endif + +#ifdef OS2 +# define OS_CODE 6 +# if defined(M_I86) && !defined(Z_SOLO) +# include +# endif +#endif + +#if defined(MACOS) +# define OS_CODE 7 +#endif + +#if defined(__acorn) || defined(__riscos) +# define OS_CODE 13 +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) +# define OS_CODE 10 +#endif + +#ifdef _BEOS_ +# define OS_CODE 16 +#endif + +#ifdef __TOS_OS400__ +# define OS_CODE 18 +#endif + +#ifdef __APPLE__ +# define OS_CODE 19 +#endif + +#if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#ifndef Z_LARGE64 + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 3 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(pyr) || defined(Z_SOLO) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy(void FAR *, const void FAR *, z_size_t); + int ZLIB_INTERNAL zmemcmp(const void FAR *, const void FAR *, z_size_t); + void ZLIB_INTERNAL zmemzero(void FAR *, z_size_t); +#endif + +/* Diagnostic functions */ +#ifdef ZLIB_DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error(char *m); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +#ifndef Z_SOLO + voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, + unsigned size); + void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr); +#endif + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +/* Reverse the bytes in a 32-bit value */ +#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +#ifdef Z_ONCE +/* + Create a local z_once() function depending on the availability of atomics. + */ + +/* Check for the availability of atomics. */ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ + !defined(__STDC_NO_ATOMICS__) + +#include +typedef struct { + atomic_flag begun; + atomic_int done; +} z_once_t; +#define Z_ONCE_INIT {ATOMIC_FLAG_INIT, 0} + +/* + Run the provided init() function exactly once, even if multiple threads + invoke once() at the same time. The state must be a once_t initialized with + Z_ONCE_INIT. + */ +local void z_once(z_once_t *state, void (*init)(void)) { + if (!atomic_load(&state->done)) { + if (atomic_flag_test_and_set(&state->begun)) + while (!atomic_load(&state->done)) + ; + else { + init(); + atomic_store(&state->done, 1); + } + } +} + +#else /* no atomics */ + +#warning zlib not thread-safe + +typedef struct z_once_s { + volatile int begun; + volatile int done; +} z_once_t; +#define Z_ONCE_INIT {0, 0} + +/* Test and set. Alas, not atomic, but tries to limit the period of + vulnerability. */ +local int test_and_set(int volatile *flag) { + int was; + + was = *flag; + *flag = 1; + return was; +} + +/* Run the provided init() function once. This is not thread-safe. */ +local void z_once(z_once_t *state, void (*init)(void)) { + if (!state->done) { + if (test_and_set(&state->begun)) + while (!state->done) + ; + else { + init(); + state->done = 1; + } + } +} + +#endif /* ?atomics */ + +#endif /* Z_ONCE */ + +#endif /* ZUTIL_H */ diff --git a/Minecraft.Client/CompassTexture.cpp b/Minecraft.Client/CompassTexture.cpp index 14806991..bba43b78 100644 --- a/Minecraft.Client/CompassTexture.cpp +++ b/Minecraft.Client/CompassTexture.cpp @@ -7,13 +7,13 @@ #include "Texture.h" #include "CompassTexture.h" -CompassTexture *CompassTexture::instance = nullptr; +CompassTexture *CompassTexture::instance = NULL; CompassTexture::CompassTexture() : StitchedTexture(L"compass",L"compass") { instance = this; - m_dataTexture = nullptr; + m_dataTexture = NULL; m_iPad = XUSER_INDEX_ANY; rot = rota = 0.0; @@ -31,27 +31,27 @@ void CompassTexture::cycleFrames() { Minecraft *mc = Minecraft::GetInstance(); - if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr) + if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL) { updateFromPosition(mc->localplayers[m_iPad]->level, mc->localplayers[m_iPad]->x, mc->localplayers[m_iPad]->z, mc->localplayers[m_iPad]->yRot, false, false); } else { frame = 1; - updateFromPosition(nullptr, 0, 0, 0, false, true); + updateFromPosition(NULL, 0, 0, 0, false, true); } } void CompassTexture::updateFromPosition(Level *level, double x, double z, double yRot, bool noNeedle, bool instant) { double rott = 0; - if (level != nullptr && !noNeedle) + if (level != NULL && !noNeedle) { Pos *spawnPos = level->getSharedSpawnPos(); double xa = spawnPos->x - x; double za = spawnPos->z - z; delete spawnPos; - yRot = static_cast(yRot) % 360; + yRot = (int)yRot % 360; rott = -((yRot - 90) * PI / 180 - atan2(za, xa)); if (!level->dimension->isNaturalDimension()) { @@ -78,9 +78,9 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double } // 4J Stu - We share data with another texture - if(m_dataTexture != nullptr) + if(m_dataTexture != NULL) { - int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = (int) (((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); while (newFrame < 0) { newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size(); @@ -93,7 +93,7 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double } else { - int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size(); + int newFrame = (int) (((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size(); while (newFrame < 0) { newFrame = (newFrame + frames->size()) % frames->size(); @@ -118,7 +118,7 @@ int CompassTexture::getSourceHeight() const int CompassTexture::getFrames() { - if(m_dataTexture == nullptr) + if(m_dataTexture == NULL) { return StitchedTexture::getFrames(); } @@ -130,7 +130,7 @@ int CompassTexture::getFrames() void CompassTexture::freeFrameTextures() { - if(m_dataTexture == nullptr) + if(m_dataTexture == NULL) { StitchedTexture::freeFrameTextures(); } @@ -138,5 +138,5 @@ void CompassTexture::freeFrameTextures() bool CompassTexture::hasOwnData() { - return m_dataTexture == nullptr; + return m_dataTexture == NULL; } \ No newline at end of file diff --git a/Minecraft.Client/ConnectScreen.cpp b/Minecraft.Client/ConnectScreen.cpp index 18d50a52..2cf005b6 100644 --- a/Minecraft.Client/ConnectScreen.cpp +++ b/Minecraft.Client/ConnectScreen.cpp @@ -12,12 +12,12 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) { aborted = false; // System.out.println("Connecting to " + ip + ", " + port); - minecraft->setLevel(nullptr); + minecraft->setLevel(NULL); #if 1 // 4J - removed from separate thread, but need to investigate what we actually need here connection = new ClientConnection(minecraft, ip, port); if (aborted) return; - connection->send(std::make_shared(minecraft->user->name)); + connection->send( shared_ptr( new PreLoginPacket(minecraft->user->name) ) ); #else new Thread() { @@ -45,7 +45,7 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) void ConnectScreen::tick() { - if (connection != nullptr) + if (connection != NULL) { connection->tick(); } @@ -69,7 +69,7 @@ void ConnectScreen::buttonClicked(Button *button) if (button->id == 0) { aborted = true; - if (connection != nullptr) connection->close(); + if (connection != NULL) connection->close(); minecraft->setScreen(new TitleScreen()); } } @@ -80,7 +80,7 @@ void ConnectScreen::render(int xm, int ym, float a) Language *language = Language::getInstance(); - if (connection == nullptr) + if (connection == NULL) { drawCenteredString(font, language->getElement(L"connect.connecting"), width / 2, height / 2 - 50, 0xffffff); drawCenteredString(font, L"", width / 2, height / 2 - 10, 0xffffff); diff --git a/Minecraft.Client/CreateWorldScreen.cpp b/Minecraft.Client/CreateWorldScreen.cpp index 9c31747a..1a897203 100644 --- a/Minecraft.Client/CreateWorldScreen.cpp +++ b/Minecraft.Client/CreateWorldScreen.cpp @@ -70,7 +70,7 @@ wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSour wstring folder2 = folder; // 4J - copy input as it is const #if 0 - while (levelSource->getDataTagFor(folder2) != nullptr) + while (levelSource->getDataTagFor(folder2) != NULL) { folder2 = folder2 + L"-"; } @@ -93,7 +93,7 @@ void CreateWorldScreen::buttonClicked(Button *button) else if (button->id == 0) { // note: code copied from SelectWorldScreen - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); if (done) return; done = true; @@ -119,7 +119,7 @@ void CreateWorldScreen::buttonClicked(Button *button) #if 0 minecraft->gameMode = new SurvivalMode(minecraft); minecraft->selectLevel(resultFolder, nameEdit->getValue(), seedValue); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); #endif } diff --git a/Minecraft.Client/CreeperRenderer.cpp b/Minecraft.Client/CreeperRenderer.cpp index bcec5215..a9d16314 100644 --- a/Minecraft.Client/CreeperRenderer.cpp +++ b/Minecraft.Client/CreeperRenderer.cpp @@ -34,9 +34,9 @@ int CreeperRenderer::getOverlayColor(shared_ptr mob, float br, flo float step = creeper->getSwelling(a); - if (static_cast(step * 10) % 2 == 0) return 0; + if ((int) (step * 10) % 2 == 0) return 0; - int _a = static_cast(step * 0.2f * 255) + 25; // 4J - added 25 here as our entities are rendered with alpha test still enabled, and so anything less is invisible + int _a = (int) (step * 0.2f * 255) + 25; // 4J - added 25 here as our entities are rendered with alpha test still enabled, and so anything less is invisible if (_a < 0) _a = 0; if (_a > 255) _a = 255; diff --git a/Minecraft.Client/CritParticle2.cpp b/Minecraft.Client/CritParticle2.cpp index fe64b91e..363e8f08 100644 --- a/Minecraft.Client/CritParticle2.cpp +++ b/Minecraft.Client/CritParticle2.cpp @@ -11,12 +11,12 @@ void CritParticle2::_init(double xa, double ya, double za, float scale) yd += ya * 0.4; zd += za * 0.4; - rCol = gCol = bCol = static_cast(Math::random() * 0.3f + 0.6f); + rCol = gCol = bCol = (float) (Math::random() * 0.3f + 0.6f); size *= 0.75f; size *= scale; oSize = size; - lifetime = static_cast(6 / (Math::random() * 0.8 + 0.6)); + lifetime = (int) (6 / (Math::random() * 0.8 + 0.6)); lifetime *= scale; noPhysics = false; diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index f1304a9e..553128d9 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -9,7 +9,6 @@ #include "Common\DLC\DLCLocalisationFile.h" #include "..\Minecraft.World\StringHelpers.h" #include "StringTable.h" -#include "Common/UI/UI.h" #include "Common\DLC\DLCAudioFile.h" #if defined _XBOX || defined _WINDOWS64 @@ -17,27 +16,27 @@ #include "Xbox\XML\xmlFilesCallback.h" #endif -DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, nullptr, pack->getName(), fallback) +DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) { m_dlcInfoPack = pack; - m_dlcDataPack = nullptr; + m_dlcDataPack = NULL; bUILoaded = false; m_bLoadingData = false; m_bHasLoadedData = false; - m_archiveFile = nullptr; + m_archiveFile = NULL; if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); m_bUsingDefaultColourTable = true; - m_stringTable = nullptr; + m_stringTable = NULL; #ifdef _XBOX - m_pStreamedWaveBank=nullptr; - m_pSoundBank=nullptr; + m_pStreamedWaveBank=NULL; + m_pSoundBank=NULL; #endif if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")) { - DLCLocalisationFile *localisationFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")); + DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); m_stringTable = localisationFile->getStringTable(); } @@ -52,7 +51,7 @@ void DLCTexturePack::loadIcon() { if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"icon.png")) { - DLCTextureFile *textureFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png")); + DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png"); m_iconData = textureFile->getData(m_iconSize); } else @@ -65,7 +64,7 @@ void DLCTexturePack::loadComparison() { if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"comparison.png")) { - DLCTextureFile *textureFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png")); + DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png"); m_comparisonData = textureFile->getData(m_comparisonSize); } } @@ -76,7 +75,7 @@ void DLCTexturePack::loadName() if(m_dlcInfoPack->GetPackID()&1024) { - if(m_stringTable != nullptr) + if(m_stringTable != NULL) { texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); m_wsWorldName=m_stringTable->getString(L"IDS_WORLD_NAME"); @@ -84,7 +83,7 @@ void DLCTexturePack::loadName() } else { - if(m_stringTable != nullptr) + if(m_stringTable != NULL) { texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); } @@ -96,7 +95,7 @@ void DLCTexturePack::loadDescription() { desc1 = L""; - if(m_stringTable != nullptr) + if(m_stringTable != NULL) { desc1 = m_stringTable->getString(L"IDS_TP_DESCRIPTION"); } @@ -116,15 +115,15 @@ InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //th // 4J Stu - We should never call this function #ifndef _CONTENT_PACKAGE __debugbreak(); - if(hasFile(name)) return nullptr; + if(hasFile(name)) return NULL; #endif - return nullptr; //resource; + return NULL; //resource; } bool DLCTexturePack::hasFile(const wstring &name) { bool hasFile = false; - if(m_dlcDataPack != nullptr) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); + if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); return hasFile; } @@ -165,23 +164,23 @@ DLCPack * DLCTexturePack::getDLCPack() void DLCTexturePack::loadColourTable() { // Load the game colours - if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) + if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) { - DLCColourTableFile *colourFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col")); + DLCColourTableFile *colourFile = (DLCColourTableFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col"); m_colourTable = colourFile->getColourTable(); m_bUsingDefaultColourTable = false; } else { // 4J Stu - We can delete the default colour table, but not the one from the DLCColourTableFile - if(!m_bUsingDefaultColourTable) m_colourTable = nullptr; + if(!m_bUsingDefaultColourTable) m_colourTable = NULL; loadDefaultColourTable(); m_bUsingDefaultColourTable = true; } // Load the text colours #ifdef _XBOX - if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); @@ -206,7 +205,7 @@ void DLCTexturePack::loadColourTable() swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#xuiscene_colourtable.xur",pbData, dwSize); HXUIOBJ hScene; - HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, nullptr, &hScene); + HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, NULL, &hScene); if(HRESULT_SUCCEEDED(hr)) { @@ -275,7 +274,7 @@ wstring DLCTexturePack::getFilePath(DWORD packId, wstring filename, bool bAddDat int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) { - DLCTexturePack *texturePack = static_cast(pParam); + DLCTexturePack *texturePack = (DLCTexturePack *)pParam; texturePack->m_bLoadingData = false; if(dwErr!=ERROR_SUCCESS) { @@ -295,11 +294,11 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack)) { delete texturePack->m_dlcDataPack; - texturePack->m_dlcDataPack = nullptr; + texturePack->m_dlcDataPack = NULL; } // Load the UI data - if(texturePack->m_dlcDataPack != nullptr) + if(texturePack->m_dlcDataPack != NULL) { #ifdef _XBOX File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) ); @@ -311,10 +310,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); if( fileHandle != INVALID_HANDLE_VALUE ) @@ -322,7 +321,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen DWORD dwFileSize = xzpPath.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); CloseHandle(fileHandle); if(success) { @@ -343,12 +342,12 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen */ DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack(); LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if (levelGen != nullptr && !levelGen->hasLoadedData()) + if (levelGen != NULL && !levelGen->hasLoadedData()) { int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); for(int i = 0; i < gameRulesCount; ++i) { - DLCGameRulesHeader *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); + DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); if (!dlcFile->getGrfPath().empty()) { @@ -362,10 +361,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -373,10 +372,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif @@ -385,7 +384,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen DWORD dwFileSize = grf.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -414,10 +413,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -425,18 +424,18 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -470,7 +469,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen //DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack(); if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio)>0) { - DLCAudioFile *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_Audio, 0)); + DLCAudioFile *dlcFile = (DLCAudioFile *) pack->getFile(DLCManager::e_DLCType_Audio, 0); texturePack->setHasAudio(true); // init the streaming sound ids for this texture pack int iOverworldStart, iNetherStart, iEndStart; @@ -514,7 +513,7 @@ void DLCTexturePack::loadUI() //L"memory://0123ABCD,21A3#skin_default.xur" // Load new skin - if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); @@ -528,7 +527,7 @@ void DLCTexturePack::loadUI() XuiFreeVisuals(L""); - HRESULT hr = app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); + HRESULT hr = app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); if(HRESULT_SUCCEEDED(hr)) { bUILoaded = true; @@ -578,7 +577,7 @@ void DLCTexturePack::unloadUI() AbstractTexturePack::unloadUI(); app.m_dlcManager.removePack(m_dlcDataPack); - m_dlcDataPack = nullptr; + m_dlcDataPack = NULL; delete m_archiveFile; m_bHasLoadedData = false; @@ -588,9 +587,9 @@ void DLCTexturePack::unloadUI() wstring DLCTexturePack::getXuiRootPath() { wstring path = L""; - if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { - DLCUIDataFile *dataFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")); + DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); DWORD dwSize = 0; PBYTE pbData = dataFile->getData(dwSize); diff --git a/Minecraft.Client/DLCTexturePack.h b/Minecraft.Client/DLCTexturePack.h index 595c47da..153f3d43 100644 --- a/Minecraft.Client/DLCTexturePack.h +++ b/Minecraft.Client/DLCTexturePack.h @@ -50,7 +50,7 @@ public: bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); virtual wstring getAnimationString(const wstring &textureName, const wstring &path); virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); virtual void loadColourTable(); diff --git a/Minecraft.Client/DeathScreen.cpp b/Minecraft.Client/DeathScreen.cpp index 0e9cfb19..e7ab1328 100644 --- a/Minecraft.Client/DeathScreen.cpp +++ b/Minecraft.Client/DeathScreen.cpp @@ -11,7 +11,7 @@ void DeathScreen::init() buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 3, L"Respawn")); buttons.push_back(new Button(2, width / 2 - 100, height / 4 + 24 * 4, L"Title menu")); - if (minecraft->user == nullptr) + if (minecraft->user == NULL) { buttons[1]->active = false; } @@ -30,12 +30,12 @@ void DeathScreen::buttonClicked(Button *button) if (button->id == 1) { minecraft->player->respawn(); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft.setScreen(new NewLevelScreen(this)); } if (button->id == 2) { - minecraft->setLevel(nullptr); + minecraft->setLevel(NULL); minecraft->setScreen(new TitleScreen()); } } diff --git a/Minecraft.Client/DefaultRenderer.h b/Minecraft.Client/DefaultRenderer.h index 28630de2..04b95390 100644 --- a/Minecraft.Client/DefaultRenderer.h +++ b/Minecraft.Client/DefaultRenderer.h @@ -5,5 +5,5 @@ class DefaultRenderer : public EntityRenderer { public: virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a); - virtual ResourceLocation *getTextureLocation(shared_ptr mob) { return nullptr; }; + virtual ResourceLocation *getTextureLocation(shared_ptr mob) { return NULL; }; }; \ No newline at end of file diff --git a/Minecraft.Client/DefaultTexturePack.cpp b/Minecraft.Client/DefaultTexturePack.cpp index d2712404..d2974b6d 100644 --- a/Minecraft.Client/DefaultTexturePack.cpp +++ b/Minecraft.Client/DefaultTexturePack.cpp @@ -4,7 +4,7 @@ #include "..\Minecraft.World\StringHelpers.h" -DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, nullptr, L"Minecraft", nullptr) +DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, NULL, L"Minecraft", NULL) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -20,7 +20,7 @@ void DefaultTexturePack::loadIcon() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); UINT size = 0; @@ -102,7 +102,7 @@ InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)/ #endif InputStream *resource = InputStream::getResourceAsStream(wDrive + name); //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name); - //if (stream == nullptr) + //if (stream == NULL) //{ // throw new FileNotFoundException(name); //} diff --git a/Minecraft.Client/DefaultTexturePack.h b/Minecraft.Client/DefaultTexturePack.h index 5fd0b40c..9aa87a07 100644 --- a/Minecraft.Client/DefaultTexturePack.h +++ b/Minecraft.Client/DefaultTexturePack.h @@ -5,7 +5,7 @@ class DefaultTexturePack : public AbstractTexturePack { public: DefaultTexturePack(); - DLCPack * getDLCPack() {return nullptr;} + DLCPack * getDLCPack() {return NULL;} protected: //@Override diff --git a/Minecraft.Client/DerivedServerLevel.cpp b/Minecraft.Client/DerivedServerLevel.cpp index 78de818d..a67408d7 100644 --- a/Minecraft.Client/DerivedServerLevel.cpp +++ b/Minecraft.Client/DerivedServerLevel.cpp @@ -10,7 +10,7 @@ DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptrsavedDataStorage) { delete this->savedDataStorage; - this->savedDataStorage=nullptr; + this->savedDataStorage=NULL; } this->savedDataStorage = wrapped->savedDataStorage; levelData = new DerivedLevelData(wrapped->getLevelData()); @@ -19,7 +19,7 @@ DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptrsavedDataStorage=nullptr; + this->savedDataStorage=NULL; } void DerivedServerLevel::saveLevelData() diff --git a/Minecraft.Client/DisconnectedScreen.cpp b/Minecraft.Client/DisconnectedScreen.cpp index 800df73f..b445e4d0 100644 --- a/Minecraft.Client/DisconnectedScreen.cpp +++ b/Minecraft.Client/DisconnectedScreen.cpp @@ -9,7 +9,7 @@ DisconnectedScreen::DisconnectedScreen(const wstring& title, const wstring reaso Language *language = Language::getInstance(); this->title = language->getElement(title); - if (reasonObjects != nullptr) + if (reasonObjects != NULL) { this->reason = language->getElement(reason, reasonObjects); } diff --git a/Minecraft.Client/DragonBreathParticle.cpp b/Minecraft.Client/DragonBreathParticle.cpp index 3fd90806..0d0f75f3 100644 --- a/Minecraft.Client/DragonBreathParticle.cpp +++ b/Minecraft.Client/DragonBreathParticle.cpp @@ -24,8 +24,8 @@ void DragonBreathParticle::init(Level *level, double x, double y, double z, doub size *= scale; oSize = size; - lifetime = static_cast(20 / (Math::random() * 0.8 + 0.2)); - lifetime = static_cast(lifetime * scale); + lifetime = (int) (20 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (lifetime * scale); noPhysics = false; m_bHasHitGround = false; diff --git a/Minecraft.Client/DragonModel.cpp b/Minecraft.Client/DragonModel.cpp index f1f36743..9e0499a9 100644 --- a/Minecraft.Client/DragonModel.cpp +++ b/Minecraft.Client/DragonModel.cpp @@ -159,7 +159,7 @@ void DragonModel::render(shared_ptr entity, float time, float r, float b rr = (float) Mth::cos(i * 0.45f + roff) * 0.15f; neck->yRot = rotWrap(dragon->getHeadPartYRotDiff(i, start, p)) * PI / 180.0f * rotScale; // 4J replaced "p[0] - start[0] with call to getHeadPartYRotDiff - neck->xRot = rr + static_cast(dragon->getHeadPartYOffset(i, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J replaced "p[1] - start[1]" with call to getHeadPartYOffset + neck->xRot = rr + (float) (dragon->getHeadPartYOffset(i, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J replaced "p[1] - start[1]" with call to getHeadPartYOffset neck->zRot = -rotWrap(p[0] - rot) * PI / 180.0f * rotScale; neck->y = yy; @@ -176,7 +176,7 @@ void DragonModel::render(shared_ptr entity, float time, float r, float b head->x = xx; dragon->getLatencyPos(p, 0, a); head->yRot = rotWrap(dragon->getHeadPartYRotDiff(6, start, p)) * PI / 180.0f * 1; // 4J replaced "p[0] - start[0] with call to getHeadPartYRotDiff - head->xRot = static_cast(dragon->getHeadPartYOffset(6, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J Added + head->xRot = (float) (dragon->getHeadPartYOffset(6, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J Added head->zRot = -rotWrap(p[0] - rot) * PI / 180 * 1; head->render(scale,usecompiled); glPushMatrix(); @@ -226,7 +226,7 @@ void DragonModel::render(shared_ptr entity, float time, float r, float b dragon->getLatencyPos(p, 12 + i, a); rr += Mth::sin(i * 0.45f + roff) * 0.05f; neck->yRot = (rotWrap(p[0] - start[0]) * rotScale + 180) * PI / 180; - neck->xRot = rr + static_cast(p[1] - start[1]) * PI / 180 * rotScale * 5; + neck->xRot = rr + (float) (p[1] - start[1]) * PI / 180 * rotScale * 5; neck->zRot = rotWrap(p[0] - rot) * PI / 180 * rotScale; neck->y = yy; neck->z = zz; @@ -244,5 +244,5 @@ float DragonModel::rotWrap(double d) d -= 360; while (d < -180) d += 360; - return static_cast(d); + return (float) d; } \ No newline at end of file diff --git a/Minecraft.Client/DripParticle.cpp b/Minecraft.Client/DripParticle.cpp index d7202b07..9463976e 100644 --- a/Minecraft.Client/DripParticle.cpp +++ b/Minecraft.Client/DripParticle.cpp @@ -30,7 +30,7 @@ DripParticle::DripParticle(Level *level, double x, double y, double z, Material this->material = material; stuckTime = 40; - lifetime = static_cast(64 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (64 / (Math::random() * 0.8 + 0.2)); xd = yd = zd = 0; } diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h index a24d6116..884f281e 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h @@ -61,8 +61,8 @@ STRING_VERIFY_RESPONSE; class C4JStringTable { public: - LPCWSTR Lookup(LPCWSTR szId) {return nullptr;} - LPCWSTR Lookup(UINT nIndex) {return nullptr;} + LPCWSTR Lookup(LPCWSTR szId) {return NULL;} + LPCWSTR Lookup(UINT nIndex) {return NULL;} void Clear(); HRESULT Load(LPCWSTR szId) {return S_OK;} }; @@ -126,8 +126,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, int iMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h index 961b5d2a..dab46417 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h @@ -132,7 +132,7 @@ public: // ACHIEVEMENTS & AWARDS //void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - // CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); + // CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); //int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h index fb16ccb3..737caa98 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h @@ -16,8 +16,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = nullptr; } - bool Allocated() { return m_pBuffer != nullptr; } + void Release() { free(m_pBuffer); m_pBuffer = NULL; } + bool Allocated() { return m_pBuffer != NULL; } }; typedef struct @@ -60,7 +60,7 @@ public: void StartFrame(); void DoScreenGrabOnNextPresent(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = nullptr); + void Clear(int flags, D3D11_RECT *pRect = NULL); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h index 62493952..be5d57fd 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h @@ -378,7 +378,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam, bool force=false); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -442,8 +442,8 @@ public: void SetLicenseChangeFn(void( *Func)(void)); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPWSTR szMountDrive = nullptr); - DWORD UnmountInstalledDLC(LPWSTR szMountDrive = nullptr); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPWSTR szMountDrive = NULL); + DWORD UnmountInstalledDLC(LPWSTR szMountDrive = NULL); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::wstring GetMountedPath(std::wstring szMount); XCONTENT_DATA * GetInstalledDLC(WCHAR *wszProductID); @@ -470,10 +470,10 @@ public: // TMS++ C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage eStorageFacility,int iPad);//,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - eTitleStorageState TMSPP_WriteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,BYTE *pbBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + eTitleStorageState TMSPP_WriteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,BYTE *pbBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); eTitleStorageState TMSPP_ReadFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int,LPVOID, WCHAR *),LPVOID lpParam, int iUserData); eTitleStorageState TMSPP_DeleteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int),LPVOID lpParam, int iUserData); - eTitleStorageState TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,int( *Func)(LPVOID,int,int,LPVOID,WCHAR *)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + eTitleStorageState TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,int( *Func)(LPVOID,int,int,LPVOID,WCHAR *)=NULL,LPVOID lpParam=NULL, int iUserData=0); bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); eTitleStorageState TMSPP_GetTitleStorageState(int iPad); diff --git a/Minecraft.Client/Durango/ApplicationView.cpp b/Minecraft.Client/Durango/ApplicationView.cpp index 6c195938..2af86496 100644 --- a/Minecraft.Client/Durango/ApplicationView.cpp +++ b/Minecraft.Client/Durango/ApplicationView.cpp @@ -22,7 +22,7 @@ ApplicationView::ApplicationView() XALLOC_ATTRIBUTES ExpandAllocAttributes( _In_ LONGLONG dwAttributes ) { XALLOC_ATTRIBUTES attr; - attr = *static_cast(&dwAttributes); + attr = *((XALLOC_ATTRIBUTES *)&dwAttributes); return attr; } @@ -247,7 +247,7 @@ void ApplicationView::OnSuspending(Platform::Object^ sender, SuspendingEventArgs LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; float fElapsedTime = 0.0f; QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); + float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; // Save the start time QueryPerformanceCounter( &qwTime ); @@ -275,7 +275,7 @@ void ApplicationView::OnSuspending(Platform::Object^ sender, SuspendingEventArgs QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); app.DebugPrintf("Entire suspend process: Elapsed time %f\n", fElapsedTime); } diff --git a/Minecraft.Client/Durango/DurangoExtras/DurangoStubs.cpp b/Minecraft.Client/Durango/DurangoExtras/DurangoStubs.cpp index 463756bc..81b9d7cf 100644 --- a/Minecraft.Client/Durango/DurangoExtras/DurangoStubs.cpp +++ b/Minecraft.Client/Durango/DurangoExtras/DurangoStubs.cpp @@ -32,7 +32,7 @@ DWORD XGetLanguage() WCHAR wchLocaleName[LOCALE_NAME_MAX_LENGTH]; GetUserDefaultLocaleName(wchLocaleName,LOCALE_NAME_MAX_LENGTH); - eMCLang eLang=static_cast(app.get_eMCLang(wchLocaleName)); + eMCLang eLang=(eMCLang)app.get_eMCLang(wchLocaleName); #ifdef _DEBUG app.DebugPrintf("XGetLanguage() ==> '%ls'\n", wchLocaleName); diff --git a/Minecraft.Client/Durango/Durango_App.cpp b/Minecraft.Client/Durango/Durango_App.cpp index efef93b4..672d6435 100644 --- a/Minecraft.Client/Durango/Durango_App.cpp +++ b/Minecraft.Client/Durango/Durango_App.cpp @@ -12,7 +12,6 @@ #include "ServiceConfig\Events-XBLA.8-149E11AEEvents.h" #include "..\..\Minecraft.World\DurangoStats.h" #include "..\..\Minecraft.Client\Durango\XML\xmlFilesCallback.h" -#include "Common/UI/UI.h" CConsoleMinecraftApp app; @@ -43,7 +42,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange() XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if((pContentData!=nullptr) &&(pContentData->bTrialLicense==false)) + if((pContentData!=NULL) &&(pContentData->bTrialLicense==false)) { DLCPack *pack = app.m_dlcManager.getPackFromProductID(xOffer.wszProductID); if(pack) @@ -194,7 +193,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages() { free(pDLCInfo->pbImageData); pDLCInfo->dwImageBytes=0; - pDLCInfo->pbImageData=nullptr; + pDLCInfo->pbImageData=NULL; } } } @@ -208,7 +207,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds swprintf(wchFilename,L"DLCImages/%s",wchName); - HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( hFile == INVALID_HANDLE_VALUE ) { @@ -222,9 +221,9 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D if(*pdwBytes!=0) { DWORD dwBytesRead; - PBYTE pbImageData=static_cast(malloc(*pdwBytes)); + PBYTE pbImageData=(PBYTE)malloc(*pdwBytes); - if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,nullptr)==FALSE) + if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,NULL)==FALSE) { // failed free(pbImageData); @@ -245,7 +244,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -274,7 +273,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -300,7 +299,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave time app.SetAutosaveTimerTime(); @@ -387,7 +386,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data) // Do we have a product id for this? DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName(Data.wszDisplayName); - if(pDLCInfo!=nullptr) + if(pDLCInfo!=NULL) { app.DebugPrintf("Updating product id for %ls\n",Data.wszDisplayName); swprintf_s(Data.wszProductID, 64,L"%ls",pDLCInfo->wsProductId.c_str()); @@ -455,9 +454,9 @@ bool CConsoleMinecraftApp::TMSPP_ReadBannedList(int iPad,eTMSAction NextAction) int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, int iUserData, LPVOID lpvData,WCHAR *wchFilename) { app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadBannedList\n"); - C4JStorage::PTMSPP_FILEDATA pFileData=static_cast(lpvData); + C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData; - CConsoleMinecraftApp* pClass = static_cast(pParam); + CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; if(pFileData) { @@ -487,7 +486,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in } // change the state to the next action - pClass->SetTMSAction(iPad,static_cast(iUserData)); + pClass->SetTMSAction(iPad,(eTMSAction)iUserData); return 0; } @@ -556,11 +555,11 @@ void CConsoleMinecraftApp::TMSPP_RetrieveFileList(int iPad,C4JStorage::eGlobalSt int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, int iUserData, LPVOID lpvData, WCHAR *wchFilename) { - CConsoleMinecraftApp* pClass = static_cast(pParam); + CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); - if(lpvData!= nullptr) + if(lpvData!=NULL) { - vector *pvTmsFileDetails=static_cast *>(lpvData); + vector *pvTmsFileDetails=(vector *)lpvData; if(pvTmsFileDetails->size()>0) { @@ -579,7 +578,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, } } // change the state to the next action - pClass->SetTMSAction(iPad,static_cast(iUserData)); + pClass->SetTMSAction(iPad,(eTMSAction)iUserData); return 0; } @@ -587,8 +586,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int iUserData, LPVOID lpvData ,WCHAR *pwchFilename) { app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadDLCFile\n"); - C4JStorage::PTMSPP_FILEDATA pFileData= static_cast(lpvData); - CConsoleMinecraftApp* pClass = static_cast(pParam); + C4JStorage::PTMSPP_FILEDATA pFileData= (C4JStorage::PTMSPP_FILEDATA)lpvData; + CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; #ifdef WRITE_DLCINFO if(0) @@ -636,7 +635,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i // hack for now to upload the file // open the local file - file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -654,12 +653,12 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bytesRead==dwFileSize) { - //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); + //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); } Sleep(5000); } @@ -668,7 +667,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i /* // now the icon - file = CreateFile(L"TP06.png", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile(L"TP06.png", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -685,11 +684,11 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); if(bytesRead==dwFileSize) { - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); } Sleep(5000); } @@ -699,14 +698,14 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i } // change the state to the next action - pClass->SetTMSAction(iPad,static_cast(iUserData)); + pClass->SetTMSAction(iPad,(eTMSAction)iUserData); return 0; } void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage::ESaveIncompleteType saveIncompleteType) { - CConsoleMinecraftApp* pClass = static_cast(pParam); + CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage ) @@ -741,7 +740,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CConsoleMinecraftApp* pClass = static_cast(pParam); + CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; switch(result) { @@ -758,7 +757,7 @@ int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pP StorageManager.CancelIncompleteOperation(); break; case C4JStorage::EMessage_ResultThirdOption: - ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, nullptr, eUILayer_Error, eUIGroup_Fullscreen); + ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, NULL, eUILayer_Error, eUIGroup_Fullscreen); break; } return 0; diff --git a/Minecraft.Client/Durango/Durango_App.h b/Minecraft.Client/Durango/Durango_App.h index ba4b26fb..6e021232 100644 --- a/Minecraft.Client/Durango/Durango_App.h +++ b/Minecraft.Client/Durango/Durango_App.h @@ -37,7 +37,7 @@ public: virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG); // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false) {} + virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} // TMS++ void TMSPP_RetrieveFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,eTMSAction NextAction); @@ -58,7 +58,7 @@ public: static void Callback_SaveGameIncomplete(void *pParam, C4JStorage::ESaveIncompleteType saveIncompleteType); static int Callback_SaveGameIncompleteMessageBoxReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - C4JStringTable *GetStringTable() { return nullptr;} + C4JStringTable *GetStringTable() { return NULL;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Durango/Durango_Minecraft.cpp b/Minecraft.Client/Durango/Durango_Minecraft.cpp index 350c4dbf..7fdab1be 100644 --- a/Minecraft.Client/Durango/Durango_Minecraft.cpp +++ b/Minecraft.Client/Durango/Durango_Minecraft.cpp @@ -272,7 +272,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - nullptr, + NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -291,7 +291,7 @@ void MemSect(int sect) #endif -HINSTANCE g_hInst = nullptr; +HINSTANCE g_hInst = NULL; Platform::Agile g_window; Windows::Foundation::Rect g_windowBounds; @@ -474,7 +474,7 @@ void oldWinMainInit() MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -546,7 +546,7 @@ void oldWinMainInit() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -583,7 +583,7 @@ void oldWinMainInit() app.ReadLocalDLCList(); // initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message - StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,static_cast(&app), app.UpdateProductId,SERVICE_CONFIG_ID,TITLE_PRODUCT_ID); + StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app, app.UpdateProductId,SERVICE_CONFIG_ID,TITLE_PRODUCT_ID); StorageManager.SetMaxSaves(99); @@ -596,21 +596,21 @@ void oldWinMainInit() app.GAME_DEFINED_PROFILE_DATA_BYTES*XUSER_MAX_COUNT, &app.uiGameDefinedDataChangedBitmask); - StorageManager.SetDefaultImages(static_cast(baSaveThumbnail.data), baSaveThumbnail.length); + StorageManager.SetDefaultImages((PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); // Set function to be called if a save game operation can't complete due to running out of storage space etc. - StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, static_cast(&app)); + StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, (LPVOID)&app); // set a function to be called when there's a sign in change, so we can exit a level if the primary player signs out ProfileManager.SetSignInChangeCallback(&CConsoleMinecraftApp::SignInChangeCallback,(LPVOID)&app); // Set a callback for the default player options to be set - when there is no profile data for the player - StorageManager.SetDefaultOptionsCallback(&CConsoleMinecraftApp::DefaultOptionsCallback,static_cast(&app)); - StorageManager.SetOptionsDataCallback(&CConsoleMinecraftApp::OptionsDataCallback,static_cast(&app)); + StorageManager.SetDefaultOptionsCallback(&CConsoleMinecraftApp::DefaultOptionsCallback,(LPVOID)&app); + StorageManager.SetOptionsDataCallback(&CConsoleMinecraftApp::OptionsDataCallback,(LPVOID)&app); // Set a callback to deal with old profile versions needing updated to new versions - StorageManager.SetOldProfileVersionCallback(&CConsoleMinecraftApp::OldProfileVersionCallback,static_cast(&app)); + StorageManager.SetOldProfileVersionCallback(&CConsoleMinecraftApp::OldProfileVersionCallback,(LPVOID)&app); g_NetworkManager.Initialise(); @@ -785,7 +785,7 @@ void oldWinMainTick() else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); diff --git a/Minecraft.Client/Durango/Durango_UIController.cpp b/Minecraft.Client/Durango/Durango_UIController.cpp index e27d91d2..446ab87e 100644 --- a/Minecraft.Client/Durango/Durango_UIController.cpp +++ b/Minecraft.Client/Durango/Durango_UIController.cpp @@ -75,7 +75,7 @@ void ConsoleUIController::render() example, no resolve targets are required. */ gdraw_D3D11_SetTileOrigin( m_pRenderTargetView.Get(), m_pDepthStencilView.Get(), - nullptr, + NULL, 0, 0 ); @@ -153,7 +153,7 @@ void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { gdraw_D3D11_SetTileOrigin( m_pRenderTargetView.Get(), m_pDepthStencilView.Get(), - nullptr, + NULL, xPos, yPos ); } @@ -169,7 +169,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId) ID3D11ShaderResourceView *tex = RenderManager.TextureGetTexture(textureId); ID3D11Resource *resource; tex->GetResource(&resource); - ID3D11Texture2D *tex2d = static_cast(resource); + ID3D11Texture2D *tex2d = (ID3D11Texture2D *)resource; D3D11_TEXTURE2D_DESC desc; tex2d->GetDesc(&desc); GDrawTexture *gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl index 6ea0d142..d4d2bb22 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl @@ -1364,7 +1364,7 @@ static DWORD pshader_exceptional_blend_12[276] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { nullptr, 0, }, + { NULL, 0, }, { pshader_exceptional_blend_1, 1340, }, { pshader_exceptional_blend_2, 1444, }, { pshader_exceptional_blend_3, 1424, }, @@ -2672,10 +2672,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_9, 708, }, { pshader_filter_10, 1644, }, { pshader_filter_11, 1372, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, { pshader_filter_16, 1740, }, { pshader_filter_17, 1732, }, { pshader_filter_18, 1820, }, @@ -2688,10 +2688,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_25, 1468, }, { pshader_filter_26, 1820, }, { pshader_filter_27, 1548, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, }; static DWORD pshader_blur_2[320] = { @@ -3193,8 +3193,8 @@ static DWORD pshader_blur_9[621] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, { pshader_blur_2, 1280, }, { pshader_blur_3, 1452, }, { pshader_blur_4, 1624, }, diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp index b5bfe1f6..0c106b3f 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp @@ -64,7 +64,7 @@ static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard) HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr); if (FAILED(hr)) { report_d3d_error(hr, "Map", "of buffer"); - return nullptr; + return NULL; } else return msr.pData; } @@ -76,12 +76,12 @@ static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf) static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader) { - ctx->PSSetShader(shader, nullptr, 0); + ctx->PSSetShader(shader, NULL, 0); } static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader) { - ctx->VSSetShader(shader, nullptr, 0); + ctx->VSSetShader(shader, NULL, 0); } static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst) @@ -100,7 +100,7 @@ static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11 HRESULT hr = dev->CreateBlendState(&desc, &res); if (FAILED(hr)) { report_d3d_error(hr, "CreateBlendState", ""); - res = nullptr; + res = NULL; } return res; @@ -113,10 +113,10 @@ static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWi { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader); + HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, NULL, &p->pshader); if (FAILED(hr)) { report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = nullptr; + p->pshader = NULL; return; } } @@ -126,10 +126,10 @@ static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramW { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader); + HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, NULL, &p->vshader); if (FAILED(hr)) { report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = nullptr; + p->vshader = NULL; return; } } diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h index f8a5dc6d..c8db492a 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h @@ -41,7 +41,7 @@ IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11 There can only be one D3D GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_D3D11_DestroyContext(void); /* Destroys the current GDraw context, if any. */ @@ -69,7 +69,7 @@ IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D If your rendertarget uses multisampling, you also need to specify a shader resource view for a non-MSAA rendertarget texture (identically sized to main_rt) in non_msaa_rt. This is only used if the Flash content includes non-standard - blend modes which have to use a special blend shader, so you can leave it nullptr + blend modes which have to use a special blend shader, so you can leave it NULL if you forbid such content. You need to call this before Iggy calls any rendering functions. */ diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl index 1cbac10f..1ab1f13f 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -196,16 +196,16 @@ static void safe_release(T *&p) { if (p) { p->Release(); - p = nullptr; + p = NULL; } } static void report_d3d_error(HRESULT hr, char *call, char *context) { if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context); + IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context); else - IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); + IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); } static void unbind_resources(void) @@ -215,12 +215,12 @@ static void unbind_resources(void) // unset active textures and vertex/index buffers, // to make sure there are no dangling refs static ID3D1X(ShaderResourceView) *no_views[3] = { 0 }; - ID3D1X(Buffer) *no_vb = nullptr; + ID3D1X(Buffer) *no_vb = NULL; UINT no_offs = 0; d3d->PSSetShaderResources(0, 3, no_views); d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); + d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); } static void api_free_resource(GDrawHandle *r) @@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) static void *start_write_dyn(DynBuffer *buf, U32 size) { - U8 *ptr = nullptr; + U8 *ptr = NULL; if (size > buf->size) { - IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); - return nullptr; + IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); + return NULL; } // update statistics @@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie { GDrawStats stats={0}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = nullptr; + p->handle.tex.d3d = NULL; p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = nullptr; + p->handle.tex.d3d_rtview = NULL; p->handle.tex.w = 1; p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view) { GDrawHandle *p = (GDrawHandle *) tex; - p->handle.tex.d3d = nullptr; + p->handle.tex.d3d = NULL; p->handle.tex.d3d_view = tex_view; } @@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; DXGI_FORMAT dxgi_fmt; S32 bpp, size = 0, nmips = 0; if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); + IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); return false; } @@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, // try to allocate memory for the client to write to p->texture_data = (U8 *) IggyGDrawMalloc(size); if (!p->texture_data) { - IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); return false; } @@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, t->handle.tex.w = width; t->handle.tex.h = height; - t->handle.tex.d3d = nullptr; - t->handle.tex.d3d_view = nullptr; - t->handle.tex.d3d_rtview = nullptr; + t->handle.tex.d3d = NULL; + t->handle.tex.d3d_view = NULL; + t->handle.tex.d3d_rtview = NULL; p->texture_type = GDRAW_TEXTURE_TYPE_rgba; p->p0 = t; @@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI // and create a corresponding shader resource view failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); done: if (!FAILED(hr)) { @@ -525,7 +525,7 @@ done: safe_release(t->handle.tex.d3d_view); gdraw_HandleCacheAllocateFail(t); - t = nullptr; + t = NULL; report_d3d_error(hr, failed_call, " while creating texture"); } @@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/ static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == NULL) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) return; } - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view); + hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view); if (FAILED(hr)) { report_d3d_error(hr, "CreateShaderResourceView", " while creating texture"); safe_release(gdraw->aa_tex); @@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (p->vertex_data && p->index_data) { GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); if (vb) { - vb->handle.vbuf.verts = nullptr; - vb->handle.vbuf.inds = nullptr; + vb->handle.vbuf.verts = NULL; + vb->handle.vbuf.inds = NULL; p->vertex_data_length = vbuf_size; p->index_data_length = ibuf_size; @@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf safe_release(vb->handle.vbuf.inds); gdraw_HandleCacheAllocateFail(vb); - vb = nullptr; + vb = NULL; report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); } else { @@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); // @GDRAW_ASSERT + assert(h != NULL); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) // ran out of RTs, allocate a new one S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); - return nullptr; + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); + return NULL; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); return t; } D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0, 0 }; - t->handle.tex.d3d = nullptr; - t->handle.tex.d3d_view = nullptr; - t->handle.tex.d3d_rtview = nullptr; + t->handle.tex.d3d = NULL; + t->handle.tex.d3d_view = NULL; + t->handle.tex.d3d_rtview = NULL; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); failed_call = "CreateTexture2D"; } if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview); + hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); failed_call = "CreateRenderTargetView"; } @@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) report_d3d_error(hr, failed_call, " creating rendertarget"); - return nullptr; + return NULL; } gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked); @@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats) D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0, 0 }; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]); + hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); failed_call = "CreateDepthStencilView while creating rendertarget"; } @@ -1110,7 +1110,7 @@ static void set_render_target(GDrawStats *stats) gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]); gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); } else { - ID3D1X(DepthStencilView) *depth = nullptr; + ID3D1X(DepthStencilView) *depth = NULL; if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) depth = get_rendertarget_depthbuffer(stats); @@ -1125,15 +1125,15 @@ static void set_render_target(GDrawStats *stats) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats) { GDrawFramebufferState *n = gdraw->cur+1; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } @@ -1147,10 +1147,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->flags = flags; n->color_buffer = t; - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT ++gdraw->cur; - gdraw->cur->cached = owner != nullptr; + gdraw->cur->cached = owner != NULL; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1229,9 +1229,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != nullptr); // @GDRAW_ASSERT + assert(m->color_buffer != NULL); // @GDRAW_ASSERT } - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT // switch back to old render target set_render_target(stats); @@ -1288,8 +1288,8 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap { ID3D1XContext *d3d = gdraw->d3d_context; - if (tex == nullptr) { - ID3D1X(ShaderResourceView) *notex = nullptr; + if (tex == NULL) { + ID3D1X(ShaderResourceView) *notex = NULL; d3d->PSSetShaderResources(texunit, 1, ¬ex); } else { GDrawHandle *h = (GDrawHandle *) tex; @@ -1300,7 +1300,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == nullptr) + if (mat == NULL) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -1363,9 +1363,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta // in stencil set mode, prefer not doing any shading at all // but if alpha test is on, we need to make an exception -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems +#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems if (which != GDRAW_TEXTURE_alpha_test) - program = nullptr; + program = NULL; else #endif { @@ -1475,7 +1475,7 @@ static int vertsize[GDRAW_vformat__basic_count] = { // Draw triangles with a given renderstate // -static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) +static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) { U64 now = gdraw->frame_counter; if (r1) ((GDrawHandle *) r1)->fence.value = now; @@ -1687,7 +1687,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) return; set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); @@ -1775,7 +1775,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = nullptr; + GDrawHandle *blend_tex = NULL; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. we do this with copies @@ -1859,18 +1859,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p) { if (p->pshader) { p->pshader->Release(); - p->pshader = nullptr; + p->pshader = NULL; } } static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind) { D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 }; - ID3D1X(Buffer) *buf = nullptr; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf); + ID3D1X(Buffer) *buf = NULL; + HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = nullptr; + buf = NULL; } return buf; } @@ -1907,7 +1907,7 @@ static void create_all_shaders_and_state(void) HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]); if (FAILED(hr)) { report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = nullptr; + gdraw->inlayout[i] = NULL; } } @@ -2026,11 +2026,11 @@ static void create_all_shaders_and_state(void) hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = nullptr; + gdraw->quad_ib = NULL; } IggyGDrawFree(inds); } else - gdraw->quad_ib = nullptr; + gdraw->quad_ib = NULL; } static void destroy_all_shaders_and_state() @@ -2103,7 +2103,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } static bool alloc_dynbuffer(U32 size) @@ -2139,7 +2139,7 @@ static bool alloc_dynbuffer(U32 size) gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); gdraw->max_quad_vert_count &= ~3; // must be multiple of four - return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr; + return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; } int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2178,7 +2178,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2186,7 +2186,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; case GDRAW_D3D1X_(RESOURCE_dynbuffer): unbind_resources(); @@ -2202,7 +2202,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h) { gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -2217,7 +2217,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { free_gdraw(); - return nullptr; + return NULL; } create_all_shaders_and_state(); @@ -2288,7 +2288,7 @@ void gdraw_D3D1X_(DestroyContext)(void) if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - gdraw->d3d_device = nullptr; + gdraw->d3d_device = NULL; } free_gdraw(); @@ -2351,7 +2351,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break; case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return; - default: cache = nullptr; break; + default: cache = NULL; break; } *handles_used = *bytes_used = 0; @@ -2408,7 +2408,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break; case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break; default: { - IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); + IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); goto done; } } @@ -2424,7 +2424,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, free_data = (U8 *) IggyGDrawMalloc(total_size); if (!free_data) { - IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); goto done; } @@ -2457,7 +2457,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, if (FAILED(hr)) goto done; failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view); + hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); if (FAILED(hr)) goto done; t = gdraw_D3D1X_(WrappedTextureCreate)(view); diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl index 1790de77..a60fa520 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != nullptr) { + while (s != NULL) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! + assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, nullptr); + return gdraw_HandleCacheLockStats(t, owner, NULL); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = nullptr; - c->state[i].cache = nullptr; // should never follow cache link from sentinels! + c->state[i].owner = NULL; + c->state[i].cache = NULL; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = nullptr; + c->state[i].raw_ptr = NULL; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = nullptr; + c->handle[i].raw_ptr = NULL; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = nullptr; + c->alloc = NULL; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = nullptr; + c->alloc_other = NULL; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = nullptr; + t->raw_ptr = NULL; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -558,7 +558,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : nullptr; + return (sentinel->next != sentinel) ? sentinel->next : NULL; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -773,7 +773,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -825,7 +825,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -837,7 +837,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -944,7 +944,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); + S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1090,7 +1090,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = nullptr; + *start = NULL; *num_bytes = 0; return; } else { @@ -1127,7 +1127,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return nullptr; + return NULL; arena->current = ptr + size; return ptr; @@ -1152,7 +1152,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, nullptr-terminated list of elements in each hash +// There's a single-linked, NULL-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1161,7 +1161,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, nullptr-terminated list of unused blocks. Every block is either +// single-linked, NULL-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1379,7 +1379,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != nullptr); + GFXALLOC_ASSERT(alloc->unused_list != NULL); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1452,7 +1452,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return nullptr; + return NULL; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1460,7 +1460,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return nullptr; + return NULL; memset(a, 0, size); @@ -1501,16 +1501,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, nullptr, 0,0); + debug_complete_check(a, NULL, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = nullptr; + gfx_block_info *cur, *best = NULL; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, nullptr, 0,0); +debug_complete_check(alloc, NULL, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1560,7 +1560,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return nullptr; // not enough space! + return NULL; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1730,7 +1730,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = nullptr; + b->prev = NULL; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1743,7 +1743,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1905,7 +1905,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = nullptr; + void *ptr = NULL; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2295,7 +2295,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = nullptr; + ring->cur = NULL; ring->seg_size = 0; } @@ -2305,7 +2305,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return nullptr; // nope, won't fit + return NULL; // nope, won't fit assert(align <= ring->align); @@ -2410,7 +2410,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2430,8 +2430,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return nullptr; + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return NULL; } #ifndef GDRAW_MANAGE_MEM @@ -2440,7 +2440,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2448,7 +2448,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, nullptr, "memory"); + gdraw_res_alloc_outofmem(c, NULL, "memory"); break; } } @@ -2463,8 +2463,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == nullptr) { - gdraw_res_alloc_outofmem(c, nullptr, "handles"); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); } } } @@ -2508,7 +2508,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = nullptr; + r->owner = NULL; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2516,11 +2516,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = nullptr; + void *ptr = NULL; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2532,7 +2532,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, nullptr, "handles"); + return gdraw_res_alloc_outofmem(c, NULL, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Durango/Iggy/include/gdraw.h b/Minecraft.Client/Durango/Iggy/include/gdraw.h index 7cc4ddd0..404a2642 100644 --- a/Minecraft.Client/Durango/Iggy/include/gdraw.h +++ b/Minecraft.Client/Durango/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is nullptr, then the pointers in 'prim' are machine pointers, and + If buf is NULL, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-nullptr, then use the appropriate vertex buffer, and the + If buf is non-NULL, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or nullptr if an error occured + $:return Handle for the newly created texture, or NULL if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h index a42ccbff..1f1a90a1 100644 --- a/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP +Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp index cc19b738..46b04606 100644 --- a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -14,7 +14,7 @@ DurangoLeaderboardManager::DurangoLeaderboardManager() m_openSessions = 0; m_xboxLiveContext = nullptr; - m_scores = nullptr; + m_scores = NULL; m_readCount = 0; m_maxRank = 0; m_waitingForProfiles = false; @@ -160,7 +160,7 @@ void DurangoLeaderboardManager::Tick() m_displayNames.clear(); } - //assert(m_scores != nullptr || m_readCount == 0); + //assert(m_scores != NULL || m_readCount == 0); view.m_numQueries = m_readCount; view.m_queries = m_scores; @@ -170,7 +170,7 @@ void DurangoLeaderboardManager::Tick() eStatsReturn ret = view.m_numQueries > 0 ? eStatsReturn_Success : eStatsReturn_NoResults; - if (m_readListener != nullptr) + if (m_readListener != NULL) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _)\n", ret, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -178,7 +178,7 @@ void DurangoLeaderboardManager::Tick() app.DebugPrintf("[LeaderboardManager] Deleting scores\n"); delete [] m_scores; - m_scores = nullptr; + m_scores = NULL; setState(eStatsState_Idle); } @@ -186,9 +186,9 @@ void DurangoLeaderboardManager::Tick() case eStatsState_Failed: view.m_numQueries = 0; - view.m_queries = nullptr; + view.m_queries = NULL; - if ( m_readListener != nullptr ) + if ( m_readListener != NULL ) { m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); } @@ -371,7 +371,7 @@ void DurangoLeaderboardManager::FlushStats() //Cancel the current operation void DurangoLeaderboardManager::CancelOperation() { - m_readListener = nullptr; + m_readListener = NULL; setState(eStatsState_Canceled); if(m_leaderboardAsyncOp) m_leaderboardAsyncOp->Cancel(); @@ -428,7 +428,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationDisplayName->Data(), - LeaderboardManager::filterNames[ static_cast(filter) ].c_str(), + LeaderboardManager::filterNames[ (int) filter ].c_str(), lastResult->Rows->Size, lastResult->TotalRowCount, readCount ); @@ -458,7 +458,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationTotalRowCount; m_readCount = lastResult->Rows->Size; - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_scores = new ReadScore[m_readCount]; ZeroMemory(m_scores, sizeof(ReadScore) * m_readCount); @@ -480,10 +480,10 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationGamertag->Data(); m_scores[index].m_rank = row->Rank; - m_scores[index].m_uid = static_cast(row->XboxUserId->Data()); + m_scores[index].m_uid = PlayerUID(row->XboxUserId->Data()); // 4J-JEV: Added to help determine if this player's score is hidden due to their privacy settings. - m_scores[index].m_totalScore = static_cast(_fromString(row->Values->GetAt(0)->Data())); + m_scores[index].m_totalScore = (unsigned long) _fromString(row->Values->GetAt(0)->Data()); m_xboxUserIds->Append(row->XboxUserId); } @@ -493,7 +493,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperation xuids = vector(); for(int i = 0; i < lastResult->Rows->Size; i++) { - xuids.push_back(static_cast(lastResult->Rows->GetAt(i)->XboxUserId->Data())); + xuids.push_back(PlayerUID(lastResult->Rows->GetAt(i)->XboxUserId->Data())); } m_waitingForProfiles = true; ProfileManager.GetProfiles(xuids, &GetProfilesCallback, this); @@ -579,7 +579,7 @@ void DurangoLeaderboardManager::updateStatsInfo(int userIndex, int difficulty, E void DurangoLeaderboardManager::GetProfilesCallback(LPVOID param, std::vector profiles) { - DurangoLeaderboardManager *dlm = static_cast(param); + DurangoLeaderboardManager *dlm = (DurangoLeaderboardManager *)param; app.DebugPrintf("[LeaderboardManager] GetProfilesCallback, profiles.size() == %d.\n", profiles.size()); diff --git a/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp b/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp index 5ac71141..caa5857e 100644 --- a/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp +++ b/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp @@ -84,7 +84,7 @@ vector *StatParam::getStats() return out; } -DurangoStatsDebugger *DurangoStatsDebugger::instance = nullptr; +DurangoStatsDebugger *DurangoStatsDebugger::instance = NULL; DurangoStatsDebugger::DurangoStatsDebugger() { @@ -320,7 +320,7 @@ DurangoStatsDebugger *DurangoStatsDebugger::Initialize() void DurangoStatsDebugger::PrintStats(int iPad) { - if (instance == nullptr) instance = Initialize(); + if (instance == NULL) instance = Initialize(); vector *tmp = instance->getStats(); instance->m_printQueue.insert(instance->m_printQueue.end(), tmp->begin(), tmp->end()); diff --git a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp index f97f9bb3..dd07f3e9 100644 --- a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp +++ b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp @@ -10,11 +10,11 @@ namespace WFC = Windows::Foundation::Collections; namespace MXSA = Microsoft::Xbox::Services::Achievements; namespace CC = concurrency; -GameProgress *GameProgress::instance = nullptr; +GameProgress *GameProgress::instance = NULL; void GameProgress::Flush(int iPad) { - if (instance == nullptr) + if (instance == NULL) instance = new GameProgress(); instance->updatePlayer(iPad); @@ -22,7 +22,7 @@ void GameProgress::Flush(int iPad) void GameProgress::Tick() { - if (instance == nullptr) + if (instance == NULL) instance = new GameProgress(); long long currentTime = System::currentTimeMillis(); @@ -103,5 +103,5 @@ void GameProgress::updatePlayer(int iPad) float GameProgress::calcGameProgress(int achievementsUnlocked) { - return static_cast(achievementsUnlocked) / 0.60f; + return (float) achievementsUnlocked / 0.60f; } \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h b/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h index f81a0f1f..80b4e10a 100644 --- a/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h +++ b/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h @@ -238,7 +238,7 @@ private: __in ChatPacketType chatPacketType ); Concurrency::critical_section m_chatPacketStatsLock; - int m_chatVoicePacketsStatistic[2][static_cast(Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage)+1]; + int m_chatVoicePacketsStatistic[2][(int)Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage+1]; }; std::shared_ptr GetChatIntegrationLayer(); \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp index 9e9e78c0..39dc53a9 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp @@ -25,7 +25,7 @@ int DQRNetworkManager::m_bootUserIndex; wstring DQRNetworkManager::m_bootSessionName; wstring DQRNetworkManager::m_bootServiceConfig; wstring DQRNetworkManager::m_bootSessionTemplate; -DQRNetworkManager * DQRNetworkManager::s_pDQRManager = nullptr; +DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL; //using namespace Windows::Xbox::Networking; @@ -87,16 +87,16 @@ DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener) memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); memset(m_players, 0, sizeof(m_players)); - m_CreateSessionThread = nullptr; - m_GetFriendPartyThread = nullptr; - m_UpdateCustomSessionDataThread = nullptr; + m_CreateSessionThread = NULL; + m_GetFriendPartyThread = NULL; + m_UpdateCustomSessionDataThread = NULL; - m_CheckPartyInviteThread = nullptr; + m_CheckPartyInviteThread = NULL; m_notifyForFullParty = false; m_customDataDirtyUpdateTicks = 0; m_sessionResultCount = 0; - m_sessionSearchResults = nullptr; + m_sessionSearchResults = NULL; m_joinSessionUserMask = 0; m_cancelJoinFromSearchResult = false; @@ -274,7 +274,7 @@ void DQRNetworkManager::JoinSession(int playerMask) // If we found the session, then set the status of this member to be active (should be reserved). This will stop our slot timing out and us being dropped out of the session. if( session != nullptr ) { - if(!IsPlayerInSession(joiningUser->XboxUserId, session, nullptr) ) + if(!IsPlayerInSession(joiningUser->XboxUserId, session, NULL) ) { app.DebugPrintf("DNM_INT_STATE_JOINING_FAILED didn't find required player in session\n"); SetState(DNM_INT_STATE_JOINING_FAILED); @@ -515,7 +515,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) pPlayer->SetSmallId(smallId); pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex)); - pPlayer->SetUID(static_cast(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); // Also add to the party so that our friends can find us. The host will get notified of this additional player in the party, but we should ignore since we're already in the session m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0)); @@ -550,7 +550,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) pPlayer->SetSmallId(m_currentSmallId++); pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex)); - pPlayer->SetUID(static_cast(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); // TODO - could this add fail? if(AddRoomSyncPlayer( pPlayer, 0, userIndex)) @@ -600,7 +600,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) m_joinSessionXUIDs[userIndex] = ProfileManager.GetUser(userIndex)->XboxUserId; m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0)); - m_addLocalPlayerSuccessPlayer = nullptr; + m_addLocalPlayerSuccessPlayer = NULL; m_addLocalPlayerState = DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS; } } @@ -763,7 +763,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerBySmallId(int idx) } } } - return nullptr; + return NULL; } DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) @@ -778,7 +778,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) } } } - return nullptr; + return NULL; } // Retrieve player display name by gamertag @@ -809,7 +809,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetLocalPlayerByUserIndex(int idx) } } } - return nullptr; + return NULL; } DQRNetworkPlayer *DQRNetworkManager::GetHostPlayer() @@ -892,7 +892,7 @@ void DQRNetworkManager::Tick_VoiceChat() #endif // If we have to inform the chat integration layer of any players that have joined, do that now EnterCriticalSection(&m_csVecChatPlayers); - for( size_t i = 0; i < m_vecChatPlayersJoined.size(); i++ ) + for( int i = 0; i < m_vecChatPlayersJoined.size(); i++ ) { int idx = m_vecChatPlayersJoined[i]; if( m_chat ) @@ -967,19 +967,19 @@ void DQRNetworkManager::Tick_Party() void DQRNetworkManager::Tick_CustomSessionData() { // If there was a thread updaing our custom session data, then clear it up if it is done - if( m_UpdateCustomSessionDataThread != nullptr ) + if( m_UpdateCustomSessionDataThread != NULL ) { if( !m_UpdateCustomSessionDataThread->isRunning() ) { delete m_UpdateCustomSessionDataThread; - m_UpdateCustomSessionDataThread = nullptr; + m_UpdateCustomSessionDataThread = NULL; } } // If our custom data is dirty, and we aren't currently updating, then kick off a thread to update it if( m_isHosting && ( !m_isOfflineGame ) ) { - if( m_UpdateCustomSessionDataThread == nullptr ) + if( m_UpdateCustomSessionDataThread == NULL ) { if( m_customDataDirtyUpdateTicks ) { @@ -1003,7 +1003,7 @@ void DQRNetworkManager::Tick_AddAndRemoveLocalPlayers() // A lot of handling adding local players is handled asynchronously. Trying to avoid having the callbacks that may result from this being called from the task threads, so handling this aspect of it here in the tick if( m_addLocalPlayerState == DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS ) { - // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be nullptr as the actual + // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be NULL as the actual // adding of the player happens as part of a longer process of the host creating us a reserved slot etc. etc. if( m_addLocalPlayerSuccessPlayer ) { @@ -1201,7 +1201,7 @@ void DQRNetworkManager::Tick_StateMachine() break; case DNM_INT_STATE_HOSTING_WAITING_TO_PLAY: delete m_CreateSessionThread; - m_CreateSessionThread = nullptr; + m_CreateSessionThread = NULL; // If the game is offline we can transition straight to playing if (m_isOfflineGame) StartGame(); break; @@ -1247,10 +1247,10 @@ void DQRNetworkManager::Tick_CheckInviteParty() if( !m_CheckPartyInviteThread->isRunning() ) { delete m_CheckPartyInviteThread; - m_CheckPartyInviteThread = nullptr; + m_CheckPartyInviteThread = NULL; } } - if( m_CheckPartyInviteThread == nullptr ) + if( m_CheckPartyInviteThread == NULL ) { m_inviteReceived = false; m_CheckPartyInviteThread = new C4JThread(&DQRNetworkManager::_CheckInviteThreadProc, this, "Check invite thread"); @@ -1326,11 +1326,11 @@ void DQRNetworkManager::HandleSessionChange(MXSM::MultiplayerSession^ multiplaye { // 4J-JEV: This id is needed to link stats together. // I thought setting the value from here would be less intrusive than adding an accessor. - static_cast(GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); + ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); } else { - static_cast(GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); + ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); } m_multiplayerSession = multiplayerSession; @@ -1403,7 +1403,7 @@ bool DQRNetworkManager::IsPlayerInSession( Platform::String^ xboxUserId, MXSM::M { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - *smallId = static_cast(customValue->GetNumber()) & 255; + *smallId = (int)(customValue->GetNumber()) & 255; } catch (Platform::COMException^ ex) { @@ -1449,7 +1449,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) for( int j = 0; j < m_roomSyncData.playerCount; j++ ) { tempPlayers.push_back(m_players[j]); - m_players[j] = nullptr; + m_players[j] = NULL; } // For each new player, it's either: @@ -1509,12 +1509,12 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) } memcpy(&m_roomSyncData, pNewSyncData, sizeof(m_roomSyncData)); - for( size_t i = 0; i < tempPlayers.size(); i++ ) + for( int i = 0; i < tempPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(tempPlayers[i]); delete tempPlayers[i]; } - for( size_t i = 0; i < newPlayers.size(); i++ ) + for( int i = 0; i < newPlayers.size(); i++ ) { m_listener->HandlePlayerJoined(newPlayers[i]); // For clients, this is where we get notified of local and remote players joining } @@ -1592,12 +1592,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses } m_roomSyncData.playerCount = iWriteIdx; - for( size_t i = 0; i < removedPlayers.size(); i++ ) + for( int i = 0; i < removedPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = nullptr; + m_players[m_roomSyncData.playerCount + i] = NULL; } LeaveCriticalSection(&m_csRoomSyncData); } @@ -1623,12 +1623,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer) } m_roomSyncData.playerCount = iWriteIdx; - for( size_t i = 0; i < removedPlayers.size(); i++ ) + for( int i = 0; i < removedPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = nullptr; + m_players[m_roomSyncData.playerCount + i] = NULL; } } @@ -1643,7 +1643,7 @@ void DQRNetworkManager::SendRoomSyncInfo() // (2) A single byte internal data tag // (3) An unsigned int encoding the size of the combined size of all the strings in stage (5) // (4) The RoomSyncData structure itself - // (5) A wchar nullptr terminated string for every active player to encode the XUID + // (5) A wchar NULL terminated string for every active player to encode the XUID unsigned int xuidBytes = 0; for( int i = 0 ; i < m_roomSyncData.playerCount; i++ ) { @@ -1689,7 +1689,7 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid) // (1) 2 byte general header // (2) A single byte internal data tag // (3) An unsigned int encoding the size size of the string - // (5) A wchar nullptr terminated string storing the xuid of the player which has failed to join + // (5) A wchar NULL terminated string storing the xuid of the player which has failed to join unsigned int xuidBytes = sizeof(wchar_t) * ( xuid->Length() + 1 ); @@ -1745,7 +1745,7 @@ void DQRNetworkManager::SendSmallId(bool reliableAndSequential, int playerMask) { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - smallId = static_cast(customValue->GetNumber()); + smallId = (BYTE)(customValue->GetNumber()); bFound = true; } catch (Platform::COMException^ ex) @@ -1797,7 +1797,7 @@ int DQRNetworkManager::GetSessionIndexForSmallId(unsigned char smallId) { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - smallIdMember = static_cast(customValue->GetNumber()); + smallIdMember = (BYTE)(customValue->GetNumber()); } catch (Platform::COMException^ ex) { @@ -1830,7 +1830,7 @@ int DQRNetworkManager::GetSessionIndexAndSmallIdForHost(unsigned char *smallId) } if( smallIdMember > 255 ) { - *smallId = static_cast(smallIdMember); + *smallId = (BYTE)(smallIdMember); return i; } } @@ -1877,7 +1877,7 @@ Platform::String^ DQRNetworkManager::GetNextSmallIdAsJsonString() int DQRNetworkManager::_HostGameThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->HostGameThreadProc(); } @@ -2190,7 +2190,7 @@ int DQRNetworkManager::HostGameThreadProc() pPlayer->SetSmallId(smallId); pPlayer->SetName(user->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(displayName); - pPlayer->SetUID(static_cast(user->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(user->XboxUserId->Data())); AddRoomSyncPlayer( pPlayer, localSessionAddress, i); @@ -2208,7 +2208,7 @@ int DQRNetworkManager::HostGameThreadProc() int DQRNetworkManager::_LeaveRoomThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->LeaveRoomThreadProc(); } @@ -2311,7 +2311,7 @@ int DQRNetworkManager::LeaveRoomThreadProc() int DQRNetworkManager::_TidyUpJoinThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->TidyUpJoinThreadProc(); } @@ -2416,7 +2416,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc() int DQRNetworkManager::_UpdateCustomSessionDataThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->UpdateCustomSessionDataThreadProc(); } @@ -2491,7 +2491,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc() int DQRNetworkManager::_CheckInviteThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->CheckInviteThreadProc(); } @@ -2614,7 +2614,7 @@ void DQRNetworkManager::LeaveRoom() for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { delete m_players[i]; - m_players[i] = nullptr; + m_players[i] = NULL; } memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); m_displayNames.clear(); @@ -3026,8 +3026,8 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player) void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Services::Social::XboxUserProfile^ profile) { - DQRNetworkManager *dqnm = static_cast(pParam); - dqnm->SetDisplayName(static_cast(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); + DQRNetworkManager *dqnm = (DQRNetworkManager *)pParam; + dqnm->SetDisplayName(PlayerUID(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); } // Set player display name diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Durango/Network/DQRNetworkManager.h index b74e079c..3c4a742c 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.h @@ -221,7 +221,7 @@ public: class SessionSearchResult { public: - SessionSearchResult() { m_extData = nullptr; } + SessionSearchResult() { m_extData = NULL; } ~SessionSearchResult() { free(m_extData); } wstring m_partyId; wstring m_sessionName; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp index 0822a93c..3a14a2d5 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -49,7 +49,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() m_sessionResultCount = 0; delete [] m_sessionSearchResults; - m_sessionSearchResults = nullptr; + m_sessionSearchResults = NULL; m_GetFriendPartyThread = new C4JThread(&_GetFriendsThreadProc,this,"GetFriendsThreadProc"); m_GetFriendPartyThread->Run(); @@ -61,7 +61,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchResult *searchResult) { assert( idx < m_sessionResultCount ); - assert( ( m_GetFriendPartyThread == nullptr ) || ( !m_GetFriendPartyThread->isRunning()) ); + assert( ( m_GetFriendPartyThread == NULL ) || ( !m_GetFriendPartyThread->isRunning()) ); // Need to make sure that copied data has independently allocated m_extData, so both copies can be freed *searchResult = m_sessionSearchResults[idx]; @@ -71,7 +71,7 @@ void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchR int DQRNetworkManager::_GetFriendsThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->GetFriendsThreadProc(); } @@ -410,7 +410,7 @@ int DQRNetworkManager::GetFriendsThreadProc() for( int j = 0; j < nameResolveVector[i]->Size; j++ ) { m_sessionSearchResults[i].m_playerNames[j] = nameResolveVector[i]->GetAt(j)->GameDisplayName->Data(); - m_sessionSearchResults[i].m_playerXuids[j] = static_cast(nameResolveVector[i]->GetAt(j)->XboxUserId->Data()); + m_sessionSearchResults[i].m_playerXuids[j] = PlayerUID(nameResolveVector[i]->GetAt(j)->XboxUserId->Data()); } m_sessionSearchResults[i].m_playerCount = nameResolveVector[i]->Size; m_sessionSearchResults[i].m_usedSlotCount = newSessionVector[i]->Members->Size; @@ -556,7 +556,7 @@ bool DQRNetworkManager::IsSessionFriendsOfFriends(MXSM::MultiplayerSession^ sess if (result) { - friendsOfFriends = app.GetGameHostOption(static_cast(gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends); + friendsOfFriends = app.GetGameHostOption(((GameSessionData *)gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends); } free(gameSessionData); @@ -577,7 +577,7 @@ bool DQRNetworkManager::GetGameSessionData(MXSM::MultiplayerSession^ session, vo Platform::String ^customValueString = customValue->GetString(); if( customValueString ) { - base64_decode( customValueString, static_cast(gameSessionData), sizeof(GameSessionData) ); + base64_decode( customValueString, (unsigned char *)gameSessionData, sizeof(GameSessionData) ); return true; } } diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp index eed3e851..9232d095 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp @@ -24,7 +24,7 @@ void DQRNetworkManager::BytesReceived(int smallId, BYTE *bytes, int byteCount) DQRNetworkPlayer *host = GetPlayerBySmallId(m_hostSmallId); DQRNetworkPlayer *client = GetPlayerBySmallId(smallId); - if( ( host == nullptr ) || ( client == nullptr ) ) + if( ( host == NULL ) || ( client == NULL ) ) { return; } @@ -113,7 +113,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, case DQRConnectionInfo::ConnectionState_InternalAssignSmallId2: case DQRConnectionInfo::ConnectionState_InternalAssignSmallId3: { - int channel = static_cast(connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0; + int channel = ((int)connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0; if( ( connectionInfo->m_smallIdReadMask & ( 1 << channel ) ) && ( !connectionInfo->m_channelActive[channel] ) ) { @@ -137,7 +137,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, DQRNetworkPlayer *pPlayer = new DQRNetworkPlayer(this, DQRNetworkPlayer::DNP_TYPE_REMOTE, true, 0, sessionAddress); pPlayer->SetSmallId(byte); - pPlayer->SetUID(static_cast(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); HostGamertagResolveDetails *resolveDetails = new HostGamertagResolveDetails(); resolveDetails->m_pPlayer = pPlayer; @@ -238,7 +238,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, UpdateRoomSyncPlayers((RoomSyncData *)connectionInfo->m_pucRoomSyncData); delete connectionInfo->m_pucRoomSyncData; - connectionInfo->m_pucRoomSyncData = nullptr; + connectionInfo->m_pucRoomSyncData = NULL; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; // If we haven't actually established a connection yet for this channel, then this is the point where we can consider this active @@ -267,7 +267,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, { if( m_currentUserMask & ( 1 << i ) ) { - if( GetLocalPlayerByUserIndex(i) == nullptr ) + if( GetLocalPlayerByUserIndex(i) == NULL ) { allLocalPlayersHere = false; } @@ -307,7 +307,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, // XUID fully read, can now handle what to do with it AddPlayerFailed(ref new Platform::String( (wchar_t *)connectionInfo->m_pucAddFailedPlayerData ) ); delete [] connectionInfo->m_pucAddFailedPlayerData; - connectionInfo->m_pucAddFailedPlayerData = nullptr; + connectionInfo->m_pucAddFailedPlayerData = NULL; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; } @@ -371,7 +371,7 @@ void DQRNetworkManager::SendBytesChat(unsigned int address, BYTE *bytes, int byt void DQRNetworkManager::SendBytes(int smallId, BYTE *bytes, int byteCount) { EnterCriticalSection(&m_csSendBytes); - unsigned char *tempSendBuffer = static_cast(malloc(8191 + 2)); + unsigned char *tempSendBuffer = (unsigned char *)malloc(8191 + 2); BYTE *data = bytes; BYTE *dataEnd = bytes + byteCount; @@ -381,7 +381,7 @@ void DQRNetworkManager::SendBytes(int smallId, BYTE *bytes, int byteCount) // blocks of this size. do { - int bytesToSend = static_cast(dataEnd - data); + int bytesToSend = (int)(dataEnd - data); if( bytesToSend > 8191 ) bytesToSend = 8191; // Send header with data sending mode - see full comment in DQRNetworkManagerEventHandlers::DataReceivedHandler diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp index ae7094fb..c985a191 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp @@ -84,7 +84,7 @@ void DQRNetworkManagerEventHandlers::DataReceivedHandler(Platform::Object^ sessi } rtsMessage.m_sessionAddress = args->SessionAddress; rtsMessage.m_dataSize = args->Data->Length; - rtsMessage.m_pucData = static_cast(malloc(rtsMessage.m_dataSize)); + rtsMessage.m_pucData = (unsigned char *)malloc(rtsMessage.m_dataSize); memcpy( rtsMessage.m_pucData, args->Data->Data, rtsMessage.m_dataSize ); m_pDQRNet->m_RTSMessageQueueIncoming.push(rtsMessage); LeaveCriticalSection(&m_pDQRNet->m_csRTSMessageQueueIncoming); @@ -311,7 +311,7 @@ void DQRNetworkManager::Process_RTS_MESSAGE_DATA_RECEIVED(RTS_Message &message) break; case DQRConnectionInfo::ConnectionState_ReadBytes: // At this stage we can send up to connectionInfo->m_bytesRemaining bytes, or the number of bytes that we have remaining in the data received, whichever is lowest. - int bytesInBuffer = static_cast(pEndByte - pNextByte); + int bytesInBuffer = (int)(pEndByte - pNextByte); int bytesToReceive = ( ( connectionInfo->m_bytesRemaining < bytesInBuffer ) ? connectionInfo->m_bytesRemaining : bytesInBuffer ); if( connectionInfo->m_internalFlag ) @@ -438,7 +438,7 @@ void DQRNetworkManager::Process_RTS_MESSAGE_STATUS_TERMINATED(RTS_Message &messa int DQRNetworkManager::_RTSDoWorkThread(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->RTSDoWorkThread(); } @@ -603,7 +603,7 @@ void DQRNetworkManager::RTS_StartCient() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_CLIENT; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -614,7 +614,7 @@ void DQRNetworkManager::RTS_StartHost() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_HOST; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -625,7 +625,7 @@ void DQRNetworkManager::RTS_Terminate() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_TERMINATE; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -636,7 +636,7 @@ void DQRNetworkManager::RTS_SendData(unsigned char *pucData, unsigned int dataSi EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_SEND_DATA; - message.m_pucData = static_cast(malloc(dataSize)); + message.m_pucData = (unsigned char *)malloc(dataSize); memcpy(message.m_pucData, pucData, dataSize); message.m_dataSize = dataSize; message.m_sessionAddress = sessionAddress; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp index a8140764..e2d82a90 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp @@ -97,7 +97,7 @@ bool DQRNetworkPlayer::HasVoice() Microsoft::Xbox::GameChat::ChatUser^ chatUser = m_manager->m_chat->GetChatUserByXboxUserId(ref new Platform::String(m_UID.toString().c_str())); if( chatUser == nullptr ) return false; - if( static_cast(chatUser->ParticipantType) & static_cast(Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) + if( ((int)chatUser->ParticipantType) & ((int)Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) { return true; } diff --git a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp index 84a34a97..fd2181df 100644 --- a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp @@ -4,7 +4,7 @@ NetworkPlayerDurango::NetworkPlayerDurango(DQRNetworkPlayer *qnetPlayer) { m_dqrPlayer = qnetPlayer; - m_pSocket = nullptr; + m_pSocket = NULL; } unsigned char NetworkPlayerDurango::GetSmallId() @@ -14,12 +14,12 @@ unsigned char NetworkPlayerDurango::GetSmallId() void NetworkPlayerDurango::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority) { - m_dqrPlayer->SendData( static_cast(player)->m_dqrPlayer, pvData, dataSize ); + m_dqrPlayer->SendData( ((NetworkPlayerDurango *)player)->m_dqrPlayer, pvData, dataSize ); } bool NetworkPlayerDurango::IsSameSystem(INetworkPlayer *player) { - return m_dqrPlayer->IsSameSystem(static_cast(player)->m_dqrPlayer); + return m_dqrPlayer->IsSameSystem(((NetworkPlayerDurango *)player)->m_dqrPlayer); } int NetworkPlayerDurango::GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ) diff --git a/Minecraft.Client/Durango/Network/PartyController.cpp b/Minecraft.Client/Durango/Network/PartyController.cpp index 1dfd5eb0..753a71ac 100644 --- a/Minecraft.Client/Durango/Network/PartyController.cpp +++ b/Minecraft.Client/Durango/Network/PartyController.cpp @@ -103,7 +103,7 @@ void PartyController::RefreshPartyView() } catch ( Platform::Exception^ ex ) { - if( ex->HResult != static_cast(Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty) ) + if( ex->HResult != (int)Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty ) { // LogCommentWithError( L"GetPartyView failed", ex->HResult ); } @@ -181,7 +181,7 @@ bool PartyController::AddLocalUsersToParty(int userMask, Windows::Xbox::System:: bool alreadyInSession = false; if( session ) { - if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, nullptr ) ) + if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, NULL ) ) { alreadyInSession = true; } @@ -577,7 +577,7 @@ void PartyController::OnPartyRosterChanged( PartyRosterChangedEventArgs^ eventAr // Still a party, find out who left for( int i = 0; i < eventArgs->RemovedMembers->Size; i++ ) { - DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(static_cast(eventArgs->RemovedMembers->GetAt(i)->Data())); + DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(PlayerUID(eventArgs->RemovedMembers->GetAt(i)->Data())); if( player ) { if( player->IsLocal() ) @@ -621,7 +621,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl } #endif - if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, nullptr)) + if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, NULL)) { DQRNetworkManager::LogComment( L"Player is already in session; skipping join request: " + player->XboxUserId->ToString() ); continue; @@ -639,7 +639,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl { bFoundLocal = true; // Check that they aren't in the game already (don't see how this could be the case anyway) - if( m_pDQRNet->GetPlayerByXuid( static_cast(player->XboxUserId->Data()) ) == nullptr ) + if( m_pDQRNet->GetPlayerByXuid( PlayerUID(player->XboxUserId->Data()) ) == NULL ) { // And check whether they are signed in yet or not int userIdx = -1; @@ -838,7 +838,7 @@ void PartyController::OnGameSessionReady( GameSessionReadyEventArgs^ eventArgs ) if( !isAJoiningXuid ) // Isn't someone we are actively trying to join { if( (!bInSession) || // If not in a game session at all - ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast(memberXUID->Data()) ) == nullptr ) ) // Or we're fully in, and this player isn't in it + ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( PlayerUID(memberXUID->Data()) ) == NULL ) ) // Or we're fully in, and this player isn't in it ) { for( int j = 4; j < 12; j++ ) // Final check that we have a gamepad for this xuid so that we might possibly be able to pair someone up @@ -1201,5 +1201,5 @@ double PartyController::GetTimeBetweenInSeconds(Windows::Foundation::DateTime dt { const uint64 tickPerSecond = 10000000i64; uint64 deltaTime = dt2.UniversalTime - dt1.UniversalTime; - return static_cast(deltaTime) / static_cast(tickPerSecond); + return (double)deltaTime / (double)tickPerSecond; } \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp index 5e3a0824..925a37a8 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -87,7 +87,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerDurango *networkPlayer = static_cast(addNetworkPlayer(pDQRPlayer)); + NetworkPlayerDurango *networkPlayer = (NetworkPlayerDurango *)addNetworkPlayer(pDQRPlayer); // Request full display name for this player m_pDQRNet->RequestDisplayName(pDQRPlayer); @@ -166,7 +166,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -175,7 +175,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -198,7 +198,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -214,14 +214,14 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( nullptr ); + networkPlayer->SetSocket( NULL ); } if( m_pDQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pDQRPlayer) ) { - DQRNetworkPlayer *pNewDQRPrimaryPlayer = nullptr; + DQRNetworkPlayer *pNewDQRPrimaryPlayer = NULL; for(unsigned int i = 0; i < m_pDQRNet->GetPlayerCount(); ++i ) { DQRNetworkPlayer *pDQRPlayer2 = m_pDQRNet->GetPlayerByIndex( i ); @@ -238,7 +238,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP m_machineDQRPrimaryPlayers.erase( it ); } - if( pNewDQRPrimaryPlayer != nullptr ) + if( pNewDQRPrimaryPlayer != NULL ) m_machineDQRPrimaryPlayers.push_back( pNewDQRPrimaryPlayer ); } @@ -251,7 +251,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -260,7 +260,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -289,7 +289,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize, false); } else @@ -298,7 +298,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize); } } @@ -319,7 +319,7 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -330,14 +330,14 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; m_searchResultsCount = 0; m_lastSearchStartTime = 0; // The results that will be filled in with the current search - m_pSearchResults = nullptr; + m_pSearchResults = NULL; Windows::Networking::Connectivity::NetworkInformation::NetworkStatusChanged += ref new Windows::Networking::Connectivity::NetworkStatusChangedEventHandler( []( Platform::Object^ pxObject ) { @@ -585,8 +585,8 @@ void CPlatformNetworkManagerDurango::UnRegisterPlayerChangedCallback(int iPad, v { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -613,12 +613,12 @@ bool CPlatformNetworkManagerDurango::_RunNetworkGame() return true; } -void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { if( this->m_bLeavingGame ) return; - if( GetHostPlayer() == nullptr ) + if( GetHostPlayer() == NULL ) return; m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); @@ -628,18 +628,18 @@ void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer int CPlatformNetworkManagerDurango::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast(lpParam); + INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -712,7 +712,7 @@ void CPlatformNetworkManagerDurango::SystemFlagReset() void CPlatformNetworkManagerDurango::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -728,7 +728,7 @@ void CPlatformNetworkManagerDurango::SystemFlagSet(INetworkPlayer *pNetworkPlaye bool CPlatformNetworkManagerDurango::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -769,7 +769,7 @@ void CPlatformNetworkManagerDurango::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -777,7 +777,7 @@ void CPlatformNetworkManagerDurango::TickSearch() if( !m_pDQRNet->FriendPartyManagerIsBusy() ) { // Don't start searches unless we have registered a callback - if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) + if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) { if( m_pDQRNet->FriendPartyManagerSearch() ); { @@ -794,13 +794,13 @@ vector *CPlatformNetworkManagerDurango::GetSessionList(int vector *filteredList = new vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { - GameSessionData *gameSessionData = static_cast(m_pSearchResults[i].m_extData); + GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData; if( ( gameSessionData->netVersion == MINECRAFT_NET_VERSION ) && ( gameSessionData->isReadyToJoin ) ) { FriendSessionInfo *session = new FriendSessionInfo(); session->searchResult = m_pSearchResults[i]; - session->searchResult.m_extData = nullptr; // We have another copy of the GameSessionData, so don't need to make another copy of this here + session->searchResult.m_extData = NULL; // We have another copy of the GameSessionData, so don't need to make another copy of this here session->displayLabelLength = session->searchResult.m_playerNames[0].size(); session->displayLabel = new wchar_t[ session->displayLabelLength + 1 ]; memcpy(&session->data, gameSessionData, sizeof(GameSessionData)); @@ -832,7 +832,7 @@ void CPlatformNetworkManagerDurango::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete [] m_pSearchResults; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; } INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) @@ -858,7 +858,7 @@ void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRP INetworkPlayer *CPlatformNetworkManagerDurango::getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) { - return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : nullptr; + return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h index 5626b012..55807227 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h @@ -87,7 +87,7 @@ private: bool m_hostGameSessionIsJoinable; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Durango/Network/base64.cpp b/Minecraft.Client/Durango/Network/base64.cpp index c916725f..c5af745c 100644 --- a/Minecraft.Client/Durango/Network/base64.cpp +++ b/Minecraft.Client/Durango/Network/base64.cpp @@ -109,13 +109,13 @@ void base64_decode(Platform::String ^encoded_string, unsigned char *output, unsi while (in_len-- && ( encoded_string->Data()[in_] != L'=') && is_base64(encoded_string->Data()[in_])) { - char_array_4[i++] = static_cast(encoded_string->Data()[in_]); + char_array_4[i++] = (unsigned char)(encoded_string->Data()[in_]); in_++; if (i ==4) { for (i = 0; i <4; i++) { - char_array_4[i] = static_cast(base64_chars.find(char_array_4[i])); + char_array_4[i] = (unsigned char )base64_chars.find(char_array_4[i]); } char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); @@ -140,7 +140,7 @@ void base64_decode(Platform::String ^encoded_string, unsigned char *output, unsi for (j = 0; j <4; j++) { - char_array_4[j] = static_cast(base64_chars.find(char_array_4[j])); + char_array_4[j] = (unsigned char )base64_chars.find(char_array_4[j]); } char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); diff --git a/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp b/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp index 31ab9d64..2386a348 100644 --- a/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp @@ -64,7 +64,7 @@ bool CDurangoTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) // 4J-JEV: Still needed to flush cached travel stats. DurangoStats::playerSessionEnd(iPad); - if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) + if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { ULONG hr = EventWritePlayerSessionEnd( DurangoStats::getUserId(iPad), @@ -131,7 +131,7 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) + if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { hr = EventWritePlayerSessionStart( DurangoStats::getUserId(iPad), @@ -968,7 +968,7 @@ bool CDurangoTelemetryManager::RecordUnBanLevel(int iPad) DurangoStats *CDurangoTelemetryManager::durangoStats() { - return static_cast(GenericStats::getInstance()); + return (DurangoStats*) GenericStats::getInstance(); } wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) diff --git a/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h b/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h index 8bd11354..5fc80438 100644 --- a/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h +++ b/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h @@ -195,7 +195,7 @@ EventWriteAchievementGet(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, _ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &AchievementId, sizeof(AchievementId)); @@ -216,7 +216,7 @@ EventWriteAchievemntUnlocked(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -246,7 +246,7 @@ EventWriteBanLevel(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in co EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -274,7 +274,7 @@ EventWriteBlockBroken(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &BlockId, sizeof(BlockId)); @@ -298,7 +298,7 @@ EventWriteBlockPlaced(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &BlockId, sizeof(BlockId)); @@ -322,7 +322,7 @@ EventWriteChestfulOfCobblestone(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessi EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Cobblecount, sizeof(Cobblecount)); @@ -343,7 +343,7 @@ EventWriteEnteredNewBiome(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &BiomeId, sizeof(BiomeId)); @@ -364,7 +364,7 @@ EventWriteGameProgress(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __i EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &CompletionPercent, sizeof(CompletionPercent)); @@ -385,7 +385,7 @@ EventWriteIncDistanceTravelled(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessio EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &Distance, sizeof(Distance)); @@ -408,7 +408,7 @@ EventWriteIncTimePlayed(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &TimePlayed, sizeof(TimePlayed)); @@ -430,7 +430,7 @@ EventWriteLeaderboardTotals(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &LeaderboardId, sizeof(LeaderboardId)); @@ -453,7 +453,7 @@ EventWriteLevelExit(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in c EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -482,7 +482,7 @@ EventWriteLevelResume(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -516,7 +516,7 @@ EventWriteLevelSaveOrCheckpoint(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessi EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -546,7 +546,7 @@ EventWriteLevelStart(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -579,10 +579,10 @@ EventWriteMcItemAcquired(__in_opt PCWSTR UserId, __in const signed int SectionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], &ItemId, sizeof(ItemId)); @@ -610,10 +610,10 @@ EventWriteMcItemUsed(__in_opt PCWSTR UserId, __in const signed int SectionId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], &ItemId, sizeof(ItemId)); @@ -641,7 +641,7 @@ EventWriteMenuShown(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in c EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -671,7 +671,7 @@ EventWriteMobInteract(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &MobId, sizeof(MobId)); EventDataDescCreate(&EventData[4], &InteractionId, sizeof(InteractionId)); @@ -693,10 +693,10 @@ EventWriteMobKilled(__in_opt PCWSTR UserId, __in const signed int SectionId, __i EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], RoundId, sizeof(GUID)); @@ -728,11 +728,11 @@ EventWriteMultiplayerRoundEnd(__in_opt PCWSTR UserId, __in LPCGUID RoundId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], RoundId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[4], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[6], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[7], &MatchTypeId, sizeof(MatchTypeId)); EventDataDescCreate(&EventData[8], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -756,11 +756,11 @@ EventWriteMultiplayerRoundStart(__in_opt PCWSTR UserId, __in LPCGUID RoundId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], RoundId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[4], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[6], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[7], &MatchTypeId, sizeof(MatchTypeId)); EventDataDescCreate(&EventData[8], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -782,7 +782,7 @@ EventWriteOnARail(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in con EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Distance, sizeof(Distance)); @@ -803,7 +803,7 @@ EventWriteOverkill(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in co EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Damage, sizeof(Damage)); @@ -824,7 +824,7 @@ EventWritePauseOrInactive(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -852,7 +852,7 @@ EventWritePlayedMusicDisc(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DiscId, sizeof(DiscId)); @@ -873,7 +873,7 @@ EventWritePlayerDiedOrFailed(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -908,9 +908,9 @@ EventWritePlayerSessionEnd(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[6], &ExitStatusId, sizeof(ExitStatusId)); @@ -932,9 +932,9 @@ EventWritePlayerSessionPause(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); return EtxEventWrite(&XBLA_149E11AEEvents[28], &XBLA_149E11AEProvider, XBLA_149E11AEHandle, ARGUMENT_COUNT_XBLA_149E11AE_PlayerSessionPause, EventData); } @@ -953,9 +953,9 @@ EventWritePlayerSessionResume(__in_opt PCWSTR UserId, __in LPCGUID PlayerSession EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -976,9 +976,9 @@ EventWritePlayerSessionStart(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -999,7 +999,7 @@ EventWriteRecordMediaShareUpload(__in_opt PCWSTR UserId, __in LPCGUID PlayerSess EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1027,7 +1027,7 @@ EventWriteRichPresenceState(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &ContextID, sizeof(ContextID)); @@ -1048,7 +1048,7 @@ EventWriteSkinChanged(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1077,7 +1077,7 @@ EventWriteTexturePackLoaded(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1107,7 +1107,7 @@ EventWriteUnbanLevel(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1135,7 +1135,7 @@ EventWriteUnpauseOrActive(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1163,7 +1163,7 @@ EventWriteUpsellPresented(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1193,7 +1193,7 @@ EventWriteUpsellResponded(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); diff --git a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp index 89ca7714..771ba268 100644 --- a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp @@ -27,7 +27,7 @@ XMLParser::XMLParser() { m_pWritePtr = m_pWriteBuf; m_pReadPtr = m_pReadBuf; - m_pISAXCallback = nullptr; + m_pISAXCallback = NULL; m_hFile = INVALID_HANDLE_VALUE; } @@ -49,7 +49,7 @@ VOID XMLParser::FillBuffer() m_pReadPtr = m_pReadBuf; - if( m_hFile == nullptr ) + if( m_hFile == NULL ) { if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) NChars = XML_READ_BUFFER_SIZE; @@ -62,15 +62,15 @@ VOID XMLParser::FillBuffer() } else { - if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, nullptr )) + if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, NULL )) { return; } } m_dwCharsConsumed += NChars; - int64_t iProgress = m_dwCharsTotal ? (( static_cast(m_dwCharsConsumed) * 1000 ) / static_cast(m_dwCharsTotal)) : 0; - m_pISAXCallback->SetParseProgress( static_cast(iProgress) ); + int64_t iProgress = m_dwCharsTotal ? (( (int64_t)m_dwCharsConsumed * 1000 ) / (int64_t)m_dwCharsTotal) : 0; + m_pISAXCallback->SetParseProgress( (DWORD)iProgress ); m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars + 1] = '\0'; @@ -198,7 +198,7 @@ HRESULT XMLParser::ConvertEscape() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = static_cast(m_pWritePtr - pEntityRefVal); + EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); m_pWritePtr = pEntityRefVal; if ( EntityRefLen == 0 ) @@ -359,7 +359,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail ) // Read more from the file FillBuffer(); - // We are at EOF if it is still nullptr + // We are at EOF if it is still NULL if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) { if( !bOkToFail ) @@ -497,8 +497,8 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - if (FAILED(m_pISAXCallback->ElementEnd( pEntityRefVal, - static_cast(m_pWritePtr - pEntityRefVal) ))) + if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, + (UINT) ( m_pWritePtr - pEntityRefVal ) ) ) ) return E_ABORT; if( FAILED( hr = ConsumeSpace() ) ) @@ -541,7 +541,7 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = static_cast(m_pWritePtr - pEntityRefVal); + EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); if( FAILED( hr = ConsumeSpace() ) ) return hr; @@ -566,7 +566,7 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - Attributes[ NumAttrs ].NameLen = static_cast(m_pWritePtr - Attributes[NumAttrs].strName); + Attributes[ NumAttrs ].NameLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName ); if( FAILED( hr = ConsumeSpace() ) ) return hr; @@ -588,8 +588,8 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceAttrVal() ) ) return hr; - Attributes[ NumAttrs ].ValueLen = static_cast(m_pWritePtr - - Attributes[NumAttrs].strValue); + Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr - + Attributes[ NumAttrs ].strValue ); ++NumAttrs; @@ -663,13 +663,13 @@ HRESULT XMLParser::AdvanceCDATA() if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE ) { - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; } } - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; @@ -782,10 +782,11 @@ HRESULT XMLParser::MainParseLoop() { if( FAILED( AdvanceCharacter( TRUE ) ) ) { - if ( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) + if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; + bWhiteSpaceOnly = TRUE; } @@ -797,10 +798,9 @@ HRESULT XMLParser::MainParseLoop() if( m_Ch == '<' ) { -\ - if( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) + if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -838,7 +838,8 @@ HRESULT XMLParser::MainParseLoop() if( !bWhiteSpaceOnly ) { if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, - static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) + ( UINT ) ( m_pWritePtr - m_pWriteBuf ), + TRUE ) ) ) { return E_ABORT; } @@ -860,7 +861,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { HRESULT hr; - if( m_pISAXCallback == nullptr ) + if( m_pISAXCallback == NULL ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -871,17 +872,16 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_pReadPtr = m_pReadBuf; m_pReadBuf[ 0 ] = '\0'; - m_pReadBuf[ 1 ] = '\0'; - m_pInXMLBuffer = nullptr; + m_pInXMLBuffer = NULL; m_uInXMLBufferCharsLeft = 0; WCHAR wchFilename[ 64 ]; swprintf_s(wchFilename,64,L"%s",strFilename); - m_hFile = CreateFile(wchFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); if( m_hFile == INVALID_HANDLE_VALUE ) { @@ -893,7 +893,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { LARGE_INTEGER iFileSize; GetFileSizeEx( m_hFile, &iFileSize ); - m_dwCharsTotal = static_cast(iFileSize.QuadPart); + m_dwCharsTotal = (DWORD)iFileSize.QuadPart; m_dwCharsConsumed = 0; hr = MainParseLoop(); } @@ -904,7 +904,8 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_hFile = INVALID_HANDLE_VALUE; // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; + m_pISAXCallback->m_strFilename = NULL; + return hr; } @@ -916,7 +917,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) { HRESULT hr; - if( m_pISAXCallback == nullptr ) + if( m_pISAXCallback == NULL ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -929,7 +930,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_hFile = nullptr; + m_hFile = NULL; m_pInXMLBuffer = strBuffer; m_uInXMLBufferCharsLeft = uBufferSize; m_dwCharsTotal = uBufferSize; @@ -938,7 +939,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) hr = MainParseLoop(); // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; + m_pISAXCallback->m_strFilename = NULL; return hr; } diff --git a/Minecraft.Client/Durango/XML/ATGXmlParser.h b/Minecraft.Client/Durango/XML/ATGXmlParser.h index 12f59737..75142e3e 100644 --- a/Minecraft.Client/Durango/XML/ATGXmlParser.h +++ b/Minecraft.Client/Durango/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Durango/XML/xmlFilesCallback.h b/Minecraft.Client/Durango/XML/xmlFilesCallback.h index 16149340..deba843d 100644 --- a/Minecraft.Client/Durango/XML/xmlFilesCallback.h +++ b/Minecraft.Client/Durango/XML/xmlFilesCallback.h @@ -47,7 +47,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - xuid=_wcstoui64(wTemp,nullptr,10); + xuid=_wcstoui64(wTemp,NULL,10); } } else if (_wcsicmp(wAttName,L"cape")==0) @@ -138,7 +138,7 @@ public: #ifdef _XBOX iValue=_wtoi(wValue); #else - iValue=wcstol(wValue, nullptr, 10); + iValue=wcstol(wValue, NULL, 10); #endif } } @@ -220,7 +220,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - uiSortIndex=wcstoul(wTemp,nullptr,10); + uiSortIndex=wcstoul(wTemp,NULL,10); } } else if (_wcsicmp(wAttName,L"Banner")==0) @@ -269,7 +269,7 @@ public: #ifdef _XBOX iConfig=_wtoi(wConfig); #else - iConfig=wcstol(wConfig, nullptr, 10); + iConfig=wcstol(wConfig, NULL, 10); #endif } } diff --git a/Minecraft.Client/EchantmentTableParticle.cpp b/Minecraft.Client/EchantmentTableParticle.cpp index 95bd3dbc..5af7ef36 100644 --- a/Minecraft.Client/EchantmentTableParticle.cpp +++ b/Minecraft.Client/EchantmentTableParticle.cpp @@ -21,22 +21,22 @@ EchantmentTableParticle::EchantmentTableParticle(Level *level, double x, double oSize = size = random->nextFloat() * 0.5f + 0.2f; - lifetime = static_cast(Math::random() * 10) + 30; + lifetime = (int) (Math::random() * 10) + 30; noPhysics = true; - setMiscTex( static_cast(Math::random() * 26 + 1 + 14 * 16) ); + setMiscTex( (int) (Math::random() * 26 + 1 + 14 * 16) ); } int EchantmentTableParticle::getLightColor(float a) { int br = Particle::getLightColor(a); - float pos = age / static_cast(lifetime); + float pos = age / (float) lifetime; pos = pos * pos; pos = pos * pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += static_cast(pos * 15 * 16); + br2 += (int) (pos * 15 * 16); if (br2 > 15 * 16) br2 = 15 * 16; return br1 | br2 << 16; } @@ -44,7 +44,7 @@ int EchantmentTableParticle::getLightColor(float a) float EchantmentTableParticle::getBrightness(float a) { float br = Particle::getBrightness(a); - float pos = age / static_cast(lifetime); + float pos = age / (float) lifetime; pos = pos * pos; pos = pos * pos; return br * (1 - pos) + pos; @@ -56,7 +56,7 @@ void EchantmentTableParticle::tick() yo = y; zo = z; - float pos = age / static_cast(lifetime); + float pos = age / (float) lifetime; pos = 1 - pos; diff --git a/Minecraft.Client/EnchantTableRenderer.cpp b/Minecraft.Client/EnchantTableRenderer.cpp index e188529b..ff539fcd 100644 --- a/Minecraft.Client/EnchantTableRenderer.cpp +++ b/Minecraft.Client/EnchantTableRenderer.cpp @@ -28,7 +28,7 @@ void EnchantTableRenderer::render(shared_ptr _table, double x, doubl #endif glPushMatrix(); - glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 12 / 16.0f, static_cast(z) + 0.5f); + glTranslatef((float) x + 0.5f, (float) y + 12 / 16.0f, (float) z + 0.5f); float tt = table->time + a; diff --git a/Minecraft.Client/EnderChestRenderer.cpp b/Minecraft.Client/EnderChestRenderer.cpp index 71804a5a..52fdede9 100644 --- a/Minecraft.Client/EnderChestRenderer.cpp +++ b/Minecraft.Client/EnderChestRenderer.cpp @@ -23,7 +23,7 @@ void EnderChestRenderer::render(shared_ptr _chest, double x, double glEnable(GL_RESCALE_NORMAL); //glColor4f(1, 1, 1, 1); if( setColor ) glColor4f(1, 1, 1, alpha); - glTranslatef(static_cast(x), static_cast(y) + 1, static_cast(z) + 1); + glTranslatef((float) x, (float) y + 1, (float) z + 1); glScalef(1, -1, -1); glTranslatef(0.5f, 0.5f, 0.5f); diff --git a/Minecraft.Client/EnderCrystalRenderer.cpp b/Minecraft.Client/EnderCrystalRenderer.cpp index 2dde1246..d2eba5e8 100644 --- a/Minecraft.Client/EnderCrystalRenderer.cpp +++ b/Minecraft.Client/EnderCrystalRenderer.cpp @@ -25,7 +25,7 @@ void EnderCrystalRenderer::render(shared_ptr _crystal, double x, double float tt = crystal->time + a; glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); bindTexture(&ENDER_CRYSTAL_LOCATION); float hh = sin(tt * 0.2f) / 2 + 0.5f; hh = hh * hh + hh; diff --git a/Minecraft.Client/EnderDragonRenderer.cpp b/Minecraft.Client/EnderDragonRenderer.cpp index 8b5b248c..4119e5b9 100644 --- a/Minecraft.Client/EnderDragonRenderer.cpp +++ b/Minecraft.Client/EnderDragonRenderer.cpp @@ -13,7 +13,7 @@ ResourceLocation EnderDragonRenderer::DRAGON_LOCATION = ResourceLocation(TN_MOB_ EnderDragonRenderer::EnderDragonRenderer() : MobRenderer(new DragonModel(0), 0.5f) { - dragonModel = static_cast(model); + dragonModel = (DragonModel *) model; setArmor(model); // TODO: Make second constructor that assigns this. } @@ -90,15 +90,15 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do shared_ptr mob = dynamic_pointer_cast(_mob); BossMobGuiInfo::setBossHealth(mob, false); MobRenderer::render(mob, x, y, z, rot, a); - if (mob->nearestCrystal != nullptr) + if (mob->nearestCrystal != NULL) { float tt = mob->nearestCrystal->time + a; float hh = sin(tt * 0.2f) / 2 + 0.5f; hh = (hh * hh + hh) * 0.2f; - float xd = static_cast(mob->nearestCrystal->x - mob->x - (mob->xo - mob->x) * (1 - a)); - float yd = static_cast(hh + mob->nearestCrystal->y - 1 - mob->y - (mob->yo - mob->y) * (1 - a)); - float zd = static_cast(mob->nearestCrystal->z - mob->z - (mob->zo - mob->z) * (1 - a)); + float xd = (float) (mob->nearestCrystal->x - mob->x - (mob->xo - mob->x) * (1 - a)); + float yd = (float) (hh + mob->nearestCrystal->y - 1 - mob->y - (mob->yo - mob->y) * (1 - a)); + float zd = (float) (mob->nearestCrystal->z - mob->z - (mob->zo - mob->z) * (1 - a)); float sdd = sqrt(xd * xd + zd * zd); float dd = sqrt(xd * xd + yd * yd + zd * zd); @@ -107,7 +107,7 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do glColor4f(1, 1, 1, 1); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y) + 2, static_cast(z)); + glTranslatef((float) x, (float) y + 2, (float) z); glRotatef((float) (-atan2(zd, xd)) * 180.0f / PI - 90.0f, 0, 1, 0); glRotatef((float) (-atan2(sdd, yd)) * 180.0f / PI - 90.0f, 1, 0, 0); @@ -202,7 +202,7 @@ void EnderDragonRenderer::additionalRendering(shared_ptr _mob, flo t->begin(GL_TRIANGLE_FAN); float dist = random.nextFloat() * 20 + 5 + overDrive * 10; float w = random.nextFloat() * 2 + 1 + overDrive * 2; - t->color(0xffffff, static_cast(255 * (1 - overDrive))); + t->color(0xffffff, (int) (255 * (1 - overDrive))); t->vertex(0, 0, 0); t->color(0xff00ff, 0); t->vertex(-0.866 * w, dist, -0.5f * w); diff --git a/Minecraft.Client/EnderParticle.cpp b/Minecraft.Client/EnderParticle.cpp index ee1a9c35..3889bf92 100644 --- a/Minecraft.Client/EnderParticle.cpp +++ b/Minecraft.Client/EnderParticle.cpp @@ -28,14 +28,14 @@ EnderParticle::EnderParticle(Level *level, double x, double y, double z, double oSize = size = random->nextFloat()*0.2f+0.5f; - lifetime = static_cast(Math::random() * 10) + 40; + lifetime = (int) (Math::random()*10) + 40; noPhysics = true; - setMiscTex(static_cast(Math::random() * 8)); + setMiscTex((int)(Math::random()*8)); } void EnderParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / static_cast(lifetime); + float s = (age + a) / (float) lifetime; s = 1-s; s = s*s; s = 1-s; @@ -48,13 +48,13 @@ int EnderParticle::getLightColor(float a) { int br = Particle::getLightColor(a); - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; pos = pos*pos; pos = pos*pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += static_cast(pos * 15 * 16); + br2 += (int) (pos * 15 * 16); if (br2 > 15 * 16) br2 = 15 * 16; return br1 | br2 << 16; } @@ -62,7 +62,7 @@ int EnderParticle::getLightColor(float a) float EnderParticle::getBrightness(float a) { float br = Particle::getBrightness(a); - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; pos = pos*pos; pos = pos*pos; return br*(1-pos)+pos; @@ -74,7 +74,7 @@ void EnderParticle::tick() yo = y; zo = z; - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; float a = pos; pos = -pos+pos*pos*2; // pos = pos*pos; diff --git a/Minecraft.Client/EndermanRenderer.cpp b/Minecraft.Client/EndermanRenderer.cpp index fc2b8952..f6e5220a 100644 --- a/Minecraft.Client/EndermanRenderer.cpp +++ b/Minecraft.Client/EndermanRenderer.cpp @@ -10,7 +10,7 @@ ResourceLocation EndermanRenderer::ENDERMAN_LOCATION = ResourceLocation(TN_MOB_E EndermanRenderer::EndermanRenderer() : MobRenderer(new EndermanModel(), 0.5f) { - model = static_cast(MobRenderer::model); + model = (EndermanModel *) MobRenderer::model; this->setArmor(model); } diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index cc14558f..5bb98ead 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -87,7 +87,7 @@ double EntityRenderDispatcher::xOff = 0.0; double EntityRenderDispatcher::yOff = 0.0; double EntityRenderDispatcher::zOff = 0.0; -EntityRenderDispatcher *EntityRenderDispatcher::instance = nullptr; +EntityRenderDispatcher *EntityRenderDispatcher::instance = NULL; void EntityRenderDispatcher::staticCtor() { @@ -222,7 +222,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon int data = level->getData(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); int direction = data & 3; - playerRotY = static_cast(direction * 90 + 180); + playerRotY = (float)(direction * 90 + 180); playerRotX = 0; } } else { @@ -280,7 +280,7 @@ void EntityRenderDispatcher::render(shared_ptr entity, float a) void EntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) { EntityRenderer *renderer = getRenderer(entity); - if (renderer != nullptr) + if (renderer != NULL) { renderer->SetItemFrame(bItemFrame); diff --git a/Minecraft.Client/EntityRenderer.cpp b/Minecraft.Client/EntityRenderer.cpp index fa41dfa6..9aa4ad7d 100644 --- a/Minecraft.Client/EntityRenderer.cpp +++ b/Minecraft.Client/EntityRenderer.cpp @@ -18,7 +18,7 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M // 4J - added EntityRenderer::EntityRenderer() { - model = nullptr; + model = NULL; tileRenderer = new TileRenderer(); shadowRadius = 0; shadowStrength = 1.0f; @@ -89,7 +89,7 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl Icon *fire2 = Tile::fire->getTextureLayer(1); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); float s = e->bbWidth * 1.4f; glScalef(s, s, s); @@ -102,18 +102,18 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl float xo = 0.0f; float h = e->bbHeight / s; - float yo = static_cast(e->y - e->bb->y0); + float yo = (float) (e->y - e->bb->y0); glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0); - glTranslatef(0, 0, -0.3f + static_cast(h) * 0.02f); + glTranslatef(0, 0, -0.3f + ((int) h) * 0.02f); glColor4f(1, 1, 1, 1); float zo = 0; int ss = 0; t->begin(); while (h > 0) { - Icon *tex = nullptr; + Icon *tex = NULL; if (ss % 2 == 0) { tex = fire1; @@ -238,7 +238,7 @@ void EntityRenderer::renderTileShadow(Tile *tt, double x, double y, double z, in if (a < 0) return; if (a > 1) a = 1; - t->color(1.0f, 1.0f, 1.0f, static_cast(a)); + t->color(1.0f, 1.0f, 1.0f, (float) a); // glColor4f(1, 1, 1, (float) a); double x0 = xt + tt->getShapeX0() + xo; @@ -247,20 +247,20 @@ void EntityRenderer::renderTileShadow(Tile *tt, double x, double y, double z, in double z0 = zt + tt->getShapeZ0() + zo; double z1 = zt + tt->getShapeZ1() + zo; - float u0 = static_cast((x - (x0)) / 2 / r + 0.5f); - float u1 = static_cast((x - (x1)) / 2 / r + 0.5f); - float v0 = static_cast((z - (z0)) / 2 / r + 0.5f); - float v1 = static_cast((z - (z1)) / 2 / r + 0.5f); + float u0 = (float) ((x - (x0)) / 2 / r + 0.5f); + float u1 = (float) ((x - (x1)) / 2 / r + 0.5f); + float v0 = (float) ((z - (z0)) / 2 / r + 0.5f); + float v1 = (float) ((z - (z1)) / 2 / r + 0.5f); // u0 = 0; // v0 = 0; // u1 = 1; // v1 = 1; - t->vertexUV(static_cast(x0), static_cast(y0), static_cast(z0), (float)( u0), (float)( v0)); - t->vertexUV(static_cast(x0), static_cast(y0), static_cast(z1), (float)( u0), (float)( v1)); - t->vertexUV(static_cast(x1), static_cast(y0), static_cast(z1), (float)( u1), (float)( v1)); - t->vertexUV(static_cast(x1), static_cast(y0), static_cast(z0), (float)( u1), (float)( v0)); + t->vertexUV((float)(x0), (float)( y0), (float)( z0), (float)( u0), (float)( v0)); + t->vertexUV((float)(x0), (float)( y0), (float)( z1), (float)( u0), (float)( v1)); + t->vertexUV((float)(x1), (float)( y0), (float)( z1), (float)( u1), (float)( v1)); + t->vertexUV((float)(x1), (float)( y0), (float)( z0), (float)( u1), (float)( v0)); } void EntityRenderer::render(AABB *bb, double xo, double yo, double zo) @@ -269,42 +269,42 @@ void EntityRenderer::render(AABB *bb, double xo, double yo, double zo) Tesselator *t = Tesselator::getInstance(); glColor4f(1, 1, 1, 1); t->begin(); - t->offset(static_cast(xo), static_cast(yo), static_cast(zo)); + t->offset((float)xo, (float)yo, (float)zo); t->normal(0, 0, -1); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); t->normal(0, 0, 1); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); t->normal(0, -1, 0); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); t->normal(0, 1, 0); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); t->normal(-1, 0, 0); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); t->normal(1, 0, 0); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); t->offset(0, 0, 0); t->end(); glEnable(GL_TEXTURE_2D); @@ -315,30 +315,30 @@ void EntityRenderer::renderFlat(AABB *bb) { Tesselator *t = Tesselator::getInstance(); t->begin(); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x0), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x0), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z0)); - t->vertex(static_cast(bb->x1), static_cast(bb->y1), static_cast(bb->z1)); - t->vertex(static_cast(bb->x1), static_cast(bb->y0), static_cast(bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x0), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x0), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z0)); + t->vertex((float)(bb->x1), (float)( bb->y1), (float)( bb->z1)); + t->vertex((float)(bb->x1), (float)( bb->y0), (float)( bb->z1)); t->end(); } @@ -385,7 +385,7 @@ void EntityRenderer::postRender(shared_ptr entity, double x, double y, d if (bRenderPlayerShadow && entityRenderDispatcher->options->fancyGraphics && shadowRadius > 0 && !entity->isInvisible()) { double dist = entityRenderDispatcher->distanceToSqr(entity->x, entity->y, entity->z); - float pow = static_cast((1 - dist / (16.0f * 16.0f)) * shadowStrength); + float pow = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength); if (pow > 0) { renderShadow(entity, x, y, z, pow, a); @@ -406,5 +406,5 @@ void EntityRenderer::registerTerrainTextures(IconRegister *iconRegister) ResourceLocation *EntityRenderer::getTextureLocation(shared_ptr mob) { - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.Client/EntityTileRenderer.cpp b/Minecraft.Client/EntityTileRenderer.cpp index 6a84e3a3..deed369e 100644 --- a/Minecraft.Client/EntityTileRenderer.cpp +++ b/Minecraft.Client/EntityTileRenderer.cpp @@ -8,9 +8,9 @@ EntityTileRenderer *EntityTileRenderer::instance = new EntityTileRenderer; EntityTileRenderer::EntityTileRenderer() { - chest = std::make_shared(); - trappedChest = std::make_shared(ChestTile::TYPE_TRAP); - enderChest = std::make_shared(); + chest = shared_ptr(new ChestTileEntity()); + trappedChest = shared_ptr(new ChestTileEntity(ChestTile::TYPE_TRAP)); + enderChest = shared_ptr(new EnderChestTileEntity()); } void EntityTileRenderer::render(Tile *tile, int data, float brightness, float alpha, bool setColor, bool useCompiled) diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index 087227e7..db175542 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -59,7 +59,7 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true); else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false); else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false); - else if (dynamic_pointer_cast(e)!=nullptr) addEntity(e, 16 * 5, 1, true); + else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 1, true); else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true); else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); @@ -85,7 +85,7 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva { __debugbreak(); } - shared_ptr te = std::make_shared(e, range, updateInterval, trackDeltas); + shared_ptr te = shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); entities.insert(te); entityMap[e->entityId] = te; te->updatePlayers(this, &level->players); @@ -145,9 +145,9 @@ void EntityTracker::tick() shared_ptr ep = server->getPlayers()->players[i]; if( ep->dimension != level->dimension->id ) continue; - if( ep->connection == nullptr ) continue; + if( ep->connection == NULL ) continue; INetworkPlayer *thisPlayer = ep->connection->getNetworkPlayer(); - if( thisPlayer == nullptr ) continue; + if( thisPlayer == NULL ) continue; bool addPlayer = false; for (unsigned int j = 0; j < movedPlayers.size(); j++) @@ -156,9 +156,9 @@ void EntityTracker::tick() if( sp == ep ) break; - if(sp->connection == nullptr) continue; + if(sp->connection == NULL) continue; INetworkPlayer *otherPlayer = sp->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { addPlayer = true; break; @@ -170,7 +170,7 @@ void EntityTracker::tick() for (unsigned int i = 0; i < movedPlayers.size(); i++) { shared_ptr player = movedPlayers[i]; - if(player->connection == nullptr) continue; + if(player->connection == NULL) continue; for( auto& te : entities ) { if ( te && te->e != player) diff --git a/Minecraft.Client/ExperienceOrbRenderer.cpp b/Minecraft.Client/ExperienceOrbRenderer.cpp index 691efade..c0eae756 100644 --- a/Minecraft.Client/ExperienceOrbRenderer.cpp +++ b/Minecraft.Client/ExperienceOrbRenderer.cpp @@ -20,7 +20,7 @@ void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, { shared_ptr orb = dynamic_pointer_cast(_orb); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); int icon = orb->getIcon(); bindTexture(orb); // 4J was L"/item/xporb.png" @@ -50,9 +50,9 @@ void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, } float br = 255.0f; float rr = (orb->tickCount + a) / 2; - int rc = static_cast((Mth::sin(rr + 0 * PI * 2 / 3) + 1) * 0.5f * br); - int gc = static_cast(br); - int bc = static_cast((Mth::sin(rr + 2 * PI * 2 / 3) + 1) * 0.1f * br); + int rc = (int) ((Mth::sin(rr + 0 * PI * 2 / 3) + 1) * 0.5f * br); + int gc = (int) (br); + int bc = (int) ((Mth::sin(rr + 2 * PI * 2 / 3) + 1) * 0.1f * br); int col = rc << 16 | gc << 8 | bc; glRotatef(180 - entityRenderDispatcher->playerRotY, 0, 1, 0); glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0); diff --git a/Minecraft.Client/ExplodeParticle.cpp b/Minecraft.Client/ExplodeParticle.cpp index e9d4687b..fa950a03 100644 --- a/Minecraft.Client/ExplodeParticle.cpp +++ b/Minecraft.Client/ExplodeParticle.cpp @@ -5,9 +5,9 @@ ExplodeParticle::ExplodeParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, xa, ya, za) { - xd = xa+static_cast(Math::random() * 2 - 1)*0.05f; - yd = ya+static_cast(Math::random() * 2 - 1)*0.05f; - zd = za+static_cast(Math::random() * 2 - 1)*0.05f; + xd = xa+(float)(Math::random()*2-1)*0.05f; + yd = ya+(float)(Math::random()*2-1)*0.05f; + zd = za+(float)(Math::random()*2-1)*0.05f; //rCol = gCol = bCol = random->nextFloat()*.3f+.7; @@ -21,16 +21,16 @@ ExplodeParticle::ExplodeParticle(Level *level, double x, double y, double z, dou size = random->nextFloat()*random->nextFloat()*6+1; - lifetime = static_cast(16 / (random->nextFloat() * 0.8 + 0.2))+2; + lifetime = (int)(16/(random->nextFloat()*0.8+0.2))+2; // noPhysics = true; } void ExplodeParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { // 4J - don't render explosion particles that are less than 3 metres away, to try and avoid large particles that are causing us problems with photosensitivity testing - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); float distSq = (x*x + y*y + z*z); if( distSq < (3.0f * 3.0f) ) return; diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 5d676b29..da9fe12e 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -58,7 +58,7 @@ bool CSocialManager::IsTitleAllowedToPostImages() { return false; } bool CSocialManager::PostLinkToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } bool CSocialManager::PostImageToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } -CSocialManager* CSocialManager::Instance() { return nullptr; } +CSocialManager* CSocialManager::Instance() { return NULL; } void CSocialManager::SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc) {}; DWORD XShowPartyUI(DWORD dwUserIndex) { return 0; } @@ -68,7 +68,7 @@ DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA* pContentData, void XShowAchievementsUI(int i) {} DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } -#if !defined(_DURANGO) && !defined(_WIN64) +#ifndef _DURANGO void PIXAddNamedCounter(int a, const char* b, ...) {} //#define PS3_USE_PIX_EVENTS //#define PS4_USE_PIX_EVENTS @@ -126,9 +126,7 @@ void PIXEndNamedEvent() #endif } void PIXSetMarkerDeprecated(int a, const char* b, ...) {} -#endif - -#if 0//__PSVITA__ +#else // 4J Stu - Removed this implementation in favour of a macro that will convert our string format // conversion at compile time rather than at runtime //void PIXBeginNamedEvent(int a, char *b, ...) @@ -161,7 +159,7 @@ void PIXSetMarkerDeprecated(int a, const char* b, ...) {} //} #endif -// void *D3DXBUFFER::GetBufferPointer() { return nullptr; } +// void *D3DXBUFFER::GetBufferPointer() { return NULL; } // int D3DXBUFFER::GetBufferSize() { return 0; } // void D3DXBUFFER::Release() {} @@ -255,16 +253,16 @@ IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) !m_player[dwUserIndex].m_isRemote && Win64_IsActivePlayer(&m_player[dwUserIndex], dwUserIndex)) return &m_player[dwUserIndex]; - return nullptr; + return NULL; } if (dwUserIndex != 0) - return nullptr; + return NULL; for (DWORD i = 0; i < s_playerCount; i++) { if (!m_player[i].m_isRemote && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; } - return nullptr; + return NULL; } static bool Win64_IsActivePlayer(IQNetPlayer * p, DWORD index) { @@ -291,7 +289,7 @@ IQNetPlayer* IQNet::GetPlayerBySmallId(BYTE SmallId) { if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; } - return nullptr; + return NULL; } IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { @@ -303,7 +301,7 @@ IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) if (m_player[i].GetXuid() == xuid) return &m_player[i]; } - // Keep existing stub behavior: return host slot instead of nullptr on miss. + // Keep existing stub behavior: return host slot instead of NULL on miss. return &m_player[0]; } DWORD IQNet::GetPlayerCount() @@ -332,7 +330,7 @@ void IQNet::ClientJoinGame() for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - m_player[i].m_smallId = static_cast(i); + m_player[i].m_smallId = (BYTE)i; m_player[i].m_isRemote = true; m_player[i].m_isHostPlayer = false; m_player[i].m_resolvedXuid = INVALID_XUID; @@ -347,7 +345,7 @@ void IQNet::EndGame() s_playerCount = 1; for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - m_player[i].m_smallId = static_cast(i); + m_player[i].m_smallId = (BYTE)i; m_player[i].m_isRemote = false; m_player[i].m_isHostPlayer = false; m_player[i].m_resolvedXuid = INVALID_XUID; @@ -455,11 +453,11 @@ HRESULT XMemCreateCompressionContext( ) { /* - COMPRESSOR_HANDLE Compressor = nullptr; + COMPRESSOR_HANDLE Compressor = NULL; HRESULT hr = CreateCompressor( COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - nullptr, // Optional allocation routine + NULL, // Optional allocation routine &Compressor); // Handle pContext = (XMEMDECOMPRESSION_CONTEXT *)Compressor; @@ -476,11 +474,11 @@ HRESULT XMemCreateDecompressionContext( ) { /* - DECOMPRESSOR_HANDLE Decompressor = nullptr; + DECOMPRESSOR_HANDLE Decompressor = NULL; HRESULT hr = CreateDecompressor( COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - nullptr, // Optional allocation routine + NULL, // Optional allocation routine &Decompressor); // Handle pContext = (XMEMDECOMPRESSION_CONTEXT *)Decompressor; @@ -530,7 +528,7 @@ void C_4JProfile::Initialise(DWORD dwTitleID, ZeroMemory(profileData[i], sizeof(byte) * iGameDefinedDataSizeX4 / 4); // Set some sane initial values! - GAME_SETTINGS* pGameSettings = static_cast(profileData[i]); + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)profileData[i]; pGameSettings->ucMenuSensitivity = 100; //eGameSetting_Sensitivity_InMenu pGameSettings->ucInterfaceOpacity = 80; //eGameSetting_Sensitivity_InMenu pGameSettings->usBitmaskValues |= 0x0200; //eGameSetting_DisplaySplitscreenGamertags - on @@ -647,8 +645,8 @@ bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } bool C_4JProfile::IsSystemUIDisplayed() { return false; } void C_4JProfile::SetProfileReadErrorCallback(void (*Func)(LPVOID), LPVOID lpParam) {} -int(*defaultOptionsCallback)(LPVOID, C_4JProfile::PROFILESETTINGS*, const int iPad) = nullptr; -LPVOID lpProfileParam = nullptr; +int(*defaultOptionsCallback)(LPVOID, C_4JProfile::PROFILESETTINGS*, const int iPad) = NULL; +LPVOID lpProfileParam = NULL; int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS*, const int iPad), LPVOID lpParam) { defaultOptionsCallback = Func; @@ -726,7 +724,7 @@ void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA & xCont void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE * ppbImageData, DWORD * pdwImageBytes) {} C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam) { return C4JStorage::ESaveGame_Idle; } C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam) { return C4JStorage::EDeleteGame_Idle; } -PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } +PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return NULL; } void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam) {} void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} @@ -748,7 +746,7 @@ void C4JStorage::StoreTMSPathName(WCHAR * pwchName) {} unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return 0; } struct PTMSPP_FILEDATA; -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR)/*=nullptr*/, LPVOID lpParam/*=nullptr*/, int iUserData/*=0*/) { return C4JStorage::ETMSStatus_Idle; } +C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR)/*=NULL*/, LPVOID lpParam/*=NULL*/, int iUserData/*=0*/) { return C4JStorage::ETMSStatus_Idle; } #endif // _WINDOWS64 #endif // __PS3__ diff --git a/Minecraft.Client/FallingTileRenderer.cpp b/Minecraft.Client/FallingTileRenderer.cpp index 132f033a..2d9f5dae 100644 --- a/Minecraft.Client/FallingTileRenderer.cpp +++ b/Minecraft.Client/FallingTileRenderer.cpp @@ -22,7 +22,7 @@ void FallingTileRenderer::render(shared_ptr _tile, double x, double y, d if (level->getTile(floor(tile->x), floor(tile->y), floor(tile->z)) != tile->tile) { glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); bindTexture(tile); // 4J was L"/terrain.png" Tile *tt = Tile::tiles[tile->tile]; @@ -37,7 +37,7 @@ void FallingTileRenderer::render(shared_ptr _tile, double x, double y, d Tesselator *t = Tesselator::getInstance(); t->begin(); t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, -Mth::floor(tile->z) - 0.5f); - tileRenderer->tesselateAnvilInWorld(static_cast(tt), Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); + tileRenderer->tesselateAnvilInWorld((AnvilTile *) tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); t->offset(0, 0, 0); t->end(); } @@ -51,7 +51,7 @@ void FallingTileRenderer::render(shared_ptr _tile, double x, double y, d t->offset(0, 0, 0); t->end(); } - else if( tt != nullptr ) + else if( tt != NULL ) { tileRenderer->setShape(tt); tileRenderer->renderBlock(tt, level, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); diff --git a/Minecraft.Client/FileTexturePack.cpp b/Minecraft.Client/FileTexturePack.cpp index 711f6736..af58dc1e 100644 --- a/Minecraft.Client/FileTexturePack.cpp +++ b/Minecraft.Client/FileTexturePack.cpp @@ -36,7 +36,7 @@ InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //t return zipFile.getInputStream(entry); #endif - return nullptr; + return NULL; } bool FileTexturePack::hasFile(const wstring &name) diff --git a/Minecraft.Client/FireballRenderer.cpp b/Minecraft.Client/FireballRenderer.cpp index 24e59ff4..3b1ab924 100644 --- a/Minecraft.Client/FireballRenderer.cpp +++ b/Minecraft.Client/FireballRenderer.cpp @@ -20,7 +20,7 @@ void FireballRenderer::render(shared_ptr _fireball, double x, double y, glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); glEnable(GL_RESCALE_NORMAL); float s = scale; glScalef(s / 1.0f, s / 1.0f, s / 1.0f); @@ -43,10 +43,10 @@ void FireballRenderer::render(shared_ptr _fireball, double x, double y, glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0); t->begin(); t->normal(0, 1, 0); - t->vertexUV((float)(0 - xo), (float)( 0 - yo), static_cast(0), (float)( u0), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 0 - yo), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 1 - yo), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV((float)(0 - xo), (float)( 1 - yo), static_cast(0), (float)( u0), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 1 - yo), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 1 - yo), (float)( 0), (float)( u0), (float)( v0)); t->end(); glDisable(GL_RESCALE_NORMAL); @@ -61,7 +61,7 @@ void FireballRenderer::renderFlame(shared_ptr e, double x, double y, dou Icon *tex = Tile::fire->getTextureLayer(0); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); float s = e->bbWidth * 1.4f; glScalef(s, s, s); @@ -75,7 +75,7 @@ void FireballRenderer::renderFlame(shared_ptr e, double x, double y, dou // float yo = 0.0f; float h = e->bbHeight / s; - float yo = static_cast(e->y - e->bb->y0); + float yo = (float) (e->y - e->bb->y0); //glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0); @@ -99,10 +99,10 @@ void FireballRenderer::renderFlame(shared_ptr e, double x, double y, dou u1 = u0; u0 = tmp; - t->vertexUV((float)(0 - xo), (float)( 0 - yo), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 0 - yo), static_cast(0), (float)( u0), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 1.4f - yo), static_cast(0), (float)( u0), (float)( v0)); - t->vertexUV((float)(0 - xo), (float)( 1.4f - yo), static_cast(0), (float)( u1), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 1.4f - yo), (float)( 0), (float)( u0), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 1.4f - yo), (float)( 0), (float)( u1), (float)( v0)); t->end(); glPopMatrix(); diff --git a/Minecraft.Client/FireworksParticles.cpp b/Minecraft.Client/FireworksParticles.cpp index c17283ac..fd19b011 100644 --- a/Minecraft.Client/FireworksParticles.cpp +++ b/Minecraft.Client/FireworksParticles.cpp @@ -15,12 +15,12 @@ FireworksParticles::FireworksStarter::FireworksStarter(Level *level, double x, d this->engine = engine; lifetime = 8; - if (infoTag != nullptr) + if (infoTag != NULL) { - explosions = static_cast *>(infoTag->getList(FireworksItem::TAG_EXPLOSIONS)->copy()); + explosions = (ListTag *)infoTag->getList(FireworksItem::TAG_EXPLOSIONS)->copy(); if (explosions->size() == 0) { - explosions = nullptr; + explosions = NULL; } else { @@ -42,7 +42,7 @@ FireworksParticles::FireworksStarter::FireworksStarter(Level *level, double x, d else { // 4J: - explosions = nullptr; + explosions = NULL; } } @@ -53,7 +53,7 @@ void FireworksParticles::FireworksStarter::render(Tesselator *t, float a, float void FireworksParticles::FireworksStarter::tick() { - if (life == 0 && explosions != nullptr) + if (life == 0 && explosions != NULL) { bool farEffect = isFarAwayFromCamera(); @@ -97,7 +97,7 @@ void FireworksParticles::FireworksStarter::tick() level->playLocalSound(x, y, z, soundId, 20, .95f + random->nextFloat() * .1f, true, 100.0f); } - if ((life % 2) == 0 && explosions != nullptr && (life / 2) < explosions->size()) + if ((life % 2) == 0 && explosions != NULL && (life / 2) < explosions->size()) { int eIndex = life / 2; CompoundTag *compoundTag = explosions->get(eIndex); @@ -186,10 +186,10 @@ void FireworksParticles::FireworksStarter::tick() } { int rgb = colors[0]; - float r = static_cast((rgb & 0xff0000) >> 16) / 255.0f; - float g = static_cast((rgb & 0x00ff00) >> 8) / 255.0f; - float b = static_cast((rgb & 0x0000ff) >> 0) / 255.0f; - shared_ptr fireworksOverlayParticle = std::make_shared(level, x, y, z); + float r = (float) ((rgb & 0xff0000) >> 16) / 255.0f; + float g = (float) ((rgb & 0x00ff00) >> 8) / 255.0f; + float b = (float) ((rgb & 0x0000ff) >> 0) / 255.0f; + shared_ptr fireworksOverlayParticle = shared_ptr(new FireworksParticles::FireworksOverlayParticle(level, x, y, z)); fireworksOverlayParticle->setColor(r, g, b); fireworksOverlayParticle->setAlpha(0.99f); // 4J added engine->add(fireworksOverlayParticle); @@ -212,7 +212,7 @@ void FireworksParticles::FireworksStarter::tick() bool FireworksParticles::FireworksStarter::isFarAwayFromCamera() { Minecraft *instance = Minecraft::GetInstance(); - if (instance != nullptr && instance->cameraTargetPlayer != nullptr) + if (instance != NULL && instance->cameraTargetPlayer != NULL) { if (instance->cameraTargetPlayer->distanceToSqr(x, y, z) < 16 * 16) { @@ -224,14 +224,14 @@ bool FireworksParticles::FireworksStarter::isFarAwayFromCamera() void FireworksParticles::FireworksStarter::createParticle(double x, double y, double z, double xa, double ya, double za, intArray rgbColors, intArray fadeColors, bool trail, bool flicker) { - shared_ptr fireworksSparkParticle = std::make_shared(level, x, y, z, xa, ya, za, engine); + shared_ptr fireworksSparkParticle = shared_ptr(new FireworksSparkParticle(level, x, y, z, xa, ya, za, engine)); fireworksSparkParticle->setAlpha(0.99f); fireworksSparkParticle->setTrail(trail); fireworksSparkParticle->setFlicker(flicker); int color = random->nextInt(rgbColors.length); fireworksSparkParticle->setColor(rgbColors[color]); - if (/*fadeColors != nullptr &&*/ fadeColors.length > 0) + if (/*fadeColors != NULL &&*/ fadeColors.length > 0) { fireworksSparkParticle->setFadeColor(fadeColors[random->nextInt(fadeColors.length)]); } @@ -365,24 +365,24 @@ void FireworksParticles::FireworksSparkParticle::setFlicker(bool flicker) void FireworksParticles::FireworksSparkParticle::setColor(int rgb) { - float r = static_cast((rgb & 0xff0000) >> 16) / 255.0f; - float g = static_cast((rgb & 0x00ff00) >> 8) / 255.0f; - float b = static_cast((rgb & 0x0000ff) >> 0) / 255.0f; + float r = (float) ((rgb & 0xff0000) >> 16) / 255.0f; + float g = (float) ((rgb & 0x00ff00) >> 8) / 255.0f; + float b = (float) ((rgb & 0x0000ff) >> 0) / 255.0f; float scale = 1.0f; Particle::setColor(r * scale, g * scale, b * scale); } void FireworksParticles::FireworksSparkParticle::setFadeColor(int rgb) { - fadeR = static_cast((rgb & 0xff0000) >> 16) / 255.0f; - fadeG = static_cast((rgb & 0x00ff00) >> 8) / 255.0f; - fadeB = static_cast((rgb & 0x0000ff) >> 0) / 255.0f; + fadeR = (float) ((rgb & 0xff0000) >> 16) / 255.0f; + fadeG = (float) ((rgb & 0x00ff00) >> 8) / 255.0f; + fadeB = (float) ((rgb & 0x0000ff) >> 0) / 255.0f; hasFade = true; } AABB *FireworksParticles::FireworksSparkParticle::getCollideBox() { - return nullptr; + return NULL; } bool FireworksParticles::FireworksSparkParticle::isPushable() @@ -407,7 +407,7 @@ void FireworksParticles::FireworksSparkParticle::tick() if (age++ >= lifetime) remove(); if (age > lifetime / 2) { - setAlpha(1.0f - ((static_cast(age) - lifetime / 2) / static_cast(lifetime))); + setAlpha(1.0f - (((float) age - lifetime / 2) / (float) lifetime)); if (hasFade) { @@ -433,7 +433,7 @@ void FireworksParticles::FireworksSparkParticle::tick() if (trail && (age < lifetime / 2) && ((age + lifetime) % 2) == 0) { - shared_ptr fireworksSparkParticle = std::make_shared(level, x, y, z, 0, 0, 0, engine); + shared_ptr fireworksSparkParticle = shared_ptr(new FireworksParticles::FireworksSparkParticle(level, x, y, z, 0, 0, 0, engine)); fireworksSparkParticle->setAlpha(0.99f); fireworksSparkParticle->setColor(rCol, gCol, bCol); fireworksSparkParticle->age = fireworksSparkParticle->lifetime / 2; @@ -475,12 +475,12 @@ void FireworksParticles::FireworksOverlayParticle::render(Tesselator *t, float a float u1 = u0 + 32.0f / 128.0f; float v0 = 16.0f / 128.0f; float v1 = v0 + 32.0f / 128.0f; - float r = 7.1f * sin((static_cast(age) + a - 1.0f) * .25f * PI); - alpha = 0.6f - (static_cast(age) + a - 1.0f) * .25f * .5f; + float r = 7.1f * sin(((float) age + a - 1.0f) * .25f * PI); + alpha = 0.6f - ((float) age + a - 1.0f) * .25f * .5f; - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); t->color(rCol, gCol, bCol, alpha); diff --git a/Minecraft.Client/FishingHookRenderer.cpp b/Minecraft.Client/FishingHookRenderer.cpp index d587ddb8..9d60a9ac 100644 --- a/Minecraft.Client/FishingHookRenderer.cpp +++ b/Minecraft.Client/FishingHookRenderer.cpp @@ -17,7 +17,7 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); glEnable(GL_RESCALE_NORMAL); glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f); int xi = 1; @@ -39,17 +39,17 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0); t->begin(); t->normal(0, 1, 0); - t->vertexUV((float)(0 - xo), (float)( 0 - yo), static_cast(0), (float)( u0), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 0 - yo), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 1 - yo), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV((float)(0 - xo), (float)( 1 - yo), static_cast(0), (float)( u0), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 1 - yo), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 1 - yo), (float)( 0), (float)( u0), (float)( v0)); t->end(); glDisable(GL_RESCALE_NORMAL); glPopMatrix(); - if (hook->owner != nullptr) + if (hook->owner != NULL) { float swing = hook->owner->getAttackAnim(a); float swing2 = (float) Mth::sin(sqrt(swing) * PI); @@ -82,9 +82,9 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d double yh = hook->yo + (hook->y - hook->yo) * a + 4 / 16.0f; double zh = hook->zo + (hook->z - hook->zo) * a; - double xa = static_cast(xp - xh); - double ya = static_cast(yp - yh); - double za = static_cast(zp - zh); + double xa = (float) (xp - xh); + double ya = (float) (yp - yh); + double za = (float) (zp - zh); glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); @@ -93,8 +93,8 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d int steps = 16; for (int i = 0; i <= steps; i++) { - float aa = i / static_cast(steps); - t->vertex(static_cast(x + xa * aa), static_cast(y + ya * (aa * aa + aa) * 0.5 + 4 / 16.0f), static_cast(z + za * aa)); + float aa = i / (float) steps; + t->vertex((float)(x + xa * aa), (float)( y + ya * (aa * aa + aa) * 0.5 + 4 / 16.0f), (float)( z + za * aa)); } t->end(); glEnable(GL_LIGHTING); diff --git a/Minecraft.Client/FlameParticle.cpp b/Minecraft.Client/FlameParticle.cpp index a242f714..eb12dbfd 100644 --- a/Minecraft.Client/FlameParticle.cpp +++ b/Minecraft.Client/FlameParticle.cpp @@ -15,14 +15,14 @@ FlameParticle::FlameParticle(Level *level, double x, double y, double z, double oSize = size; rCol = gCol = bCol = 1.0f; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2))+4; + lifetime = (int)(8/(Math::random()*0.8+0.2))+4; noPhysics = true; setMiscTex(48); } void FlameParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / static_cast(lifetime); + float s = (age + a) / (float) lifetime; size = oSize * (1 - s*s*0.5f); Particle::render(t, a, xa, ya, za, xa2, za2); } @@ -37,7 +37,7 @@ int FlameParticle::getLightColor(float a) int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br1 += static_cast(l * 15 * 16); + br1 += (int) (l * 15 * 16); if (br1 > 15 * 16) br1 = 15 * 16; return br1 | br2 << 16; } diff --git a/Minecraft.Client/FolderTexturePack.cpp b/Minecraft.Client/FolderTexturePack.cpp index 05feca66..4b65dc7f 100644 --- a/Minecraft.Client/FolderTexturePack.cpp +++ b/Minecraft.Client/FolderTexturePack.cpp @@ -31,7 +31,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / #endif InputStream *resource = InputStream::getResourceAsStream(wDrive + name); //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name); - //if (stream == nullptr) + //if (stream == NULL) //{ // throw new FileNotFoundException(name); //} @@ -85,7 +85,7 @@ void FolderTexturePack::loadUI() swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); XuiFreeVisuals(L""); - app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); + app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); bUILoaded = true; //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack"); } diff --git a/Minecraft.Client/FolderTexturePack.h b/Minecraft.Client/FolderTexturePack.h index 4327698d..40921078 100644 --- a/Minecraft.Client/FolderTexturePack.h +++ b/Minecraft.Client/FolderTexturePack.h @@ -20,7 +20,7 @@ public: bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index b6d96e8e..ce2275f6 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -34,7 +34,7 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor m_textureLocation = textureLocation; // Build character map - if (charMap != nullptr) + if (charMap != NULL) { for(int i = 0; i < charC; i++) { @@ -383,7 +383,7 @@ int Font::width(const wstring& str) { wstring cleanStr = sanitize(str); - if (cleanStr == L"") return 0; // 4J - was nullptr comparison + if (cleanStr == L"") return 0; // 4J - was NULL comparison int len = 0; for (int i = 0; i < cleanStr.length(); ++i) @@ -602,7 +602,7 @@ bool Font::AllCharactersValid(const wstring &str) continue; } - size_t index = SharedConstants::acceptableLetters.find(c); + int index = SharedConstants::acceptableLetters.find(c); if ((c != ' ') && !(index > 0 && !enforceUnicodeSheet)) { diff --git a/Minecraft.Client/Font.h b/Minecraft.Client/Font.h index c78ea678..a5d117ca 100644 --- a/Minecraft.Client/Font.h +++ b/Minecraft.Client/Font.h @@ -38,7 +38,7 @@ private: std::map m_charMap; public: - Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, ResourceLocation *textureLocation, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = nullptr); + Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, ResourceLocation *textureLocation, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); #ifndef _XBOX // 4J Stu - This dtor clashes with one in xui! We never delete these anyway so take it out for now. Can go back when we have got rid of XUI ~Font(); diff --git a/Minecraft.Client/FootstepParticle.cpp b/Minecraft.Client/FootstepParticle.cpp index b2bfc989..300575eb 100644 --- a/Minecraft.Client/FootstepParticle.cpp +++ b/Minecraft.Client/FootstepParticle.cpp @@ -31,9 +31,9 @@ void FootstepParticle::render(Tesselator *t, float a, float xa, float ya, float glDisable(GL_LIGHTING); float r = 2 / 16.0f; - float xx = static_cast(x - xOff); - float yy = static_cast(y - yOff); - float zz = static_cast(z - zOff); + float xx = (float) (x - xOff); + float yy = (float) (y - yOff); + float zz = (float) (z - zOff); float br = level->getBrightness(Mth::floor(x), Mth::floor(y), Mth::floor(z)); @@ -43,10 +43,10 @@ void FootstepParticle::render(Tesselator *t, float a, float xa, float ya, float t->begin(); t->color(br, br, br, alpha); - t->vertexUV((float)(xx - r), (float)( yy), (float)( zz + r), static_cast(0), static_cast(1)); - t->vertexUV((float)(xx + r), (float)( yy), (float)( zz + r), static_cast(1), static_cast(1)); - t->vertexUV((float)(xx + r), (float)( yy), (float)( zz - r), static_cast(1), static_cast(0)); - t->vertexUV((float)(xx - r), (float)( yy), (float)( zz - r), static_cast(0), static_cast(0)); + t->vertexUV((float)(xx - r), (float)( yy), (float)( zz + r), (float)( 0), (float)( 1)); + t->vertexUV((float)(xx + r), (float)( yy), (float)( zz + r), (float)( 1), (float)( 1)); + t->vertexUV((float)(xx + r), (float)( yy), (float)( zz - r), (float)( 1), (float)( 0)); + t->vertexUV((float)(xx - r), (float)( yy), (float)( zz - r), (float)( 0), (float)( 0)); t->end(); glDisable(GL_BLEND); diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index ecd2f462..5790bea2 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -74,7 +74,7 @@ ResourceLocation GameRenderer::SNOW_LOCATION = ResourceLocation(TN_ENVIRONMENT_S GameRenderer::GameRenderer(Minecraft *mc) { // 4J - added this block of initialisers - renderDistance = static_cast(16 * 16 >> mc->options->viewDistance); + renderDistance = (float)(16 * 16 >> mc->options->viewDistance); _tick = 0; hovered = nullptr; thirdDistance = 4; @@ -106,8 +106,8 @@ GameRenderer::GameRenderer(Minecraft *mc) zoom = 1; zoom_x = 0; zoom_y = 0; - rainXa = nullptr; - rainZa = nullptr; + rainXa = NULL; + rainZa = NULL; lastActiveTime = Minecraft::currentTimeMillis(); lastNsTime = 0; random = new Random(); @@ -139,7 +139,7 @@ GameRenderer::GameRenderer(Minecraft *mc) } this->mc = mc; - itemInHandRenderer = nullptr; + itemInHandRenderer = NULL; // 4J-PB - set up the local players iteminhand renderers here - needs to be done with lighting enabled so that the render geometry gets compiled correctly glEnable(GL_LIGHTING); @@ -170,7 +170,7 @@ GameRenderer::GameRenderer(Minecraft *mc) m_updateEvents->Set(eUpdateEventIsFinished); InitializeCriticalSection(&m_csDeleteStack); - m_updateThread = new C4JThread(runUpdate, nullptr, "Chunk update"); + m_updateThread = new C4JThread(runUpdate, NULL, "Chunk update"); #ifdef __PS3__ m_updateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); #endif// __PS3__ @@ -182,8 +182,8 @@ GameRenderer::GameRenderer(Minecraft *mc) // 4J Stu Added to go with 1.8.2 change GameRenderer::~GameRenderer() { - if(rainXa != nullptr) delete [] rainXa; - if(rainZa != nullptr) delete [] rainZa; + if(rainXa != NULL) delete [] rainXa; + if(rainZa != NULL) delete [] rainZa; } void GameRenderer::tick(bool first) // 4J - add bFirst @@ -211,7 +211,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst accumulatedSmoothYO = 0; } - if (mc->cameraTargetPlayer == nullptr) + if (mc->cameraTargetPlayer == NULL) { mc->cameraTargetPlayer = dynamic_pointer_cast(mc->player); } @@ -230,7 +230,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst darkenWorldAmountO = darkenWorldAmount; if (BossMobGuiInfo::darkenWorld) { - darkenWorldAmount += 1.0f / (static_cast(SharedConstants::TICKS_PER_SECOND) * 1); + darkenWorldAmount += 1.0f / ((float) SharedConstants::TICKS_PER_SECOND * 1); if (darkenWorldAmount > 1) { darkenWorldAmount = 1; @@ -239,7 +239,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst } else if (darkenWorldAmount > 0) { - darkenWorldAmount -= 1.0f / (static_cast(SharedConstants::TICKS_PER_SECOND) * 4); + darkenWorldAmount -= 1.0f / ((float) SharedConstants::TICKS_PER_SECOND * 4); } if( mc->player != mc->localplayers[ProfileManager.GetPrimaryPad()] ) return; // 4J added for split screen - only do rest of processing for once per frame @@ -249,8 +249,8 @@ void GameRenderer::tick(bool first) // 4J - add bFirst void GameRenderer::pick(float a) { - if (mc->cameraTargetPlayer == nullptr) return; - if (mc->level == nullptr) return; + if (mc->cameraTargetPlayer == NULL) return; + if (mc->level == NULL) return; mc->crosshairPickMob = nullptr; @@ -280,7 +280,7 @@ void GameRenderer::pick(float a) ( hitz < minxz ) || ( hitz > maxxz) ) { delete mc->hitResult; - mc->hitResult = nullptr; + mc->hitResult = NULL; } } @@ -297,7 +297,7 @@ void GameRenderer::pick(float a) range = dist; } - if (mc->hitResult != nullptr) + if (mc->hitResult != NULL) { dist = mc->hitResult->pos->distanceTo(from); } @@ -327,14 +327,13 @@ void GameRenderer::pick(float a) else if (p != nullptr) { double dd = from->distanceTo(p->pos); - auto const riding = mc->cameraTargetPlayer->riding; - if (riding != nullptr && e == riding) - { - if (nearest == 0) - { - hovered = e; - } - } + if (e == mc->cameraTargetPlayer->riding != NULL) + { + if (nearest == 0) + { + hovered = e; + } + } else { hovered = e; @@ -344,11 +343,11 @@ void GameRenderer::pick(float a) delete p; } - if (hovered != nullptr) + if (hovered != NULL) { - if (nearest < dist || (mc->hitResult == nullptr)) + if (nearest < dist || (mc->hitResult == NULL)) { - if( mc->hitResult != nullptr ) + if( mc->hitResult != NULL ) delete mc->hitResult; mc->hitResult = new HitResult(hovered); if (hovered->instanceof(eTYPE_LIVINGENTITY)) @@ -476,7 +475,7 @@ void GameRenderer::moveCameraToPlayer(float a) int data = mc->level->getData(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); int direction = data & 3; - glRotatef(static_cast(direction) * 90,0.0f, 1.0f, 0.0f); + glRotatef((float)direction * 90,0.0f, 1.0f, 0.0f); } glRotatef(player->yRotO + (player->yRot - player->yRotO) * a + 180, 0, -1, 0); glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, -1, 0, 0); @@ -494,7 +493,7 @@ void GameRenderer::moveCameraToPlayer(float a) float rotationY = thirdRotationO + (thirdRotation - thirdRotationO) * a; float xRot = thirdTiltO + (thirdTilt - thirdTiltO) * a; - glTranslatef(0, 0, static_cast(-cameraDist)); + glTranslatef(0, 0, (float) -cameraDist); glRotatef(xRot, 1, 0, 0); glRotatef(rotationY, 0, 1, 0); } @@ -523,9 +522,9 @@ void GameRenderer::moveCameraToPlayer(float a) for (int i = 0; i < 8; i++) { - float xo = static_cast((i & 1) * 2 - 1); - float yo = static_cast(((i >> 1) & 1) * 2 - 1); - float zo = static_cast(((i >> 2) & 1) * 2 - 1); + float xo = (float)((i & 1) * 2 - 1); + float yo = (float)(((i >> 1) & 1) * 2 - 1); + float zo = (float)(((i >> 2) & 1) * 2 - 1); xo *= 0.1f; yo *= 0.1f; @@ -533,7 +532,7 @@ void GameRenderer::moveCameraToPlayer(float a) // 4J - corrected bug here where zo was also added to x component HitResult *hr = mc->level->clip(Vec3::newTemp(x + xo, y + yo, z + zo), Vec3::newTemp(x - xd + xo, y - yd + yo, z - zd + zo)); - if (hr != nullptr) + if (hr != NULL) { double dist = hr->pos->distanceTo(Vec3::newTemp(x, y, z)); if (dist < cameraDist) cameraDist = dist; @@ -541,7 +540,7 @@ void GameRenderer::moveCameraToPlayer(float a) } } - glTranslatef(0, 0, static_cast(-cameraDist)); + glTranslatef(0, 0, (float) -cameraDist); } } else @@ -596,7 +595,7 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool appl { // 4J - split out aspect ratio and fov here so we can adjust for viewports - we might need to revisit these as // they are maybe be too generous for performance. - aspect = mc->width / static_cast(mc->height); + aspect = mc->width / (float) mc->height; fov = getFov(a, applyEffects); if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP ) || @@ -617,11 +616,11 @@ void GameRenderer::setupCamera(float a, int eye) { if (mc->options->viewDistance >= 0) { - renderDistance = static_cast(16 * 16 >> mc->options->viewDistance); + renderDistance = (float)(16 * 16 >> mc->options->viewDistance); } else { - renderDistance = static_cast((16 * 16) << (-mc->options->viewDistance)); + renderDistance = (float)((16 * 16) << (-mc->options->viewDistance)); } glMatrixMode(GL_PROJECTION); @@ -636,7 +635,7 @@ void GameRenderer::setupCamera(float a, int eye) if (zoom != 1) { - glTranslatef(static_cast(zoom_x), static_cast(-zoom_y), 0); + glTranslatef((float) zoom_x, (float) -zoom_y, 0); glScaled(zoom, zoom, 1); } gluPerspective(fov, aspect, 0.05f, renderDistance * 2); @@ -701,7 +700,7 @@ void GameRenderer::renderItemInHand(float a, int eye) bool renderHand = true; // 4J-PB - to turn off the hand for screenshots, but not when the item held is a map - if ( localplayer!=nullptr) + if ( localplayer!=NULL) { shared_ptr item = localplayer->inventory->getSelected(); if(!(item && item->getItem()->id==Item::map_Id) && app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_DisplayHand)==0 ) renderHand = false; @@ -719,7 +718,7 @@ void GameRenderer::renderItemInHand(float a, int eye) if (zoom != 1) { - glTranslatef(static_cast(zoom_x), static_cast(-zoom_y), 0); + glTranslatef((float) zoom_x, (float) -zoom_y, 0); glScaled(zoom, zoom, 1); } gluPerspective(fov, aspect, 0.05f, renderDistance * 2); @@ -831,8 +830,8 @@ void GameRenderer::turnOnLightLayer(double alpha) // 4J - change brought forward from 1.8.2 void GameRenderer::tickLightTexture() { - blrt += static_cast((Math::random() - Math::random()) * Math::random() * Math::random()); - blgt += static_cast((Math::random() - Math::random()) * Math::random() * Math::random()); + blrt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); + blgt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); blrt *= 0.9; blgt *= 0.9; blr += (blrt - blr) * 1; @@ -1169,57 +1168,56 @@ void GameRenderer::render(float a, bool bFirst) } #endif - if (mc->noRender) - return; - GameRenderer::anaglyph3d = mc->options->anaglyph3d; + if (mc->noRender) return; + GameRenderer::anaglyph3d = mc->options->anaglyph3d; - glViewport(0, 0, mc->width, mc->height); // 4J - added - ScreenSizeCalculator ssc(mc->options, mc->width, mc->height); - int screenWidth = ssc.getWidth(); - int screenHeight = ssc.getHeight(); - int xMouse = Mouse::getX() * screenWidth / mc->width; - int yMouse = screenHeight - Mouse::getY() * screenHeight / mc->height - 1; + glViewport(0, 0, mc->width, mc->height); // 4J - added + ScreenSizeCalculator ssc(mc->options, mc->width, mc->height); + int screenWidth = ssc.getWidth(); + int screenHeight = ssc.getHeight(); + int xMouse = Mouse::getX() * screenWidth / mc->width; + int yMouse = screenHeight - Mouse::getY() * screenHeight / mc->height - 1; - int maxFps = getFpsCap(mc->options->framerateLimit); + int maxFps = getFpsCap(mc->options->framerateLimit); - if (mc->level != nullptr) - { - if (mc->options->framerateLimit == 0) - { - renderLevel(a, 0); - } - else - { - renderLevel(a, lastNsTime + 1000000000 / maxFps); - } + if (mc->level != NULL) + { + if (mc->options->framerateLimit == 0) + { + renderLevel(a, 0); + } + else + { + renderLevel(a, lastNsTime + 1000000000 / maxFps); + } - lastNsTime = System::nanoTime(); + lastNsTime = System::nanoTime(); - if (!mc->options->hideGui || mc->screen != nullptr) - { - mc->gui->render(a, mc->screen != nullptr, xMouse, yMouse); - } - } - else - { - glViewport(0, 0, mc->width, mc->height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - setupGuiScreen(); + if (!mc->options->hideGui || mc->screen != NULL) + { + mc->gui->render(a, mc->screen != NULL, xMouse, yMouse); + } + } + else + { + glViewport(0, 0, mc->width, mc->height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + setupGuiScreen(); - lastNsTime = System::nanoTime(); - } + lastNsTime = System::nanoTime(); + } - if (mc->screen != nullptr) - { - glClear(GL_DEPTH_BUFFER_BIT); - mc->screen->render(xMouse, yMouse, a); - if (mc->screen != nullptr && mc->screen->particles != nullptr) - mc->screen->particles->render(a); - } -} + + if (mc->screen != NULL) + { + glClear(GL_DEPTH_BUFFER_BIT); + mc->screen->render(xMouse, yMouse, a); + if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a); + } + } void GameRenderer::renderLevel(float a) { @@ -1385,7 +1383,7 @@ void GameRenderer::renderLevel(float a, int64_t until) // going to do for the primary player, and the other players can just view whatever they have loaded in - we're sharing render data between players. bool updateChunks = ( mc->player == mc->localplayers[ProfileManager.GetPrimaryPad()] ); - // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we want to update this is mc->player changes for different local players + // if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we want to update this is mc->player changes for different local players { mc->cameraTargetPlayer = mc->player; } @@ -1513,7 +1511,7 @@ void GameRenderer::renderLevel(float a, int64_t until) PIXEndNamedEvent(); turnOffLightLayer(a); // 4J - brought forward from 1.8.2 - if ( (mc->hitResult != nullptr) && cameraEntity->isUnderLiquid(Material::water) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) + if ( (mc->hitResult != NULL) && cameraEntity->isUnderLiquid(Material::water) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) { shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); @@ -1582,7 +1580,7 @@ void GameRenderer::renderLevel(float a, int64_t until) if ( (zoom == 1) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) { - if (mc->hitResult != nullptr && !cameraEntity->isUnderLiquid(Material::water)) + if (mc->hitResult != NULL && !cameraEntity->isUnderLiquid(Material::water)) { shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); @@ -1672,7 +1670,7 @@ void GameRenderer::tickRain() double rainPosZ = 0; int rainPosSamples = 0; - int rainCount = static_cast(100 * rainLevel * rainLevel); + int rainCount = (int) (100 * rainLevel * rainLevel); if (mc->options->particles == 1) { rainCount >>= 1; @@ -1695,7 +1693,7 @@ void GameRenderer::tickRain() { if (Tile::tiles[t]->material == Material::lava) { - mc->particleEngine->add(std::make_shared(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0)); + mc->particleEngine->add( shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); } else { @@ -1705,7 +1703,7 @@ void GameRenderer::tickRain() rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); rainPosZ = z + za; } - mc->particleEngine->add(std::make_shared(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za)); + mc->particleEngine->add( shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); } } } @@ -1740,7 +1738,7 @@ void GameRenderer::renderSnowAndRain(float a) turnOnLightLayer(a); - if (rainXa == nullptr) + if (rainXa == NULL) { rainXa = new float[32 * 32]; rainZa = new float[32 * 32]; @@ -1887,11 +1885,11 @@ void GameRenderer::renderSnowAndRain(float a) t->begin(); } float ra = (((_tick) & 511) + a) / 512.0f; - float uo = random->nextFloat() + time * 0.01f * static_cast(random->nextGaussian()); - float vo = random->nextFloat() + time * static_cast(random->nextGaussian()) * 0.001f; + float uo = random->nextFloat() + time * 0.01f * (float) random->nextGaussian(); + float vo = random->nextFloat() + time * (float) random->nextGaussian() * 0.001f; double xd = (x + 0.5f) - player->x; double zd = (z + 0.5f) - player->z; - float dd = static_cast(sqrt(xd * xd + zd * zd)) / r; + float dd = (float) sqrt(xd * xd + zd * zd) / r; float br = 1; t->offset(-xo * 1, -yo * 1, -zo * 1); #ifdef __PSVITA__ @@ -1933,7 +1931,7 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, static_cast(ssc.rawWidth), static_cast(ssc.rawHeight), 0, 1000, 3000); + glOrtho(0, (float)ssc.rawWidth, (float)ssc.rawHeight, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1945,27 +1943,27 @@ void GameRenderer::setupClearColor(float a) shared_ptr player = mc->cameraTargetPlayer; float whiteness = 1.0f / (4 - mc->options->viewDistance); - whiteness = 1 - static_cast(pow(static_cast(whiteness), 0.25)); + whiteness = 1 - (float) pow((double)whiteness, 0.25); Vec3 *skyColor = level->getSkyColor(mc->cameraTargetPlayer, a); - float sr = static_cast(skyColor->x); - float sg = static_cast(skyColor->y); - float sb = static_cast(skyColor->z); + float sr = (float) skyColor->x; + float sg = (float) skyColor->y; + float sb = (float) skyColor->z; Vec3 *fogColor = level->getFogColor(a); - fr = static_cast(fogColor->x); - fg = static_cast(fogColor->y); - fb = static_cast(fogColor->z); + fr = (float) fogColor->x; + fg = (float) fogColor->y; + fb = (float) fogColor->z; if (mc->options->viewDistance < 2) { Vec3 *sunAngle = Mth::sin(level->getSunAngle(a)) > 0 ? Vec3::newTemp(-1, 0, 0) : Vec3::newTemp(1, 0, 0); - float d = static_cast(player->getViewVector(a)->dot(sunAngle)); + float d = (float) player->getViewVector(a)->dot(sunAngle); if (d < 0) d = 0; if (d > 0) { float *c = level->dimension->getSunriseColor(level->getTimeOfDay(a), a); - if (c != nullptr) + if (c != NULL) { d *= c[3]; fr = fr * (1 - d) + c[0] * d; @@ -2001,9 +1999,9 @@ void GameRenderer::setupClearColor(float a) if (isInClouds) { Vec3 *cc = level->getCloudColor(a); - fr = static_cast(cc->x); - fg = static_cast(cc->y); - fb = static_cast(cc->z); + fr = (float) cc->x; + fg = (float) cc->y; + fb = (float) cc->z; } else if (t != 0 && Tile::tiles[t]->material == Material::water) { @@ -2014,9 +2012,9 @@ void GameRenderer::setupClearColor(float a) byte greenComponent = ((colour>>8)&0xFF); byte blueComponent = ((colour)&0xFF); - fr = static_cast(redComponent)/256 + clearness;//0.02f; - fg = static_cast(greenComponent)/256 + clearness;//0.02f; - fb = static_cast(blueComponent)/256 + clearness;//0.2f; + fr = (float)redComponent/256 + clearness;//0.02f; + fg = (float)greenComponent/256 + clearness;//0.02f; + fb = (float)blueComponent/256 + clearness;//0.2f; } else if (t != 0 && Tile::tiles[t]->material == Material::lava) { @@ -2025,9 +2023,9 @@ void GameRenderer::setupClearColor(float a) byte greenComponent = ((colour>>8)&0xFF); byte blueComponent = ((colour)&0xFF); - fr = static_cast(redComponent)/256;//0.6f; - fg = static_cast(greenComponent)/256;//0.1f; - fb = static_cast(blueComponent)/256;//0.00f; + fr = (float)redComponent/256;//0.6f; + fg = (float)greenComponent/256;//0.1f; + fb = (float)blueComponent/256;//0.00f; } float brr = fogBrO + (fogBr - fogBrO) * a; @@ -2042,7 +2040,7 @@ void GameRenderer::setupClearColor(float a) int duration = player->getEffect(MobEffect::blindness)->getDuration(); if (duration < 20) { - yy = yy * (1.0f - static_cast(duration) / 20.0f); + yy = yy * (1.0f - (float) duration / 20.0f); } else { @@ -2147,7 +2145,7 @@ void GameRenderer::setupFog(int i, float alpha) int duration = player->getEffect(MobEffect::blindness)->getDuration(); if (duration < 20) { - distance = 5.0f + (renderDistance - 5.0f) * (1.0f - static_cast(duration) / 20.0f); + distance = 5.0f + (renderDistance - 5.0f) * (1.0f - (float) duration / 20.0f); } glFogi(GL_FOG_MODE, GL_LINEAR); @@ -2202,7 +2200,7 @@ void GameRenderer::setupFog(int i, float alpha) { if (yy < 0) yy = 0; yy = yy * yy; - float dist = 100 * static_cast(yy); + float dist = 100 * (float) yy; if (dist < 5) dist = 5; if (distance > dist) distance = dist; } @@ -2229,7 +2227,7 @@ void GameRenderer::setupFog(int i, float alpha) } */ - if (mc->level->dimension->isFoggyAt(static_cast(player->x), static_cast(player->z))) + if (mc->level->dimension->isFoggyAt((int) player->x, (int) player->z)) { glFogf(GL_FOG_START, distance * 0.05f); glFogf(GL_FOG_END, min(distance, 16 * 16 * .75f) * .5f); diff --git a/Minecraft.Client/GhastModel.cpp b/Minecraft.Client/GhastModel.cpp index 0a482e62..14277c43 100644 --- a/Minecraft.Client/GhastModel.cpp +++ b/Minecraft.Client/GhastModel.cpp @@ -23,7 +23,7 @@ GhastModel::GhastModel() : Model() tentacles[i]->x = xo; tentacles[i]->z = yo; - tentacles[i]->y = static_cast(31 + yoffs); + tentacles[i]->y = (float)(31 + yoffs); } // 4J added - compile now to avoid random performance hit first time cubes are rendered diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 6217bc40..f9810a36 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -28,7 +28,6 @@ #include "..\Minecraft.World\net.minecraft.world.h" #include "..\Minecraft.World\LevelChunk.h" #include "..\Minecraft.World\Biome.h" -#include ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR); @@ -88,7 +87,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) int quickSelectHeight=22; float fScaleFactorWidth=1.0f,fScaleFactorHeight=1.0f; bool bTwoPlayerSplitscreen=false; - currentGuiScaleFactor = static_cast(guiScale); // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport + currentGuiScaleFactor = (float) guiScale; // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport switch(guiScale) { @@ -118,7 +117,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) iSafezoneYHalf = splitYOffset; iSafezoneTopYHalf = screenHeight/10; fScaleFactorWidth=0.5f; - iWidthOffset=static_cast((float)screenWidth * (1.0f - fScaleFactorWidth)); + iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth)); iTooltipsYOffset=44; bTwoPlayerSplitscreen=true; currentGuiScaleFactor *= 0.5f; @@ -128,7 +127,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) iSafezoneYHalf = splitYOffset + screenHeight/10;// 5% (need to treat the whole screen is 2x this screen) iSafezoneTopYHalf = 0; fScaleFactorWidth=0.5f; - iWidthOffset=static_cast((float)screenWidth * (1.0f - fScaleFactorWidth)); + iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth)); iTooltipsYOffset=44; bTwoPlayerSplitscreen=true; currentGuiScaleFactor *= 0.5f; @@ -698,7 +697,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) #endif glPushMatrix(); - glTranslatef(static_cast(xo), static_cast(yo), 50); + glTranslatef((float)xo, (float)yo, 50); float ss = 12; glScalef(-ss, ss, ss); glRotatef(180, 0, 0, 1); @@ -807,14 +806,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) glDisable(GL_DEPTH_TEST); glDisable(GL_ALPHA_TEST); int timer = minecraft->player->getSleepTimer(); - float amount = static_cast(timer) / static_cast(Player::SLEEP_DURATION); + float amount = (float) timer / (float) Player::SLEEP_DURATION; if (amount > 1) { // waking up - amount = 1.0f - (static_cast(timer - Player::SLEEP_DURATION) / static_cast(Player::WAKE_UP_DURATION)); + amount = 1.0f - ((float) (timer - Player::SLEEP_DURATION) / (float) Player::WAKE_UP_DURATION); } - int color = static_cast(220.0f * amount) << 24 | (0x101020); + int color = (int) (220.0f * amount) << 24 | (0x101020); fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color); glEnable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); @@ -826,9 +825,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) glDisable(GL_DEPTH_TEST); glDisable(GL_ALPHA_TEST); int timer = minecraft->player->getDeathFadeTimer(); - float amount = static_cast(timer) / static_cast(Player::DEATHFADE_DURATION); + float amount = (float) timer / (float) Player::DEATHFADE_DURATION; - int color = static_cast(220.0f * amount) << 24 | (0x200000); + int color = (int) (220.0f * amount) << 24 | (0x200000); fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color); glEnable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); @@ -851,15 +850,15 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) const int debugTop = 1; const float maxContentWidth = 1200.f; const float maxContentHeight = 420.f; - float scale = static_cast(screenWidth - debugLeft - 8) / maxContentWidth; - float scaleV = static_cast(screenHeight - debugTop - 80) / maxContentHeight; + float scale = (float)(screenWidth - debugLeft - 8) / maxContentWidth; + float scaleV = (float)(screenHeight - debugTop - 80) / maxContentHeight; if (scaleV < scale) scale = scaleV; if (scale > 1.f) scale = 1.f; if (scale < 0.5f) scale = 0.5f; glPushMatrix(); - glTranslatef(static_cast(debugLeft), static_cast(debugTop), 0.f); + glTranslatef((float)debugLeft, (float)debugTop, 0.f); glScalef(scale, scale, 1.f); - glTranslatef(static_cast(-debugLeft), static_cast(-debugTop), 0.f); + glTranslatef((float)-debugLeft, (float)-debugTop, 0.f); vector lines; @@ -985,11 +984,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) wfeature[eTerrainFeature_Village] = L"Village: "; wfeature[eTerrainFeature_Ravine] = L"Ravine: "; - float maxW = static_cast(screenWidth - debugLeft - 8) / scale; - float maxWForContent = maxW - static_cast(font->width(L"...")); + float maxW = (float)(screenWidth - debugLeft - 8) / scale; + float maxWForContent = maxW - (float)font->width(L"..."); bool truncated[eTerrainFeature_Count] = {}; - for (size_t i = 0; i < app.m_vTerrainFeatures.size(); i++) + for (int i = 0; i < (int)app.m_vTerrainFeatures.size(); i++) { FEATURE_DATA *pFeatureData = app.m_vTerrainFeatures[i]; int type = pFeatureData->eTerrainFeature; @@ -1015,7 +1014,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) } lines.push_back(L""); // Add a spacer line - for (int i = eTerrainFeature_Stronghold; i <= static_cast(eTerrainFeature_Ravine); i++) + for (int i = eTerrainFeature_Stronghold; i <= (int)eTerrainFeature_Ravine; i++) { lines.push_back(wfeature[i]); } @@ -1242,10 +1241,10 @@ void Gui::renderPumpkin(int w, int h) MemSect(0); Tesselator *t = Tesselator::getInstance(); t->begin(); - t->vertexUV(static_cast(0), static_cast(h), static_cast(-90), static_cast(0), static_cast(1)); - t->vertexUV(static_cast(w), static_cast(h), static_cast(-90), static_cast(1), static_cast(1)); - t->vertexUV(static_cast(w), static_cast(0), static_cast(-90), static_cast(1), static_cast(0)); - t->vertexUV(static_cast(0), static_cast(0), static_cast(-90), static_cast(0), static_cast(0)); + t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( 0), (float)( 1)); + t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( 1), (float)( 1)); + t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( 1), (float)( 0)); + t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( 0), (float)( 0)); t->end(); glDepthMask(true); glEnable(GL_DEPTH_TEST); @@ -1306,10 +1305,10 @@ void Gui::renderTp(float br, int w, int h) float v1 = slot->getV1(); Tesselator *t = Tesselator::getInstance(); t->begin(); - t->vertexUV(static_cast(0), static_cast(h), static_cast(-90), (float)( u0), (float)( v1)); - t->vertexUV(static_cast(w), static_cast(h), static_cast(-90), (float)( u1), (float)( v1)); - t->vertexUV(static_cast(w), static_cast(0), static_cast(-90), (float)( u1), (float)( v0)); - t->vertexUV(static_cast(0), static_cast(0), static_cast(-90), (float)( u0), (float)( v0)); + t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( u0), (float)( v1)); + t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( u1), (float)( v1)); + t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( u1), (float)( v0)); + t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( u0), (float)( v0)); t->end(); glDepthMask(true); glEnable(GL_DEPTH_TEST); @@ -1327,10 +1326,10 @@ void Gui::renderSlot(int slot, int x, int y, float a) if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); - glTranslatef(static_cast(x + 8), static_cast(y + 12), 0); + float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; + glTranslatef((float)(x + 8), (float)(y + 12), 0); glScalef(1 / squeeze, (squeeze + 1) / 2, 1); - glTranslatef(static_cast(-(x + 8)), static_cast(-(y + 12)), 0); + glTranslatef((float)-(x + 8), (float)-(y + 12), 0); } itemRenderer->renderAndDecorateItem(minecraft->font, minecraft->textures, item, x, y); @@ -1469,7 +1468,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) { i++; } - size_t iLast=string.find_last_of(L" ",i); + int iLast=(int)string.find_last_of(L" ",i); switch(XGetLanguage()) { case XC_LANGUAGE_JAPANESE: @@ -1478,7 +1477,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) iLast = maximumChars; break; default: - iLast=string.find_last_of(L" ",i); + iLast=(int)string.find_last_of(L" ",i); break; } @@ -1538,7 +1537,7 @@ float Gui::getOpacity(int iPad, DWORD index) float Gui::getJukeboxOpacity(int iPad) { float t = overlayMessageTime - lastTickA; - int alpha = static_cast(t * 256 / 20); + int alpha = (int) (t * 256 / 20); if (alpha > 255) alpha = 255; alpha /= 255; @@ -1572,7 +1571,7 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, static_cast(minecraft->width), static_cast(height), 0, 1000, 3000); + glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1603,8 +1602,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc int64_t aVal = dataA[i] / dataAScale; - t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), static_cast(0)); - t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), static_cast(0)); + t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0)); + t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0)); } if( dataB != NULL ) @@ -1620,8 +1619,8 @@ void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataASc int64_t bVal = dataB[i] / dataBScale; - t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), static_cast(0)); - t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), static_cast(0)); + t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0)); + t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0)); } } t->end(); @@ -1636,7 +1635,7 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64 glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, static_cast(minecraft->width), static_cast(height), 0, 1000, 3000); + glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1665,15 +1664,15 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64 if( thisVal > 0 ) { - float vary = static_cast(source)/dataSources; + float vary = (float)source/dataSources; int fColour = floor(vary * 0xffffff); int colour = 0xff000000 + fColour; //printf("Colour is %x\n", colour); t->color(colour); - t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), static_cast(0)); - t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), static_cast(0)); + t->vertex((float)(i + 0.5f), (float)( height - topVal - thisVal + 0.5f), (float)( 0)); + t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), (float)( 0)); topVal += thisVal; } @@ -1684,8 +1683,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64 { t->color(0xff000000); - t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast(0)); - t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), static_cast(0)); + t->vertex((float)(0 + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0)); + t->vertex((float)(dataLength + 0.5f), (float)( height - (horiz*100) + 0.5f), (float)( 0)); } } t->end(); diff --git a/Minecraft.Client/Gui.h b/Minecraft.Client/Gui.h index 64b8dfbe..60ea8b7c 100644 --- a/Minecraft.Client/Gui.h +++ b/Minecraft.Client/Gui.h @@ -59,7 +59,7 @@ public: void displayClientMessage(int messageId, int iPad); // 4J Added - DWORD getMessagesCount(int iPad) { return static_cast(guiMessages[iPad].size()); } + DWORD getMessagesCount(int iPad) { return (int)guiMessages[iPad].size(); } wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; } float getOpacity(int iPad, DWORD index); diff --git a/Minecraft.Client/GuiParticle.cpp b/Minecraft.Client/GuiParticle.cpp index 1e6bcc70..25859c70 100644 --- a/Minecraft.Client/GuiParticle.cpp +++ b/Minecraft.Client/GuiParticle.cpp @@ -24,7 +24,7 @@ GuiParticle::GuiParticle(double x, double y, double xa, double ya) friction = 1.0 / (random->nextDouble() * 0.05 + 1.01); - lifeTime = static_cast(10.0 / (random->nextDouble() * 2 + 0.1)); + lifeTime = (int) (10.0 / (random->nextDouble() * 2 + 0.1)); } void GuiParticle::tick(GuiParticles *guiParticles) @@ -37,7 +37,7 @@ void GuiParticle::tick(GuiParticles *guiParticles) ya += 0.1; if (++life > lifeTime) remove(); - a = 2 - (life / static_cast(lifeTime)) * 2; + a = 2 - (life / (double) lifeTime) * 2; if (a > 1) a = 1; a = a * a; a *= 0.5; diff --git a/Minecraft.Client/HugeExplosionParticle.cpp b/Minecraft.Client/HugeExplosionParticle.cpp index 276b1d16..2a104c19 100644 --- a/Minecraft.Client/HugeExplosionParticle.cpp +++ b/Minecraft.Client/HugeExplosionParticle.cpp @@ -25,12 +25,12 @@ HugeExplosionParticle::HugeExplosionParticle(Textures *textures, Level *level, d gCol = g * br; bCol = b * br; - size = 1 - static_cast(xa) * 0.5f; + size = 1 - (float) xa * 0.5f; } void HugeExplosionParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - int tex = static_cast((life + a) * 15 / lifeTime); + int tex = (int) ((life + a) * 15 / lifeTime); if (tex > 15) return; textures->bindTexture(&EXPLOSION_LOCATION); @@ -41,9 +41,9 @@ void HugeExplosionParticle::render(Tesselator *t, float a, float xa, float ya, f float r = 2.0f * size; - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); // 4J - don't render explosion particles that are less than 3 metres away, to try and avoid large particles that are causing us problems with photosensitivity testing float distSq = (x*x + y*y + z*z); diff --git a/Minecraft.Client/HugeExplosionSeedParticle.cpp b/Minecraft.Client/HugeExplosionSeedParticle.cpp index bb8c8f22..7514cc44 100644 --- a/Minecraft.Client/HugeExplosionSeedParticle.cpp +++ b/Minecraft.Client/HugeExplosionSeedParticle.cpp @@ -24,9 +24,9 @@ void HugeExplosionSeedParticle::tick() double xx = x + (random->nextDouble() - random->nextDouble()) * 4; double yy = y + (random->nextDouble() - random->nextDouble()) * 4; double zz = z + (random->nextDouble() - random->nextDouble()) * 4; - level->addParticle(eParticleType_largeexplode, xx, yy, zz, life / static_cast(lifeTime), 0, 0); + level->addParticle(eParticleType_largeexplode, xx, yy, zz, life / (float) lifeTime, 0, 0); } - Minecraft::GetInstance()->animateTickLevel = nullptr; + Minecraft::GetInstance()->animateTickLevel = NULL; life++; if (life == lifeTime) remove(); } diff --git a/Minecraft.Client/HumanoidMobRenderer.cpp b/Minecraft.Client/HumanoidMobRenderer.cpp index 284b084d..5329f2d9 100644 --- a/Minecraft.Client/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/HumanoidMobRenderer.cpp @@ -17,8 +17,8 @@ void HumanoidMobRenderer::_init(HumanoidModel *humanoidModel, float scale) { this->humanoidModel = humanoidModel; this->_scale = scale; - armorParts1 = nullptr; - armorParts2 = nullptr; + armorParts1 = NULL; + armorParts2 = NULL; createArmorParts(); } @@ -76,9 +76,9 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in void HumanoidMobRenderer::prepareSecondPassArmor(shared_ptr mob, int layer, float a) { shared_ptr itemInstance = mob->getArmor(3 - layer); - if (itemInstance != nullptr) { + if (itemInstance != NULL) { Item *item = itemInstance->getItem(); - if (dynamic_cast(item) != nullptr) + if (dynamic_cast(item) != NULL) { bindTexture(getArmorLocation(dynamic_cast(item), layer, true)); @@ -99,10 +99,10 @@ int HumanoidMobRenderer::prepareArmor(shared_ptr _mob, int layer, shared_ptr mob = dynamic_pointer_cast(_mob); shared_ptr itemInstance = mob->getArmor(3 - layer); - if (itemInstance != nullptr) + if (itemInstance != NULL) { Item *item = itemInstance->getItem(); - if (dynamic_cast(item) != nullptr) + if (dynamic_cast(item) != NULL) { ArmorItem *armorItem = dynamic_cast(item); bindTexture(getArmorLocation(armorItem, layer)); @@ -126,9 +126,9 @@ int HumanoidMobRenderer::prepareArmor(shared_ptr _mob, int layer, if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) { int color = armorItem->getColor(itemInstance); - float red = static_cast((color >> 16) & 0xFF) / 0xFF; - float green = static_cast((color >> 8) & 0xFF) / 0xFF; - float blue = static_cast(color & 0xFF) / 0xFF; + float red = (float) ((color >> 16) & 0xFF) / 0xFF; + float green = (float) ((color >> 8) & 0xFF) / 0xFF; + float blue = (float) (color & 0xFF) / 0xFF; glColor3f(brightness * red, brightness * green, brightness * blue); if (itemInstance->isEnchanted()) return 0x1f; @@ -171,12 +171,12 @@ void HumanoidMobRenderer::render(shared_ptr _mob, double x, double y, do ResourceLocation *HumanoidMobRenderer::getTextureLocation(shared_ptr mob) { // TODO -- Figure out of we need some data in here - return nullptr; + return NULL; } void HumanoidMobRenderer::prepareCarriedItem(shared_ptr mob, shared_ptr item) { - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; + armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking(); } @@ -187,7 +187,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa shared_ptr item = mob->getCarriedItem(); shared_ptr headGear = mob->getArmor(3); - if (headGear != nullptr) + if (headGear != NULL) { // don't render the pumpkin of skulls for the skins with that disabled // 4J-PB - need to disable rendering armour/skulls/pumpkins for some special skins (Daleks) @@ -199,7 +199,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa if (headGear->getItem()->id < 256) { - if (Tile::tiles[headGear->id] != nullptr && TileRenderer::canRender(Tile::tiles[headGear->id]->getRenderShape())) + if (Tile::tiles[headGear->id] != NULL && TileRenderer::canRender(Tile::tiles[headGear->id]->getRenderShape())) { float s = 10 / 16.0f; glTranslatef(-0 / 16.0f, -4 / 16.0f, 0 / 16.0f); @@ -226,7 +226,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa } } - if (item != nullptr) + if (item != NULL) { glPushMatrix(); diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index c6c6b9f4..05d132fa 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -8,7 +8,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) { - ModelPart *pAttachTo=nullptr; + ModelPart *pAttachTo=NULL; switch(pBox->ePart) { @@ -37,17 +37,17 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) if(pNewBox) { - if((pNewBox->getfU()!=static_cast(pBox->fU)) || (pNewBox->getfV()!=static_cast(pBox->fV))) + if((pNewBox->getfU()!=(int)pBox->fU) || (pNewBox->getfV()!=(int)pBox->fV)) { app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Box geometry was found, but with different uvs\n"); - pNewBox=nullptr; + pNewBox=NULL; } } - if(pNewBox==nullptr) + if(pNewBox==NULL) { //app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Adding box to model part\n"); - pNewBox = new ModelPart(this, static_cast(pBox->fU), static_cast(pBox->fV)); + pNewBox = new ModelPart(this, (int)pBox->fU, (int)pBox->fV); pNewBox->visible=false; pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, 0); // 4J-PB - don't compile here, since the lighting isn't set up. It'll be compiled on first use. @@ -142,7 +142,7 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { - if(entity != nullptr) + if(entity != NULL) { m_uiAnimOverrideBitmask=entity->getAnimOverrideBitmask(); } diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index c9b04e78..1fd67683 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -84,7 +84,7 @@ void Input::tick(LocalPlayer *player) } // 4J: In flying mode, don't actually toggle sneaking (unless we're riding in which case we need to sneak to dismount) - if(!player->abilities.flying || player->riding != nullptr) + if(!player->abilities.flying || player->riding != NULL) { if((player->ullButtonsPressed&(1LL<localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE)) { @@ -137,9 +137,9 @@ void Input::tick(LocalPlayer *player) float ty = 0.0f; if( pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LOOK_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LOOK_RIGHT) ) - tx = InputManager.GetJoypadStick_RX(iPad)*(static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame))/100.0f); // apply sensitivity to look + tx = InputManager.GetJoypadStick_RX(iPad)*(((float)app.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 = InputManager.GetJoypadStick_RY(iPad)*(static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame))/100.0f); // apply sensitivity to look + ty = InputManager.GetJoypadStick_RY(iPad)*(((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame))/100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE if (app.GetFreezePlayers()) tx = ty = 0.0f; @@ -166,7 +166,7 @@ void Input::tick(LocalPlayer *player) #ifdef _WINDOWS64 if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { - float mouseSensitivity = static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; + float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f; float mouseLookScale = 5.0f; float mx = g_KBMInput.GetLookX(mouseSensitivity * mouseLookScale); float my = g_KBMInput.GetLookY(mouseSensitivity * mouseLookScale); diff --git a/Minecraft.Client/InventoryScreen.cpp b/Minecraft.Client/InventoryScreen.cpp index b6728533..726a5e8d 100644 --- a/Minecraft.Client/InventoryScreen.cpp +++ b/Minecraft.Client/InventoryScreen.cpp @@ -31,8 +31,8 @@ void InventoryScreen::renderLabels() void InventoryScreen::render(int xm, int ym, float a) { AbstractContainerScreen::render(xm, ym, a); - this->xMouse = static_cast(xm); - this->yMouse = static_cast(ym); + this->xMouse = (float)xm; + this->yMouse = (float)ym; } void InventoryScreen::renderBg(float a) diff --git a/Minecraft.Client/ItemFrameRenderer.cpp b/Minecraft.Client/ItemFrameRenderer.cpp index 55354aac..2d7493ec 100644 --- a/Minecraft.Client/ItemFrameRenderer.cpp +++ b/Minecraft.Client/ItemFrameRenderer.cpp @@ -33,15 +33,15 @@ void ItemFrameRenderer::render(shared_ptr _itemframe, double x, double shared_ptr itemFrame = dynamic_pointer_cast(_itemframe); glPushMatrix(); - float xOffs = static_cast(itemFrame->x - x) - 0.5f; - float yOffs = static_cast(itemFrame->y - y) - 0.5f; - float zOffs = static_cast(itemFrame->z - z) - 0.5f; + float xOffs = (float) (itemFrame->x - x) - 0.5f; + float yOffs = (float) (itemFrame->y - y) - 0.5f; + float zOffs = (float) (itemFrame->z - z) - 0.5f; int xt = itemFrame->xTile + Direction::STEP_X[itemFrame->dir]; int yt = itemFrame->yTile; int zt = itemFrame->zTile + Direction::STEP_Z[itemFrame->dir]; - glTranslatef(static_cast(xt) - xOffs, static_cast(yt) - yOffs, static_cast(zt) - zOffs); + glTranslatef((float) xt - xOffs, (float) yt - yOffs, (float) zt - zOffs); drawFrame(itemFrame); drawItem(itemFrame); @@ -110,9 +110,9 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) Minecraft *pMinecraft=Minecraft::GetInstance(); shared_ptr instance = entity->getItem(); - if (instance == nullptr) return; + if (instance == NULL) return; - shared_ptr itemEntity = std::make_shared(entity->level, 0, 0, 0, instance); + shared_ptr itemEntity = shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); itemEntity->getItem()->count = 1; itemEntity->bobOffs = 0; @@ -154,7 +154,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) t->end(); shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); - if (data != nullptr) + if (data != NULL) { entityRenderDispatcher->itemInHandRenderer->minimap->render(nullptr, entityRenderDispatcher->textures, data, entity->entityId); } @@ -168,7 +168,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) double compassRotA = ct->rota; ct->rot = 0; ct->rota = 0; - ct->updateFromPosition(entity->level, entity->x, entity->z, Mth::wrapDegrees( static_cast(180 + entity->dir * 90) ), false, true); + ct->updateFromPosition(entity->level, entity->x, entity->z, Mth::wrapDegrees( (float)(180 + entity->dir * 90) ), false, true); ct->rot = compassRot; ct->rota = compassRotA; } diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index 4cebda2f..78253705 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -226,7 +226,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrid]->getColor(item,0); float red = ((col >> 16) & 0xff) / 255.0f; @@ -238,7 +238,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrid]; - if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr && TileRenderer::canRender(tile->getRenderShape())) + if (item->getIconType() == Icon::TYPE_TERRAIN && tile != NULL && TileRenderer::canRender(tile->getRenderShape())) { MemSect(31); minecraft->textures->bindTexture(minecraft->textures->getTextureLocation(Icon::TYPE_TERRAIN)); @@ -249,7 +249,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrgetItemInHandIcon(item, layer); - if (icon == nullptr) + if (icon == NULL) { glPopMatrix(); MemSect(0); @@ -299,7 +299,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrgetSourceWidth(), icon->getSourceHeight(), 1 / 16.0f, false, bIsTerrain); - if (item != nullptr && item->isFoil() && layer == 0) + if (item != NULL && item->isFoil() && layer == 0) { glDepthFunc(GL_EQUAL); glDisable(GL_LIGHTING); @@ -425,7 +425,7 @@ void ItemInHandRenderer::render(float a) glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); glColor4f(1, 1, 1, 1); } - if (item != nullptr) + if (item != NULL) { int col = Item::items[item->id]->getColor(item,0); float red = ((col >> 16) & 0xff) / 255.0f; @@ -439,7 +439,7 @@ void ItemInHandRenderer::render(float a) glColor4f(br, br, br, 1); } - if (item != nullptr && item->id == Item::map->id) + if (item != NULL && item->id == Item::map->id) { glPushMatrix(); float d = 0.8f; @@ -481,13 +481,13 @@ void ItemInHandRenderer::render(float a) glPushMatrix(); glTranslatef(-0.0f, -0.6f, 1.1f * flip); - glRotatef(static_cast(-45 * flip), 1, 0, 0); + glRotatef((float)(-45 * flip), 1, 0, 0); glRotatef(-90, 0, 0, 1); glRotatef(59, 0, 0, 1); - glRotatef(static_cast(-65 * flip), 0, 1, 0); + glRotatef((float)(-65 * flip), 0, 1, 0); EntityRenderer *er = EntityRenderDispatcher::instance->getRenderer(minecraft->player); - PlayerRenderer *playerRenderer = static_cast(er); + PlayerRenderer *playerRenderer = (PlayerRenderer *) er; float ss = 1; glScalef(ss, ss, ss); @@ -530,20 +530,20 @@ void ItemInHandRenderer::render(float a) t->begin(); int vo = 7; t->normal(0,0,-1); - t->vertexUV(static_cast(0 - vo), static_cast(128 + vo), static_cast(0), static_cast(0), static_cast(1)); - t->vertexUV(static_cast(128 + vo), static_cast(128 + vo), static_cast(0), static_cast(1), static_cast(1)); - t->vertexUV(static_cast(128 + vo), static_cast(0 - vo), static_cast(0), static_cast(1), static_cast(0)); - t->vertexUV(static_cast(0 - vo), static_cast(0 - vo), static_cast(0), static_cast(0), static_cast(0)); + t->vertexUV((float)(0 - vo), (float)( 128 + vo), (float)( 0), (float)( 0), (float)( 1)); + t->vertexUV((float)(128 + vo), (float)( 128 + vo), (float)( 0), (float)( 1), (float)( 1)); + t->vertexUV((float)(128 + vo), (float)( 0 - vo), (float)( 0), (float)( 1), (float)( 0)); + t->vertexUV((float)(0 - vo), (float)( 0 - vo), (float)( 0), (float)( 0), (float)( 0)); t->end(); shared_ptr data = Item::map->getSavedData(item, minecraft->level); PIXBeginNamedEvent(0,"Minimap render"); - if(data != nullptr) minimap->render(minecraft->player, minecraft->textures, data, minecraft->player->entityId); + if(data != NULL) minimap->render(minecraft->player, minecraft->textures, data, minecraft->player->entityId); PIXEndNamedEvent(); glPopMatrix(); } - else if (item != nullptr) + else if (item != NULL) { glPushMatrix(); float d = 0.8f; @@ -617,7 +617,7 @@ void ItemInHandRenderer::render(float a) glRotatef(-8, 1, 0, 0); glTranslatef(-0.9f, 0.2f, 0.0f); float timeHeld = (item->getUseDuration() - (player->getUseItemDuration() - a + 1)); - float pow = timeHeld / static_cast(BowItem::MAX_DRAW_DURATION); + float pow = timeHeld / (float) (BowItem::MAX_DRAW_DURATION); pow = ((pow * pow) + pow * 2) / 3; if (pow > 1) pow = 1; if (pow > 0.1f) @@ -706,7 +706,7 @@ void ItemInHandRenderer::render(float a) glTranslatef(5.6f, 0, 0); EntityRenderer *er = EntityRenderDispatcher::instance->getRenderer(minecraft->player); - PlayerRenderer *playerRenderer = static_cast(er); + PlayerRenderer *playerRenderer = (PlayerRenderer *) er; float ss = 1; glScalef(ss, ss, ss); MemSect(31); @@ -762,7 +762,7 @@ void ItemInHandRenderer::renderScreenEffect(float a) } } - if (Tile::tiles[tile] != nullptr) renderTex(a, Tile::tiles[tile]->getTexture(2)); + if (Tile::tiles[tile] != NULL) renderTex(a, Tile::tiles[tile]->getTexture(2)); } if (minecraft->player->isUnderLiquid(Material::water)) @@ -905,11 +905,11 @@ void ItemInHandRenderer::tick() shared_ptr nextTile = player->inventory->getSelected(); bool matches = lastSlot == player->inventory->selected && nextTile == selectedItem; - if (selectedItem == nullptr && nextTile == nullptr) + if (selectedItem == NULL && nextTile == NULL) { matches = true; } - if (nextTile != nullptr && selectedItem != nullptr && nextTile != selectedItem && nextTile->id == selectedItem->id && nextTile->getAuxValue() == selectedItem->getAuxValue()) + if (nextTile != NULL && selectedItem != NULL && nextTile != selectedItem && nextTile->id == selectedItem->id && nextTile->getAuxValue() == selectedItem->getAuxValue()) { selectedItem = nextTile; matches = true; diff --git a/Minecraft.Client/ItemRenderer.cpp b/Minecraft.Client/ItemRenderer.cpp index a7a3a1bf..6fb7e633 100644 --- a/Minecraft.Client/ItemRenderer.cpp +++ b/Minecraft.Client/ItemRenderer.cpp @@ -65,7 +65,7 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do random->setSeed(187); shared_ptr item = itemEntity->getItem(); - if (item->getItem() == nullptr) return; + if (item->getItem() == NULL) return; glPushMatrix(); float bob = Mth::sin((itemEntity->age + a) / 10.0f + itemEntity->bobOffs) * 0.1f + 0.1f; @@ -77,12 +77,12 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do if (itemEntity->getItem()->count > 20) count = 4; if (itemEntity->getItem()->count > 40) count = 5; - glTranslatef(static_cast(x), static_cast(y) + bob, static_cast(z)); + glTranslatef((float) x, (float) y + bob, (float) z); glEnable(GL_RESCALE_NORMAL); Tile *tile = Tile::tiles[item->id]; - if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr && TileRenderer::canRender(tile->getRenderShape())) + if (item->getIconType() == Icon::TYPE_TERRAIN && tile != NULL && TileRenderer::canRender(tile->getRenderShape())) { glRotatef(spin, 0, 1, 0); @@ -200,7 +200,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon { Tesselator *t = Tesselator::getInstance(); - if (icon == nullptr) icon = entityRenderDispatcher->textures->getMissingIcon(entity->getItem()->getIconType()); + if (icon == NULL) icon = entityRenderDispatcher->textures->getMissingIcon(entity->getItem()->getIconType()); float u0 = icon->getU0(); float u1 = icon->getU1(); float v0 = icon->getV0(); @@ -264,7 +264,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon glTranslatef(0, 0, width + margin); bool bIsTerrain = false; - if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != nullptr) + if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != NULL) { bIsTerrain = true; bindTexture(&TextureAtlas::LOCATION_BLOCKS); // TODO: Do this sanely by Icon @@ -279,7 +279,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon //ItemInHandRenderer::renderItem3D(t, u1, v0, u0, v1, icon->getSourceWidth(), icon->getSourceHeight(), width, false); ItemInHandRenderer::renderItem3D(t, u0, v0, u1, v1, icon->getSourceWidth(), icon->getSourceHeight(), width, false, bIsTerrain); - if (item != nullptr && item->isFoil()) + if (item != NULL && item->isFoil()) { glDepthFunc(GL_EQUAL); glDisable(GL_LIGHTING); @@ -332,10 +332,10 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon glColor4f(red, green, blue, 1); t->begin(); t->normal(0, 1, 0); - t->vertexUV((float)(0 - xo), (float)( 0 - yo), static_cast(0), (float)( u0), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 0 - yo), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 1 - yo), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV((float)(0 - xo), (float)( 1 - yo), static_cast(0), (float)( u0), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 1 - yo), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 1 - yo), (float)( 0), (float)( u0), (float)( v0)); t->end(); glPopMatrix(); @@ -416,7 +416,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr(x), static_cast(y), fillingIcon, 16, 16); + blit((int)x, (int)y, fillingIcon, 16, 16); } } glEnable(GL_LIGHTING); @@ -443,7 +443,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptrgetMissingIcon(item->getIconType()); } @@ -462,7 +462,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr(x), static_cast(y), itemIcon, 16, 16); + blit((int)x, (int)y, itemIcon, 16, 16); } glEnable(GL_LIGHTING); PIXEndNamedEvent(); @@ -475,13 +475,13 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y) { - renderGuiItem(font, textures, item, static_cast(x), static_cast(y), 1.0f, 1.0f ); + renderGuiItem(font, textures, item, (float)x, (float)y, 1.0f, 1.0f ); } // 4J - this used to take x and y as ints, and no scale, alpha or foil - but this interface is now implemented as a wrapper round this more fully featured one void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) { - if(item==nullptr) return; + if(item==NULL) return; renderAndDecorateItem(font, textures, item, x, y,fScale, fScale, fAlpha, isFoil, true); } @@ -489,7 +489,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s // (ie from the gui rather than xui). In this case we dno't want to enable/disable blending, and do need to restore the blend state when we are done. void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled) { - if (item == nullptr) + if (item == NULL) { return; } @@ -535,7 +535,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s // 4J - original interface, now just a wrapper for preceding overload void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, int x, int y) { - renderAndDecorateItem( font, textures, item, static_cast(x), static_cast(y), 1.0f, 1.0f, item->isFoil() ); + renderAndDecorateItem( font, textures, item, (float)x, (float)y, 1.0f, 1.0f, item->isFoil() ); } // 4J - a few changes here to get x, y, w, h in as floats (for xui rendering accuracy), and to align @@ -546,8 +546,8 @@ void ItemRenderer::blitGlint(int id, float x, float y, float w, float h) float vs = 1.0f / 64.0f / 4; // 4J - calculate what the pixel coordinates will be in final screen coordinates - float sfx = static_cast(Minecraft::GetInstance()->width) / static_cast(Minecraft::GetInstance()->width_phys); - float sfy = static_cast(Minecraft::GetInstance()->height) / static_cast(Minecraft::GetInstance()->height_phys); + float sfx = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; + float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; float xx0 = x * sfx; float xx1 = ( x + w ) * sfx; float yy0 = y * sfy; @@ -593,7 +593,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha) { - if (item == nullptr) + if (item == NULL) { return; } @@ -617,15 +617,15 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar MemSect(0); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - font->drawShadow(amount, x + 19 - 2 - font->width(amount), y + 6 + 3, 0xffffff |(static_cast(fAlpha * 0xff)<<24)); + font->drawShadow(amount, x + 19 - 2 - font->width(amount), y + 6 + 3, 0xffffff |(((unsigned int)(fAlpha * 0xff))<<24)); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); } if (item->isDamaged()) { - int p = static_cast(Math::round(13.0 - (double)item->getDamageValue() * 13.0 / (double)item->getMaxDamage())); - int cc = static_cast(Math::round(255.0 - (double)item->getDamageValue() * 255.0 / (double)item->getMaxDamage())); + int p = (int) Math::round(13.0 - (double) item->getDamageValue() * 13.0 / (double) item->getMaxDamage()); + int cc = (int) Math::round(255.0 - (double) item->getDamageValue() * 255.0 / (double) item->getMaxDamage()); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); @@ -676,10 +676,10 @@ void ItemRenderer::fillRect(Tesselator *t, int x, int y, int w, int h, int c) { t->begin(); t->color(c); - t->vertex(static_cast(x + 0), static_cast(y + 0), static_cast(0)); - t->vertex(static_cast(x + 0), static_cast(y + h), static_cast(0)); - t->vertex(static_cast(x + w), static_cast(y + h), static_cast(0)); - t->vertex(static_cast(x + w), static_cast(y + 0), static_cast(0)); + t->vertex((float)(x + 0), (float)( y + 0), (float)( 0)); + t->vertex((float)(x + 0), (float)( y + h), (float)( 0)); + t->vertex((float)(x + w), (float)( y + h), (float)( 0)); + t->vertex((float)(x + w), (float)( y + 0), (float)( 0)); t->end(); } @@ -693,8 +693,8 @@ void ItemRenderer::blit(float x, float y, int sx, int sy, float w, float h) t->begin(); // 4J - calculate what the pixel coordinates will be in final screen coordinates - float sfx = static_cast(Minecraft::GetInstance()->width) / static_cast(Minecraft::GetInstance()->width_phys); - float sfy = static_cast(Minecraft::GetInstance()->height) / static_cast(Minecraft::GetInstance()->height_phys); + float sfx = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; + float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; float xx0 = x * sfx; float xx1 = ( x + w ) * sfx; float yy0 = y * sfy; @@ -716,7 +716,7 @@ void ItemRenderer::blit(float x, float y, int sx, int sy, float w, float h) float yy1f = yy1 / sfy; // 4J - subtracting 0.5f (actual screen pixels, so need to compensate for physical & game width) from each x & y coordinate to compensate for centre of pixels in directx vs openGL - float f = ( 0.5f * static_cast(Minecraft::GetInstance()->width) ) / static_cast(Minecraft::GetInstance()->width_phys); + float f = ( 0.5f * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys; t->vertexUV(xx0f, yy1f, (float)( blitOffset), (float)( (sx + 0) * us), (float)( (sy + 16) * vs)); t->vertexUV(xx1f, yy1f, (float)( blitOffset), (float)( (sx + 16) * us), (float)( (sy + 16) * vs)); @@ -731,8 +731,8 @@ void ItemRenderer::blit(float x, float y, Icon *tex, float w, float h) t->begin(); // 4J - calculate what the pixel coordinates will be in final screen coordinates - float sfx = static_cast(Minecraft::GetInstance()->width) / static_cast(Minecraft::GetInstance()->width_phys); - float sfy = static_cast(Minecraft::GetInstance()->height) / static_cast(Minecraft::GetInstance()->height_phys); + float sfx = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; + float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; float xx0 = x * sfx; float xx1 = ( x + w ) * sfx; float yy0 = y * sfy; @@ -754,7 +754,7 @@ void ItemRenderer::blit(float x, float y, Icon *tex, float w, float h) float yy1f = yy1 / sfy; // 4J - subtracting 0.5f (actual screen pixels, so need to compensate for physical & game width) from each x & y coordinate to compensate for centre of pixels in directx vs openGL - float f = ( 0.5f * static_cast(Minecraft::GetInstance()->width) ) / static_cast(Minecraft::GetInstance()->width_phys); + float f = ( 0.5f * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys; t->vertexUV(xx0f, yy1f, blitOffset, tex->getU0(true), tex->getV1(true)); t->vertexUV(xx1f, yy1f, blitOffset, tex->getU1(true), tex->getV1(true)); diff --git a/Minecraft.Client/ItemSpriteRenderer.cpp b/Minecraft.Client/ItemSpriteRenderer.cpp index afe8023e..5f1c7089 100644 --- a/Minecraft.Client/ItemSpriteRenderer.cpp +++ b/Minecraft.Client/ItemSpriteRenderer.cpp @@ -22,14 +22,14 @@ void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double { // the icon is already cached in the item object, so there should not be any performance impact by not caching it here Icon *icon = sourceItem->getIcon(sourceItemAuxValue); - if (icon == nullptr) + if (icon == NULL) { return; } glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); glEnable(GL_RESCALE_NORMAL); glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f); bindTexture(e); @@ -72,10 +72,10 @@ void ItemSpriteRenderer::renderIcon(Tesselator *t, Icon *icon) glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0); t->begin(); t->normal(0, 1, 0); - t->vertexUV((float)(0 - xo), (float)( 0 - yo), static_cast(0), (float)( u0), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( 0 - yo), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV((float)(r - xo), (float)( r - yo), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV((float)(0 - xo), (float)( r - yo), static_cast(0), (float)( u0), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(r - xo), (float)( r - yo), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(0 - xo), (float)( r - yo), (float)( 0), (float)( u0), (float)( v0)); t->end(); } diff --git a/Minecraft.Client/JoinMultiplayerScreen.cpp b/Minecraft.Client/JoinMultiplayerScreen.cpp index f8e13fbb..a98e7bee 100644 --- a/Minecraft.Client/JoinMultiplayerScreen.cpp +++ b/Minecraft.Client/JoinMultiplayerScreen.cpp @@ -7,7 +7,7 @@ JoinMultiplayerScreen::JoinMultiplayerScreen(Screen *lastScreen) { - ipEdit = nullptr; + ipEdit = NULL; this->lastScreen = lastScreen; } @@ -55,7 +55,7 @@ void JoinMultiplayerScreen::buttonClicked(Button *button) vector parts = stringSplit(ip,L'L'); if (ip[0]==L'[') { - size_t pos = ip.find(L"]"); + int pos = (int)ip.find(L"]"); if (pos != wstring::npos) { wstring path = ip.substr(1, pos); diff --git a/Minecraft.Client/LavaParticle.cpp b/Minecraft.Client/LavaParticle.cpp index 0ff9b1b0..ac0608e5 100644 --- a/Minecraft.Client/LavaParticle.cpp +++ b/Minecraft.Client/LavaParticle.cpp @@ -15,7 +15,7 @@ LavaParticle::LavaParticle(Level *level, double x, double y, double z) : Particl size *= (random->nextFloat() * 2 + 0.2f); oSize = size; - lifetime = static_cast(16 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (16 / (Math::random() * 0.8 + 0.2)); noPhysics = false; setMiscTex(49); } @@ -40,7 +40,7 @@ float LavaParticle::getBrightness(float a) void LavaParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / static_cast(lifetime); + float s = (age + a) / (float) lifetime; size = oSize * (1 - s*s); Particle::render(t, a, xa, ya, za, xa2, za2); } @@ -52,7 +52,7 @@ void LavaParticle::tick() zo = z; if (age++ >= lifetime) remove(); - float odds = age / static_cast(lifetime); + float odds = age / (float) lifetime; if (random->nextFloat() > odds) level->addParticle(eParticleType_smoke, x, y, z, xd, yd, zd); yd -= 0.03; diff --git a/Minecraft.Client/LavaSlimeModel.cpp b/Minecraft.Client/LavaSlimeModel.cpp index 0f9d6a43..052850f8 100644 --- a/Minecraft.Client/LavaSlimeModel.cpp +++ b/Minecraft.Client/LavaSlimeModel.cpp @@ -22,7 +22,7 @@ LavaSlimeModel::LavaSlimeModel() v = 19; } bodyCubes[i] = new ModelPart(this, u, v); - bodyCubes[i]->addBox(-4.0f, 16.0f + static_cast(i), -4.0f, 8, 1, 8); + bodyCubes[i]->addBox(-4.0f, 16.0f + (float)i, -4.0f, 8, 1, 8); } insideCube = new ModelPart(this, 0, 16); diff --git a/Minecraft.Client/LavaSlimeRenderer.cpp b/Minecraft.Client/LavaSlimeRenderer.cpp index 3d5858ea..e828a353 100644 --- a/Minecraft.Client/LavaSlimeRenderer.cpp +++ b/Minecraft.Client/LavaSlimeRenderer.cpp @@ -7,7 +7,7 @@ ResourceLocation LavaSlimeRenderer::MAGMACUBE_LOCATION = ResourceLocation(TN_MOB LavaSlimeRenderer::LavaSlimeRenderer() : MobRenderer(new LavaSlimeModel(), .25f) { - this->modelVersion = static_cast(model)->getModelVersion(); + this->modelVersion = ((LavaSlimeModel *) model)->getModelVersion(); } ResourceLocation *LavaSlimeRenderer::getTextureLocation(shared_ptr mob) diff --git a/Minecraft.Client/LeashKnotRenderer.cpp b/Minecraft.Client/LeashKnotRenderer.cpp index 3c58ce52..b210379f 100644 --- a/Minecraft.Client/LeashKnotRenderer.cpp +++ b/Minecraft.Client/LeashKnotRenderer.cpp @@ -19,7 +19,7 @@ void LeashKnotRenderer::render(shared_ptr entity, double x, double y, do glPushMatrix(); glDisable(GL_CULL_FACE); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); float scale = 1 / 16.0f; glEnable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 8d61e1b2..c1b4850c 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -112,12 +112,12 @@ const int LevelRenderer::DIMENSION_OFFSETS[3] = { 0, (80 * 80 * CHUNK_Y_COUNT) , LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) { - breakingTextures = nullptr; + breakingTextures = NULL; for( int i = 0; i < 4; i++ ) { - level[i] = nullptr; - tileRenderer[i] = nullptr; + level[i] = NULL; + tileRenderer[i] = NULL; xOld[i] = -9999; yOld[i] = -9999; zOld[i] = -9999; @@ -143,7 +143,7 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) totalChunks= offscreenChunks= occludedChunks= renderedChunks= emptyChunks = 0; for( int i = 0; i < 4; i++ ) { - // sortedChunks[i] = nullptr; // 4J - removed - not sorting our chunks anymore + // sortedChunks[i] = NULL; // 4J - removed - not sorting our chunks anymore chunks[i] = ClipChunkArray(); lastPlayerCount[i] = 0; } @@ -185,16 +185,16 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) float yy; int s = 64; int d = 256 / s + 2; - yy = static_cast(16); + yy = (float) 16; for (int xx = -s * d; xx <= s * d; xx += s) { for (int zz = -s * d; zz <= s * d; zz += s) { t->begin(); - t->vertex(static_cast(xx + 0), (float)( yy), static_cast(zz + 0)); - t->vertex(static_cast(xx + s), (float)( yy), static_cast(zz + 0)); - t->vertex(static_cast(xx + s), (float)( yy), static_cast(zz + s)); - t->vertex(static_cast(xx + 0), (float)( yy), static_cast(zz + s)); + t->vertex((float)(xx + 0), (float)( yy), (float)( zz + 0)); + t->vertex((float)(xx + s), (float)( yy), (float)( zz + 0)); + t->vertex((float)(xx + s), (float)( yy), (float)( zz + s)); + t->vertex((float)(xx + 0), (float)( yy), (float)( zz + s)); t->end(); } } @@ -202,16 +202,16 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) darkList = starList + 2; glNewList(darkList, GL_COMPILE); - yy = -static_cast(16); + yy = -(float) 16; t->begin(); for (int xx = -s * d; xx <= s * d; xx += s) { for (int zz = -s * d; zz <= s * d; zz += s) { - t->vertex(static_cast(xx + s), (float)( yy), static_cast(zz + 0)); - t->vertex(static_cast(xx + 0), (float)( yy), static_cast(zz + 0)); - t->vertex(static_cast(xx + 0), (float)( yy), static_cast(zz + s)); - t->vertex(static_cast(xx + s), (float)( yy), static_cast(zz + s)); + t->vertex((float)(xx + s), (float)( yy), (float)( zz + 0)); + t->vertex((float)(xx + 0), (float)( yy), (float)( zz + 0)); + t->vertex((float)(xx + 0), (float)( yy), (float)( zz + s)); + t->vertex((float)(xx + s), (float)( yy), (float)( zz + s)); } } t->end(); @@ -313,7 +313,7 @@ void LevelRenderer::renderStars() double yo = _yo; double zo = _zo * ySin + _xo * yCos; - t->vertex(static_cast(xp + xo), static_cast(yp + yo), static_cast(zp + zo)); + t->vertex((float)(xp + xo), (float)( yp + yo), (float)( zp + zo)); } } } @@ -324,7 +324,7 @@ void LevelRenderer::renderStars() void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) { - if (this->level[playerIndex] != nullptr) + if (this->level[playerIndex] != NULL) { // Remove listener for this level if this is the last player referencing it Level *prevLevel = this->level[playerIndex]; @@ -344,12 +344,12 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) zOld[playerIndex] = -9999; this->level[playerIndex] = level; - if( tileRenderer[playerIndex] != nullptr ) + if( tileRenderer[playerIndex] != NULL ) { delete tileRenderer[playerIndex]; } tileRenderer[playerIndex] = new TileRenderer(level); - if (level != nullptr) + if (level != NULL) { // If we're the only player referencing this level, add a new listener for it int refCount = 0; @@ -367,7 +367,7 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) else { // printf("NULLing player %d, chunks @ 0x%x\n",playerIndex,chunks[playerIndex]); - if( chunks[playerIndex].data != nullptr ) + if( chunks[playerIndex].data != NULL ) { for (unsigned int i = 0; i < chunks[playerIndex].length; i++) { @@ -375,21 +375,21 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) delete chunks[playerIndex][i].chunk; } delete chunks[playerIndex].data; - chunks[playerIndex].data = nullptr; + chunks[playerIndex].data = NULL; chunks[playerIndex].length = 0; // delete sortedChunks[playerIndex]; // 4J - removed - not sorting our chunks anymore - // sortedChunks[playerIndex] = nullptr; // 4J - removed - not sorting our chunks anymore + // sortedChunks[playerIndex] = NULL; // 4J - removed - not sorting our chunks anymore } // 4J Stu - If we do this for splitscreen players leaving, then all the tile entities in the world dissappear - // We should only do this when actually exiting the game, so only when the primary player sets there level to nullptr + // We should only do this when actually exiting the game, so only when the primary player sets there level to NULL if(playerIndex == ProfileManager.GetPrimaryPad()) renderableTileEntities.clear(); } } void LevelRenderer::AddDLCSkinsToMemTextures() { - for(size_t i=0;iaddMemTexture(app.vSkinNames[i], new MobSkinMemTextureProcessor()); } @@ -417,7 +417,7 @@ void LevelRenderer::allChanged(int playerIndex) // If this CS is entered before DisableUpdateThread is called then (on 360 at least) we can get a // deadlock when starting a game in splitscreen. //EnterCriticalSection(&m_csDirtyChunks); - if( level == nullptr ) + if( level == NULL ) { return; } @@ -431,7 +431,7 @@ void LevelRenderer::allChanged(int playerIndex) int realrenderArea = (realviewDistance * realviewDistance * 4); // Calculate size of area we can render based on number of players we need to render for - int dist = static_cast(sqrtf(static_cast(realrenderArea) / static_cast(activePlayers()))); + int dist = (int)sqrtf( (float)realrenderArea / (float)activePlayers() ); // AP - poor little Vita just can't cope with such a big area #ifdef __PSVITA__ @@ -444,7 +444,7 @@ void LevelRenderer::allChanged(int playerIndex) yChunks = Level::maxBuildHeight / CHUNK_SIZE; zChunks = dist; - if( chunks[playerIndex].data != nullptr ) + if( chunks[playerIndex].data != NULL ) { for (unsigned int i = 0; i < chunks[playerIndex].length; i++) { @@ -467,7 +467,7 @@ void LevelRenderer::allChanged(int playerIndex) yMaxChunk = yChunks; zMaxChunk = zChunks; - // 4J removed - we now only fully clear this on exiting the game (setting level to nullptr). Apart from that, the chunk rebuilding is responsible for maintaining this + // 4J removed - we now only fully clear this on exiting the game (setting level to NULL). Apart from that, the chunk rebuilding is responsible for maintaining this // renderableTileEntities.clear(); for (int x = 0; x < xChunks; x++) @@ -487,10 +487,10 @@ void LevelRenderer::allChanged(int playerIndex) } nonStackDirtyChunksAdded(); - if (level != nullptr) + if (level != NULL) { shared_ptr player = mc->cameraTargetPlayer; - if (player != nullptr) + if (player != NULL) { this->resortChunks(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); // sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), DistanceChunkSorter(player)); // 4J - removed - not sorting our chunks anymore @@ -535,7 +535,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2 vector > entities = level[playerIndex]->getAllEntities(); - totalEntities = static_cast(entities.size()); + totalEntities = (int)entities.size(); for (auto& entity : level[playerIndex]->globalEntities) { @@ -551,7 +551,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) if ( !shouldRender && entity->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(entity); - if ( mob->isLeashed() && (mob->getLeashHolder() != nullptr) ) + if ( mob->isLeashed() && (mob->getLeashHolder() != NULL) ) { shared_ptr leashHolder = mob->getLeashHolder(); shouldRender = culler->isVisible(leashHolder->bb); @@ -733,7 +733,7 @@ int LevelRenderer::render(shared_ptr player, int layer, double alp } Lighting::turnOff(); - int count = renderChunks(0, static_cast(chunks[playerIndex].length), layer, alpha); + int count = renderChunks(0, (int)chunks[playerIndex].length, layer, alpha); return count; @@ -769,7 +769,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) double zOff = player->zOld + (player->z - player->zOld) * alpha; glPushMatrix(); - glTranslatef(static_cast(-xOff), static_cast(-yOff), static_cast(-zOff)); + glTranslatef((float)-xOff, (float)-yOff, (float)-zOff); #ifdef __PSVITA__ // AP - also set the camera position so we can work out if a chunk is fogged or not @@ -994,9 +994,9 @@ void LevelRenderer::renderSky(float alpha) int playerIndex = mc->player->GetXboxPad(); Vec3 *sc = level[playerIndex]->getSkyColor(mc->cameraTargetPlayer, alpha); - float sr = static_cast(sc->x); - float sg = static_cast(sc->y); - float sb = static_cast(sc->z); + float sr = (float) sc->x; + float sg = (float) sc->y; + float sb = (float) sc->z; if (mc->options->anaglyph3d) { @@ -1031,7 +1031,7 @@ void LevelRenderer::renderSky(float alpha) Lighting::turnOff(); float *c = level[playerIndex]->dimension->getSunriseColor(level[playerIndex]->getTimeOfDay(alpha), alpha); - if (c != nullptr) + if (c != NULL) { glDisable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); @@ -1059,7 +1059,7 @@ void LevelRenderer::renderSky(float alpha) t->begin(GL_TRIANGLE_FAN); t->color(r, g, b, c[3]); - t->vertex(static_cast(0), static_cast(100), static_cast(0)); + t->vertex((float)(0), (float)( 100), (float)( 0)); int steps = 16; t->color(c[0], c[1], c[2], 0.0f); for (int i = 0; i <= steps; i++) @@ -1093,10 +1093,10 @@ void LevelRenderer::renderSky(float alpha) textures->bindTexture(&SUN_LOCATION); MemSect(0); t->begin(); - t->vertexUV((float)(-ss), static_cast(100), (float)( -ss), static_cast(0), static_cast(0)); - t->vertexUV((float)(+ss), static_cast(100), (float)( -ss), static_cast(1), static_cast(0)); - t->vertexUV((float)(+ss), static_cast(100), (float)( +ss), static_cast(1), static_cast(1)); - t->vertexUV((float)(-ss), static_cast(100), (float)( +ss), static_cast(0), static_cast(1)); + t->vertexUV((float)(-ss), (float)( 100), (float)( -ss), (float)( 0), (float)( 0)); + t->vertexUV((float)(+ss), (float)( 100), (float)( -ss), (float)( 1), (float)( 0)); + t->vertexUV((float)(+ss), (float)( 100), (float)( +ss), (float)( 1), (float)( 1)); + t->vertexUV((float)(-ss), (float)( 100), (float)( +ss), (float)( 0), (float)( 1)); t->end(); ss = 20; @@ -1141,7 +1141,7 @@ void LevelRenderer::renderSky(float alpha) if (yy < 0) { glPushMatrix(); - glTranslatef(0, -static_cast(-12), 0); + glTranslatef(0, -(float) (-12), 0); glCallList(darkList); glPopMatrix(); @@ -1192,7 +1192,7 @@ void LevelRenderer::renderSky(float alpha) glColor3f(sr, sg, sb); } glPushMatrix(); - glTranslatef(0, -static_cast(yy - 16), 0); + glTranslatef(0, -(float) (yy - 16), 0); glCallList(darkList); glPopMatrix(); glEnable(GL_TEXTURE_2D); @@ -1213,9 +1213,9 @@ void LevelRenderer::renderHaloRing(float alpha) int playerIndex = mc->player->GetXboxPad(); Vec3 *sc = level[playerIndex]->getSkyColor(mc->cameraTargetPlayer, alpha); - float sr = static_cast(sc->x); - float sg = static_cast(sc->y); - float sb = static_cast(sc->z); + float sr = (float) sc->x; + float sg = (float) sc->y; + float sb = (float) sc->z; // Rough lumninance calculation float Y = (sr+sr+sb+sg+sg+sg)/6; @@ -1278,7 +1278,7 @@ void LevelRenderer::renderClouds(float alpha) } } glDisable(GL_CULL_FACE); - float yOffs = static_cast(mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); + float yOffs = (float) (mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); int s = 32; int d = 256 / s; Tesselator *t = Tesselator::getInstance(); @@ -1288,9 +1288,9 @@ void LevelRenderer::renderClouds(float alpha) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Vec3 *cc = level[playerIndex]->getCloudColor(alpha); - float cr = static_cast(cc->x); - float cg = static_cast(cc->y); - float cb = static_cast(cc->z); + float cr = (float) cc->x; + float cg = (float) cc->y; + float cb = (float) cc->z; if (mc->options->anaglyph3d) { @@ -1316,8 +1316,8 @@ void LevelRenderer::renderClouds(float alpha) zo -= zOffs * 2048; float yy = (float) (level[playerIndex]->dimension->getCloudHeight() - yOffs + 0.33f); - float uo = static_cast(xo * scale); - float vo = static_cast(zo * scale); + float uo = (float) (xo * scale); + float vo = (float) (zo * scale); t->begin(); t->color(cr, cg, cb, 0.8f); @@ -1325,10 +1325,10 @@ void LevelRenderer::renderClouds(float alpha) { for (int zz = -s * d; zz < +s * d; zz += s) { - t->vertexUV(static_cast(xx + 0), (float)( yy), static_cast(zz + s), (float)( (xx + 0) * scale + uo), (float)( (zz + s) * scale + vo)); - t->vertexUV(static_cast(xx + s), (float)( yy), static_cast(zz + s), (float)( (xx + s) * scale + uo), (float)( (zz + s) * scale + vo)); - t->vertexUV(static_cast(xx + s), (float)( yy), static_cast(zz + 0), (float)( (xx + s) * scale + uo), (float)( (zz + 0) * scale + vo)); - t->vertexUV(static_cast(xx + 0), (float)( yy), static_cast(zz + 0), (float)( (xx + 0) * scale + uo), (float)( (zz + 0) * scale + vo)); + t->vertexUV((float)(xx + 0), (float)( yy), (float)( zz + s), (float)( (xx + 0) * scale + uo), (float)( (zz + s) * scale + vo)); + t->vertexUV((float)(xx + s), (float)( yy), (float)( zz + s), (float)( (xx + s) * scale + uo), (float)( (zz + s) * scale + vo)); + t->vertexUV((float)(xx + s), (float)( yy), (float)( zz + 0), (float)( (xx + s) * scale + uo), (float)( (zz + 0) * scale + vo)); + t->vertexUV((float)(xx + 0), (float)( yy), (float)( zz + 0), (float)( (xx + 0) * scale + uo), (float)( (zz + 0) * scale + vo)); } } t->end(); @@ -1375,13 +1375,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(0.7f, 0.7f, 0.7f, 0.8f); t->normal(0, -1, 0); @@ -1400,13 +1400,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(1.0f, 1.0f, 1.0f, 0.8f); t->normal(0, 1, 0); @@ -1425,13 +1425,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(0.9f, 0.9f, 0.9f, 0.8f); t->normal(-1, 0, 0); @@ -1450,13 +1450,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(0.9f, 0.9f, 0.9f, 0.8f); t->normal(1, 0, 0); @@ -1475,13 +1475,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(0.8f, 0.8f, 0.8f, 0.8f); t->normal(-1, 0, 0); @@ -1500,13 +1500,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (static_cast(xt) + 0.5f ) / 256.0f; - float v = (static_cast(zt) + 0.5f ) / 256.0f; - float x0 = static_cast(xt); + float u = (((float) xt ) + 0.5f ) / 256.0f; + float v = (((float) zt ) + 0.5f ) / 256.0f; + float x0 = (float)xt; float x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = static_cast(zt); + float z0 = (float)zt; float z1 = z0 + 1.0f; t->color(0.8f, 0.8f, 0.8f, 0.8f); t->normal(1, 0, 0); @@ -1531,7 +1531,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) // 4J - most of our viewports are now rendered with no clip planes but using stencilling to limit the area drawn to. Clouds have a relatively large fill area compared to // the number of vertices that they have, and so enabling clipping here to try and reduce fill rate cost. RenderManager.StateSetEnableViewportClipPlanes(true); - float yOffs = static_cast(mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); + float yOffs = (float) (mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); Tesselator *t = Tesselator::getInstance(); int playerIndex = mc->player->GetXboxPad(); @@ -1581,9 +1581,9 @@ void LevelRenderer::renderAdvancedClouds(float alpha) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Vec3 *cc = level[playerIndex]->getCloudColor(alpha); - float cr = static_cast(cc->x); - float cg = static_cast(cc->y); - float cb = static_cast(cc->z); + float cr = (float) cc->x; + float cg = (float) cc->y; + float cb = (float) cc->z; if (mc->options->anaglyph3d) { @@ -1596,19 +1596,19 @@ void LevelRenderer::renderAdvancedClouds(float alpha) cb = cbb; } - float uo = static_cast(xo * 0); - float vo = static_cast(zo * 0); + float uo = (float) (xo * 0); + float vo = (float) (zo * 0); float scale = 1 / 256.0f; - uo = static_cast(Mth::floor(xo)) * scale; - vo = static_cast(Mth::floor(zo)) * scale; + uo = (float) (Mth::floor(xo)) * scale; + vo = (float) (Mth::floor(zo)) * scale; // 4J - keep our UVs +ve - there's a small bug in the xbox GPU that incorrectly rounds small -ve UVs (between -1/(64*size) and 0) up to 0, which leaves gaps in our clouds... while( uo < 1.0f ) uo += 1.0f; while( vo < 1.0f ) vo += 1.0f; - float xoffs = static_cast(xo - Mth::floor(xo)); - float zoffs = static_cast(zo - Mth::floor(zo)); + float xoffs = (float) (xo - Mth::floor(xo)); + float zoffs = (float) (zo - Mth::floor(zo)); int D = 8; @@ -1638,8 +1638,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) // 4J - reimplemented the clouds with full cube-per-texel geometry to get rid of seams. This is a huge amount more quads to render, so // now using command buffers to render each section to cut CPU hit. #if 1 - float xx = static_cast(xPos * D); - float zz = static_cast(zPos * D); + float xx = (float)(xPos * D); + float zz = (float)(zPos * D); float xp = xx - xoffs; float zp = zz - zoffs; @@ -1817,7 +1817,7 @@ bool LevelRenderer::updateDirtyChunks() std::list< std::pair > nearestClipChunks; #endif - ClipChunk *nearChunk = nullptr; // Nearest chunk that is dirty + ClipChunk *nearChunk = NULL; // Nearest chunk that is dirty int veryNearCount = 0; int minDistSq = 0x7fffffff; // Distances to this chunk @@ -1832,7 +1832,7 @@ bool LevelRenderer::updateDirtyChunks() } throttle++; */ - PIXAddNamedCounter(static_cast(memAlloc)/(1024.0f*1024.0f),"Command buffer allocations"); + PIXAddNamedCounter(((float)memAlloc)/(1024.0f*1024.0f),"Command buffer allocations"); bool onlyRebuild = ( memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS ); EnterCriticalSection(&m_csDirtyChunks); @@ -1895,15 +1895,15 @@ bool LevelRenderer::updateDirtyChunks() g_findNearestChunkDataIn.chunks[i] = (LevelRenderer_FindNearestChunk_DataIn::ClipChunk*)chunks[i].data; g_findNearestChunkDataIn.chunkLengths[i] = chunks[i].length; g_findNearestChunkDataIn.level[i] = level[i]; - g_findNearestChunkDataIn.playerData[i].bValid = mc->localplayers[i] != nullptr; - if(mc->localplayers[i] != nullptr) + g_findNearestChunkDataIn.playerData[i].bValid = mc->localplayers[i] != NULL; + if(mc->localplayers[i] != NULL) { g_findNearestChunkDataIn.playerData[i].x = mc->localplayers[i]->x; g_findNearestChunkDataIn.playerData[i].y = mc->localplayers[i]->y; g_findNearestChunkDataIn.playerData[i].z = mc->localplayers[i]->z; } - if(level[i] != nullptr) + if(level[i] != NULL) { g_findNearestChunkDataIn.multiplayerChunkCache[i].XZOFFSET = ((MultiPlayerChunkCache*)(level[i]->chunkSource))->XZOFFSET; g_findNearestChunkDataIn.multiplayerChunkCache[i].XZSIZE = ((MultiPlayerChunkCache*)(level[i]->chunkSource))->XZSIZE; @@ -1927,16 +1927,16 @@ bool LevelRenderer::updateDirtyChunks() // Find nearest chunk that is dirty for( int p = 0; p < XUSER_MAX_COUNT; p++ ) { - // It's possible that the localplayers member can be set to nullptr on the main thread when a player chooses to exit the game + // It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game // So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it shared_ptr player = mc->localplayers[p]; - if( player == nullptr ) continue; - if( chunks[p].data == nullptr ) continue; - if( level[p] == nullptr ) continue; + if( player == NULL ) continue; + if( chunks[p].data == NULL ) continue; + if( level[p] == NULL ) continue; if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue; - int px = static_cast(player->x); - int py = static_cast(player->y); - int pz = static_cast(player->z); + int px = (int)player->x; + int py = (int)player->y; + int pz = (int)player->z; // app.DebugPrintf("!! %d %d %d, %d %d %d {%d,%d} ",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, xChunks, zChunks); @@ -2035,7 +2035,7 @@ bool LevelRenderer::updateDirtyChunks() - Chunk *chunk = nullptr; + Chunk *chunk = NULL; #ifdef _LARGE_WORLDS if(!nearestClipChunks.empty()) { @@ -2186,7 +2186,7 @@ void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, glEnable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glColor4f(1, 1, 1, ((float) (Mth::sin(Minecraft::currentTimeMillis() / 100.0f)) * 0.2f + 0.4f) * 0.5f); - if (mode != 0 && inventoryItem != nullptr) + if (mode != 0 && inventoryItem != NULL) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); float br = (Mth::sin(Minecraft::currentTimeMillis() / 100.0f) * 0.2f + 0.8f); @@ -2225,7 +2225,7 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr pla // so just add on a little bit of y to fix this. hacky hacky t->offset((float)-xo, (float)-yo + 0.01f,(float) -zo); #else - t->offset(static_cast(-xo), static_cast(-yo),static_cast(-zo)); + t->offset((float)-xo, (float)-yo,(float) -zo); #endif t->noColor(); @@ -2241,8 +2241,8 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr pla { int iPad = mc->player->GetXboxPad(); // 4J added int tileId = level[iPad]->getTile(block->getX(), block->getY(), block->getZ()); - Tile *tile = tileId > 0 ? Tile::tiles[tileId] : nullptr; - if (tile == nullptr) tile = Tile::stone; + Tile *tile = tileId > 0 ? Tile::tiles[tileId] : NULL; + if (tile == NULL) tile = Tile::stone; tileRenderer[iPad]->tesselateInWorldFixedTexture(tile, block->getX(), block->getY(), block->getZ(), breakingTextures[block->getProgress()]); // 4J renamed to differentiate from tesselateInWorld } ++it; @@ -2302,30 +2302,30 @@ void LevelRenderer::render(AABB *b) Tesselator *t = Tesselator::getInstance(); t->begin(GL_LINE_STRIP); - t->vertex(static_cast(b->x0), static_cast(b->y0), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y0), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y0), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y0), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y0), static_cast(b->z0)); + t->vertex((float)(b->x0), (float)( b->y0), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y0), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y0), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y0), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y0), (float)( b->z0)); t->end(); t->begin(GL_LINE_STRIP); - t->vertex(static_cast(b->x0), static_cast(b->y1), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y1), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y1), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y1), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y1), static_cast(b->z0)); + t->vertex((float)(b->x0), (float)( b->y1), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y1), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y1), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y1), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y1), (float)( b->z0)); t->end(); t->begin(GL_LINES); - t->vertex(static_cast(b->x0), static_cast(b->y0), static_cast(b->z0)); - t->vertex(static_cast(b->x0), static_cast(b->y1), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y0), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y1), static_cast(b->z0)); - t->vertex(static_cast(b->x1), static_cast(b->y0), static_cast(b->z1)); - t->vertex(static_cast(b->x1), static_cast(b->y1), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y0), static_cast(b->z1)); - t->vertex(static_cast(b->x0), static_cast(b->y1), static_cast(b->z1)); + t->vertex((float)(b->x0), (float)( b->y0), (float)( b->z0)); + t->vertex((float)(b->x0), (float)( b->y1), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y0), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y1), (float)( b->z0)); + t->vertex((float)(b->x1), (float)( b->y0), (float)( b->z1)); + t->vertex((float)(b->x1), (float)( b->y1), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y0), (float)( b->z1)); + t->vertex((float)(b->x0), (float)( b->y1), (float)( b->z1)); t->end(); } @@ -2333,7 +2333,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev { // 4J - level is passed if this is coming from setTilesDirty, which could come from when connection is being ticked outside of normal level tick, and player won't // be set up - if( level == nullptr ) level = this->level[mc->player->GetXboxPad()]; + if( level == NULL ) level = this->level[mc->player->GetXboxPad()]; // EnterCriticalSection(&m_csDirtyChunks); int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE); int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE); @@ -2354,7 +2354,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev // These chunks are then added to the global flags in the render update thread. // An XLockFreeQueue actually implements a queue of pointers to its templated type, and I don't want to have to go allocating ints here just to store the // pointer to them in a queue. Hence actually pretending that the int Is a pointer here. Our Index has a a valid range from 0 to something quite big, - // but including zero. The lock free queue, since it thinks it is dealing with pointers, uses a nullptr pointer to signify that a Pop hasn't succeeded. + // but including zero. The lock free queue, since it thinks it is dealing with pointers, uses a NULL pointer to signify that a Pop hasn't succeeded. // We also want to reserve one special value (of 1 ) for use when multiple chunks not individually listed are made dirty. Therefore adding 2 to our // index value here to move our valid range from 1 to something quite big + 2 if( index > -1 ) @@ -2412,12 +2412,12 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev void LevelRenderer::tileChanged(int x, int y, int z) { - setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, nullptr); + setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, NULL); } void LevelRenderer::tileLightChanged(int x, int y, int z) { - setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, nullptr); + setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, NULL); } void LevelRenderer::setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level) // 4J - added level param @@ -2531,7 +2531,7 @@ void LevelRenderer::cull(Culler *culler, float a) #endif // __PS3__ - FrustumCuller *fc = static_cast(culler); + FrustumCuller *fc = (FrustumCuller *)culler; FrustumData *fd = fc->frustum; float fdraw[6 * 4]; for( int i = 0; i < 6; i++ ) @@ -2539,10 +2539,10 @@ void LevelRenderer::cull(Culler *culler, float a) double fx = fd->m_Frustum[i][0]; double fy = fd->m_Frustum[i][1]; double fz = fd->m_Frustum[i][2]; - fdraw[i * 4 + 0] = static_cast(fx); - fdraw[i * 4 + 1] = static_cast(fy); - fdraw[i * 4 + 2] = static_cast(fz); - fdraw[i * 4 + 3] = static_cast(fd->m_Frustum[i][3] + (fx * -fc->xOff) + (fy * -fc->yOff) + (fz * -fc->zOff)); + fdraw[i * 4 + 0] = (float)fx; + fdraw[i * 4 + 1] = (float)fy; + fdraw[i * 4 + 2] = (float)fz; + fdraw[i * 4 + 3] = (float)(fd->m_Frustum[i][3] + ( fx * -fc->xOff ) + ( fy * - fc->yOff ) + ( fz * -fc->zOff )); } ClipChunk *pClipChunk = chunks[playerIndex].data; @@ -2581,7 +2581,7 @@ void LevelRenderer::playStreamingMusic(const wstring& name, int x, int y, int z) { mc->gui->setNowPlaying(L"C418 - " + name); } - mc->soundEngine->playStreaming(name, static_cast(x), static_cast(y), static_cast(z), 1, 1); + mc->soundEngine->playStreaming(name, (float) x, (float) y, (float) z, 1, 1); } void LevelRenderer::playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) @@ -2624,7 +2624,7 @@ void LevelRenderer::playSoundExceptPlayer(shared_ptr player, int iSound, /* void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) { -if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr) return; +if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) return; double xd = mc->cameraTargetPlayer->x - x; double yd = mc->cameraTargetPlayer->y - y; @@ -2660,7 +2660,7 @@ void LevelRenderer::addParticle(ePARTICLE_TYPE eParticleType, double x, double y shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za) { - if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr) + if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) { return nullptr; } @@ -2695,12 +2695,12 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle distCull = false; } - // 4J - this is a bit of hack to get communication through from the level itself, but if Minecraft::animateTickLevel is nullptr then + // 4J - this is a bit of hack to get communication through from the level itself, but if Minecraft::animateTickLevel is NULL then // we are to behave as normal, and if it is set, then we should use that as a pointer to the level the particle is to be created with // rather than try to work it out from the current player. This is because in this state we are calling from a loop that is trying // to amalgamate particle creation between all players for a particular level. Also don't do distance clipping as it isn't for a particular // player, and distance is already taken into account before we get here anyway by the code in Level::animateTickDoWork - if( mc->animateTickLevel == nullptr ) + if( mc->animateTickLevel == NULL ) { double particleDistanceSquared = 16 * 16; double xd = 0.0f; @@ -2713,7 +2713,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { shared_ptr thisPlayer = mc->localplayers[i]; - if(thisPlayer != nullptr && level[i] == lev) + if(thisPlayer != NULL && level[i] == lev) { xd = thisPlayer->x - x; yd = thisPlayer->y - y; @@ -2740,32 +2740,32 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle switch(eParticleType) { case eParticleType_hugeexplosion: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za)); break; case eParticleType_largeexplode: - particle = std::make_shared(textures, lev, x, y, z, xa, ya, za); + particle = shared_ptr(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za)); break; case eParticleType_fireworksspark: - particle = std::make_shared(lev, x, y, z, xa, ya, za, mc->particleEngine); + particle = shared_ptr(new FireworksParticles::FireworksSparkParticle(lev, x, y, z, xa, ya, za, mc->particleEngine)); particle->setAlpha(0.99f); break; case eParticleType_bubble: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new BubbleParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_suspended: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SuspendedParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_depthsuspend: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_townaura: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_crit: { - shared_ptr critParticle2 = std::make_shared(lev, x, y, z, xa, ya, za); + shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); particle = shared_ptr( critParticle2 ); // request from 343 to set pink for the needler in the Halo Texture Pack @@ -2781,8 +2781,8 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle } else { - float fStart=static_cast(cStart & 0xFF); - float fDiff=static_cast((cEnd - cStart) & 0xFF); + float fStart=((float)(cStart&0xFF)); + float fDiff=(float)((cEnd-cStart)&0xFF); float fCol = (fStart + (Math::random() * fDiff))/255.0f; particle->setColor( fCol, fCol, fCol ); @@ -2791,7 +2791,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle break; case eParticleType_magicCrit: { - shared_ptr critParticle2 = std::make_shared(lev, x, y, z, xa, ya, za); + shared_ptr critParticle2 = shared_ptr(new CritParticle2(lev, x, y, z, xa, ya, za)); critParticle2->CritParticle2PostConstructor(); particle = shared_ptr(critParticle2); particle->setColor(particle->getRedCol() * 0.3f, particle->getGreenCol() * 0.8f, particle->getBlueCol()); @@ -2799,7 +2799,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle } break; case eParticleType_smoke: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_endportal: // 4J - Added. { @@ -2813,107 +2813,107 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle } break; case eParticleType_mobSpell: - particle = std::make_shared(lev, x, y, z, 0, 0, 0); - particle->setColor(static_cast(xa), static_cast(ya), static_cast(za)); + particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); + particle->setColor((float) xa, (float) ya, (float) za); break; case eParticleType_mobSpellAmbient: - particle = std::make_shared(lev, x, y, z, 0, 0, 0); + particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); particle->setAlpha(0.15f); - particle->setColor(static_cast(xa), static_cast(ya), static_cast(za)); + particle->setColor((float) xa, (float) ya, (float) za); break; case eParticleType_spell: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_witchMagic: { - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); dynamic_pointer_cast(particle)->setBaseTex(9 * 16); float randBrightness = lev->random->nextFloat() * 0.5f + 0.35f; particle->setColor(1 * randBrightness, 0 * randBrightness, 1 * randBrightness); } break; case eParticleType_instantSpell: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr(new SpellParticle(lev, x, y, z, xa, ya, za)); dynamic_pointer_cast(particle)->setBaseTex(9 * 16); break; case eParticleType_note: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new NoteParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_netherportal: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new NetherPortalParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_ender: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new EnderParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_enchantmenttable: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_explode: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new ExplodeParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_flame: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new FlameParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_lava: - particle = std::make_shared(lev, x, y, z); + particle = shared_ptr( new LavaParticle(lev, x, y, z) ); break; case eParticleType_footstep: - particle = std::make_shared(textures, lev, x, y, z); + particle = shared_ptr( new FootstepParticle(textures, lev, x, y, z) ); break; case eParticleType_splash: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SplashParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_largesmoke: - particle = std::make_shared(lev, x, y, z, xa, ya, za, 2.5f); + particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); break; case eParticleType_reddust: - particle = std::make_shared(lev, x, y, z, static_cast(xa), static_cast(ya), static_cast(za)); + particle = shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); break; case eParticleType_snowballpoof: - particle = std::make_shared(lev, x, y, z, Item::snowBall, textures); + particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); break; case eParticleType_dripWater: - particle = std::make_shared(lev, x, y, z, Material::water); + particle = shared_ptr( new DripParticle(lev, x, y, z, Material::water) ); break; case eParticleType_dripLava: - particle = std::make_shared(lev, x, y, z, Material::lava); + particle = shared_ptr( new DripParticle(lev, x, y, z, Material::lava) ); break; case eParticleType_snowshovel: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SnowShovelParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_slime: - particle = std::make_shared(lev, x, y, z, Item::slimeBall, textures); + particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures)); break; case eParticleType_heart: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new HeartParticle(lev, x, y, z, xa, ya, za) ); break; case eParticleType_angryVillager: - particle = std::make_shared(lev, x, y + 0.5f, z, xa, ya, za); + particle = shared_ptr( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) ); particle->setMiscTex(1 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_happyVillager: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) ); particle->setMiscTex(2 + 16 * 5); particle->setColor(1, 1, 1); break; case eParticleType_dragonbreath: - particle = std::make_shared(lev, x, y, z, xa, ya, za); + particle = shared_ptr( new DragonBreathParticle(lev, x, y, z, xa, ya, za) ); break; default: if( ( eParticleType >= eParticleType_iconcrack_base ) && ( eParticleType <= eParticleType_iconcrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = std::make_shared(lev, x, y, z, xa, ya, za, Item::items[id], textures, data); + particle = shared_ptr(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data)); } else if( ( eParticleType >= eParticleType_tilecrack_base ) && ( eParticleType <= eParticleType_tilecrack_last ) ) { int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType); - particle = dynamic_pointer_cast(std::make_shared(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures)->init(data) ); + particle = dynamic_pointer_cast( shared_ptr(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) ); } } - if (particle != nullptr) + if (particle != NULL) { mc->particleEngine->add(particle); } @@ -2989,7 +2989,7 @@ void LevelRenderer::globalLevelEvent(int type, int sourceX, int sourceY, int sou { case LevelEvent::SOUND_WITHER_BOSS_SPAWN: case LevelEvent::SOUND_DRAGON_DEATH: - if (mc->cameraTargetPlayer != nullptr) + if (mc->cameraTargetPlayer != NULL) { // play the sound at an offset from the player double dx = sourceX - mc->cameraTargetPlayer->x; @@ -3028,7 +3028,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y { //case LevelEvent::SOUND_WITHER_BOSS_SPAWN: case LevelEvent::SOUND_DRAGON_DEATH: - if (mc->cameraTargetPlayer != nullptr) + if (mc->cameraTargetPlayer != NULL) { // play the sound at an offset from the player double dx = x - mc->cameraTargetPlayer->x; @@ -3114,9 +3114,9 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y int colorValue = Item::potion->getColor(data); - float red = static_cast((colorValue >> 16) & 0xff) / 255.0f; - float green = static_cast((colorValue >> 8) & 0xff) / 255.0f; - float blue = static_cast((colorValue >> 0) & 0xff) / 255.0f; + float red = (float) ((colorValue >> 16) & 0xff) / 255.0f; + float green = (float) ((colorValue >> 8) & 0xff) / 255.0f; + float blue = (float) ((colorValue >> 0) & 0xff) / 255.0f; ePARTICLE_TYPE particleName = eParticleType_spell; if (Item::potion->hasInstantenousEffects(data)) @@ -3133,11 +3133,11 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double zs = sin(angle) * dist; shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); - if (spellParticle != nullptr) + if (spellParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; spellParticle->setColor(red * randBrightness, green * randBrightness, blue * randBrightness); - spellParticle->setPower(static_cast(dist)); + spellParticle->setPower((float) dist); } } level[playerIndex]->playLocalSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_GLASS, 1, level[playerIndex]->random->nextFloat() * 0.1f + 0.9f, false); @@ -3160,10 +3160,10 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double zs = sin(angle) * dist; shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); - if (acidParticle != nullptr) + if (acidParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; - acidParticle->setPower(static_cast(dist)); + acidParticle->setPower((float) dist); } } level[playerIndex]->playLocalSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_EXPLODE, 1, level[playerIndex]->random->nextFloat() * 0.1f + 0.9f); @@ -3221,7 +3221,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y case LevelEvent::SOUND_PLAY_RECORDING: { RecordingItem *rci = dynamic_cast(Item::items[data]); - if (rci != nullptr) + if (rci != NULL) { level[playerIndex]->playStreamingMusic(rci->recording, x, y, z); } @@ -3230,7 +3230,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y // 4J-PB - only play streaming music if there isn't already some playing - the CD playing may have finished, and game music started playing already if(!mc->soundEngine->GetIsPlayingStreamingGameMusic()) { - level[playerIndex]->playStreamingMusic(L"", x, y, z); // 4J - used to pass nullptr, but using empty string here now instead + level[playerIndex]->playStreamingMusic(L"", x, y, z); // 4J - used to pass NULL, but using empty string here now instead } } mc->localplayers[playerIndex]->updateRichPresence(); @@ -3290,12 +3290,12 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres } else { - BlockDestructionProgress *entry = nullptr; + BlockDestructionProgress *entry = NULL; auto it = destroyingBlocks.find(id); if(it != destroyingBlocks.end()) entry = it->second; - if (entry == nullptr || entry->getX() != x || entry->getY() != y || entry->getZ() != z) + if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z) { entry = new BlockDestructionProgress(id, x, y, z); destroyingBlocks.insert( unordered_map::value_type(id, entry) ); @@ -3554,10 +3554,10 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt( Level *level, int x, // ones, so make a temporary list and then copy over RecentTile *recentTile = new RecentTile(x, y, z, level); - AABB *box = AABB::newTemp(static_cast(x), static_cast(y), static_cast(z), static_cast(x + 1), static_cast(y + 1), static_cast(z + 1)); + AABB *box = AABB::newTemp((float)x, (float)y, (float)z, (float)(x+1), (float)(y+1), (float)(z+1)); Tile *tile = Tile::tiles[level->getTile(x, y, z)]; - if (tile != nullptr) + if (tile != NULL) { tile->addAABBs(level, x, y, z, box, &recentTile->boxes, nullptr); } diff --git a/Minecraft.Client/Lighting.cpp b/Minecraft.Client/Lighting.cpp index ef9feaa1..50529d51 100644 --- a/Minecraft.Client/Lighting.cpp +++ b/Minecraft.Client/Lighting.cpp @@ -44,7 +44,7 @@ void Lighting::turnOn() FloatBuffer *Lighting::getBuffer(double a, double b, double c, double d) { - return getBuffer(static_cast(a), static_cast(b), static_cast(c), static_cast(d)); + return getBuffer((float) a, (float) b, (float) c, (float) d); } FloatBuffer *Lighting::getBuffer(float a, float b, float c, float d) diff --git a/Minecraft.Client/LightningBoltRenderer.cpp b/Minecraft.Client/LightningBoltRenderer.cpp index 46b628df..d02ea7f7 100644 --- a/Minecraft.Client/LightningBoltRenderer.cpp +++ b/Minecraft.Client/LightningBoltRenderer.cpp @@ -79,8 +79,8 @@ void LightningBoltRenderer::render(shared_ptr _bolt, double x, double y, if (i == 1 || i == 2) xx2 += rr2 * 2; if (i == 2 || i == 3) zz2 += rr2 * 2; - t->vertex(static_cast(xx2 + xo0), static_cast(y + (h) * 16), static_cast(zz2 + zo0)); - t->vertex(static_cast(xx1 + xo1), static_cast(y + (h + 1) * 16), static_cast(zz1 + zo1)); + t->vertex((float)(xx2 + xo0), (float)( y + (h) * 16), (float)( zz2 + zo0)); + t->vertex((float)(xx1 + xo1), (float)( y + (h + 1) * 16), (float)( zz1 + zo1)); } diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index 600a6655..757948a3 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -17,7 +17,7 @@ LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow) { this->model = model; shadowRadius = shadow; - armor = nullptr; + armor = NULL; } void LivingEntityRenderer::setArmor(Model *armor) @@ -43,11 +43,11 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d glDisable(GL_CULL_FACE); model->attackTime = getAttackAnim(mob, a); - if (armor != nullptr) armor->attackTime = model->attackTime; + if (armor != NULL) armor->attackTime = model->attackTime; model->riding = mob->isRiding(); - if (armor != nullptr) armor->riding = model->riding; + if (armor != NULL) armor->riding = model->riding; model->young = mob->isBaby(); - if (armor != nullptr) armor->young = model->young; + if (armor != NULL) armor->young = model->young; /*try*/ { @@ -259,7 +259,7 @@ void LivingEntityRenderer::renderModel(shared_ptr mob, float wp, f void LivingEntityRenderer::setupPosition(shared_ptr mob, double x, double y, double z) { - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); } void LivingEntityRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, float a) @@ -306,7 +306,7 @@ void LivingEntityRenderer::renderArrows(shared_ptr mob, float a) int arrowCount = mob->getArrowCount(); if (arrowCount > 0) { - shared_ptr arrow = std::make_shared(mob->level, mob->x, mob->y, mob->z); + shared_ptr arrow = shared_ptr(new Arrow(mob->level, mob->x, mob->y, mob->z)); Random random = Random(mob->entityId); Lighting::turnOff(); for (int i = 0; i < arrowCount; i++) @@ -405,7 +405,7 @@ void LivingEntityRenderer::renderName(shared_ptr mob, double x, do Font *font = getFont(); glPushMatrix(); - glTranslatef(static_cast(x) + 0, static_cast(y) + mob->bbHeight + 0.5f, static_cast(z)); + glTranslatef((float) x + 0, (float) y + mob->bbHeight + 0.5f, (float) z); glNormal3f(0, 1, 0); glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0); @@ -448,7 +448,7 @@ void LivingEntityRenderer::renderName(shared_ptr mob, double x, do bool LivingEntityRenderer::shouldShowName(shared_ptr mob) { - return Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) && mob->rider.lock() == nullptr; + return Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) && mob->rider.lock() == NULL; } void LivingEntityRenderer::renderNameTags(shared_ptr mob, double x, double y, double z, const wstring &msg, float scale, double dist) @@ -595,10 +595,10 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst { t->color(0.0f, 0.0f, 0.0f, 0.25f); } - t->vertex(static_cast(-w - 1), static_cast(-1 + offs), static_cast(0)); - t->vertex(static_cast(-w - 1), static_cast(+8 + offs + 1), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(+8 + offs + 1), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(-1 + offs), static_cast(0)); + t->vertex((float)(-w - 1), (float)( -1 + offs), (float)( 0)); + t->vertex((float)(-w - 1), (float)( +8 + offs + 1), (float)( 0)); + t->vertex((float)(+w + 1), (float)( +8 + offs + 1), (float)( 0)); + t->vertex((float)(+w + 1), (float)( -1 + offs), (float)( 0)); t->end(); glEnable(GL_DEPTH_TEST); @@ -607,11 +607,11 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst glLineWidth(2.0f); t->begin(GL_LINE_STRIP); t->color(color, 255 * textOpacity); - t->vertex(static_cast(-w - 1), static_cast(-1 + offs), static_cast(0)); - t->vertex(static_cast(-w - 1), static_cast(+8 + offs + 1), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(+8 + offs + 1), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(-1 + offs), static_cast(0)); - t->vertex(static_cast(-w - 1), static_cast(-1 + offs), static_cast(0)); + t->vertex((float)(-w - 1), (float)( -1 + offs), (float)( 0)); + t->vertex((float)(-w - 1), (float)( +8 + offs + 1), (float)( 0)); + t->vertex((float)(+w + 1), (float)( +8 + offs + 1), (float)( 0)); + t->vertex((float)(+w + 1), (float)( -1 + offs), (float)( 0)); + t->vertex((float)(-w - 1), (float)( -1 + offs), (float)( 0)); t->end(); glDepthFunc(GL_LEQUAL); glDepthMask(false); @@ -632,10 +632,10 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst t->begin(); int w = font->width(playerName) / 2; t->color(color, 255); - t->vertex(static_cast(-w - 1), static_cast(-1 + offs), static_cast(0)); - t->vertex(static_cast(-w - 1), static_cast(+8 + offs), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(+8 + offs), static_cast(0)); - t->vertex(static_cast(+w + 1), static_cast(-1 + offs), static_cast(0)); + t->vertex((float)(-w - 1), (float)( -1 + offs), (float)( 0)); + t->vertex((float)(-w - 1), (float)( +8 + offs), (float)( 0)); + t->vertex((float)(+w + 1), (float)( +8 + offs), (float)( 0)); + t->vertex((float)(+w + 1), (float)( -1 + offs), (float)( 0)); t->end(); glDepthFunc(GL_LEQUAL); glEnable(GL_TEXTURE_2D); @@ -645,7 +645,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst if( textOpacity > 0.0f ) { - int textColor = ( ( static_cast(textOpacity * 255) << 24 ) | 0xffffff ); + int textColor = ( ( (int)(textOpacity*255) << 24 ) | 0xffffff ); font->draw(playerName, -font->width(playerName) / 2, offs, textColor); } diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index 7988416a..d743543e 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -56,7 +56,7 @@ #ifndef _DURANGO #include "..\Minecraft.World\CommonStats.h" #endif -extern ConsoleUIController ui; + LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dimension) : Player(level, user->name) @@ -79,11 +79,11 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim this->minecraft = minecraft; this->dimension = dimension; - if (user != nullptr && user->name.length() > 0) + if (user != NULL && user->name.length() > 0) { customTextureUrl = L"http://s3.amazonaws.com/MinecraftSkins/" + user->name + L".png"; } - if( user != nullptr ) + if( user != NULL ) { this->name = user->name; //wprintf(L"Created LocalPlayer with name %ls\n", name.c_str() ); @@ -95,7 +95,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim } } - input = nullptr; + input = NULL; m_iPad = -1; m_iScreenSection=C4JRender::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default m_bPlayerRespawned=false; @@ -124,7 +124,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim LocalPlayer::~LocalPlayer() { - if( this->input != nullptr ) + if( this->input != NULL ) delete input; } @@ -188,9 +188,9 @@ void LocalPlayer::aiStep() { if (!level->isClientSide) { - if (riding != nullptr) this->ride(nullptr); + if (riding != NULL) this->ride(nullptr); } - if (minecraft->screen != nullptr) minecraft->setScreen(nullptr); + if (minecraft->screen != NULL) minecraft->setScreen(NULL); if (portalTime == 0) { @@ -389,11 +389,11 @@ void LocalPlayer::aiStep() jumpRidingTicks++; if (jumpRidingTicks < 10) { - jumpRidingScale = static_cast(jumpRidingTicks) * .1f; + jumpRidingScale = (float) jumpRidingTicks * .1f; } else { - jumpRidingScale = .8f + (2.f / static_cast(jumpRidingTicks - 9)) * .1f; + jumpRidingScale = .8f + (2.f / ((float) (jumpRidingTicks - 9))) * .1f; } } } @@ -427,9 +427,9 @@ void LocalPlayer::aiStep() #ifdef _DEBUG_MENUS_ENABLED if(abilities.debugflying) { - flyX = static_cast(viewVector->x) * input->ya; - flyY = static_cast(viewVector->y) * input->ya; - flyZ = static_cast(viewVector->z) * input->ya; + flyX = (float)viewVector->x * input->ya; + flyY = (float)viewVector->y * input->ya; + flyZ = (float)viewVector->z * input->ya; } else #endif @@ -437,11 +437,11 @@ void LocalPlayer::aiStep() if( isSprinting() ) { // Accelrate up to full speed if we are sprinting, moving in the direction of the view vector - flyX = static_cast(viewVector->x) * input->ya; - flyY = static_cast(viewVector->y) * input->ya; - flyZ = static_cast(viewVector->z) * input->ya; + flyX = (float)viewVector->x * input->ya; + flyY = (float)viewVector->y * input->ya; + flyZ = (float)viewVector->z * input->ya; - float scale = static_cast(SPRINT_DURATION - sprintTime)/10.0f; + float scale = ((float)(SPRINT_DURATION - sprintTime))/10.0f; scale = scale * scale; if ( scale > 1.0f ) scale = 1.0f; flyX *= scale; @@ -544,7 +544,7 @@ float LocalPlayer::getFieldOfViewModifier() if (isUsingItem() && getUseItem()->id == Item::bow->id) { int ticksHeld = getTicksUsingItem(); - float scale = static_cast(ticksHeld) / BowItem::MAX_DRAW_DURATION; + float scale = (float) ticksHeld / BowItem::MAX_DRAW_DURATION; if (scale > 1) { scale = 1; @@ -574,7 +574,7 @@ void LocalPlayer::readAdditionalSaveData(CompoundTag *entityTag) void LocalPlayer::closeContainer() { Player::closeContainer(); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // 4J - Close any xui here // Fix for #9164 - CRASH: MP: Title crashes upon opening a chest and having another user destroy it. @@ -705,21 +705,21 @@ bool LocalPlayer::openTrading(shared_ptr traderTarget, const wstring & void LocalPlayer::crit(shared_ptr e) { - shared_ptr critParticle = std::make_shared(reinterpret_cast(minecraft->level), e); + shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } void LocalPlayer::magicCrit(shared_ptr e) { - shared_ptr critParticle = std::make_shared(reinterpret_cast(minecraft->level), e, eParticleType_magicCrit); + shared_ptr critParticle = shared_ptr( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) ); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); } void LocalPlayer::take(shared_ptr e, int orgCount) { - minecraft->particleEngine->add(std::make_shared(reinterpret_cast(minecraft->level), e, shared_from_this(), -0.5f)); + minecraft->particleEngine->add( shared_ptr( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) ); } void LocalPlayer::chat(const wstring& message) @@ -754,8 +754,8 @@ void LocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damageSource) if( this->getHealth() <= 0) { - int deathTime = static_cast(level->getGameTime() % Level::TICKS_PER_DAY)/1000; - int carriedId = inventory->getSelected() == nullptr ? 0 : inventory->getSelected()->id; + int deathTime = (int)(level->getGameTime() % Level::TICKS_PER_DAY)/1000; + int carriedId = inventory->getSelected() == NULL ? 0 : inventory->getSelected()->id; TelemetryManager->RecordPlayerDiedOrFailed(GetXboxPad(), 0, y, 0, 0, carriedId, 0, damageSource); // if there are any xuiscenes up for this player, close them @@ -800,11 +800,11 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) delete [] param.data; if (!app.CanRecordStatsAndAchievements()) return; - if (stat == nullptr) return; + if (stat == NULL) return; if (stat->isAchievement()) { - Achievement *ach = static_cast(stat); + Achievement *ach = (Achievement *) stat; // 4J-PB - changed to attempt to award everytime - the award may need a storage device, so needs a primary player, and the player may not have been a primary player when they first 'got' the award // so let the award manager figure it out //if (!minecraft->stats[m_iPad]->hasTaken(ach)) @@ -830,7 +830,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) } // 4J-JEV: To stop spamming trophies. - unsigned long long achBit = static_cast(1) << ach->getAchievementID(); + unsigned long long achBit = ((unsigned long long)1) << ach->getAchievementID(); if ( !(achBit & m_awardedThisSession) ) { ProfileManager.Award(m_iPad, ach->getAchievementID()); @@ -1196,7 +1196,7 @@ void LocalPlayer::playSound(int soundId, float volume, float pitch) bool LocalPlayer::isRidingJumpable() { - return riding != nullptr && riding->GetType() == eTYPE_HORSE; + return riding != NULL && riding->GetType() == eTYPE_HORSE; } float LocalPlayer::getJumpRidingScale() @@ -1215,9 +1215,9 @@ bool LocalPlayer::hasPermission(EGameCommand command) void LocalPlayer::onCrafted(shared_ptr item) { - if( minecraft->localgameModes[m_iPad] != nullptr ) + if( minecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_iPad]; gameMode->getTutorial()->onCrafted(item); } } @@ -1239,8 +1239,8 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) int cx = this->xChunk; int cz = this->zChunk; - int pZ = static_cast(floor(this->z)) %16; - int pX = static_cast(floor(this->x)) %16; + int pZ = ((int) floor(this->z)) %16; + int pX = ((int) floor(this->x)) %16; cout<<"player in chunk ("<x<<","<y<<","<z<<")\n"; @@ -1272,14 +1272,14 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) void LocalPlayer::handleMouseDown(int button, bool down) { // 4J Stu - We should not accept any input while asleep, except the above to wake up - if(isSleeping() && level != nullptr && level->isClientSide) + if(isSleeping() && level != NULL && level->isClientSide) { return; } if (!down) missTime = 0; if (button == 0 && missTime > 0) return; - if (down && minecraft->hitResult != nullptr && minecraft->hitResult->type == HitResult::TILE && button == 0) + if (down && minecraft->hitResult != NULL && minecraft->hitResult->type == HitResult::TILE && button == 0) { int x = minecraft->hitResult->x; int y = minecraft->hitResult->y; @@ -1328,9 +1328,9 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed) } // Get distance from last click point in each axis - float dX = static_cast(x) - lastClickX; - float dY = static_cast(y) - lastClickY; - float dZ = static_cast(z) - lastClickZ; + float dX = (float)x - lastClickX; + float dY = (float)y - lastClickY; + float dZ = (float)z - lastClickZ; bool newClick = false; float ddx = dX - lastClickdX; @@ -1436,9 +1436,9 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed) else { // First click - just record position & handle - lastClickX = static_cast(x); - lastClickY = static_cast(y); - lastClickZ = static_cast(z); + lastClickX = (float)x; + lastClickY = (float)y; + lastClickZ = (float)z; // If we actually placed an item, then move into the init state as we are going to be doing the special creative mode auto repeat bool itemPlaced = handleMouseClick(button); // If we're sprinting or riding, don't auto-repeat at all. With auto repeat on, we can quickly place fires causing photosensitivity issues due to rapid flashing @@ -1486,7 +1486,7 @@ bool LocalPlayer::handleMouseClick(int button) // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button - if(button==1 && (isSleeping() && level != nullptr && level->isClientSide)) + if(button==1 && (isSleeping() && level != NULL && level->isClientSide)) { if(lastClickState == lastClick_oldRepeat) return false; @@ -1497,14 +1497,14 @@ bool LocalPlayer::handleMouseClick(int button) } // 4J Stu - We should not accept any input while asleep, except the above to wake up - if(isSleeping() && level != nullptr && level->isClientSide) + if(isSleeping() && level != NULL && level->isClientSide) { return false; } shared_ptr oldItem = inventory->getSelected(); - if (minecraft->hitResult == nullptr) + if (minecraft->hitResult == NULL) { if (button == 0 && minecraft->localgameModes[GetXboxPad()]->hasMissTime()) missTime = 10; } @@ -1555,7 +1555,7 @@ bool LocalPlayer::handleMouseClick(int button) else { shared_ptr item = oldItem; - int oldCount = item != nullptr ? item->count : 0; + int oldCount = item != NULL ? item->count : 0; bool usedItem = false; if (minecraft->gameMode->useItemOn(minecraft->localplayers[GetXboxPad()], level, item, x, y, z, face, minecraft->hitResult->pos, false, &usedItem)) { @@ -1568,7 +1568,7 @@ bool LocalPlayer::handleMouseClick(int button) //app.DebugPrintf("Player %d is swinging\n",GetXboxPad()); swing(); } - if (item == nullptr) + if (item == NULL) { return false; } @@ -1587,7 +1587,7 @@ bool LocalPlayer::handleMouseClick(int button) if (mayUse && button == 1) { shared_ptr item = inventory->getSelected(); - if (item != nullptr) + if (item != NULL) { if (minecraft->gameMode->useItem(minecraft->localplayers[GetXboxPad()], level, item)) { @@ -1603,23 +1603,23 @@ void LocalPlayer::updateRichPresence() if((m_iPad!=-1)/* && !ui.GetMenuDisplayed(m_iPad)*/ ) { shared_ptr selectedItem = inventory->getSelected(); - if(selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) + if(selectedItem != NULL && selectedItem->id == Item::fishingRod_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FISHING); } - else if(selectedItem != nullptr && selectedItem->id == Item::map_Id) + else if(selectedItem != NULL && selectedItem->id == Item::map_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP); } - else if ( (riding != nullptr) && riding->instanceof(eTYPE_MINECART) ) + else if ( (riding != NULL) && riding->instanceof(eTYPE_MINECART) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART); } - else if ( (riding != nullptr) && riding->instanceof(eTYPE_BOAT) ) + else if ( (riding != NULL) && riding->instanceof(eTYPE_BOAT) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BOATING); } - else if ( (riding != nullptr) && riding->instanceof(eTYPE_PIG) ) + else if ( (riding != NULL) && riding->instanceof(eTYPE_PIG) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_PIG); } @@ -1660,13 +1660,13 @@ float LocalPlayer::getAndResetChangeDimensionTimer() void LocalPlayer::handleCollectItem(shared_ptr item) { - if(item != nullptr) + if(item != NULL) { unsigned int itemCountAnyAux = 0; unsigned int itemCountThisAux = 0; for (unsigned int k = 0; k < inventory->items.length; ++k) { - if (inventory->items[k] != nullptr) + if (inventory->items[k] != NULL) { // do they have the item if(inventory->items[k]->id == item->id) @@ -1682,7 +1682,7 @@ void LocalPlayer::handleCollectItem(shared_ptr item) } } } - TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_iPad]; gameMode->getTutorial()->onTake(item, itemCountAnyAux, itemCountThisAux); } diff --git a/Minecraft.Client/MemTexture.cpp b/Minecraft.Client/MemTexture.cpp index ee3ba798..f587e82f 100644 --- a/Minecraft.Client/MemTexture.cpp +++ b/Minecraft.Client/MemTexture.cpp @@ -15,7 +15,7 @@ MemTexture::MemTexture(const wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextu //loadedImage=Textures::getTexture() // 4J - remember to add deletes in here for any created BufferedImages when implemented loadedImage = new BufferedImage(pbData,dwBytes); - if(processor==nullptr) + if(processor==NULL) { } diff --git a/Minecraft.Client/MinecartModel.cpp b/Minecraft.Client/MinecartModel.cpp index 0cb0764f..8a1ce0d7 100644 --- a/Minecraft.Client/MinecartModel.cpp +++ b/Minecraft.Client/MinecartModel.cpp @@ -16,23 +16,23 @@ MinecartModel::MinecartModel() : Model() int h = 16; int yOff = 4; - cubes[0]->addBox(static_cast(-w / 2), static_cast(-h / 2), -1, w, h, 2, 0); - cubes[0]->setPos(0, static_cast(0 + yOff), 0); + cubes[0]->addBox((float)(-w / 2), (float)(-h / 2), -1, w, h, 2, 0); + cubes[0]->setPos(0, (float)(0 + yOff), 0); - cubes[5]->addBox(static_cast(-w / 2 + 1), static_cast(-h / 2 + 1), -1, w - 2, h - 2, 1, 0); - cubes[5]->setPos(0, static_cast(0 + yOff), 0); + cubes[5]->addBox((float)(-w / 2 + 1), (float)(-h / 2 + 1), -1, w - 2, h - 2, 1, 0); + cubes[5]->setPos(0, (float)(0 + yOff), 0); - cubes[1]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[1]->setPos(static_cast(-w / 2 + 1), static_cast(0 + yOff), 0); + cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0); - cubes[2]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[2]->setPos(static_cast(+w / 2 - 1), static_cast(0 + yOff), 0); + cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0); - cubes[3]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[3]->setPos(0, static_cast(0 + yOff), static_cast(-h / 2 + 1)); + cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1)); - cubes[4]->addBox(static_cast(-w / 2 + 2), static_cast(-d - 1), -1, w - 4, d, 2, 0); - cubes[4]->setPos(0, static_cast(0 + yOff), static_cast(+h / 2 - 1)); + cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); + cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1)); cubes[0]->xRot = PI / 2; cubes[1]->yRot = PI / 2 * 3; diff --git a/Minecraft.Client/MinecartRenderer.cpp b/Minecraft.Client/MinecartRenderer.cpp index 0ecb7f58..34205d33 100644 --- a/Minecraft.Client/MinecartRenderer.cpp +++ b/Minecraft.Client/MinecartRenderer.cpp @@ -42,12 +42,12 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub float xRot = cart->xRotO + (cart->xRot - cart->xRotO) * a; - if (p != nullptr) + if (p != NULL) { Vec3 *p0 = cart->getPosOffs(xx, yy, zz, r); Vec3 *p1 = cart->getPosOffs(xx, yy, zz, -r); - if (p0 == nullptr) p0 = p; - if (p1 == nullptr) p1 = p; + if (p0 == NULL) p0 = p; + if (p1 == NULL) p1 = p; x += p->x - xx; y += (p0->y + p1->y) / 2 - yy; @@ -60,11 +60,11 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub else { dir = dir->normalize(); - rot = static_cast(atan2(dir->z, dir->x) * 180 / PI); - xRot = static_cast(atan(dir->y) * 73); + rot = (float) (atan2(dir->z, dir->x) * 180 / PI); + xRot = (float) (atan(dir->y) * 73); } } - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); glRotatef(180 - rot, 0, 1, 0); glRotatef(-xRot, 0, 0, 1); @@ -80,7 +80,7 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub Tile *tile = cart->getDisplayTile(); int tileData = cart->getDisplayData(); - if (tile != nullptr) + if (tile != NULL) { glPushMatrix(); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 4b9fd74c..46e8497a 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -84,15 +84,13 @@ // from the main thread, and have longer to run, since it's called at 20Hz instead of 60 #define DISABLE_LEVELTICK_THREAD -Minecraft *Minecraft::m_instance = nullptr; +Minecraft *Minecraft::m_instance = NULL; int64_t Minecraft::frameTimes[512]; int64_t Minecraft::tickTimes[512]; int Minecraft::frameTimePos = 0; int64_t Minecraft::warezTime = 0; File Minecraft::workDir = File(L""); -extern ConsoleUIController ui; - #ifdef __PSVITA__ TOUCHSCREENRECT QuickSelectRect[3]= @@ -121,33 +119,33 @@ ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet *minecraftApplet, int width, int height, bool fullscreen) { // 4J - added this block of initialisers - gameMode = nullptr; + gameMode = NULL; hasCrashed = false; timer = new Timer(SharedConstants::TICKS_PER_SECOND); - oldLevel = nullptr; //4J Stu added - level = nullptr; + oldLevel = NULL; //4J Stu added + level = NULL; levels = MultiPlayerLevelArray(3); // 4J Added - levelRenderer = nullptr; + levelRenderer = NULL; player = nullptr; cameraTargetPlayer = nullptr; - particleEngine = nullptr; - user = nullptr; - parent = nullptr; + particleEngine = NULL; + user = NULL; + parent = NULL; pause = false; - textures = nullptr; - font = nullptr; - screen = nullptr; + textures = NULL; + font = NULL; + screen = NULL; localPlayerIdx = 0; rightClickDelay = 0; // 4J Stu Added InitializeCriticalSection( &ProgressRenderer::s_progress ); InitializeCriticalSection(&m_setLevelCS); - //m_hPlayerRespawned = CreateEvent(nullptr, FALSE, FALSE, nullptr); + //m_hPlayerRespawned = CreateEvent(NULL, FALSE, FALSE, NULL); - progressRenderer = nullptr; - gameRenderer = nullptr; - bgLoader = nullptr; + progressRenderer = NULL; + gameRenderer = NULL; + bgLoader = NULL; ticks = 0; // 4J-PB - moved into the local player @@ -158,20 +156,20 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet orgWidth = orgHeight = 0; achievementPopup = new AchievementPopup(this); - gui = nullptr; + gui = NULL; noRender = false; humanoidModel = new HumanoidModel(0); - hitResult = nullptr; - options = nullptr; + hitResult = 0; + options = NULL; soundEngine = new SoundEngine(); - mouseHandler = nullptr; - skins = nullptr; + mouseHandler = NULL; + skins = NULL; workingDirectory = File(L""); - levelSource = nullptr; - stats[0] = nullptr; - stats[1] = nullptr; - stats[2] = nullptr; - stats[3] = nullptr; + levelSource = NULL; + stats[0] = NULL; + stats[1] = NULL; + stats[2] = NULL; + stats[3] = NULL; connectToPort = 0; workDir = File(L""); // 4J removed @@ -188,7 +186,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet orgHeight = height; this->fullscreen = fullscreen; - this->minecraftApplet = nullptr; + this->minecraftApplet = NULL; this->parent = parent; // 4J - Our actual physical frame buffer is always 1280x720 ie in a 16:9 ratio. If we want to do a 4:3 mode, we are telling the original minecraft code @@ -215,12 +213,12 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet for(int i=0;isoundEngine->init(nullptr); + this->soundEngine->init(NULL); #endif #ifndef DISABLE_LEVELTICK_THREAD @@ -355,7 +353,7 @@ void Minecraft::init() stats[i] = new StatsCounter(); /* 4J - TODO, 4J-JEV: Unnecessary. - Achievements::openInventory->setDescFormatter(nullptr); + Achievements::openInventory->setDescFormatter(NULL); Achievements.openInventory.setDescFormatter(new DescFormatter(){ public String format(String i18nValue) { return String.format(i18nValue, Keyboard.getKeyName(options.keyBuild.key)); @@ -416,7 +414,7 @@ void Minecraft::init() MemSect(0); gui = new Gui(this); - if (connectToIp != L"") // 4J - was nullptr comparison + if (connectToIp != L"") // 4J - was NULL comparison { // setScreen(new ConnectScreen(this, connectToIp, connectToPort)); // 4J TODO - put back in } @@ -486,10 +484,10 @@ void Minecraft::blit(int x, int y, int sx, int sy, int w, int h) float vs = 1 / 256.0f; Tesselator *t = Tesselator::getInstance(); t->begin(); - t->vertexUV(static_cast(x + 0), static_cast(y + h), static_cast(0), (float)( (sx + 0) * us), (float)( (sy + h) * vs)); - t->vertexUV(static_cast(x + w), static_cast(y + h), static_cast(0), (float)( (sx + w) * us), (float)( (sy + h) * vs)); - t->vertexUV(static_cast(x + w), static_cast(y + 0), static_cast(0), (float)( (sx + w) * us), (float)( (sy + 0) * vs)); - t->vertexUV(static_cast(x + 0), static_cast(y + 0), static_cast(0), (float)( (sx + 0) * us), (float)( (sy + 0) * vs)); + t->vertexUV((float)(x + 0), (float)( y + h), (float)( 0), (float)( (sx + 0) * us), (float)( (sy + h) * vs)); + t->vertexUV((float)(x + w), (float)( y + h), (float)( 0), (float)( (sx + w) * us), (float)( (sy + h) * vs)); + t->vertexUV((float)(x + w), (float)( y + 0), (float)( 0), (float)( (sx + w) * us), (float)( (sy + 0) * vs)); + t->vertexUV((float)(x + 0), (float)( y + 0), (float)( 0), (float)( (sx + 0) * us), (float)( (sy + 0) * vs)); t->end(); } @@ -500,30 +498,30 @@ LevelStorageSource *Minecraft::getLevelSource() void Minecraft::setScreen(Screen *screen) { - if (this->screen != nullptr) + if (this->screen != NULL) { this->screen->removed(); } #ifdef _WINDOWS64 - if (screen != nullptr && g_KBMInput.IsMouseGrabbed()) + if (screen != NULL && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); } #endif //4J Gordon: Do not force a stats save here - /*if (dynamic_cast(screen)!=nullptr) + /*if (dynamic_cast(screen)!=NULL) { stats->forceSend(); } stats->forceSave();*/ - if (screen == nullptr && level == nullptr) + if (screen == NULL && level == NULL) { screen = new TitleScreen(); } - else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) + else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { //screen = new DeathScreen(); @@ -536,18 +534,18 @@ void Minecraft::setScreen(Screen *screen) } else { - ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,nullptr); + ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,NULL); } } - if (dynamic_cast(screen)!=nullptr) + if (dynamic_cast(screen)!=NULL) { options->renderDebug = false; gui->clearMessages(); } this->screen = screen; - if (screen != nullptr) + if (screen != NULL) { // releaseMouse(); // 4J - removed ScreenSizeCalculator ssc(options, width, height); @@ -563,7 +561,7 @@ void Minecraft::setScreen(Screen *screen) // 4J-PB - if a screen has been set, go into menu mode // it's possible that player doesn't exist here yet - /*if(screen!=nullptr) + /*if(screen!=NULL) { if(player && player->GetXboxPad()!=-1) { @@ -600,7 +598,7 @@ void Minecraft::destroy() stats->forceSave();*/ // try { - setLevel(nullptr); + setLevel(NULL); // } catch (Throwable e) { // } @@ -647,11 +645,11 @@ void Minecraft::run() AABB::resetPool(); Vec3::resetPool(); - // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed + // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed // stop(); // } - if (pause && level != nullptr) + if (pause && level != NULL) { float lastA = timer->a; timer->advanceTime(); @@ -684,14 +682,14 @@ void Minecraft::run() soundEngine->update(player, timer->a); glEnable(GL_TEXTURE_2D); - if (level != nullptr) level->updateLights(); + if (level != NULL) level->updateLights(); // if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed - if (player != nullptr && player->isInWall()) options->thirdPersonView = false; + if (player != NULL && player->isInWall()) options->thirdPersonView = false; if (!noRender) { - if (gameMode != nullptr) gameMode->render(timer->a); + if (gameMode != NULL) gameMode->render(timer->a); gameRenderer->render(timer->a); } @@ -725,7 +723,7 @@ void Minecraft::run() // checkScreenshot(); // 4J - removed /* 4J - removed - if (parent != nullptr && !fullscreen) + if (parent != NULL && !fullscreen) { if (parent.getWidth() != width || parent.getHeight() != height) { @@ -740,7 +738,7 @@ void Minecraft::run() */ checkGlError(L"Post render"); frames++; - pause = !isClientSide() && screen != nullptr && screen->isPauseScreen(); + pause = !isClientSide() && screen != NULL && screen->isPauseScreen(); while (System::currentTimeMillis() >= lastTime + 1000) { @@ -794,7 +792,7 @@ bool Minecraft::setLocalPlayerIdx(int idx) localPlayerIdx = idx; // If the player is not null, but the game mode is then this is just a temp player // whose only real purpose is to hold the viewport position - if( localplayers[idx] == nullptr || localgameModes[idx] == nullptr ) return false; + if( localplayers[idx] == NULL || localgameModes[idx] == NULL ) return false; gameMode = localgameModes[idx]; player = localplayers[idx]; @@ -818,7 +816,7 @@ void Minecraft::updatePlayerViewportAssignments() int viewportsRequired = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != nullptr ) viewportsRequired++; + if( localplayers[i] != NULL ) viewportsRequired++; } if( viewportsRequired == 3 ) viewportsRequired = 4; @@ -828,7 +826,7 @@ void Minecraft::updatePlayerViewportAssignments() // Single viewport for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != nullptr ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; + if( localplayers[i] != NULL ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; } } else if( viewportsRequired == 2 ) @@ -837,7 +835,7 @@ void Minecraft::updatePlayerViewportAssignments() int found = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != nullptr ) + if( localplayers[i] != NULL ) { // Primary player settings decide what the mode is if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_SplitScreenVertical)) @@ -860,7 +858,7 @@ void Minecraft::updatePlayerViewportAssignments() for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != nullptr ) + if( localplayers[i] != NULL ) { // 4J Stu - If the game hasn't started, ignore current allocations (as the players won't have seen them) @@ -884,7 +882,7 @@ void Minecraft::updatePlayerViewportAssignments() // Found which quadrants are currently in use, now allocate out any spares that are required for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != nullptr ) + if( localplayers[i] != NULL ) { if( ( localplayers[i]->m_iScreenSection < C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT ) || ( localplayers[i]->m_iScreenSection > C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT ) ) @@ -920,22 +918,22 @@ void Minecraft::updatePlayerViewportAssignments() bool Minecraft::addLocalPlayer(int idx) { //int iLocalPlayerC=app.GetLocalPlayerCount(); - if( m_pendingLocalConnections[idx] != nullptr ) + if( m_pendingLocalConnections[idx] != NULL ) { // 4J Stu - Should we ever be in a state where this happens? assert(false); m_pendingLocalConnections[idx]->close(); } m_connectionFailed[idx] = false; - m_pendingLocalConnections[idx] = nullptr; + m_pendingLocalConnections[idx] = NULL; bool success=g_NetworkManager.AddLocalPlayerByUserIndex(idx); if(success) { app.DebugPrintf("Adding temp local player on pad %d\n", idx); - localplayers[idx] = shared_ptr(new MultiplayerLocalPlayer(this, level, user, nullptr)); - localgameModes[idx] = nullptr; + localplayers[idx] = shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); + localgameModes[idx] = NULL; updatePlayerViewportAssignments(); @@ -948,7 +946,7 @@ bool Minecraft::addLocalPlayer(int idx) // send the message for(int i=0;i Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= nullptr*/,MultiPlayerLevel *levelpassedin) +shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) { - if( clientConnection == nullptr) return nullptr; + if( clientConnection == NULL) return nullptr; if( clientConnection == m_pendingLocalConnections[idx] ) { int tempScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; - if( localplayers[idx] != nullptr && localgameModes[idx] == nullptr ) + if( localplayers[idx] != NULL && localgameModes[idx] == NULL ) { // A temp player displaying a connecting screen tempScreenSection = localplayers[idx]->m_iScreenSection; @@ -998,7 +996,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co user->name = name; // Don't need this any more - m_pendingLocalConnections[idx] = nullptr; + m_pendingLocalConnections[idx] = NULL; // Add the connection to the level which will now take responsibility for ticking it // 4J-PB - can't use the dimension from localplayers[idx], since there may be no localplayers at this point @@ -1045,7 +1043,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co // Compatibility rule for Win64 id migration // host keeps legacy host XUID, non-host uses persistent uid.dat XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -1062,11 +1060,11 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co localplayers[idx]->m_iScreenSection = tempScreenSection; - if( levelpassedin == nullptr) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves + if( levelpassedin == NULL) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves localplayers[idx]->SetXboxPad(iPad); - if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input; + if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input; localplayers[idx]->input = new Input(); localplayers[idx]->resetPos(); @@ -1095,7 +1093,7 @@ void Minecraft::storeExtraLocalPlayer(int idx) { localplayers[idx] = player; - if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input; + if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input; localplayers[idx]->input = new Input(); if(ProfileManager.IsSignedIn(idx)) @@ -1107,14 +1105,14 @@ void Minecraft::storeExtraLocalPlayer(int idx) void Minecraft::removeLocalPlayerIdx(int idx) { bool updateXui = true; - if(localgameModes[idx] != nullptr) + if(localgameModes[idx] != NULL) { if( getLevel( localplayers[idx]->dimension )->isClientSide ) { shared_ptr mplp = localplayers[idx]; ( (MultiPlayerLevel *)getLevel( localplayers[idx]->dimension ) )->removeClientConnection(mplp->connection, true); delete mplp->connection; - mplp->connection = nullptr; + mplp->connection = NULL; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); } getLevel( localplayers[idx]->dimension )->removeEntity(localplayers[idx]); @@ -1129,13 +1127,13 @@ void Minecraft::removeLocalPlayerIdx(int idx) playerLeftTutorial( idx ); delete localgameModes[idx]; - localgameModes[idx] = nullptr; + localgameModes[idx] = NULL; } - else if( m_pendingLocalConnections[idx] != nullptr ) + else if( m_pendingLocalConnections[idx] != NULL ) { - m_pendingLocalConnections[idx]->sendAndDisconnect(std::make_shared(DisconnectPacket::eDisconnect_Quitting));; + m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; delete m_pendingLocalConnections[idx]; - m_pendingLocalConnections[idx] = nullptr; + m_pendingLocalConnections[idx] = NULL; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); } else @@ -1160,18 +1158,18 @@ void Minecraft::removeLocalPlayerIdx(int idx) /* // If we are removing the primary player then there can't be a valid gamemode left anymore, this // pointer will be referring to the one we've just deleted - gameMode = nullptr; + gameMode = NULL; // Remove references to player - player = nullptr; - cameraTargetPlayer = nullptr; - EntityRenderDispatcher::instance->cameraEntity = nullptr; - TileEntityRenderDispatcher::instance->cameraEntity = nullptr; + player = NULL; + cameraTargetPlayer = NULL; + EntityRenderDispatcher::instance->cameraEntity = NULL; + TileEntityRenderDispatcher::instance->cameraEntity = NULL; */ } else if( updateXui ) { gameRenderer->DisableUpdateThread(); - levelRenderer->setLevel(idx, nullptr); + levelRenderer->setLevel(idx, NULL); gameRenderer->EnableUpdateThread(); ui.CloseUIScenes(idx,true); updatePlayerViewportAssignments(); @@ -1199,22 +1197,22 @@ void Minecraft::applyFrameMouseLook() // Per-frame mouse look: consume mouse deltas every frame instead of waiting // for the 20Hz game tick. Apply the same delta to both xRot/yRot AND xRotO/yRotO // so the render interpolation instantly reflects the change without waiting for a tick. - if (level == nullptr) return; + if (level == NULL) return; for (int i = 0; i < XUSER_MAX_COUNT; i++) { - if (localplayers[i] == nullptr) continue; + if (localplayers[i] == NULL) continue; int iPad = localplayers[i]->GetXboxPad(); if (iPad != 0) continue; // Mouse only applies to pad 0 if (!g_KBMInput.IsMouseGrabbed()) continue; - if (localgameModes[iPad] == nullptr) continue; + if (localgameModes[iPad] == NULL) continue; float rawDx, rawDy; g_KBMInput.ConsumeMouseDelta(rawDx, rawDy); if (rawDx == 0.0f && rawDy == 0.0f) continue; - float mouseSensitivity = static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; + float mouseSensitivity = ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; float mdx = rawDx * mouseSensitivity; float mdy = -rawDy * mouseSensitivity; if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook)) @@ -1267,12 +1265,12 @@ void Minecraft::run_middle() AABB::resetPool(); Vec3::resetPool(); - // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed + // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed // stop(); // } // 4J-PB - AUTOSAVE TIMER - only in the full game and if the player is the host - if(level!=nullptr && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost()) + if(level!=NULL && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost()) { /*if(!bAutosaveTimerSet) { @@ -1295,7 +1293,7 @@ void Minecraft::run_middle() if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack(); @@ -1392,7 +1390,7 @@ void Minecraft::run_middle() } // When we go into the first loaded level, check if the console has active joypads that are not in the game, and bring up the quadrant display to remind them to press start (if the session has space) - if(level!=nullptr && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace()) + if(level!=NULL && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace()) { // have a short delay before the display if(iFirstTimeCountdown==0) @@ -1403,7 +1401,7 @@ void Minecraft::run_middle() { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if((localplayers[i] == nullptr) && InputManager.IsPadConnected(i)) + if((localplayers[i] == NULL) && InputManager.IsPadConnected(i)) { if(!ui.PressStartPlaying(i)) { @@ -1420,10 +1418,10 @@ void Minecraft::run_middle() for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { #ifdef __ORBIS__ - if ( m_pPsPlusUpsell != nullptr && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i ) + if ( m_pPsPlusUpsell != NULL && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i ) { delete m_pPsPlusUpsell; - m_pPsPlusUpsell = nullptr; + m_pPsPlusUpsell = NULL; if ( ProfileManager.HasPlayStationPlus(i) ) { @@ -1624,7 +1622,7 @@ void Minecraft::run_middle() // 4J Stu - Check that content restriction information has been received if( !g_NetworkManager.IsLocalGame() ) { - tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,nullptr,nullptr,nullptr); + tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,NULL,NULL,NULL); } #endif if(tryJoin) @@ -1664,7 +1662,7 @@ void Minecraft::run_middle() { #ifdef __ORBIS__ bool contentRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,nullptr,&contentRestricted,nullptr); // TODO! + ProfileManager.GetChatAndContentRestrictions(i,false,NULL,&contentRestricted,NULL); // TODO! if (!g_NetworkManager.IsLocalGame() && contentRestricted) { @@ -1692,7 +1690,7 @@ void Minecraft::run_middle() if(g_NetworkManager.IsLocalGame() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,NULL,NULL); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, i ); @@ -1705,7 +1703,7 @@ void Minecraft::run_middle() { // create the localplayer shared_ptr player = localplayers[i]; - if( player == nullptr) + if( player == NULL) { player = createExtraLocalPlayer(i, (convStringToWstring( ProfileManager.GetGamertag(i) )).c_str(), i, level->dimension->id); } @@ -1779,7 +1777,7 @@ void Minecraft::run_middle() int firstEmptyUser = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if(localplayers[i] == nullptr) + if(localplayers[i] == NULL) { firstEmptyUser = i; break; @@ -1813,7 +1811,7 @@ void Minecraft::run_middle() } #endif - if (pause && level != nullptr) + if (pause && level != NULL) { float lastA = timer->a; timer->advanceTime(); @@ -1842,13 +1840,13 @@ void Minecraft::run_middle() { // 4J - If we are waiting for this connection to do something, then tick it here. // This replaces many of the original Java scenes which would tick the connection while showing that scene - if( m_pendingLocalConnections[idx] != nullptr ) + if( m_pendingLocalConnections[idx] != NULL ) { m_pendingLocalConnections[idx]->tick(); } // reset the player inactive tick - if(localplayers[idx]!=nullptr) + if(localplayers[idx]!=NULL) { // any input received? if((localplayers[idx]->ullButtonsPressed!=0) || InputManager.GetJoypadStick_LX(idx,false)!=0.0f || @@ -1932,8 +1930,8 @@ void Minecraft::run_middle() // if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed // 4J-PB - changing this to be per player - //if (player != nullptr && player->isInWall()) options->thirdPersonView = false; - if (player != nullptr && player->isInWall()) player->SetThirdPersonView(0); + //if (player != NULL && player->isInWall()) options->thirdPersonView = false; + if (player != NULL && player->isInWall()) player->SetThirdPersonView(0); if (!noRender) { @@ -1944,7 +1942,7 @@ void Minecraft::run_middle() if( setLocalPlayerIdx(i) ) { PIXBeginNamedEvent(0,"Game render player idx %d",i); - RenderManager.StateSetViewport(static_cast(player->m_iScreenSection)); + RenderManager.StateSetViewport((C4JRender::eViewportType)player->m_iScreenSection); gameRenderer->render(timer->a, bFirst); bFirst = false; PIXEndNamedEvent(); @@ -1972,7 +1970,7 @@ void Minecraft::run_middle() if( unoccupiedQuadrant > -1 ) { // render a logo - RenderManager.StateSetViewport(static_cast(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant)); + RenderManager.StateSetViewport((C4JRender::eViewportType)(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2043,7 +2041,7 @@ void Minecraft::run_middle() // checkScreenshot(); // 4J - removed /* 4J - removed - if (parent != nullptr && !fullscreen) + if (parent != NULL && !fullscreen) { if (parent.getWidth() != width || parent.getHeight() != height) { @@ -2060,7 +2058,7 @@ void Minecraft::run_middle() checkGlError(L"Post render"); MemSect(0); frames++; - //pause = !isClientSide() && screen != nullptr && screen->isPauseScreen(); + //pause = !isClientSide() && screen != NULL && screen->isPauseScreen(); //pause = g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()); pause = app.IsAppPaused(); @@ -2112,7 +2110,7 @@ void Minecraft::emergencySave() levelRenderer->clear(); AABB::clearPool(); Vec3::clearPool(); - setLevel(nullptr); + setLevel(NULL); } void Minecraft::renderFpsMeter(int64_t tickTime) @@ -2131,7 +2129,7 @@ void Minecraft::renderFpsMeter(int64_t tickTime) glMatrixMode(GL_PROJECTION); glEnable(GL_COLOR_MATERIAL); glLoadIdentity(); - glOrtho(0, static_cast(width), static_cast(height), 0, 1000, 3000); + glOrtho(0, (float)width, (float)height, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -2142,16 +2140,16 @@ void Minecraft::renderFpsMeter(int64_t tickTime) t->begin(GL_QUADS); int hh1 = (int) (nsPer60Fps / 200000); t->color(0x20000000); - t->vertex(static_cast(0), static_cast(height - hh1), static_cast(0)); - t->vertex(static_cast(0), static_cast(height), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height - hh1), static_cast(0)); + t->vertex((float)(0), (float)( height - hh1), (float)( 0)); + t->vertex((float)(0), (float)( height), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1), (float)( 0)); t->color(0x20200000); - t->vertex(static_cast(0), static_cast(height - hh1 * 2), static_cast(0)); - t->vertex(static_cast(0), static_cast(height - hh1), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height - hh1), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height - hh1 * 2), static_cast(0)); + t->vertex((float)(0), (float)( height - hh1 * 2), (float)( 0)); + t->vertex((float)(0), (float)( height - hh1), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0)); t->end(); int64_t totalTime = 0; @@ -2159,13 +2157,13 @@ void Minecraft::renderFpsMeter(int64_t tickTime) { totalTime += Minecraft::frameTimes[i]; } - int hh = static_cast(totalTime / 200000 / Minecraft::frameTimes_length); + int hh = (int) (totalTime / 200000 / Minecraft::frameTimes_length); t->begin(GL_QUADS); t->color(0x20400000); - t->vertex(static_cast(0), static_cast(height - hh), static_cast(0)); - t->vertex(static_cast(0), static_cast(height), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height), static_cast(0)); - t->vertex(static_cast(Minecraft::frameTimes_length), static_cast(height - hh), static_cast(0)); + t->vertex((float)(0), (float)( height - hh), (float)( 0)); + t->vertex((float)(0), (float)( height), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height), (float)( 0)); + t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh), (float)( 0)); t->end(); t->begin(GL_LINES); for (int i = 0; i < Minecraft::frameTimes_length; i++) @@ -2187,16 +2185,16 @@ void Minecraft::renderFpsMeter(int64_t tickTime) int64_t time = Minecraft::frameTimes[i] / 200000; int64_t time2 = Minecraft::tickTimes[i] / 200000; - t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), static_cast(0)); - t->vertex((float)(i + 0.5f), (float)( height + 0.5f), static_cast(0)); + t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0)); + t->vertex((float)(i + 0.5f), (float)( height + 0.5f), (float)( 0)); // if (Minecraft.frameTimes[i]>nsPer60Fps) { t->color(0xff000000 + cc * 65536 + cc * 256 + cc * 1); // } else { // t.color(0xff808080 + cc/2 * 256); // } - t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), static_cast(0)); - t->vertex((float)(i + 0.5f), (float)( height - (time - time2) + 0.5f), static_cast(0)); + t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0)); + t->vertex((float)(i + 0.5f), (float)( height - (time - time2) + 0.5f), (float)( 0)); } t->end(); @@ -2211,7 +2209,7 @@ void Minecraft::stop() void Minecraft::pauseGame() { - if (screen != nullptr) return; + if (screen != NULL) return; // setScreen(new PauseScreen()); // 4J - TODO put back in } @@ -2223,7 +2221,7 @@ void Minecraft::resize(int width, int height) this->width = width; this->height = height; - if (screen != nullptr) + if (screen != NULL) { ScreenSizeCalculator ssc(options, width, height); int screenWidth = ssc.getWidth(); @@ -2257,7 +2255,7 @@ void Minecraft::verify() void Minecraft::levelTickUpdateFunc(void* pParam) { - Level* pLevel = static_cast(pParam); + Level* pLevel = (Level*)pParam; pLevel->tick(); } @@ -2290,10 +2288,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) gameRenderer->pick(1); #if 0 // 4J - removed - we don't use ChunkCache anymore - if (player != nullptr) + if (player != NULL) { ChunkSource *cs = level->getChunkSource(); - if (dynamic_cast(cs) != nullptr) + if (dynamic_cast(cs) != NULL) { ChunkCache *spcc = (ChunkCache *)cs; @@ -2307,7 +2305,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // soundEngine.playMusicTick(); - if (!pause && level != nullptr) gameMode->tick(); + if (!pause && level != NULL) gameMode->tick(); MemSect(31); glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); //L"/terrain.png")); MemSect(0); @@ -2325,33 +2323,33 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) * progressRenderer.progressStagePercentage(0); } else { * serverConnection.tick(); serverConnection.sendPosition(player); } } */ - if (screen == nullptr && player != nullptr ) + if (screen == NULL && player != NULL ) { if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) ) { - setScreen(nullptr); + setScreen(NULL); } - else if (player->isSleeping() && level != nullptr && level->isClientSide) + else if (player->isSleeping() && level != NULL && level->isClientSide) { // setScreen(new InBedChatScreen()); // 4J - TODO put back in } } - else if (screen != nullptr && (dynamic_cast(screen)!=nullptr) && !player->isSleeping()) + else if (screen != NULL && (dynamic_cast(screen)!=NULL) && !player->isSleeping()) { - setScreen(nullptr); + setScreen(NULL); } - if (screen != nullptr) + if (screen != NULL) { player->missTime = 10000; player->lastClickTick[0] = ticks + 10000; player->lastClickTick[1] = ticks + 10000; } - if (screen != nullptr) + if (screen != NULL) { screen->updateEvents(); - if (screen != nullptr) + if (screen != NULL) { screen->particles->tick(); screen->tick(); @@ -2359,13 +2357,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef _WINDOWS64 - if ((screen != nullptr || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed()) + if ((screen != NULL || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); } #endif - if (screen == nullptr && !ui.GetMenuDisplayed(iPad) ) + if (screen == NULL && !ui.GetMenuDisplayed(iPad) ) { #ifdef _WINDOWS64 if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused()) @@ -2477,7 +2475,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piAlt=-1; // 4J-PB another special case for when the player is sleeping in a bed - if (player->isSleeping() && (level != nullptr) && level->isClientSide) + if (player->isSleeping() && (level != NULL) && level->isClientSide) { *piUse=IDS_TOOLTIPS_WAKEUP; } @@ -2533,8 +2531,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Item::spiderEye_Id: // Check that we are actually hungry so will eat this item { - FoodItem *food = static_cast(itemInstance->getItem()); - if (food != nullptr && food->canEat(player)) + FoodItem *food = (FoodItem *)itemInstance->getItem(); + if (food != NULL && food->canEat(player)) { *piUse=IDS_TOOLTIPS_EAT; } @@ -2612,7 +2610,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } } - if (hitResult!=nullptr) + if (hitResult!=NULL) { switch(hitResult->type) { @@ -2627,7 +2625,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) int iTileID=level->getTile(x,y ,z ); int iData = level->getData(x, y, z); - if( gameMode != nullptr && gameMode->getTutorial() != nullptr ) + if( gameMode != NULL && gameMode->getTutorial() != NULL ) { // 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints gameMode->getTutorial()->onLookAt(iTileID,iData); @@ -2641,7 +2639,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) * for noteblocks, enderportals and flowerpots in case of non-standard items. * (ie. ignite behaviour) */ - if (bUseItemOn && itemInstance!=nullptr) + if (bUseItemOn && itemInstance!=NULL) { switch (itemInstance->getItem()->id) { @@ -2736,7 +2734,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Tile::chest_Id: *piAction = IDS_TOOLTIPS_MINE; - *piUse = (Tile::chest->getContainer(level,x,y,z) != nullptr) ? IDS_TOOLTIPS_OPEN : -1; + *piUse = (Tile::chest->getContainer(level,x,y,z) != NULL) ? IDS_TOOLTIPS_OPEN : -1; break; case Tile::enderChest_Id: @@ -2805,7 +2803,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Tile::jukebox_Id: - if (!bUseItemOn && itemInstance!=nullptr) + if (!bUseItemOn && itemInstance!=NULL) { int iID=itemInstance->getItem()->id; if ( (iID>=Item::record_01_Id) && (iID<=Item::record_12_Id) ) @@ -2825,7 +2823,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Tile::flowerPot_Id: - if ( !bUseItemOn && (itemInstance != nullptr) && (iData == 0) ) + if ( !bUseItemOn && (itemInstance != NULL) && (iData == 0) ) { int iID = itemInstance->getItem()->id; if (iID<256) // is it a tile? @@ -2886,7 +2884,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case HitResult::ENTITY: eINSTANCEOF entityType = hitResult->entity->GetType(); - if ( (gameMode != nullptr) && (gameMode->getTutorial() != nullptr) ) + if ( (gameMode != NULL) && (gameMode->getTutorial() != NULL) ) { // 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints gameMode->getTutorial()->onLookAtEntity(hitResult->entity); @@ -2897,7 +2895,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { heldItem = player->inventory->getSelected(); } - int heldItemId = heldItem != nullptr ? heldItem->getItem()->id : -1; + int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1; switch(entityType) { @@ -3332,7 +3330,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) shared_ptr itemFrame = dynamic_pointer_cast(hitResult->entity); // is the frame occupied? - if(itemFrame->getItem()!=nullptr) + if(itemFrame->getItem()!=NULL) { // rotate the item *piUse=IDS_TOOLTIPS_ROTATE; @@ -3363,7 +3361,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_ZOMBIE: { shared_ptr zomb = dynamic_pointer_cast(hitResult->entity); - static GoldenAppleItem *goldapple = static_cast(Item::apple_gold); + static GoldenAppleItem *goldapple = (GoldenAppleItem *) Item::apple_gold; //zomb->hasEffect(MobEffect::weakness) - not present on client. if ( zomb->isVillager() && zomb->isWeakened() && (heldItemId == Item::apple_gold_Id) && !goldapple->isFoil(heldItem) ) @@ -3535,7 +3533,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { player->inventory->swapPaint(wheel); - if( gameMode != nullptr && gameMode->getTutorial() != nullptr ) + if( gameMode != NULL && gameMode->getTutorial() != NULL ) { // 4J Stu - For the tutorial we want to be able to record what items we are using so that we can give hints gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected()); @@ -3685,7 +3683,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) app.EnableDebugOverlay(options->renderDebug,iPad); #else // 4J Stu - The xbox uses a completely different way of navigating to this scene - ui.NavigateToScene(0, eUIScene_DebugOverlay, nullptr, eUILayer_Debug); + ui.NavigateToScene(0, eUIScene_DebugOverlay, NULL, eUILayer_Debug); #endif #endif } @@ -3749,7 +3747,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) app.LoadCreativeMenu(iPad,player); } // 4J-PB - Microsoft request that we use the 3x3 crafting if someone presses X while at the workbench - else if ((hitResult!=nullptr) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id)) + else if ((hitResult!=NULL) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id)) { //ui.PlayUISFX(eSFX_Press); //app.LoadXuiCrafting3x3Menu(iPad,player,hitResult->x, hitResult->y, hitResult->z); @@ -3771,7 +3769,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { app.DebugPrintf("PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n",player->GetXboxPad()); ui.PlayUISFX(eSFX_Press); - ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene); } if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_DROP)) @@ -3806,12 +3804,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item int iCount=0; - if(selectedItem != nullptr) iCount=selectedItem->GetCount(); - if(selectedItem != nullptr && !( (player->ullButtonsPressed&(1LL<GetCount() == 1)) + if(selectedItem != NULL) iCount=selectedItem->GetCount(); + if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<GetCount() == 1)) { itemName = selectedItem->getHoverName(); } - if( !(player->ullButtonsPressed&(1LL<GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName ); + if( !(player->ullButtonsPressed&(1LL<GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName ); } } else @@ -3819,7 +3817,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // 4J-PB if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && gameMode->isInputAllowed(ACTION_MENU_CANCEL)) { - setScreen(nullptr); + setScreen(NULL); } } @@ -3843,7 +3841,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) #if 0 // 4J - TODO - some replacement for input handling... - if (screen == nullptr || screen.passEvents) + if (screen == NULL || screen.passEvents) { while (Mouse.next()) { @@ -3986,9 +3984,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #endif - if (level != nullptr) + if (level != NULL) { - if (player != nullptr) + if (player != NULL) { recheckPlayerIn++; if (recheckPlayerIn == 30) @@ -4034,7 +4032,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // 4J - this doesn't fully tick the animateTick here, but does register this player's position. The actual // work is now done in Level::animateTickDoWork() so we can take into account multiple players in the one level. - if (!pause && levels[i] != nullptr) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); + if (!pause && levels[i] != NULL) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); if( levelsTickedFlags & ( 1 << i ) ) continue; // Don't tick further if we've already ticked this level this frame levelsTickedFlags |= (1 << i); @@ -4047,7 +4045,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // level.addEntity(player); // } // } - if( levels[i] != nullptr ) + if( levels[i] != NULL ) { if (!pause) { @@ -4063,7 +4061,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) int currPlayerIdx = getLocalPlayerIdx(); for( int idx = 0; idx < XUSER_MAX_COUNT; idx++ ) { - if(localplayers[idx]!=nullptr) + if(localplayers[idx]!=NULL) { if( localplayers[idx]->level == levels[i] ) { @@ -4141,7 +4139,7 @@ void Minecraft::reloadSound() bool Minecraft::isClientSide() { - return level != nullptr && level->isClientSide; + return level != NULL && level->isClientSide; } void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings) @@ -4160,8 +4158,8 @@ bool Minecraft::loadSlot(const wstring& userName, int slot) void Minecraft::releaseLevel(int message) { - //this->level = nullptr; - setLevel(nullptr, message); + //this->level = NULL; + setLevel(NULL, message); } // 4J Stu - This code was within setLevel, but I moved it out so that I can call it at a better @@ -4192,14 +4190,14 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension) // 4J Stu - Removed as redundant with default values in params. //void Minecraft::setLevel(Level *level, bool doForceStatsSave /*= true*/) //{ -// setLevel(level, -1, nullptr, doForceStatsSave); +// setLevel(level, -1, NULL, doForceStatsSave); //} // Also causing ambiguous call for some reason // as it is matching shared_ptr from the func below with bool from this one //void Minecraft::setLevel(Level *level, const wstring& message, bool doForceStatsSave /*= true*/) //{ -// setLevel(level, message, nullptr, doForceStatsSave); +// setLevel(level, message, NULL, doForceStatsSave); //} void Minecraft::forceaddLevel(MultiPlayerLevel *level) @@ -4210,13 +4208,13 @@ void Minecraft::forceaddLevel(MultiPlayerLevel *level) else levels[0] = level; } -void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr forceInsertPlayer /*=nullptr*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) +void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) { EnterCriticalSection(&m_setLevelCS); bool playerAdded = false; this->cameraTargetPlayer = nullptr; - if(progressRenderer != nullptr) + if(progressRenderer != NULL) { this->progressRenderer->progressStart(message); this->progressRenderer->progressStage(-1); @@ -4225,80 +4223,80 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // 4J-PB - since we now play music in the menu, just let it keep playing //soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); - // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-nullptr + // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-NULL gameRenderer->DisableUpdateThread(); for(unsigned int i = 0; i < levels.length; ++i) { - // 4J We only need to save out in multiplayer is we are setting the level to nullptr + // 4J We only need to save out in multiplayer is we are setting the level to NULL // If we ever go back to making single player only then this will not work properly! - if (levels[i] != nullptr && level == nullptr) + if (levels[i] != NULL && level == NULL) { // 4J Stu - This is really only relevant for single player (ie not what we do at the moment) - if((doForceStatsSave==true) && player!=nullptr) + if((doForceStatsSave==true) && player!=NULL) forceStatsSave(player->GetXboxPad() ); - // 4J Stu - Added these for the case when we exit a level so we are setting the level to nullptr - // The level renderer needs to have it's stored level set to nullptr so that it doesn't break next time we set one - if (levelRenderer != nullptr) + // 4J Stu - Added these for the case when we exit a level so we are setting the level to NULL + // The level renderer needs to have it's stored level set to NULL so that it doesn't break next time we set one + if (levelRenderer != NULL) { for(DWORD p = 0; p < XUSER_MAX_COUNT; ++p) { - levelRenderer->setLevel(p, nullptr); + levelRenderer->setLevel(p, NULL); } } - if (particleEngine != nullptr) particleEngine->setLevel(nullptr); + if (particleEngine != NULL) particleEngine->setLevel(NULL); } } - // 4J If we are setting the level to nullptr then we are exiting, so delete the levels - if( level == nullptr ) + // 4J If we are setting the level to NULL then we are exiting, so delete the levels + if( level == NULL ) { - if(levels[0]!=nullptr) + if(levels[0]!=NULL) { delete levels[0]; - levels[0] = nullptr; + levels[0] = NULL; // Both level share the same savedDataStorage - if(levels[1]!=nullptr) levels[1]->savedDataStorage = nullptr; + if(levels[1]!=NULL) levels[1]->savedDataStorage = NULL; } - if(levels[1]!=nullptr) + if(levels[1]!=NULL) { delete levels[1]; - levels[1] = nullptr; + levels[1] = NULL; } - if(levels[2]!=nullptr) + if(levels[2]!=NULL) { delete levels[2]; - levels[2] = nullptr; + levels[2] = NULL; } // Delete all the player objects for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { shared_ptr mplp = localplayers[idx]; - if(mplp != nullptr && mplp->connection != nullptr ) + if(mplp != NULL && mplp->connection != NULL ) { delete mplp->connection; - mplp->connection = nullptr; + mplp->connection = NULL; } - if( localgameModes[idx] != nullptr ) + if( localgameModes[idx] != NULL ) { delete localgameModes[idx]; - localgameModes[idx] = nullptr; + localgameModes[idx] = NULL; } - if( m_pendingLocalConnections[idx] != nullptr ) + if( m_pendingLocalConnections[idx] != NULL ) { delete m_pendingLocalConnections[idx]; - m_pendingLocalConnections[idx] = nullptr; + m_pendingLocalConnections[idx] = NULL; } localplayers[idx] = nullptr; } // If we are removing the primary player then there can't be a valid gamemode left anymore, this // pointer will be referring to the one we've just deleted - gameMode = nullptr; + gameMode = NULL; // Remove references to player player = nullptr; cameraTargetPlayer = nullptr; @@ -4307,7 +4305,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt } this->level = level; - if (level != nullptr) + if (level != NULL) { int dimId = level->dimension->id; if (dimId == -1) levels[1] = level; @@ -4316,7 +4314,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // If no player has been set, then this is the first level to be set this game, so set up // a primary player & initialise some other things - if (player == nullptr) + if (player == NULL) { int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); @@ -4337,7 +4335,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`. // To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer); - if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -4360,32 +4358,32 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt for(int i=0;iresetPos(); // gameMode.initPlayer(player); - if (level != nullptr) + if (level != NULL) { level->addEntity(player); playerAdded = true; } } - if(player->input != nullptr) delete player->input; + if(player->input != NULL) delete player->input; player->input = new Input(); - if (levelRenderer != nullptr) levelRenderer->setLevel(player->GetXboxPad(), level); - if (particleEngine != nullptr) particleEngine->setLevel(level); + if (levelRenderer != NULL) levelRenderer->setLevel(player->GetXboxPad(), level); + if (particleEngine != NULL) particleEngine->setLevel(level); #if 0 // 4J - removed - we don't use ChunkCache anymore ChunkSource *cs = level->getChunkSource(); - if (dynamic_cast(cs) != nullptr) + if (dynamic_cast(cs) != NULL) { ChunkCache *spcc = (ChunkCache *)cs; @@ -4400,7 +4398,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt for(int i=0;iclearAll(); player = nullptr; - // Clear all players if the new level is nullptr + // Clear all players if the new level is NULL for(int i=0;iclose(); - m_pendingLocalConnections[i] = nullptr; + if( m_pendingLocalConnections[i] != NULL ) m_pendingLocalConnections[i]->close(); + m_pendingLocalConnections[i] = NULL; localplayers[i] = nullptr; - localgameModes[i] = nullptr; + localgameModes[i] = NULL; } } @@ -4432,7 +4430,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt void Minecraft::prepareLevel(int title) { - if(progressRenderer != nullptr) + if(progressRenderer != NULL) { this->progressRenderer->progressStart(title); this->progressRenderer->progressStage(IDS_PROGRESS_BUILDING_TERRAIN); @@ -4445,15 +4443,15 @@ void Minecraft::prepareLevel(int title) ChunkSource *cs = level->getChunkSource(); Pos *spawnPos = level->getSharedSpawnPos(); - if (player != nullptr) + if (player != NULL) { - spawnPos->x = static_cast(player->x); - spawnPos->z = static_cast(player->z); + spawnPos->x = (int) player->x; + spawnPos->z = (int) player->z; } #if 0 // 4J - removed - we don't use ChunkCache anymore - if (dynamic_cast(cs)!=nullptr) + if (dynamic_cast(cs)!=NULL) { ChunkCache *spcc = (ChunkCache *) cs; @@ -4465,7 +4463,7 @@ void Minecraft::prepareLevel(int title) { for (int z = -r; z <= r; z += 16) { - if(progressRenderer != nullptr) this->progressRenderer->progressStagePercentage((pp++) * 100 / max); + if(progressRenderer != NULL) this->progressRenderer->progressStagePercentage((pp++) * 100 / max); level->getTile(spawnPos->x + x, 64, spawnPos->z + z); if (!gameMode->isCutScene()) { } @@ -4474,7 +4472,7 @@ void Minecraft::prepareLevel(int title) delete spawnPos; if (!gameMode->isCutScene()) { - if(progressRenderer != nullptr) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD); + if(progressRenderer != NULL) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD); max = 2000; } } @@ -4510,7 +4508,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->validateSpawn(); level->removeAllPendingEntityRemovals(); - if (localPlayer != nullptr) + if (localPlayer != NULL) { level->removeEntity(localPlayer); } @@ -4531,7 +4529,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) #ifdef _WINDOWS64 // Same compatibility rule as create/init paths. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad); - if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -4595,7 +4593,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->addEntity(player); gameMode->initPlayer(player); - if(player->input != nullptr) delete player->input; + if(player->input != NULL) delete player->input; player->input = new Input(); player->entityId = newEntityId; player->animateRespawn(); @@ -4611,7 +4609,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) //SetEvent(m_hPlayerRespawned); player->SetPlayerRespawned(true); - if (dynamic_cast(screen) != nullptr) setScreen(nullptr); + if (dynamic_cast(screen) != NULL) setScreen(NULL); gameRenderer->EnableUpdateThread(); } @@ -4643,9 +4641,9 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const */ Minecraft *minecraft; - // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); + // 4J - was new Minecraft(frame, canvas, NULL, 854, 480, fullScreen); - minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen); + minecraft = new Minecraft(NULL, NULL, NULL, 1280, 720, fullScreen); /* - 4J - removed { @@ -4666,7 +4664,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const // 4J Stu - We never want the player to be DemoUser, we always want them to have their gamertag displayed //if (ProfileManager.IsFullVersion()) { - if (userName != L"" && sid != L"") // 4J - username & side were compared with nullptr rather than empty strings + if (userName != L"" && sid != L"") // 4J - username & side were compared with NULL rather than empty strings { minecraft->user = new User(userName, sid); } @@ -4681,7 +4679,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const //} /* 4J - TODO - if (url != nullptr) + if (url != NULL) { String[] tokens = url.split(":"); minecraft.connectTo(tokens[0], Integer.parseInt(tokens[1])); @@ -4746,7 +4744,7 @@ void Minecraft::main() #if 0 for(unsigned int i = 0; i < Item::items.length; ++i) { - if(Item::items[i] != nullptr) + if(Item::items[i] != NULL) { app.DebugPrintf("%ls\n", i, app.GetString( Item::items[i]->getDescriptionId() )); } @@ -4756,7 +4754,7 @@ void Minecraft::main() for(unsigned int i = 0; i < 256; ++i) { - if(Tile::tiles[i] != nullptr) + if(Tile::tiles[i] != NULL) { app.DebugPrintf("%ls\n", i, app.GetString( Tile::tiles[i]->getDescriptionId() )); } @@ -4788,7 +4786,7 @@ void Minecraft::main() bool Minecraft::renderNames() { - if (m_instance == nullptr || !m_instance->options->hideGui) + if (m_instance == NULL || !m_instance->options->hideGui) { return true; } @@ -4797,17 +4795,17 @@ bool Minecraft::renderNames() bool Minecraft::useFancyGraphics() { - return (m_instance != nullptr && m_instance->options->fancyGraphics); + return (m_instance != NULL && m_instance->options->fancyGraphics); } bool Minecraft::useAmbientOcclusion() { - return (m_instance != nullptr && m_instance->options->ambientOcclusion != Options::AO_OFF); + return (m_instance != NULL && m_instance->options->ambientOcclusion != Options::AO_OFF); } bool Minecraft::renderDebug() { - return (m_instance != nullptr && m_instance->options->renderDebug); + return (m_instance != NULL && m_instance->options->renderDebug); } bool Minecraft::handleClientSideCommand(const wstring& chatMessage) @@ -4846,7 +4844,7 @@ if (gameMode->instaBuild) return; if (!down) missTime = 0; if (button == 0 && missTime > 0) return; -if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button == 0) +if (down && hitResult != NULL && hitResult->type == HitResult::TILE && button == 0) { int x = hitResult->x; int y = hitResult->y; @@ -4878,7 +4876,7 @@ bool mayUse = true; // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button -if(button==1 && (player->isSleeping() && level != nullptr && level->isClientSide)) +if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide)) { shared_ptr mplp = dynamic_pointer_cast( player ); @@ -4892,9 +4890,9 @@ if(mplp) mplp->StopSleeping(); //} } -if (hitResult == nullptr) +if (hitResult == NULL) { -if (button == 0 && !(dynamic_cast(gameMode) != nullptr)) missTime = 10; +if (button == 0 && !(dynamic_cast(gameMode) != NULL)) missTime = 10; } else if (hitResult->type == HitResult::ENTITY) { @@ -4930,21 +4928,21 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f); else { shared_ptr item = player->inventory->getSelected(); -int oldCount = item != nullptr ? item->count : 0; +int oldCount = item != NULL ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { mayUse = false; app.DebugPrintf("Player %d is swinging\n",player->GetXboxPad()); player->swing(); } -if (item == nullptr) +if (item == NULL) { return; } if (item->count == 0) { -player->inventory->items[player->inventory->selected] = nullptr; +player->inventory->items[player->inventory->selected] = NULL; } else if (item->count != oldCount) { @@ -4956,7 +4954,7 @@ gameRenderer->itemInHandRenderer->itemPlaced(); if (mayUse && button == 1) { shared_ptr item = player->inventory->getSelected(); -if (item != nullptr) +if (item != NULL) { if (gameMode->useItem(player, level, item)) { @@ -4977,7 +4975,7 @@ bool Minecraft::isTutorial() { return m_inFullTutorialBits > 0; - /*if( gameMode != nullptr && gameMode->isTutorial() ) + /*if( gameMode != NULL && gameMode->isTutorial() ) { return true; } @@ -5012,7 +5010,7 @@ void Minecraft::playerLeftTutorial(int iPad) #ifndef _XBOX_ONE for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(localplayers[idx] != nullptr) + if(localplayers[idx] != NULL) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -5043,7 +5041,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP { // create the local player for the iPad shared_ptr player = pClass->localplayers[iPad]; - if( player == nullptr) + if( player == NULL) { if( pClass->level->isClientSide ) { @@ -5053,7 +5051,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP { // create the local player for the iPad shared_ptr player = pClass->localplayers[iPad]; - if( player == nullptr) + if( player == NULL) { player = pClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pClass->level->dimension->id); } @@ -5070,7 +5068,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad, int int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) #endif { - Minecraft* pMinecraftClass = static_cast(pParam); + Minecraft* pMinecraftClass = (Minecraft*)pParam; if(g_NetworkManager.IsInSession()) { @@ -5081,7 +5079,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) } // If sign in succeded, we're in game and this player isn't already playing, continue - if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == nullptr) + if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == NULL) { // It's possible that the player has not signed in - they can back out or choose no for the converttoguest if(ProfileManager.IsSignedIn(iPad)) @@ -5107,7 +5105,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) { #ifdef __ORBIS__ bool contentRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&contentRestricted,nullptr); // TODO! + ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&contentRestricted,NULL); // TODO! if (!g_NetworkManager.IsLocalGame() && contentRestricted) { @@ -5128,7 +5126,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) { // create the local player for the iPad shared_ptr player = pMinecraftClass->localplayers[iPad]; - if( player == nullptr) + if( player == NULL) { player = pMinecraftClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pMinecraftClass->level->dimension->id); } @@ -5197,7 +5195,7 @@ ColourTable *Minecraft::getColourTable() ColourTable *colours = selected->getColourTable(); - if(colours == nullptr) + if(colours == NULL) { colours = skins->getDefault()->getColourTable(); } diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 2c5203d8..91c20c14 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -114,7 +114,7 @@ public: void addPendingLocalConnection(int idx, ClientConnection *connection); void connectionDisconnected(int idx, DisconnectPacket::eDisconnectReason reason) { m_connectionFailed[idx] = true; m_connectionFailedReason[idx] = reason; } - shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = nullptr,MultiPlayerLevel *levelpassedin=nullptr); + shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); void createPrimaryLocalPlayer(int iPad); bool setLocalPlayerIdx(int idx); int getLocalPlayerIdx(); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index de9d26b9..55b02cb9 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -66,7 +66,7 @@ #define DEBUG_SERVER_DONT_SPAWN_MOBS 0 //4J Added -MinecraftServer *MinecraftServer::server = nullptr; +MinecraftServer *MinecraftServer::server = NULL; bool MinecraftServer::setTimeAtEndOfTick = false; int64_t MinecraftServer::setTime = 0; bool MinecraftServer::setTimeOfDayAtEndOfTick = false; @@ -97,17 +97,17 @@ static bool ShouldUseDedicatedServerProperties() static int GetDedicatedServerInt(Settings *settings, const wchar_t *key, int defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getInt(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getInt(key, defaultValue) : defaultValue; } static bool GetDedicatedServerBool(Settings *settings, const wchar_t *key, bool defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getBoolean(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getBoolean(key, defaultValue) : defaultValue; } static wstring GetDedicatedServerString(Settings *settings, const wchar_t *key, const wstring &defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getString(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getString(key, defaultValue) : defaultValue; } static void PrintConsoleLine(const wchar_t *prefix, const wstring &message) @@ -148,12 +148,12 @@ static wstring JoinConsoleCommandTokens(const vector &tokens, size_t st static shared_ptr FindPlayerByName(PlayerList *playerList, const wstring &name) { - if (playerList == nullptr) return nullptr; + if (playerList == NULL) return nullptr; for (size_t i = 0; i < playerList->players.size(); ++i) { shared_ptr player = playerList->players[i]; - if (player != nullptr && equalsIgnoreCase(player->getName(), name)) + if (player != NULL && equalsIgnoreCase(player->getName(), name)) { return player; } @@ -166,7 +166,7 @@ static void SetAllLevelTimes(MinecraftServer *server, int value) { for (unsigned int i = 0; i < server->levels.length; ++i) { - if (server->levels[i] != nullptr) + if (server->levels[i] != NULL) { server->levels[i]->setDayTime(value); } @@ -175,7 +175,7 @@ static void SetAllLevelTimes(MinecraftServer *server, int value) static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCommand) { - if (server == nullptr) + if (server == NULL) return false; wstring command = trimString(rawCommand); @@ -209,9 +209,9 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (action == L"list") { - wstring playerNames = (playerList != nullptr) ? playerList->getPlayerNames() : L""; + wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L""; if (playerNames.empty()) playerNames = L"(none)"; - server->info(L"Players (" + std::to_wstring((playerList != nullptr) ? playerList->getPlayerCount() : 0) + L"): " + playerNames); + server->info(L"Players (" + std::to_wstring((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames); return true; } @@ -224,9 +224,9 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } wstring message = L"[Server] " + JoinConsoleCommandTokens(tokens, 1); - if (playerList != nullptr) + if (playerList != NULL) { - playerList->broadcastAll(std::make_shared(message)); + playerList->broadcastAll(shared_ptr(new ChatPacket(message))); } server->info(message); return true; @@ -234,9 +234,9 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (action == L"save-all") { - if (playerList != nullptr) + if (playerList != NULL) { - playerList->saveAll(nullptr, false); + playerList->saveAll(NULL, false); } server->info(L"World saved."); return true; @@ -267,7 +267,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom for (unsigned int i = 0; i < server->levels.length; ++i) { - if (server->levels[i] != nullptr) + if (server->levels[i] != NULL) { server->levels[i]->setDayTime(server->levels[i]->getDayTime() + delta); } @@ -323,7 +323,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom return false; } - if (server->levels[0] == nullptr) + if (server->levels[0] == NULL) { server->warn(L"The overworld is not loaded."); return false; @@ -370,12 +370,12 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom shared_ptr subject = FindPlayerByName(playerList, tokens[1]); shared_ptr destination = FindPlayerByName(playerList, tokens[2]); - if (subject == nullptr) + if (subject == NULL) { server->warn(L"Unknown player: " + tokens[1]); return false; } - if (destination == nullptr) + if (destination == NULL) { server->warn(L"Unknown player: " + tokens[2]); return false; @@ -401,7 +401,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == nullptr) + if (player == NULL) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -425,7 +425,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom server->warn(L"Invalid aux value: " + tokens[4]); return false; } - if (itemId <= 0 || Item::items[itemId] == nullptr) + if (itemId <= 0 || Item::items[itemId] == NULL) { server->warn(L"Unknown item id: " + std::to_wstring(itemId)); return false; @@ -438,7 +438,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom shared_ptr itemInstance(new ItemInstance(itemId, amount, aux)); shared_ptr drop = player->drop(itemInstance); - if (drop != nullptr) + if (drop != NULL) { drop->throwTime = 0; } @@ -455,7 +455,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == nullptr) + if (player == NULL) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -475,14 +475,14 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr selectedItem = player->getSelectedItem(); - if (selectedItem == nullptr) + if (selectedItem == NULL) { server->warn(L"The player is not holding an item."); return false; } Enchantment *enchantment = Enchantment::enchantments[enchantmentId]; - if (enchantment == nullptr) + if (enchantment == NULL) { server->warn(L"Unknown enchantment id: " + std::to_wstring(enchantmentId)); return false; @@ -499,12 +499,12 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (selectedItem->hasTag()) { ListTag *enchantmentTags = selectedItem->getEnchantmentTags(); - if (enchantmentTags != nullptr) + if (enchantmentTags != NULL) { for (int i = 0; i < enchantmentTags->size(); i++) { int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); - if (Enchantment::enchantments[type] != nullptr && !Enchantment::enchantments[type]->isCompatibleWith(enchantment)) + if (Enchantment::enchantments[type] != NULL && !Enchantment::enchantments[type]->isCompatibleWith(enchantment)) { server->warn(L"That enchantment conflicts with an existing enchantment on the selected item."); return false; @@ -527,7 +527,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == nullptr) + if (player == NULL) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -545,10 +545,10 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom MinecraftServer::MinecraftServer() { // 4J - added initialisers - connection = nullptr; - settings = nullptr; - players = nullptr; - commands = nullptr; + connection = NULL; + settings = NULL; + players = NULL; + commands = NULL; running = true; m_bLoaded = false; stopped = false; @@ -567,7 +567,7 @@ MinecraftServer::MinecraftServer() m_texturePackId = 0; maxBuildHeight = Level::maxBuildHeight; playerIdleTimeout = 0; - m_postUpdateThread = nullptr; + m_postUpdateThread = NULL; forceGameType = false; commandDispatcher = new ServerCommandDispatcher(); @@ -690,10 +690,10 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW #endif // 4J-JEV: Need to wait for levelGenerationOptions to load. - while ( app.getLevelGenerationOptions() != nullptr && !app.getLevelGenerationOptions()->hasLoadedData() ) + while ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->hasLoadedData() ) Sleep(1); - if ( app.getLevelGenerationOptions() != nullptr && !app.getLevelGenerationOptions()->ready() ) + if ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->ready() ) { // TODO: Stop loading, add error message. } @@ -704,7 +704,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW wstring levelTypeString; bool gameRuleUseFlatWorld = false; - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { gameRuleUseFlatWorld = app.getLevelGenerationOptions()->getuseFlatWorld(); } @@ -718,7 +718,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW } LevelType *pLevelType = LevelType::getLevelType(levelTypeString); - if (pLevelType == nullptr) + if (pLevelType == NULL) { pLevelType = LevelType::lvl_normal; } @@ -773,7 +773,7 @@ int MinecraftServer::runPostUpdate(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::ePostProcessThread); - MinecraftServer *server = static_cast(lpParam); + MinecraftServer *server = (MinecraftServer *)lpParam; Entity::useSmallIds(); // This thread can end up spawning entities as resources IntCache::CreateNewThreadStorage(); AABB::CreateNewThreadStorage(); @@ -868,7 +868,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) } } while ( status == WAIT_TIMEOUT ); delete m_postUpdateThread; - m_postUpdateThread = nullptr; + m_postUpdateThread = NULL; DeleteCriticalSection(&m_postProcessCS); } @@ -894,7 +894,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring // 4J - temp - load existing level shared_ptr storage = nullptr; bool levelChunksNeedConverted = false; - if( initData->saveData != nullptr ) + if( initData->saveData != NULL ) { // We are loading a file from disk with the data passed in @@ -910,7 +910,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring levelChunksNeedConverted = true; pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 - storage = std::make_shared(pSave, File(L"."), name, true); + storage = shared_ptr(new McRegionLevelStorage(pSave, File(L"."), name, true)); } else { @@ -918,13 +918,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring #ifdef SPLIT_SAVES bool bLevelGenBaseSave = false; LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if( levelGen != nullptr && levelGen->requiresBaseSave()) + if( levelGen != NULL && levelGen->requiresBaseSave()) { DWORD fileSize = 0; LPVOID pvSaveData = levelGen->getBaseSaveData(fileSize); if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; } - ConsoleSaveFileSplit *newFormatSave = nullptr; + ConsoleSaveFileSplit *newFormatSave = NULL; if(bLevelGenBaseSave) { ConsoleSaveFileOriginal oldFormatSave( L"" ); @@ -937,7 +937,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring storage = shared_ptr(new McRegionLevelStorage(newFormatSave, File(L"."), name, true)); #else - storage = std::make_shared(new ConsoleSaveFileOriginal(L""), File(L"."), name, true); + storage = shared_ptr(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true)); #endif } @@ -958,11 +958,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if (i == 0) { levels[i] = new ServerLevel(this, storage, name, dimension, levelSettings); - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *mapOptions = app.getLevelGenerationOptions(); Pos *spawnPos = mapOptions->getSpawnPos(); - if( spawnPos != nullptr ) + if( spawnPos != NULL ) { levels[i]->setSpawnPos( spawnPos ); } @@ -987,7 +987,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring #endif levels[i]->getLevelData()->setGameType(gameType); - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *mapOptions = app.getLevelGenerationOptions(); levels[i]->getLevelData()->setHasBeenInCreative(mapOptions->getLevelHasBeenInCreative() ); @@ -1044,7 +1044,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring ba_gameRules.length = fe->getFileSize(); ba_gameRules.data = new BYTE[ ba_gameRules.length ]; - csf->setFilePointer(fe,0,nullptr,FILE_BEGIN); + csf->setFilePointer(fe,0,NULL,FILE_BEGIN); csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead); assert(numberOfBytesRead == ba_gameRules.length); @@ -1355,7 +1355,7 @@ void MinecraftServer::saveAllChunks() // with the data from the nethers leveldata. // Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting. ServerLevel *level = levels[levels.length - 1 - i]; - if( level ) // 4J - added check as level can be nullptr if we end up in stopServer really early on due to network failure + if( level ) // 4J - added check as level can be NULL if we end up in stopServer really early on due to network failure { level->save(true, Minecraft::GetInstance()->progressRenderer); @@ -1381,14 +1381,14 @@ void MinecraftServer::saveGameRules() #endif { byteArray ba; - ba.data = nullptr; + ba.data = NULL; app.m_gameRules.saveGameRules( &ba.data, &ba.length ); - if (ba.data != nullptr) + if (ba.data != NULL) { ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME)); - csf->setFilePointer(fe, 0, nullptr, FILE_BEGIN); + csf->setFilePointer(fe, 0, NULL, FILE_BEGIN); DWORD length; csf->writeFile(fe, ba.data, ba.length, &length ); @@ -1407,14 +1407,14 @@ void MinecraftServer::Suspend() LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; float fElapsedTime = 0.0f; QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); + float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; // Save the start time QueryPerformanceCounter( &qwTime ); if(m_bLoaded && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled())) { - if (players != nullptr) + if (players != NULL) { - players->saveAll(nullptr); + players->saveAll(NULL); } for (unsigned int j = 0; j < levels.length; j++) { @@ -1428,13 +1428,13 @@ void MinecraftServer::Suspend() if( !s_bServerHalted ) { saveGameRules(); - levels[0]->saveToDisc(nullptr, true); + levels[0]->saveToDisc(NULL, true); } } QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); // 4J-JEV: Flush stats and call PlayerSessionExit. for (int iPad = 0; iPad < XUSER_MAX_COUNT; iPad++) @@ -1487,7 +1487,7 @@ void MinecraftServer::stopServer(bool didInit) // if trial version or saving is disabled, then don't save anything. Also don't save anything if we didn't actually get through the server initialisation. if(m_saveOnExit && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()) && didInit) { - if (players != nullptr) + if (players != NULL) { players->saveAll(Minecraft::GetInstance()->progressRenderer, true); } @@ -1497,7 +1497,7 @@ void MinecraftServer::stopServer(bool didInit) //for (unsigned int i = levels.length - 1; i >= 0; i--) //{ // ServerLevel *level = levels[i]; - // if (level != nullptr) + // if (level != NULL) // { saveAllChunks(); // } @@ -1505,7 +1505,7 @@ void MinecraftServer::stopServer(bool didInit) saveGameRules(); app.m_gameRules.unloadCurrentGameRules(); - if( levels[0] != nullptr ) // This can be null if stopServer happens very quickly due to network error + if( levels[0] != NULL ) // This can be null if stopServer happens very quickly due to network error { levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, false); } @@ -1528,10 +1528,10 @@ void MinecraftServer::stopServer(bool didInit) unsigned int iServerLevelC=levels.length; for (unsigned int i = 0; i < iServerLevelC; i++) { - if(levels[i]!=nullptr) + if(levels[i]!=NULL) { delete levels[i]; - levels[i] = nullptr; + levels[i] = NULL; } } @@ -1541,11 +1541,11 @@ void MinecraftServer::stopServer(bool didInit) #endif delete connection; - connection = nullptr; + connection = NULL; delete players; - players = nullptr; + players = NULL; delete settings; - settings = nullptr; + settings = NULL; g_NetworkManager.ServerStopped(); } @@ -1703,12 +1703,12 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout) extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; void MinecraftServer::run(int64_t seed, void *lpParameter) { - NetworkGameInitData *initData = nullptr; + NetworkGameInitData *initData = NULL; DWORD initSettings = 0; bool findSeed = false; - if(lpParameter != nullptr) + if(lpParameter != NULL) { - initData = static_cast(lpParameter); + initData = (NetworkGameInitData *)lpParameter; initSettings = app.GetGameHostOption(eGameHostOption_All); findSeed = initData->findSeed; m_texturePackId = initData->texturePackId; @@ -1849,9 +1849,9 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) // Save the start time QueryPerformanceCounter( &qwTime ); - if (players != nullptr) + if (players != NULL) { - players->saveAll(nullptr); + players->saveAll(NULL); } for (unsigned int j = 0; j < levels.length; j++) @@ -1862,7 +1862,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) // Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting. ServerLevel *level = levels[levels.length - 1 - j]; PIXBeginNamedEvent(0, "Saving level %d",levels.length - 1 - j); - level->save(false, nullptr, true); + level->save(false, NULL, true); PIXEndNamedEvent(); } if( !s_bServerHalted ) @@ -1886,12 +1886,12 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) #endif case eXuiServerAction_SaveGame: app.EnterSaveNotificationSection(); - if (players != nullptr) + if (players != NULL) { players->saveAll(Minecraft::GetInstance()->progressRenderer); } - players->broadcastAll(std::make_shared(20)); + players->broadcastAll( shared_ptr( new UpdateProgressPacket(20) ) ); for (unsigned int j = 0; j < levels.length; j++) { @@ -1902,7 +1902,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) ServerLevel *level = levels[levels.length - 1 - j]; level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame)); - players->broadcastAll(std::make_shared(33 + (j * 33))); + players->broadcastAll( shared_ptr( new UpdateProgressPacket(33 + (j*33) ) ) ); } if( !s_bServerHalted ) { @@ -1917,13 +1917,13 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) { shared_ptr player = players->players.at(0); size_t id = (size_t) param; - player->drop(std::make_shared(id, 1, 0)); + player->drop( shared_ptr( new ItemInstance(id, 1, 0 ) ) ); } break; case eXuiServerAction_SpawnMob: { shared_ptr player = players->players.at(0); - eINSTANCEOF factory = static_cast((size_t)param); + eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); shared_ptr mob = dynamic_pointer_cast(EntityIO::newByEnumType(factory,player->level )); mob->moveTo(player->x+1, player->y, player->z+1, player->level->random->nextFloat() * 360, 0); mob->setDespawnProtected(); // 4J added, default to being protected against despawning (has to be done after initial position is set) @@ -1952,14 +1952,14 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) } break; case eXuiServerAction_ServerSettingChanged_Gamertags: - players->broadcastAll(std::make_shared(ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags))); + players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) ); break; case eXuiServerAction_ServerSettingChanged_BedrockFog: - players->broadcastAll(std::make_shared(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All))); + players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) ); break; case eXuiServerAction_ServerSettingChanged_Difficulty: - players->broadcastAll(std::make_shared(ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty)); + players->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) ); break; case eXuiServerAction_ExportSchematic: #ifndef _CONTENT_PACKAGE @@ -1969,7 +1969,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) if( !s_bServerHalted ) { - ConsoleSchematicFile::XboxSchematicInitParam *initData = static_cast(param); + ConsoleSchematicFile::XboxSchematicInitParam *initData = (ConsoleSchematicFile::XboxSchematicInitParam *)param; #ifdef _XBOX File targetFileDir(File::pathRoot + File::pathSeparator + L"Schematics"); #else @@ -1995,7 +1995,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) case eXuiServerAction_SetCameraLocation: #ifndef _CONTENT_PACKAGE { - DebugSetCameraPosition *pos = static_cast(param); + DebugSetCameraPosition *pos = (DebugSetCameraPosition *)param; app.DebugPrintf( "DEBUG: Player=%i\n", pos->player ); app.DebugPrintf( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking at=(%f.2,%f.2)\n", @@ -2060,14 +2060,14 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) void MinecraftServer::broadcastStartSavingPacket() { - players->broadcastAll(std::make_shared(GameEventPacket::START_SAVING, 0));; + players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );; } void MinecraftServer::broadcastStopSavingPacket() { if( !s_bServerHalted ) { - players->broadcastAll(std::make_shared(GameEventPacket::STOP_SAVING, 0));; + players->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );; } } @@ -2122,13 +2122,13 @@ void MinecraftServer::tick() if (tickCount % 20 == 0) { - players->broadcastAll(std::make_shared(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)), level->dimension->id); + players->broadcastAll( shared_ptr( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id); } // #ifndef __PS3__ static int64_t stc = 0; int64_t st0 = System::currentTimeMillis(); PIXBeginNamedEvent(0,"Level tick %d",i); - static_cast(level)->tick(); + ((Level *)level)->tick(); int64_t st1 = System::currentTimeMillis(); PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Update lights %d",i); @@ -2178,7 +2178,7 @@ void MinecraftServer::tick() // 4J - removed #if 0 - for (size_t i = 0; i < tickables.size(); i++) { + for (int i = 0; i < tickables.size(); i++) { tickables.get(i)-tick(); } #endif @@ -2220,14 +2220,14 @@ void MinecraftServer::main(int64_t seed, void *lpParameter) server = new MinecraftServer(); server->run(seed, lpParameter); delete server; - server = nullptr; + server = NULL; ShutdownManager::HasFinished(ShutdownManager::eServerThread ); } void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) { s_bServerHalted = true; - if( server != nullptr ) + if( server != NULL ) { m_bPrimaryPlayerSignedOut=bPrimaryPlayerSignedOut; server->halt(); @@ -2273,9 +2273,9 @@ void MinecraftServer::setLevel(int dimension, ServerLevel *level) bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player) { if( s_hasSentEnoughPackets ) return false; - if( player == nullptr ) return false; + if( player == NULL ) return false; - for( size_t i = 0; i < s_sentTo.size(); i++ ) + for( int i = 0; i < s_sentTo.size(); i++ ) { if( s_sentTo[i]->IsSameSystem(player) ) { @@ -2357,7 +2357,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() // not GetSessionIndex() (smallId), so reused smallIds after many connect/disconnects still get chunk sends. bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player) { - if( player == nullptr ) return false; + if( player == NULL ) return false; int time = GetTickCount(); DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount(); @@ -2403,7 +2403,7 @@ void MinecraftServer::cycleSlowQueueIndex() if( !g_NetworkManager.IsInSession() ) return; int startingIndex = s_slowQueuePlayerIndex; - INetworkPlayer *currentPlayer = nullptr; + INetworkPlayer *currentPlayer = NULL; DWORD currentPlayerCount = 0; do { @@ -2425,7 +2425,7 @@ void MinecraftServer::cycleSlowQueueIndex() } while ( g_NetworkManager.IsInSession() && currentPlayerCount > 0 && s_slowQueuePlayerIndex != startingIndex && - currentPlayer != nullptr && + currentPlayer != NULL && currentPlayer->IsLocal() ); // app.DebugPrintf("Cycled slow queue index to %d\n", s_slowQueuePlayerIndex); diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index a33888bc..28909791 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -52,9 +52,9 @@ typedef struct _NetworkGameInitData _NetworkGameInitData() { seed = 0; - saveData = nullptr; + saveData = NULL; settings = 0; - levelGen = nullptr; + levelGen = NULL; texturePackId = 0; findSeed = false; xzSize = LEVEL_LEGACY_WIDTH; @@ -236,7 +236,8 @@ private: public: void addPostProcessRequest(ChunkSource *chunkSource, int x, int z); - static PlayerList *getPlayerList() { if( server != nullptr) return server->players; else return nullptr; } +public: + static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; } static void SetTimeOfDay(int64_t time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; } static void SetTime(int64_t time) { setTimeAtEndOfTick = true; setTime = time; } diff --git a/Minecraft.Client/Minimap.cpp b/Minecraft.Client/Minimap.cpp index 4f6ccd6b..65c6d5f2 100644 --- a/Minecraft.Client/Minimap.cpp +++ b/Minecraft.Client/Minimap.cpp @@ -133,10 +133,10 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrvertexUV((float)(x + 0 + vo), (float)( y + h - vo), (float)( Offset), static_cast(0), static_cast(1)); - t->vertexUV((float)(x + w - vo), (float)( y + h - vo), (float)( Offset), static_cast(1), static_cast(1)); - t->vertexUV((float)(x + w - vo), (float)( y + 0 + vo), (float)( Offset), static_cast(1), static_cast(0)); - t->vertexUV((float)(x + 0 + vo), (float)( y + 0 + vo), (float)( Offset), static_cast(0), static_cast(0)); + t->vertexUV((float)(x + 0 + vo), (float)( y + h - vo), (float)( Offset), (float)( 0), (float)( 1)); + t->vertexUV((float)(x + w - vo), (float)( y + h - vo), (float)( Offset), (float)( 1), (float)( 1)); + t->vertexUV((float)(x + w - vo), (float)( y + 0 + vo), (float)( Offset), (float)( 1), (float)( 0)); + t->vertexUV((float)(x + 0 + vo), (float)( y + 0 + vo), (float)( Offset), (float)( 0), (float)( 0)); t->end(); glEnable(GL_ALPHA_TEST); glDisable(GL_BLEND); @@ -165,9 +165,9 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrentityId != entityId) continue; glPushMatrix(); @@ -182,10 +182,10 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrbegin(); - t->vertexUV(static_cast(-1), static_cast(+1), static_cast(0), (float)( u0), (float)( v0)); - t->vertexUV(static_cast(+1), static_cast(+1), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV(static_cast(+1), static_cast(-1), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV(static_cast(-1), static_cast(-1), static_cast(0), (float)( u0), (float)( v1)); + t->vertexUV((float)(-1), (float)( +1), (float)( 0), (float)( u0), (float)( v0)); + t->vertexUV((float)(+1), (float)( +1), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(+1), (float)( -1), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(-1), (float)( -1), (float)( 0), (float)( u0), (float)( v1)); t->end(); glPopMatrix(); fIconZ-=0.01f; @@ -201,9 +201,9 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrimg; imgIndex -= 16; - // 4J Stu - For item frame renders, the player is nullptr. We do not want to show player icons on the frames. - if(player == nullptr && (imgIndex != 12)) continue; - else if (player != nullptr && imgIndex == 12) continue; + // 4J Stu - For item frame renders, the player is NULL. We do not want to show player icons on the frames. + if(player == NULL && (imgIndex != 12)) continue; + else if (player != NULL && imgIndex == 12) continue; else if( imgIndex == 12 && dec->entityId != entityId) continue; glPushMatrix(); @@ -218,10 +218,10 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrbegin(); - t->vertexUV(static_cast(-1), static_cast(+1), static_cast(0), (float)( u0), (float)( v0)); - t->vertexUV(static_cast(+1), static_cast(+1), static_cast(0), (float)( u1), (float)( v0)); - t->vertexUV(static_cast(+1), static_cast(-1), static_cast(0), (float)( u1), (float)( v1)); - t->vertexUV(static_cast(-1), static_cast(-1), static_cast(0), (float)( u0), (float)( v1)); + t->vertexUV((float)(-1), (float)( +1), (float)( 0), (float)( u0), (float)( v0)); + t->vertexUV((float)(+1), (float)( +1), (float)( 0), (float)( u1), (float)( v0)); + t->vertexUV((float)(+1), (float)( -1), (float)( 0), (float)( u1), (float)( v1)); + t->vertexUV((float)(-1), (float)( -1), (float)( 0), (float)( u0), (float)( v1)); t->end(); glPopMatrix(); fIconZ-=0.01f; @@ -239,7 +239,7 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptr entity, double x, double y, double { shared_ptr roper = entity->getLeashHolder(); // roper = entityRenderDispatcher.cameraEntity; - if (roper != nullptr) + if (roper != NULL) { glColor4f(1.0f, 1.0f, 1.0f, 1.0f); @@ -61,9 +61,9 @@ void MobRenderer::renderLeash(shared_ptr entity, double x, double y, double x += rotOffCos; z += rotOffSin; - double dx = static_cast(endX - startX); - double dy = static_cast(endY - startY); - double dz = static_cast(endZ - startZ); + double dx = (float) (endX - startX); + double dy = (float) (endY - startY); + double dz = (float) (endZ - startZ); glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); @@ -92,9 +92,9 @@ void MobRenderer::renderLeash(shared_ptr entity, double x, double y, double { tessellator->color(rDarkCol, gDarkCol, bDarkCol, 1.0F); } - float aa = static_cast(k) / static_cast(steps); - tessellator->vertex(x + (dx * aa) + 0, y + (dy * ((aa * aa) + aa) * 0.5) + (((static_cast(steps) - static_cast(k)) / (steps * 0.75F)) + 0.125F), z + (dz * aa)); - tessellator->vertex(x + (dx * aa) + width, y + (dy * ((aa * aa) + aa) * 0.5) + (((static_cast(steps) - static_cast(k)) / (steps * 0.75F)) + 0.125F) + width, z + (dz * aa)); + float aa = (float) k / (float) steps; + tessellator->vertex(x + (dx * aa) + 0, y + (dy * ((aa * aa) + aa) * 0.5) + ((((float) steps - (float) k) / (steps * 0.75F)) + 0.125F), z + (dz * aa)); + tessellator->vertex(x + (dx * aa) + width, y + (dy * ((aa * aa) + aa) * 0.5) + ((((float) steps - (float) k) / (steps * 0.75F)) + 0.125F) + width, z + (dz * aa)); } tessellator->end(); @@ -109,9 +109,9 @@ void MobRenderer::renderLeash(shared_ptr entity, double x, double y, double { tessellator->color(rDarkCol, gDarkCol, bDarkCol, 1.0F); } - float aa = static_cast(k) / static_cast(steps); - tessellator->vertex(x + (dx * aa) + 0, y + (dy * ((aa * aa) + aa) * 0.5) + (((static_cast(steps) - static_cast(k)) / (steps * 0.75F)) + 0.125F) + width, z + (dz * aa)); - tessellator->vertex(x + (dx * aa) + width, y + (dy * ((aa * aa) + aa) * 0.5) + (((static_cast(steps) - static_cast(k)) / (steps * 0.75F)) + 0.125F), z + (dz * aa) + width); + float aa = (float) k / (float) steps; + tessellator->vertex(x + (dx * aa) + 0, y + (dy * ((aa * aa) + aa) * 0.5) + ((((float) steps - (float) k) / (steps * 0.75F)) + 0.125F) + width, z + (dz * aa)); + tessellator->vertex(x + (dx * aa) + width, y + (dy * ((aa * aa) + aa) * 0.5) + ((((float) steps - (float) k) / (steps * 0.75F)) + 0.125F), z + (dz * aa) + width); } tessellator->end(); diff --git a/Minecraft.Client/MobSkinMemTextureProcessor.cpp b/Minecraft.Client/MobSkinMemTextureProcessor.cpp index c841c3f5..a6fdf527 100644 --- a/Minecraft.Client/MobSkinMemTextureProcessor.cpp +++ b/Minecraft.Client/MobSkinMemTextureProcessor.cpp @@ -3,14 +3,14 @@ BufferedImage *MobSkinMemTextureProcessor::process(BufferedImage *in) { - if (in == nullptr) return nullptr; + if (in == NULL) return NULL; width = 64; height = 32; BufferedImage *out = new BufferedImage(width, height, BufferedImage::TYPE_INT_ARGB); Graphics *g = out->getGraphics(); - g->drawImage(in, 0, 0, nullptr); + g->drawImage(in, 0, 0, NULL); g->dispose(); pixels = out->getData(); diff --git a/Minecraft.Client/MobSkinTextureProcessor.cpp b/Minecraft.Client/MobSkinTextureProcessor.cpp index 37d2ab46..dffb467a 100644 --- a/Minecraft.Client/MobSkinTextureProcessor.cpp +++ b/Minecraft.Client/MobSkinTextureProcessor.cpp @@ -3,14 +3,14 @@ BufferedImage *MobSkinTextureProcessor::process(BufferedImage *in) { - if (in == nullptr) return nullptr; + if (in == NULL) return NULL; width = 64; height = 32; BufferedImage *out = new BufferedImage(width, height, BufferedImage::TYPE_INT_ARGB); Graphics *g = out->getGraphics(); - g->drawImage(in, 0, 0, nullptr); + g->drawImage(in, 0, 0, NULL); g->dispose(); pixels = out->getData(); diff --git a/Minecraft.Client/MobSpawnerRenderer.cpp b/Minecraft.Client/MobSpawnerRenderer.cpp index 1a083fab..02aac27f 100644 --- a/Minecraft.Client/MobSpawnerRenderer.cpp +++ b/Minecraft.Client/MobSpawnerRenderer.cpp @@ -16,15 +16,15 @@ void MobSpawnerRenderer::render(shared_ptr _spawner, double x, doubl void MobSpawnerRenderer::render(BaseMobSpawner *spawner, double x, double y, double z, float a) { glPushMatrix(); - glTranslatef(static_cast(x) + 0.5f, static_cast(y), static_cast(z) + 0.5f); + glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); shared_ptr e = spawner->getDisplayEntity(); - if (e != nullptr) + if (e != NULL) { e->setLevel(spawner->getLevel()); float s = 7 / 16.0f; glTranslatef(0, 0.4f, 0); - glRotatef(static_cast(spawner->oSpin + (spawner->spin - spawner->oSpin) * a) * 10, 0, 1, 0); + glRotatef((float) (spawner->oSpin + (spawner->spin - spawner->oSpin) * a) * 10, 0, 1, 0); glRotatef(-30, 1, 0, 0); glTranslatef(0, -0.4f, 0); glScalef(s, s, s); diff --git a/Minecraft.Client/Model.h b/Minecraft.Client/Model.h index 6a797a25..5a4b6f2e 100644 --- a/Minecraft.Client/Model.h +++ b/Minecraft.Client/Model.h @@ -23,8 +23,8 @@ public: virtual void render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {} virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr entity, unsigned int uiBitmaskOverrideAnim=0) {} virtual void prepareMobModel(shared_ptr mob, float time, float r, float a) {} - virtual ModelPart *getRandomModelPart(Random random) {return cubes.at(random.nextInt(static_cast(cubes.size())));} - virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return nullptr;} + virtual ModelPart *getRandomModelPart(Random random) {return cubes.at(random.nextInt((int)cubes.size()));} + virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} void setMapTex(wstring id, int x, int y); TexOffs *getMapTex(wstring id); diff --git a/Minecraft.Client/ModelHorse.cpp b/Minecraft.Client/ModelHorse.cpp index 81ff7ea6..7a13d0ad 100644 --- a/Minecraft.Client/ModelHorse.cpp +++ b/Minecraft.Client/ModelHorse.cpp @@ -252,7 +252,7 @@ void ModelHorse::render(shared_ptr entity, float time, float r, float bo bool largeEars = type == EntityHorse::TYPE_DONKEY || type == EntityHorse::TYPE_MULE; float sizeFactor = entityhorse->getFoalScale(); - bool rider = (entityhorse->rider.lock() != nullptr); + bool rider = (entityhorse->rider.lock() != NULL); if (saddled) { @@ -401,7 +401,7 @@ void ModelHorse::prepareMobModel(shared_ptr mob, float wp, float w float openMouth = entityhorse->getMouthAnim(a); bool tail = entityhorse->tailCounter != 0; bool saddled = entityhorse->isSaddled(); - bool rider = entityhorse->rider.lock() != nullptr; + bool rider = entityhorse->rider.lock() != NULL; float bob = mob->tickCount + a; float legAnim1 = cos((wp * 0.6662f) + 3.141593f); diff --git a/Minecraft.Client/ModelPart.cpp b/Minecraft.Client/ModelPart.cpp index e423a4ae..c59a821c 100644 --- a/Minecraft.Client/ModelPart.cpp +++ b/Minecraft.Client/ModelPart.cpp @@ -65,7 +65,7 @@ void ModelPart::construct(Model *model, int xTexOffs, int yTexOffs) void ModelPart::addChild(ModelPart *child) { - //if (children == nullptr) children = new ModelPartArray; + //if (children == NULL) children = new ModelPartArray; children.push_back(child); } @@ -89,7 +89,7 @@ ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox) } } - return nullptr; + return NULL; } ModelPart *ModelPart::mirror() @@ -139,7 +139,7 @@ void ModelPart::addBox(float x0, float y0, float z0, int w, int h, int d, float void ModelPart::addTexBox(float x0, float y0, float z0, int w, int h, int d, int tex) { - cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, static_cast(tex))); + cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, (float)tex)); } void ModelPart::setPos(float x, float y, float z) @@ -180,7 +180,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != nullptr) + //if (children != NULL) { for (unsigned int i = 0; i < children.size(); i++) { @@ -208,7 +208,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != nullptr) + //if (children != NULL) { for (unsigned int i = 0; i < children.size(); i++) { @@ -234,7 +234,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != nullptr) + //if (children != NULL) { for (unsigned int i = 0; i < children.size(); i++) { @@ -307,8 +307,8 @@ void ModelPart::compile(float scale) ModelPart *ModelPart::setTexSize(int xs, int ys) { - this->xTexSize = static_cast(xs); - this->yTexSize = static_cast(ys); + this->xTexSize = (float)xs; + this->yTexSize = (float)ys; return this; } diff --git a/Minecraft.Client/MultiPlayerChunkCache.cpp b/Minecraft.Client/MultiPlayerChunkCache.cpp index 62361ce3..a4c200be 100644 --- a/Minecraft.Client/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/MultiPlayerChunkCache.cpp @@ -65,7 +65,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level) { if( y >= 3 ) { - static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); + ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); } } } @@ -77,18 +77,18 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level) { if( y >= ( level->getSeaLevel() - 1 ) ) { - static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); + ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); } else { - static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2); + ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2); } } } } else { - waterChunk = nullptr; + waterChunk = NULL; } this->level = level; @@ -132,7 +132,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z) int idx = ix * XZSIZE + iz; LevelChunk *chunk = cache[idx]; - if( chunk == nullptr ) + if( chunk == NULL ) { return false; } @@ -166,7 +166,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z) LevelChunk *chunk = cache[idx]; LevelChunk *lastChunk = chunk; - if( chunk == nullptr ) + if( chunk == NULL ) { EnterCriticalSection(&m_csLoadCreate); @@ -174,7 +174,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z) if( g_NetworkManager.IsHost() ) // force here to disable sharing of data { // 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted. - if (MinecraftServer::getInstance()->serverHalted()) return nullptr; + if (MinecraftServer::getInstance()->serverHalted()) return NULL; // If we're the host, then don't create the chunk, share data from the server's copy #ifdef _LARGE_WORLDS @@ -248,7 +248,7 @@ LevelChunk *MultiPlayerChunkCache::getChunk(int x, int z) int idx = ix * XZSIZE + iz; LevelChunk *chunk = cache[idx]; - if( chunk == nullptr ) + if( chunk == NULL ) { return emptyChunk; } @@ -279,12 +279,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z) vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { - return nullptr; + return NULL; } TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) { - return nullptr; + return NULL; } void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ) @@ -294,7 +294,7 @@ void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chun wstring MultiPlayerChunkCache::gatherStats() { EnterCriticalSection(&m_csLoadCreate); - int size = static_cast(loadedChunkList.size()); + int size = (int)loadedChunkList.size(); LeaveCriticalSection(&m_csLoadCreate); return L"MultiplayerChunkCache: " + std::to_wstring(size); diff --git a/Minecraft.Client/MultiPlayerGameMode.cpp b/Minecraft.Client/MultiPlayerGameMode.cpp index 66fc22a6..5f9fc9de 100644 --- a/Minecraft.Client/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/MultiPlayerGameMode.cpp @@ -75,7 +75,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { - if (minecraft->player->getCarriedItem() != nullptr && dynamic_cast(minecraft->player->getCarriedItem()->getItem()) != nullptr) + if (minecraft->player->getCarriedItem() != NULL && dynamic_cast(minecraft->player->getCarriedItem()->getItem()) != NULL) { return false; } @@ -84,7 +84,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) Level *level = minecraft->level; Tile *oldTile = Tile::tiles[level->getTile(x, y, z)]; - if (oldTile == nullptr) return false; + if (oldTile == NULL) return false; level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, oldTile->id + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT)); @@ -99,7 +99,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (!localPlayerMode->isCreative()) { shared_ptr item = minecraft->player->getSelectedItem(); - if (item != nullptr) + if (item != NULL) { item->mineBlock(level, oldTile->id, x, y, z, minecraft->player); if (item->count == 0) @@ -129,7 +129,7 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) // Skip if we just broke a block — prevents double-break on single clicks if (destroyDelay > 0) return; - connection->send(std::make_shared(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)); + connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) )); creativeDestroyBlock(minecraft, this, x, y, z, face); destroyDelay = 5; } @@ -137,9 +137,9 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) { if (isDestroying) { - connection->send(std::make_shared(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, face)); + connection->send(shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, face))); } - connection->send(std::make_shared(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)); + connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); int t = minecraft->level->getTile(x, y, z); if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player); if (t > 0 && @@ -159,7 +159,7 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) destroyingItem = minecraft->player->getCarriedItem(); destroyProgress = 0; destroyTicks = 0; - minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, static_cast(destroyProgress * 10) - 1); + minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, (int)(destroyProgress * 10) - 1); } } @@ -169,7 +169,7 @@ void MultiPlayerGameMode::stopDestroyBlock() { if (isDestroying) { - connection->send(std::make_shared(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1)); + connection->send(shared_ptr(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1))); } isDestroying = false; @@ -193,7 +193,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { destroyDelay = 5; - connection->send(std::make_shared(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face)); + connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) ); creativeDestroyBlock(minecraft, this, x, y, z, face); return; } @@ -212,7 +212,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (destroyTicks % 4 == 0) { - if (tile != nullptr) + if (tile != NULL) { int iStepSound=tile->soundType->getStepSound(); @@ -225,14 +225,14 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (destroyProgress >= 1) { isDestroying = false; - connection->send(std::make_shared(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face)); + connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) ); destroyBlock(x, y, z, face); destroyProgress = 0; destroyTicks = 0; destroyDelay = 5; } - minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, static_cast(destroyProgress * 10) - 1); + minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, (int)(destroyProgress * 10) - 1); } else { @@ -259,8 +259,8 @@ void MultiPlayerGameMode::tick() bool MultiPlayerGameMode::sameDestroyTarget(int x, int y, int z) { shared_ptr selected = minecraft->player->getCarriedItem(); - bool sameItems = destroyingItem == nullptr && selected == nullptr; - if (destroyingItem != nullptr && selected != nullptr) + bool sameItems = destroyingItem == NULL && selected == NULL; + if (destroyingItem != NULL && selected != NULL) { sameItems = selected->id == destroyingItem->id && @@ -276,7 +276,7 @@ void MultiPlayerGameMode::ensureHasSentCarriedItem() if (newItem != carriedItem) { carriedItem = newItem; - connection->send(std::make_shared(carriedItem)); + connection->send( shared_ptr( new SetCarriedItemPacket(carriedItem) ) ); } } @@ -289,12 +289,12 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha { ensureHasSentCarriedItem(); } - float clickX = static_cast(hit->x) - x; - float clickY = static_cast(hit->y) - y; - float clickZ = static_cast(hit->z) - z; + float clickX = (float) hit->x - x; + float clickY = (float) hit->y - y; + float clickZ = (float) hit->z - z; bool didSomething = false; - if (!player->isSneaking() || player->getCarriedItem() == nullptr) + if (!player->isSneaking() || player->getCarriedItem() == NULL) { int t = level->getTile(x, y, z); if (t > 0 && player->isAllowedToUse(Tile::tiles[t])) @@ -327,15 +327,15 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha } } - if (!didSomething && item != nullptr && dynamic_cast(item->getItem())) + if (!didSomething && item != NULL && dynamic_cast(item->getItem())) { TileItem *tile = dynamic_cast(item->getItem()); if (!tile->mayPlace(level, x, y, z, face, player, item)) return false; } - // 4J Stu - In Java we send the use packet before the above check for item being nullptr + // 4J Stu - In Java we send the use packet before the above check for item being NULL // so the following never gets executed but the packet still gets sent (for opening chests etc) - if(item != nullptr) + if(item != NULL) { if(!didSomething && player->isAllowedToUse(item)) { @@ -379,7 +379,7 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha // Fix for #7904 - Gameplay: Players can dupe torches by throwing them repeatedly into water. if(!bTestUseOnly) { - connection->send(std::make_shared(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ)); + connection->send( shared_ptr( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) ); } return didSomething; } @@ -408,7 +408,7 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share { int oldCount = item->count; shared_ptr itemInstance = item->use(level, player); - if ((itemInstance != nullptr && itemInstance != item) || (itemInstance != nullptr && itemInstance->count != oldCount)) + if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount)) { player->inventory->items[player->inventory->selected] = itemInstance; if (itemInstance->count == 0) @@ -421,27 +421,27 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share if(!bTestUseOnly) { - connection->send(std::make_shared(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0)); + connection->send( shared_ptr( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) ); } return result; } shared_ptr MultiPlayerGameMode::createPlayer(Level *level) { - return std::make_shared(minecraft, level, minecraft->user, connection); + return shared_ptr( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) ); } void MultiPlayerGameMode::attack(shared_ptr player, shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send(std::make_shared(player->entityId, entity->entityId, InteractPacket::ATTACK)); + connection->send( shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) ); player->attack(entity); } bool MultiPlayerGameMode::interact(shared_ptr player, shared_ptr entity) { ensureHasSentCarriedItem(); - connection->send(std::make_shared(player->entityId, entity->entityId, InteractPacket::INTERACT)); + connection->send(shared_ptr( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) ); return player->interact(entity); } @@ -450,36 +450,36 @@ shared_ptr MultiPlayerGameMode::handleInventoryMouseClick(int cont short changeUid = player->containerMenu->backup(player->inventory); shared_ptr clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player); - connection->send(std::make_shared(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid)); + connection->send( shared_ptr( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) ); return clicked; } void MultiPlayerGameMode::handleInventoryButtonClick(int containerId, int buttonId) { - connection->send(std::make_shared(containerId, buttonId)); + connection->send(shared_ptr( new ContainerButtonClickPacket(containerId, buttonId) )); } void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr clicked, int slot) { if (localPlayerMode->isCreative()) { - connection->send(std::make_shared(slot, clicked)); + connection->send(shared_ptr( new SetCreativeModeSlotPacket(slot, clicked) ) ); } } void MultiPlayerGameMode::handleCreativeModeItemDrop(shared_ptr clicked) { - if (localPlayerMode->isCreative() && clicked != nullptr) + if (localPlayerMode->isCreative() && clicked != NULL) { - connection->send(std::make_shared(-1, clicked)); + connection->send(shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); } } void MultiPlayerGameMode::releaseUsingItem(shared_ptr player) { ensureHasSentCarriedItem(); - connection->send(std::make_shared(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255)); + connection->send(shared_ptr( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) ); player->releaseUsingItem(); } @@ -514,7 +514,7 @@ bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr player) { short changeUid = player->containerMenu->backup(player->inventory); - connection->send(std::make_shared(recipe, changeUid)); + connection->send( shared_ptr( new CraftItemPacket(recipe, changeUid) ) ); return true; } @@ -522,5 +522,5 @@ bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr player) void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, shared_ptr player) { player->SetDebugOptions(uiVal); - connection->send(std::make_shared(uiVal)); + connection->send( shared_ptr( new DebugOptionsPacket(uiVal) ) ); } diff --git a/Minecraft.Client/MultiPlayerGameMode.h b/Minecraft.Client/MultiPlayerGameMode.h index fb21bb67..76aa8fc8 100644 --- a/Minecraft.Client/MultiPlayerGameMode.h +++ b/Minecraft.Client/MultiPlayerGameMode.h @@ -42,7 +42,7 @@ private: bool sameDestroyTarget(int x, int y, int z); void ensureHasSentCarriedItem(); public: - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr); + virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); virtual bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); virtual shared_ptr createPlayer(Level *level); virtual void attack(shared_ptr player, shared_ptr entity); @@ -65,5 +65,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial *getTutorial() { return nullptr; } + virtual Tutorial *getTutorial() { return NULL; } }; \ No newline at end of file diff --git a/Minecraft.Client/MultiPlayerLevel.cpp b/Minecraft.Client/MultiPlayerLevel.cpp index 4aede445..29d88b8d 100644 --- a/Minecraft.Client/MultiPlayerLevel.cpp +++ b/Minecraft.Client/MultiPlayerLevel.cpp @@ -26,7 +26,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile, int data) } MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings *levelSettings, int dimension, int difficulty) - : Level(std::make_shared(), L"MpServer", Dimension::getNew(dimension), levelSettings, false) + : Level(shared_ptr(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false) { minecraft = Minecraft::GetInstance(); @@ -43,7 +43,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * levelData->setInitialized(true); } - if(connection !=nullptr) + if(connection !=NULL) { this->connections.push_back( connection ); } @@ -54,7 +54,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * //setSpawnPos(new Pos(8, 64, 8)); // The base ctor already has made some storage, so need to delete that if( this->savedDataStorage ) delete savedDataStorage; - if(connection !=nullptr) + if(connection !=NULL) { savedDataStorage = connection->savedDataStorage; } @@ -70,7 +70,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * MultiPlayerLevel::~MultiPlayerLevel() { // Don't let the base class delete this, it comes from the connection for multiplayerlevels, and we'll delete there - this->savedDataStorage = nullptr; + this->savedDataStorage = NULL; } void MultiPlayerLevel::unshareChunkAt(int x, int z) @@ -465,7 +465,7 @@ void MultiPlayerLevel::entityRemoved(shared_ptr e) void MultiPlayerLevel::putEntity(int id, shared_ptr e) { shared_ptr old = getEntity(id); - if (old != nullptr) + if (old != NULL) { removeEntity(old); } @@ -618,7 +618,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) for (auto& it : connections ) { if ( it ) - it->sendAndDisconnect(std::make_shared(DisconnectPacket::eDisconnect_Quitting)); + it->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } } else @@ -633,7 +633,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) Tickable *MultiPlayerLevel::makeSoundUpdater(shared_ptr minecart) { - return nullptr; //new MinecartSoundUpdater(minecraft->soundEngine, minecart, minecraft->player); + return NULL; //new MinecartSoundUpdater(minecraft->soundEngine, minecart, minecraft->player); } void MultiPlayerLevel::tickWeather() @@ -732,7 +732,7 @@ void MultiPlayerLevel::animateTickDoWork() } } - Minecraft::GetInstance()->animateTickLevel = nullptr; + Minecraft::GetInstance()->animateTickLevel = NULL; delete animateRandom; chunksToAnimate.clear(); @@ -770,18 +770,18 @@ void MultiPlayerLevel::playLocalSound(double x, double y, double z, int iSound, // exhaggerate sound speed effect by making speed of sound ~= // 40 m/s instead of 300 m/s double delayInSeconds = sqrt(minDistSq) / 40.0; - minecraft->soundEngine->schedule(iSound, static_cast(x), static_cast(y), static_cast(z), volume, pitch, static_cast(Math::round(delayInSeconds * SharedConstants::TICKS_PER_SECOND))); + minecraft->soundEngine->schedule(iSound, (float) x, (float) y, (float) z, volume, pitch, (int) Math::round(delayInSeconds * SharedConstants::TICKS_PER_SECOND)); } else { - minecraft->soundEngine->play(iSound, static_cast(x), static_cast(y), static_cast(z), volume, pitch); + minecraft->soundEngine->play(iSound, (float) x, (float) y, (float) z, volume, pitch); } } } void MultiPlayerLevel::createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag) { - minecraft->particleEngine->add(std::make_shared(this, x, y, z, xd, yd, zd, minecraft->particleEngine, infoTag)); + minecraft->particleEngine->add(shared_ptr(new FireworksParticles::FireworksStarter(this, x, y, z, xd, yd, zd, minecraft->particleEngine, infoTag))); } void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard) @@ -860,7 +860,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { shared_ptr e = *it;//entities.at(i); - if (e->riding != nullptr) + if (e->riding != NULL) { if (e->riding->removed || e->riding->rider.lock() != e) { @@ -899,7 +899,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc { if( sendDisconnect ) { - c->sendAndDisconnect(std::make_shared(DisconnectPacket::eDisconnect_Quitting)); + c->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); } auto it = find(connections.begin(), connections.end(), c); @@ -937,11 +937,11 @@ void MultiPlayerLevel::removeUnusedTileEntitiesInRegion(int x0, int y0, int z0, if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { LevelChunk *lc = getChunk(te->x >> 4, te->z >> 4); - if (lc != nullptr) + if (lc != NULL) { // Only remove tile entities where this is no longer a tile entity int tileId = lc->getTile(te->x & 15, te->y, te->z & 15 ); - if( Tile::tiles[tileId] == nullptr || !Tile::tiles[tileId]->isEntityTile()) + if( Tile::tiles[tileId] == NULL || !Tile::tiles[tileId]->isEntityTile()) { tileEntityList[i] = tileEntityList.back(); tileEntityList.pop_back(); diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/MultiPlayerLocalPlayer.cpp index aef7898f..25bf06bf 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp @@ -76,8 +76,8 @@ void MultiplayerLocalPlayer::tick() { if (isRiding()) { - connection->send(std::make_shared(yRot, xRot, onGround, abilities.flying)); - connection->send(std::make_shared(xxa, yya, input->jumping, input->sneaking)); + connection->send(shared_ptr(new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying))); + connection->send(shared_ptr(new PlayerInputPacket(xxa, yya, input->jumping, input->sneaking))); } else { @@ -96,8 +96,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sprinting = isSprinting(); if (sprinting != lastSprinting) { - if (sprinting) connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::START_SPRINTING)); - else connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING)); + if (sprinting) connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING))); + else connection->send(shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING))); lastSprinting = sprinting; } @@ -105,8 +105,8 @@ void MultiplayerLocalPlayer::sendPosition() bool sneaking = isSneaking(); if (sneaking != lastSneaked) { - if (sneaking) connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::START_SNEAKING)); - else connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING)); + if (sneaking) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) ); + else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) ); lastSneaked = sneaking; } @@ -114,8 +114,8 @@ void MultiplayerLocalPlayer::sendPosition() bool idle = isIdle(); if (idle != lastIdle) { - if (idle) connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::START_IDLEANIM)); - else connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM)); + if (idle) connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) ); + else connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) ); lastIdle = idle; } @@ -129,28 +129,28 @@ void MultiplayerLocalPlayer::sendPosition() bool move = (xdd * xdd + ydd1 * ydd1 + zdd * zdd) > 0.03 * 0.03 || positionReminder >= POSITION_REMINDER_INTERVAL; bool rot = rydd != 0 || rxdd != 0; - if (riding != nullptr) + if (riding != NULL) { - connection->send(std::make_shared(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying)); + connection->send( shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); move = false; } else { if (move && rot) { - connection->send(std::make_shared(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying)); + connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) ); } else if (move) { - connection->send(std::make_shared(x, bb->y0, y, z, onGround, abilities.flying)); + connection->send( shared_ptr( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) ); } else if (rot) { - connection->send(std::make_shared(yRot, xRot, onGround, abilities.flying)); + connection->send( shared_ptr( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) ); } else { - connection->send(std::make_shared(onGround, abilities.flying)); + connection->send( shared_ptr( new MovePlayerPacket(onGround, abilities.flying) ) ); } } @@ -175,7 +175,7 @@ void MultiplayerLocalPlayer::sendPosition() shared_ptr MultiplayerLocalPlayer::drop() { - connection->send(std::make_shared(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0)); + connection->send( shared_ptr( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) ); return nullptr; } @@ -185,19 +185,19 @@ void MultiplayerLocalPlayer::reallyDrop(shared_ptr itemEntity) void MultiplayerLocalPlayer::chat(const wstring& message) { - connection->send(std::make_shared(message)); + connection->send( shared_ptr( new ChatPacket(message) ) ); } void MultiplayerLocalPlayer::swing() { LocalPlayer::swing(); - connection->send(std::make_shared(shared_from_this(), AnimatePacket::SWING)); + connection->send( shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) ); } void MultiplayerLocalPlayer::respawn() { - connection->send(std::make_shared(ClientCommandPacket::PERFORM_RESPAWN)); + connection->send( shared_ptr( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN))); } @@ -211,9 +211,9 @@ void MultiplayerLocalPlayer::actuallyHurt(DamageSource *source, float dmg) void MultiplayerLocalPlayer::completeUsingItem() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(useItem != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) + if(useItem != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; Tutorial *tutorial = gameMode->getTutorial(); tutorial->completeUsingItem(useItem); } @@ -223,9 +223,9 @@ void MultiplayerLocalPlayer::completeUsingItem() void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance *effect) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -236,9 +236,9 @@ void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance *effect) void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -249,9 +249,9 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance *effect, bool doR void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != nullptr ) + if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()],true); } @@ -260,7 +260,7 @@ void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) void MultiplayerLocalPlayer::closeContainer() { - connection->send(std::make_shared(containerMenu->containerId)); + connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); clientSideCloseContainer(); } @@ -286,7 +286,7 @@ void MultiplayerLocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damage void MultiplayerLocalPlayer::awardStat(Stat *stat, byteArray param) { - if (stat == nullptr) + if (stat == NULL) { delete [] param.data; return; @@ -305,7 +305,7 @@ void MultiplayerLocalPlayer::awardStat(Stat *stat, byteArray param) void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param) { - if ( stat != nullptr && !stat->awardLocallyOnly ) + if ( stat != NULL && !stat->awardLocallyOnly ) { LocalPlayer::awardStat(stat, param); } @@ -314,7 +314,7 @@ void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param) void MultiplayerLocalPlayer::onUpdateAbilities() { - connection->send(std::make_shared(&abilities)); + connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); } bool MultiplayerLocalPlayer::isLocalPlayer() @@ -324,19 +324,19 @@ bool MultiplayerLocalPlayer::isLocalPlayer() void MultiplayerLocalPlayer::sendRidingJump() { - connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, static_cast(getJumpRidingScale() * 100.0f))); + connection->send(shared_ptr(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, (int) (getJumpRidingScale() * 100.0f)))); } void MultiplayerLocalPlayer::sendOpenInventory() { - connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY)); + connection->send(shared_ptr(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY))); } void MultiplayerLocalPlayer::ride(shared_ptr e) { - bool wasRiding = riding != nullptr; + bool wasRiding = riding != NULL; LocalPlayer::ride(e); - bool isRiding = riding != nullptr; + bool isRiding = riding != NULL; // 4J Added if(wasRiding && !isRiding) @@ -348,7 +348,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) if( isRiding ) { ETelemetryChallenges eventType = eTelemetryChallenges_Unknown; - if( this->riding != nullptr ) + if( this->riding != NULL ) { switch(riding->GetType()) { @@ -370,9 +370,9 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; if(wasRiding && !isRiding) { gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Gameplay); @@ -386,7 +386,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) void MultiplayerLocalPlayer::StopSleeping() { - connection->send(std::make_shared(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING)); + connection->send( shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) ); } // 4J Added @@ -397,7 +397,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId) #ifndef _CONTENT_PACKAGE wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() ); #endif - if(getCustomSkin() != oldSkinIndex) connection->send(std::make_shared(shared_from_this(), app.GetPlayerSkinName(GetXboxPad()))); + if(getCustomSkin() != oldSkinIndex) connection->send( shared_ptr( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) ); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) @@ -407,7 +407,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId) #ifndef _CONTENT_PACKAGE wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str()); #endif - if(getCustomCape() != oldCapeIndex) connection->send(std::make_shared(shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()))); + if(getCustomCape() != oldCapeIndex) connection->send( shared_ptr( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) ); } // 4J added for testing. This moves the player in a repeated sequence of 2 modes: diff --git a/Minecraft.Client/MushroomCowRenderer.cpp b/Minecraft.Client/MushroomCowRenderer.cpp index 277e05d8..b5f9ba9f 100644 --- a/Minecraft.Client/MushroomCowRenderer.cpp +++ b/Minecraft.Client/MushroomCowRenderer.cpp @@ -42,7 +42,7 @@ void MushroomCowRenderer::additionalRendering(shared_ptr _mob, flo glPopMatrix(); glPushMatrix(); - static_cast(model)->head->translateTo(1 / 16.0f); + ((QuadrupedModel *) model)->head->translateTo(1 / 16.0f); glScalef(1, -1, 1); glTranslatef(0, 0.75f, -0.2f); glRotatef(12, 0, 1, 0); diff --git a/Minecraft.Client/NameEntryScreen.cpp b/Minecraft.Client/NameEntryScreen.cpp index f498d4ea..c9df7024 100644 --- a/Minecraft.Client/NameEntryScreen.cpp +++ b/Minecraft.Client/NameEntryScreen.cpp @@ -41,7 +41,7 @@ void NameEntryScreen::buttonClicked(Button button) if (button.id == 0 && trimString(name).length() > 1) { minecraft->saveSlot(slot, trimString(name)); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft->grabMouse(); // 4J - removed } if (button.id == 1) diff --git a/Minecraft.Client/NetherPortalParticle.cpp b/Minecraft.Client/NetherPortalParticle.cpp index 9dcdd4ce..4b70d38f 100644 --- a/Minecraft.Client/NetherPortalParticle.cpp +++ b/Minecraft.Client/NetherPortalParticle.cpp @@ -33,14 +33,14 @@ NetherPortalParticle::NetherPortalParticle(Level *level, double x, double y, dou gCol = (g/255.0f)*br; bCol = (b/255.0f)*br; - lifetime = static_cast(Math::random() * 10) + 40; + lifetime = (int) (Math::random()*10) + 40; noPhysics = true; - setMiscTex(static_cast(Math::random() * 8)); + setMiscTex((int)(Math::random()*8)); } void NetherPortalParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / static_cast(lifetime); + float s = (age + a) / (float) lifetime; s = 1-s; s = s*s; s = 1-s; @@ -53,13 +53,13 @@ int NetherPortalParticle::getLightColor(float a) { int br = Particle::getLightColor(a); - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; pos = pos*pos; pos = pos*pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += static_cast(pos * 15 * 16); + br2 += (int) (pos * 15 * 16); if (br2 > 15 * 16) br2 = 15 * 16; return br1 | br2 << 16; } @@ -67,7 +67,7 @@ int NetherPortalParticle::getLightColor(float a) float NetherPortalParticle::getBrightness(float a) { float br = Particle::getBrightness(a); - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; pos = pos*pos; pos = pos*pos; return br*(1-pos)+pos; @@ -79,7 +79,7 @@ void NetherPortalParticle::tick() yo = y; zo = z; - float pos = age/static_cast(lifetime); + float pos = age/(float)lifetime; float a = pos; pos = -pos+pos*pos*2; // pos = pos*pos; diff --git a/Minecraft.Client/NoteParticle.cpp b/Minecraft.Client/NoteParticle.cpp index 6d2a31cd..2e2320c8 100644 --- a/Minecraft.Client/NoteParticle.cpp +++ b/Minecraft.Client/NoteParticle.cpp @@ -22,8 +22,8 @@ void NoteParticle::init(Level *level, double x, double y, double z, double xa, d // 4J-JEV: Added, // There are 24 valid colours for this particle input through the 'xa' field (0.0-1.0). - int note = static_cast(floor(0.5 + (xa * 24.0))) + static_cast(eMinecraftColour_Particle_Note_00); - unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( static_cast(note) ); + int note = (int) floor(0.5 + (xa*24.0)) + (int) eMinecraftColour_Particle_Note_00; + unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( (eMinecraftColour) note ); rCol = ( (col>>16)&0xFF )/255.0; gCol = ( (col>>8)&0xFF )/255.0; diff --git a/Minecraft.Client/OffsettedRenderList.cpp b/Minecraft.Client/OffsettedRenderList.cpp index 0a93fa92..729d26f9 100644 --- a/Minecraft.Client/OffsettedRenderList.cpp +++ b/Minecraft.Client/OffsettedRenderList.cpp @@ -20,9 +20,9 @@ void OffsettedRenderList::init(int x, int y, int z, double xOff, double yOff, do this->y = y; this->z = z; - this->xOff = static_cast(xOff); - this->yOff = static_cast(yOff); - this->zOff = static_cast(zOff); + this->xOff = (float) xOff; + this->yOff = (float) yOff; + this->zOff = (float) zOff; } bool OffsettedRenderList::isAt(int x, int y, int z) diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index ebe1295a..35857b89 100644 --- a/Minecraft.Client/Options.cpp +++ b/Minecraft.Client/Options.cpp @@ -76,7 +76,7 @@ bool Options::Option::isBoolean() const int Options::Option::getId() const { - return static_cast(this - options); + return (int)(this-options); } wstring Options::Option::getCaptionId() const @@ -152,8 +152,8 @@ void Options::init() keyMappings[12] = keyPickItem; keyMappings[13] = keyToggleFog; - minecraft = nullptr; - //optionsFile = nullptr; + minecraft = NULL; + //optionsFile = NULL; difficulty = 2; hideGui = false; @@ -417,12 +417,12 @@ void Options::load() BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) ); wstring line = L""; - while ((line = br->readLine()) != L"") // 4J - was check against nullptr - do we need to distinguish between empty lines and a fail here? + while ((line = br->readLine()) != L"") // 4J - was check against NULL - do we need to distinguish between empty lines and a fail here? { // 4J - removed try/catch // try { wstring cmds[2]; - size_t splitpos = line.find(L":"); + int splitpos = (int)line.find(L":"); if( splitpos == wstring::npos ) { cmds[0] = line; diff --git a/Minecraft.Client/OptionsScreen.cpp b/Minecraft.Client/OptionsScreen.cpp index 50764006..b5c2f5e6 100644 --- a/Minecraft.Client/OptionsScreen.cpp +++ b/Minecraft.Client/OptionsScreen.cpp @@ -47,9 +47,9 @@ void OptionsScreen::init() void OptionsScreen::buttonClicked(Button *button) { if (!button->active) return; - if (button->id < 100 && (dynamic_cast(button) != nullptr)) + if (button->id < 100 && (dynamic_cast(button) != NULL)) { - options->toggle(static_cast(button)->getOption(), 1); + options->toggle(((SmallButton *) button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); } if (button->id == VIDEO_BUTTON_ID) diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h index d988adbf..03651b8f 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h @@ -120,7 +120,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h index 00210f60..6083654d 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h @@ -19,8 +19,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = nullptr; } - bool Allocated() { return m_pBuffer != nullptr; } + void Release() { free(m_pBuffer); m_pBuffer = NULL; } + bool Allocated() { return m_pBuffer != NULL; } }; typedef struct @@ -62,7 +62,7 @@ public: void InitialiseContext(); void StartFrame(bool actualFrameStart = true); void Present(); - void Clear(int flags);//, D3D11_RECT *pRect = nullptr); + void Clear(int flags);//, D3D11_RECT *pRect = NULL); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h index 467c7a11..d4d845df 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h @@ -28,7 +28,7 @@ typedef struct int newSaveBlocksUsed; int iSaveC; PSAVE_INFO SaveInfoA; - PSAVE_INFO pCurrentSaveInfo; // Pointer to SAVE_INFO for the save that has just been loaded, or nullptr if no save has been loaded (ie this is a newly created game) + PSAVE_INFO pCurrentSaveInfo; // Pointer to SAVE_INFO for the save that has just been loaded, or NULL if no save has been loaded (ie this is a newly created game) } SAVE_DETAILS,*PSAVE_DETAILS; @@ -315,7 +315,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -398,8 +398,8 @@ public: EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); CONTENT_DATA& GetDLC(DWORD dw); DWORD GetAvailableDLCCount( int iPad ); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); void SetDLCProductCode(const char* szProductCode); diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp index 33fd6b4a..12233360 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp @@ -353,7 +353,7 @@ static void gdraw_defragment_cache(GDrawHandleCache *c, GDrawStats *stats) // synchronize compute_to_graphics_sync(); - gdraw->gfxc->setCsShader(nullptr); + gdraw->gfxc->setCsShader(NULL); gdraw->gfxc->setShaderType(Gnm::kShaderTypeGraphics); // don't need to wait till GPU is done since we never access GPU memory from the @@ -365,7 +365,7 @@ static void api_free_resource(GDrawHandle *r) if (!r->cache->is_vertex) { for (S32 i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = nullptr; + gdraw->active_tex[i] = NULL; } } @@ -410,7 +410,7 @@ static void track_staging_alloc_attempt(U32 size, U32 align) static void track_staging_alloc_failed() { if (gdraw->staging_stats.allocs_attempted == gdraw->staging_stats.allocs_succeeded + 1) { // warn the first time we run out of mem - IggyGDrawSendWarning(nullptr, "GDraw out of staging memory"); + IggyGDrawSendWarning(NULL, "GDraw out of staging memory"); } } @@ -537,7 +537,7 @@ static void gpu_compute_memset(void *ptr, U32 value, U32 size_in_bytes) // through the regular caches. gfxc->flushShaderCachesAndWait(Gnm::kCacheActionWriteBackL2Volatile, 0, Gnm::kStallCommandBufferParserDisable); gfxc->setShaderType(Gnm::kShaderTypeGraphics); - gfxc->setCsShader(nullptr); + gfxc->setCsShader(NULL); } //////////////////////////////////////////////////////////////////////// @@ -549,8 +549,8 @@ GDrawTexture * RADLINK gdraw_orbis_WrappedTextureCreate(Gnm::Texture *tex) { GDrawStats stats = {}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); - p->handle.tex.gnm_ptr = nullptr; - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + p->handle.tex.gnm_ptr = NULL; + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); gdraw_orbis_WrappedTextureChange((GDrawTexture *) p, tex); return (GDrawTexture *) p; } @@ -583,13 +583,13 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; Gnm::Texture gt; Gnm::SizeAlign sa; Gnm::DataFormat format = Gnm::kDataFormatR8G8B8A8Unorm; if (width > MAX_TEXTURE2D_DIM || height > MAX_TEXTURE2D_DIM) { - IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); + IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); return false; } @@ -742,8 +742,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); + if (t->owner == unique_id || unique_id == NULL) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -863,7 +863,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); // @GDRAW_ASSERT + assert(h != NULL); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -891,19 +891,19 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); return t; } U8 *ptr = (U8 *)gdraw_arena_alloc(&gdraw->rt_arena, gdraw->rt_colorbuffer_sa.m_size, gdraw->rt_colorbuffer_sa.m_align); if (!ptr) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); gdraw_HandleCacheAllocateFail(t); - return nullptr; + return NULL; } t->fence = get_next_fence(); - t->raw_ptr = nullptr; + t->raw_ptr = NULL; t->handle.tex.gnm_ptr = ptr; t->handle.tex.gnm->initFromRenderTarget(&gdraw->rt_colorbuffer, false); @@ -1065,7 +1065,7 @@ static void set_common_renderstate() // clear our state caching memset(gdraw->active_tex, 0, sizeof(gdraw->active_tex)); - gdraw->cur_ps = nullptr; + gdraw->cur_ps = NULL; gdraw->scissor_state = ~0u; gdraw->blend_mode = -1; @@ -1230,7 +1230,7 @@ static void eliminate_fast_clear() } gfxc->setCbControl(Gnm::kCbModeEliminateFastClear, Gnm::kRasterOpSrcCopy); - gfxc->setPsShader(nullptr); + gfxc->setPsShader(NULL); set_viewport_raw(r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0); set_projection_raw(r.x0, r.x1, r.y1, r.y0); GDrawStats stats = {}; // we already counted these clears once, so don't add to main stats @@ -1245,7 +1245,7 @@ static void eliminate_fast_clear() set_viewport(); set_projection(); - gdraw->cur_ps = nullptr; + gdraw->cur_ps = NULL; gdraw->cur->needs_clear_eliminate = false; } @@ -1276,7 +1276,7 @@ static inline U32 pack_color_8888(F32 x, F32 y, F32 z, F32 w) void gdraw_orbis_ClearWholeRenderTarget(const F32 clear_color_rgba[4]) { - assert(gdraw->gfxc != nullptr); // call after gdraw_orbis_Begin + assert(gdraw->gfxc != NULL); // call after gdraw_orbis_Begin gdraw->cur = gdraw->frame; set_common_renderstate(); @@ -1336,16 +1336,16 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 // must include anything necessary for texture creation/update static void RADLINK gdraw_RenderingBegin(void) { - assert(gdraw->gfxc != nullptr); // call after gdraw_orbis_Begin + assert(gdraw->gfxc != NULL); // call after gdraw_orbis_Begin // unbind all shaders Gnmx::GfxContext *gfxc = gdraw->gfxc; - gfxc->setVsShader(nullptr, 0, (void*)0); - gfxc->setPsShader(nullptr); - gfxc->setCsShader(nullptr); - gfxc->setLsHsShaders(nullptr, 0, (void*)0, nullptr, 0); - gfxc->setEsShader(nullptr, 0, (void *) 0); - gfxc->setGsVsShaders(nullptr); + gfxc->setVsShader(NULL, 0, (void*)0); + gfxc->setPsShader(NULL); + gfxc->setCsShader(NULL); + gfxc->setLsHsShaders(NULL, 0, (void*)0, NULL, 0); + gfxc->setEsShader(NULL, 0, (void *) 0); + gfxc->setGsVsShaders(NULL); set_common_renderstate(); } @@ -1406,7 +1406,7 @@ GDRAW_MAYBE_UNUSED static bool mem_is_direct_and_write_combined_or_cached(const void gdraw_orbis_Begin(sce::Gnmx::GfxContext *context, void *staging_buffer, U32 staging_buf_bytes) { - assert(gdraw->gfxc == nullptr); // may not nest Begin calls + assert(gdraw->gfxc == NULL); // may not nest Begin calls // make sure that the memory setup is sensible. // if any of these asserts fire, please relocate your command buffers @@ -1426,13 +1426,13 @@ void gdraw_orbis_Begin(sce::Gnmx::GfxContext *context, void *staging_buffer, U32 void gdraw_orbis_End(gdraw_orbis_staging_stats *stats) { - assert(gdraw->gfxc != nullptr); // please keep Begin / End pairs properly matched + assert(gdraw->gfxc != NULL); // please keep Begin / End pairs properly matched gdraw_HandleCacheTick(gdraw->texturecache, gdraw->tile_end_fence); gdraw_HandleCacheTick(gdraw->vbufcache, gdraw->tile_end_fence); - gdraw_arena_init(&gdraw->staging, nullptr, 0); - gdraw->gfxc = nullptr; + gdraw_arena_init(&gdraw->staging, NULL, 0); + gdraw->gfxc = NULL; if (stats) *stats = gdraw->staging_stats; @@ -1440,7 +1440,7 @@ void gdraw_orbis_End(gdraw_orbis_staging_stats *stats) void gdraw_orbis_EliminateFastClears(void) { - assert(gdraw->gfxc != nullptr); // call between gdraw_orbis_Begin and gdraw_orbis_End + assert(gdraw->gfxc != NULL); // call between gdraw_orbis_Begin and gdraw_orbis_End eliminate_fast_clear(); } @@ -1469,18 +1469,18 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawFramebufferState *n = gdraw->cur+1; GDrawHandle *t; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { // @TODO implement - t = nullptr; + t = NULL; assert(0); // nyi } else { t = get_color_rendertarget(stats); @@ -1489,9 +1489,9 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex } n->color_buffer = t; - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT - n->cached = owner != nullptr; + n->cached = owner != NULL; if (owner) { n->base_x = region->x0; n->base_y = region->y0; @@ -1571,9 +1571,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != nullptr); // @GDRAW_ASSERT + assert(m->color_buffer != NULL); // @GDRAW_ASSERT } - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT // sync on draw completion for this render target rtt_sync(n->color_buffer->handle.tex.gnm_ptr, gdraw->rt_colorbuffer_sa.m_size >> 8); @@ -1615,7 +1615,7 @@ static void RADLINK gdraw_ClearID(void) static RADINLINE void set_texture(U32 texunit, GDrawTexture *tex) { assert(texunit < MAX_SAMPLERS); - assert(tex != nullptr); + assert(tex != NULL); if (gdraw->active_tex[texunit] != tex) { gdraw->active_tex[texunit] = tex; @@ -1791,7 +1791,7 @@ static void set_vertex_buffer(const GDraw::VFormatDesc *fmtdesc, void *ptr, U32 gdraw->gfxc->setBuffers(Gnm::kShaderStageVs, 0, fmtdesc->num_attribs, bufs); } -static RADINLINE void fence_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) +static RADINLINE void fence_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) { GDrawFence fence = get_next_fence(); if (r1) ((GDrawHandle *) r1)->fence = fence; @@ -1937,7 +1937,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) return; set_texture(0, r->tex[0]); @@ -2236,7 +2236,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_orbis_resourcetype type, U32 al cache->alloc = gfxalloc_create(gdraw_limits[type].ptr, num_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - cache = nullptr; + cache = NULL; } } @@ -2302,12 +2302,12 @@ int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 num_handles case GDRAW_ORBIS_RESOURCE_texture: free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_ORBIS_RESOURCE_texture, GDRAW_ORBIS_TEXTURE_ALIGNMENT); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_ORBIS_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_ORBIS_RESOURCE_vertexbuffer, GDRAW_ORBIS_VERTEXBUFFER_ALIGNMENT); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; default: return 0; @@ -2316,9 +2316,9 @@ int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 num_handles void gdraw_orbis_ResetAllResourceMemory() { - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_rendertarget, 0, nullptr, 0); - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_texture, 0, nullptr, 0); - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_vertexbuffer, 0, nullptr, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_rendertarget, 0, NULL, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_texture, 0, NULL, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_vertexbuffer, 0, NULL, 0); } GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem) @@ -2326,7 +2326,7 @@ GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem U32 cpram_shadow_size = Gnmx::ConstantUpdateEngine::computeCpRamShadowSize(); gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw) + cpram_shadow_size); - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -2349,7 +2349,7 @@ GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem Gnm::DataFormat rtFormat = Gnm::kDataFormatR8G8B8A8Unorm; Gnm::TileMode tileMode; GpuAddress::computeSurfaceTileMode(&tileMode, GpuAddress::kSurfaceTypeRwTextureFlat, rtFormat, 1); - gdraw->rt_colorbuffer_sa = gdraw->rt_colorbuffer.init(gdraw->frametex_width, gdraw->frametex_height, 1, rtFormat, tileMode, Gnm::kNumSamples1, Gnm::kNumFragments1, nullptr, nullptr); + gdraw->rt_colorbuffer_sa = gdraw->rt_colorbuffer.init(gdraw->frametex_width, gdraw->frametex_height, 1, rtFormat, tileMode, Gnm::kNumSamples1, Gnm::kNumFragments1, NULL, NULL); gdraw->rt_colorbuffer.setCmaskFastClearEnable(false); // shaders and state @@ -2418,7 +2418,7 @@ void gdraw_orbis_DestroyContext(void) free_handle_cache(gdraw->texturecache); free_handle_cache(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } } diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h index 13964e07..9fecfb08 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h @@ -50,7 +50,7 @@ IDOC extern int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 currently hold. SetResourceMemory takes a void* argument for the address of the resource pool. - Pass in nullptr and zero bytes to reset a specific pool. + Pass in NULL and zero bytes to reset a specific pool. Resource pool memory has certain alignment requirements - see the #defines above. If you pass in an unaligned pointer, GDraw will automatically clip off @@ -86,7 +86,7 @@ IDOC extern GDrawFunctions * gdraw_orbis_CreateContext(S32 w, S32 h, void *conte There can only be one GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_orbis_DestroyContext(void); /* Destroys the current GDraw context, if any. @@ -126,7 +126,7 @@ IDOC extern void gdraw_orbis_End(gdraw_orbis_staging_stats *staging_stats); staging_stats will be filled with stats for the staging buffer, denoting how much memory was actually used and which allocations were attempted. If you're not interested, just - pass nullptr. */ + pass NULL. */ IDOC extern void gdraw_orbis_SetTileOrigin(sce::Gnm::RenderTarget *color, sce::Gnm::DepthRenderTarget *depth, S32 x, S32 y); /* This sets the main color and depth buffers that GDraw should render to and the diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl index 00010f80..fc3e31a3 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl @@ -517,24 +517,24 @@ static unsigned char pshader_basic_17[412] = { }; static ShaderCode pshader_basic_arr[18] = { - { pshader_basic_0, { nullptr } }, - { pshader_basic_1, { nullptr } }, - { pshader_basic_2, { nullptr } }, - { pshader_basic_3, { nullptr } }, - { pshader_basic_4, { nullptr } }, - { pshader_basic_5, { nullptr } }, - { pshader_basic_6, { nullptr } }, - { pshader_basic_7, { nullptr } }, - { pshader_basic_8, { nullptr } }, - { pshader_basic_9, { nullptr } }, - { pshader_basic_10, { nullptr } }, - { pshader_basic_11, { nullptr } }, - { pshader_basic_12, { nullptr } }, - { pshader_basic_13, { nullptr } }, - { pshader_basic_14, { nullptr } }, - { pshader_basic_15, { nullptr } }, - { pshader_basic_16, { nullptr } }, - { pshader_basic_17, { nullptr } }, + { pshader_basic_0, { NULL } }, + { pshader_basic_1, { NULL } }, + { pshader_basic_2, { NULL } }, + { pshader_basic_3, { NULL } }, + { pshader_basic_4, { NULL } }, + { pshader_basic_5, { NULL } }, + { pshader_basic_6, { NULL } }, + { pshader_basic_7, { NULL } }, + { pshader_basic_8, { NULL } }, + { pshader_basic_9, { NULL } }, + { pshader_basic_10, { NULL } }, + { pshader_basic_11, { NULL } }, + { pshader_basic_12, { NULL } }, + { pshader_basic_13, { NULL } }, + { pshader_basic_14, { NULL } }, + { pshader_basic_15, { NULL } }, + { pshader_basic_16, { NULL } }, + { pshader_basic_17, { NULL } }, }; static unsigned char pshader_exceptional_blend_1[440] = { @@ -917,19 +917,19 @@ static unsigned char pshader_exceptional_blend_12[336] = { }; static ShaderCode pshader_exceptional_blend_arr[13] = { - { nullptr, { nullptr } }, - { pshader_exceptional_blend_1, { nullptr } }, - { pshader_exceptional_blend_2, { nullptr } }, - { pshader_exceptional_blend_3, { nullptr } }, - { pshader_exceptional_blend_4, { nullptr } }, - { pshader_exceptional_blend_5, { nullptr } }, - { pshader_exceptional_blend_6, { nullptr } }, - { pshader_exceptional_blend_7, { nullptr } }, - { pshader_exceptional_blend_8, { nullptr } }, - { pshader_exceptional_blend_9, { nullptr } }, - { pshader_exceptional_blend_10, { nullptr } }, - { pshader_exceptional_blend_11, { nullptr } }, - { pshader_exceptional_blend_12, { nullptr } }, + { NULL, { NULL } }, + { pshader_exceptional_blend_1, { NULL } }, + { pshader_exceptional_blend_2, { NULL } }, + { pshader_exceptional_blend_3, { NULL } }, + { pshader_exceptional_blend_4, { NULL } }, + { pshader_exceptional_blend_5, { NULL } }, + { pshader_exceptional_blend_6, { NULL } }, + { pshader_exceptional_blend_7, { NULL } }, + { pshader_exceptional_blend_8, { NULL } }, + { pshader_exceptional_blend_9, { NULL } }, + { pshader_exceptional_blend_10, { NULL } }, + { pshader_exceptional_blend_11, { NULL } }, + { pshader_exceptional_blend_12, { NULL } }, }; static unsigned char pshader_filter_0[420] = { @@ -1685,38 +1685,38 @@ static unsigned char pshader_filter_27[412] = { }; static ShaderCode pshader_filter_arr[32] = { - { pshader_filter_0, { nullptr } }, - { pshader_filter_1, { nullptr } }, - { pshader_filter_2, { nullptr } }, - { pshader_filter_3, { nullptr } }, - { pshader_filter_4, { nullptr } }, - { pshader_filter_5, { nullptr } }, - { pshader_filter_6, { nullptr } }, - { pshader_filter_7, { nullptr } }, - { pshader_filter_8, { nullptr } }, - { pshader_filter_9, { nullptr } }, - { pshader_filter_10, { nullptr } }, - { pshader_filter_11, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { pshader_filter_16, { nullptr } }, - { pshader_filter_17, { nullptr } }, - { pshader_filter_18, { nullptr } }, - { pshader_filter_19, { nullptr } }, - { pshader_filter_20, { nullptr } }, - { pshader_filter_21, { nullptr } }, - { pshader_filter_22, { nullptr } }, - { pshader_filter_23, { nullptr } }, - { pshader_filter_24, { nullptr } }, - { pshader_filter_25, { nullptr } }, - { pshader_filter_26, { nullptr } }, - { pshader_filter_27, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, + { pshader_filter_0, { NULL } }, + { pshader_filter_1, { NULL } }, + { pshader_filter_2, { NULL } }, + { pshader_filter_3, { NULL } }, + { pshader_filter_4, { NULL } }, + { pshader_filter_5, { NULL } }, + { pshader_filter_6, { NULL } }, + { pshader_filter_7, { NULL } }, + { pshader_filter_8, { NULL } }, + { pshader_filter_9, { NULL } }, + { pshader_filter_10, { NULL } }, + { pshader_filter_11, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { pshader_filter_16, { NULL } }, + { pshader_filter_17, { NULL } }, + { pshader_filter_18, { NULL } }, + { pshader_filter_19, { NULL } }, + { pshader_filter_20, { NULL } }, + { pshader_filter_21, { NULL } }, + { pshader_filter_22, { NULL } }, + { pshader_filter_23, { NULL } }, + { pshader_filter_24, { NULL } }, + { pshader_filter_25, { NULL } }, + { pshader_filter_26, { NULL } }, + { pshader_filter_27, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { NULL, { NULL } }, }; static unsigned char pshader_blur_2[356] = { @@ -2024,16 +2024,16 @@ static unsigned char pshader_blur_9[748] = { }; static ShaderCode pshader_blur_arr[10] = { - { nullptr, { nullptr } }, - { nullptr, { nullptr } }, - { pshader_blur_2, { nullptr } }, - { pshader_blur_3, { nullptr } }, - { pshader_blur_4, { nullptr } }, - { pshader_blur_5, { nullptr } }, - { pshader_blur_6, { nullptr } }, - { pshader_blur_7, { nullptr } }, - { pshader_blur_8, { nullptr } }, - { pshader_blur_9, { nullptr } }, + { NULL, { NULL } }, + { NULL, { NULL } }, + { pshader_blur_2, { NULL } }, + { pshader_blur_3, { NULL } }, + { pshader_blur_4, { NULL } }, + { pshader_blur_5, { NULL } }, + { pshader_blur_6, { NULL } }, + { pshader_blur_7, { NULL } }, + { pshader_blur_8, { NULL } }, + { pshader_blur_9, { NULL } }, }; static unsigned char pshader_color_matrix_0[348] = { @@ -2062,7 +2062,7 @@ static unsigned char pshader_color_matrix_0[348] = { }; static ShaderCode pshader_color_matrix_arr[1] = { - { pshader_color_matrix_0, { nullptr } }, + { pshader_color_matrix_0, { NULL } }, }; static unsigned char pshader_manual_clear_0[164] = { @@ -2080,7 +2080,7 @@ static unsigned char pshader_manual_clear_0[164] = { }; static ShaderCode pshader_manual_clear_arr[1] = { - { pshader_manual_clear_0, { nullptr } }, + { pshader_manual_clear_0, { NULL } }, }; static unsigned char vshader_vsps4_0[580] = { @@ -2124,7 +2124,7 @@ static unsigned char vshader_vsps4_0[580] = { }; static ShaderCode vshader_vsps4_arr[1] = { - { vshader_vsps4_0, { nullptr } }, + { vshader_vsps4_0, { NULL } }, }; static unsigned char cshader_tex_upload_0[212] = { @@ -2145,7 +2145,7 @@ static unsigned char cshader_tex_upload_0[212] = { }; static ShaderCode cshader_tex_upload_arr[1] = { - { cshader_tex_upload_0, { nullptr } }, + { cshader_tex_upload_0, { NULL } }, }; static unsigned char cshader_memset_0[196] = { @@ -2165,7 +2165,7 @@ static unsigned char cshader_memset_0[196] = { }; static ShaderCode cshader_memset_arr[1] = { - { cshader_memset_0, { nullptr } }, + { cshader_memset_0, { NULL } }, }; static unsigned char cshader_defragment_0[204] = { @@ -2185,7 +2185,7 @@ static unsigned char cshader_defragment_0[204] = { }; static ShaderCode cshader_defragment_arr[1] = { - { cshader_defragment_0, { nullptr } }, + { cshader_defragment_0, { NULL } }, }; static unsigned char cshader_mipgen_0[340] = { @@ -2214,6 +2214,6 @@ static unsigned char cshader_mipgen_0[340] = { }; static ShaderCode cshader_mipgen_arr[1] = { - { cshader_mipgen_0, { nullptr } }, + { cshader_mipgen_0, { NULL } }, }; diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl index 1b7c1cc1..a6b7dda2 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != nullptr) { + while (s != NULL) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! + assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, nullptr); + return gdraw_HandleCacheLockStats(t, owner, NULL); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = nullptr; - c->state[i].cache = nullptr; // should never follow cache link from sentinels! + c->state[i].owner = NULL; + c->state[i].cache = NULL; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = nullptr; + c->state[i].raw_ptr = NULL; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = nullptr; + c->handle[i].raw_ptr = NULL; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = nullptr; + c->alloc = NULL; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = nullptr; + c->alloc_other = NULL; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = nullptr; + t->raw_ptr = NULL; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -563,7 +563,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : nullptr; + return (sentinel->next != sentinel) ? sentinel->next : NULL; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -778,7 +778,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -830,7 +830,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -842,7 +842,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -949,7 +949,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); + S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1095,7 +1095,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = nullptr; + *start = NULL; *num_bytes = 0; return; } else { @@ -1132,7 +1132,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return nullptr; + return NULL; arena->current = ptr + size; return ptr; @@ -1157,7 +1157,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, nullptr-terminated list of elements in each hash +// There's a single-linked, NULL-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1166,7 +1166,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, nullptr-terminated list of unused blocks. Every block is either +// single-linked, NULL-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1384,7 +1384,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != nullptr); + GFXALLOC_ASSERT(alloc->unused_list != NULL); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1457,7 +1457,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return nullptr; + return NULL; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1465,7 +1465,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return nullptr; + return NULL; memset(a, 0, size); @@ -1506,16 +1506,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, nullptr, 0,0); + debug_complete_check(a, NULL, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = nullptr; + gfx_block_info *cur, *best = NULL; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, nullptr, 0,0); +debug_complete_check(alloc, NULL, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1565,7 +1565,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return nullptr; // not enough space! + return NULL; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1735,7 +1735,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = nullptr; + b->prev = NULL; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1748,7 +1748,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1910,7 +1910,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = nullptr; + void *ptr = NULL; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2300,7 +2300,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = nullptr; + ring->cur = NULL; ring->seg_size = 0; } @@ -2310,7 +2310,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return nullptr; // nope, won't fit + return NULL; // nope, won't fit assert(align <= ring->align); @@ -2415,7 +2415,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2435,8 +2435,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return nullptr; + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return NULL; } #ifndef GDRAW_MANAGE_MEM @@ -2445,7 +2445,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2453,7 +2453,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, nullptr, "memory"); + gdraw_res_alloc_outofmem(c, NULL, "memory"); break; } } @@ -2468,8 +2468,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == nullptr) { - gdraw_res_alloc_outofmem(c, nullptr, "handles"); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); } } } @@ -2513,7 +2513,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = nullptr; + r->owner = NULL; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2521,11 +2521,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = nullptr; + void *ptr = NULL; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2537,7 +2537,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, nullptr, "handles"); + return gdraw_res_alloc_outofmem(c, NULL, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Orbis/Iggy/include/gdraw.h b/Minecraft.Client/Orbis/Iggy/include/gdraw.h index 7cc4ddd0..404a2642 100644 --- a/Minecraft.Client/Orbis/Iggy/include/gdraw.h +++ b/Minecraft.Client/Orbis/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is nullptr, then the pointers in 'prim' are machine pointers, and + If buf is NULL, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-nullptr, then use the appropriate vertex buffer, and the + If buf is non-NULL, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or nullptr if an error occured + $:return Handle for the newly created texture, or NULL if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h index a42ccbff..1f1a90a1 100644 --- a/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP +Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp b/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp index b2492381..b7662197 100644 --- a/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp +++ b/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp @@ -29,7 +29,7 @@ OrbisLeaderboardManager::OrbisLeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = nullptr; //m_stats = nullptr; + m_scores = NULL; //m_stats = NULL; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -41,7 +41,7 @@ OrbisLeaderboardManager::OrbisLeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = nullptr; + m_threadScoreboard = NULL; } OrbisLeaderboardManager::~OrbisLeaderboardManager() @@ -181,7 +181,7 @@ bool OrbisLeaderboardManager::getScoreByIds() SceRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = nullptr; + SceNpId *npIds = NULL; int ret; @@ -267,7 +267,7 @@ bool OrbisLeaderboardManager::getScoreByIds() ZeroMemory(comments, sizeof(SceNpScoreComment) * num); /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -284,9 +284,9 @@ bool OrbisLeaderboardManager::getScoreByIds() sceNpScoreDestroyTransactionCtx(ret); - if (npIds != nullptr) delete [] npIds; - if (ptr != nullptr) delete [] ptr; - if (comments != nullptr) delete [] comments; + if (npIds != NULL) delete [] npIds; + if (ptr != NULL) delete [] ptr; + if (comments != NULL) delete [] comments; return false; } @@ -297,9 +297,9 @@ bool OrbisLeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != nullptr) delete [] npIds; - if (ptr != nullptr) delete [] ptr; - if (comments != nullptr) delete [] comments; + if (npIds != NULL) delete [] npIds; + if (ptr != NULL) delete [] ptr; + if (comments != NULL) delete [] comments; return false; } @@ -322,14 +322,14 @@ bool OrbisLeaderboardManager::getScoreByIds() batch + comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments - nullptr, 0, // GameData. (unused) + NULL, 0, // GameData. (unused) tmpNum, &last_sort_date, &mTotalRecord, - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -357,7 +357,7 @@ bool OrbisLeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -390,7 +390,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != nullptr) delete [] npIds; + if (npIds != NULL) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -443,14 +443,14 @@ bool OrbisLeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - nullptr, 0, // GameData. + NULL, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -471,7 +471,7 @@ bool OrbisLeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = nullptr; + m_scores = NULL; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -489,7 +489,7 @@ bool OrbisLeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != nullptr) + if (m_readListener != NULL) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -636,16 +636,16 @@ void OrbisLeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = nullptr; + m_scores = NULL; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = nullptr; + view.m_queries = NULL; - if ( m_readListener != nullptr ) + if ( m_readListener != NULL ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -667,7 +667,7 @@ bool OrbisLeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == nullptr) + if (m_threadScoreboard == NULL) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -762,7 +762,7 @@ void OrbisLeaderboardManager::FlushStats() {} void OrbisLeaderboardManager::CancelOperation() { - m_readListener = nullptr; + m_readListener = NULL; m_eStatsState = eStatsState_Canceled; if (m_requestId != 0) @@ -912,7 +912,7 @@ void OrbisLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = in->utf8Comment[i]; - unsigned char fivebits = strtol(ch, nullptr, 32) << 3; + unsigned char fivebits = strtol(ch, NULL, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -973,7 +973,7 @@ bool OrbisLeaderboardManager::test_string(string testing) int ctx = sceNpScoreCreateTransactionCtx(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr); + int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp b/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp index 5db367d4..d1c9cf15 100644 --- a/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp +++ b/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp @@ -309,7 +309,7 @@ void hexStrToBin( val <<= 4; } else { - if (pBinBuf != nullptr && binOffset < binBufSize) { + if (pBinBuf != NULL && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); val = 0; } @@ -317,7 +317,7 @@ void hexStrToBin( } } - if (val != 0 && pBinBuf != nullptr && binOffset < binBufSize) { + if (val != 0 && pBinBuf != NULL && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); } diff --git a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp index 7c3e1a66..1b32bce2 100644 --- a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp @@ -17,8 +17,8 @@ // #include "..\PS3Extras\PS3Strings.h" -int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; -void * SQRNetworkManager_Orbis::s_SignInCompleteParam = nullptr; +int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; +void * SQRNetworkManager_Orbis::s_SignInCompleteParam = NULL; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Orbis::s_lastPresenceInfo; int64_t SQRNetworkManager_Orbis::s_lastPresenceTime = 0; @@ -109,8 +109,8 @@ SQRNetworkManager_Orbis::SQRNetworkManager_Orbis(ISQRNetworkManagerListener *lis m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = nullptr; - m_gameBootInvite = nullptr; + m_aServerId = NULL; + m_gameBootInvite = NULL; m_onlineStatus = false; m_bLinkDisconnected = false; m_bRefreshingRestrictionsForInvite = false; @@ -137,7 +137,7 @@ void SQRNetworkManager_Orbis::Initialise() int32_t ret = 0; int32_t libCtxId = 0; - ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, nullptr); + ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, NULL); assert (ret >= 0); libCtxId = ret; @@ -251,7 +251,7 @@ void SQRNetworkManager_Orbis::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; s_SignInCompleteCallbackPad = -1; } return; @@ -334,7 +334,7 @@ void SQRNetworkManager_Orbis::RefreshChatAndContentRestrictionsReturned_HandleIn SQRNetworkManager_Orbis *netMan = (SQRNetworkManager_Orbis *)pParam; netMan->m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), netMan->m_gameBootInvite ); - netMan->m_gameBootInvite = nullptr; + netMan->m_gameBootInvite = NULL; netMan->m_bRefreshingRestrictionsForInvite = false; } @@ -357,7 +357,7 @@ void SQRNetworkManager_Orbis::Tick() m_bRefreshingRestrictionsForInvite = true; ProfileManager.RefreshChatAndContentRestrictions(RefreshChatAndContentRestrictionsReturned_HandleInvite, this); //m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - //m_gameBootInvite = nullptr; + //m_gameBootInvite = NULL; } ErrorHandlingTick(); @@ -431,14 +431,14 @@ void SQRNetworkManager_Orbis::Tick() if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } s_SignInCompleteCallbackPad = -1; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; s_SignInCompleteCallbackPad = -1; } } @@ -539,7 +539,7 @@ void SQRNetworkManager_Orbis::ErrorHandlingTick() m_bCallPSNSignInCallback=true; //s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,s_SignInCompleteCallbackPad); } - //s_SignInCompleteCallbackFn = nullptr; + //s_SignInCompleteCallbackFn = NULL; //s_SignInCompleteCallbackPad = -1; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); @@ -655,7 +655,7 @@ void SQRNetworkManager_Orbis::UpdateExternalRoomData() reqParam.roomBinAttrExternalNum = 1; reqParam.roomBinAttrExternal = &roomBinAttr; - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -685,11 +685,11 @@ bool SQRNetworkManager_Orbis::FriendRoomManagerSearch() } // Free up any external data that we received from the previous search - for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ ) + for( int i = 0; i < m_aFriendSearchResults.size(); i++ ) { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; + m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -755,7 +755,7 @@ void SQRNetworkManager_Orbis::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = nullptr; + m_getFriendCountThread = NULL; FriendRoomManagerSearch2(); } } @@ -773,7 +773,7 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter ) do { - ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); + ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread if( event.udata == 0 ) @@ -979,7 +979,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByIndex(int idx) } else { - return nullptr; + return NULL; } } @@ -996,7 +996,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByXuid(PlayerUID xuid) @@ -1012,7 +1012,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetLocalPlayerByUserIndex(int idx) @@ -1028,7 +1028,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetHostPlayer() @@ -1041,11 +1041,11 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == nullptr ) return nullptr; + if( player == NULL ) return NULL; if( player->IsReady() ) return player; - return nullptr; + return NULL; } // Update state internally @@ -1099,7 +1099,7 @@ bool SQRNetworkManager_Orbis::JoinRoom(SQRNetworkManager_Orbis::SessionSearchRes { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -1165,7 +1165,7 @@ void SQRNetworkManager_Orbis::LeaveRoom(bool bActuallyLeaveRoom) reqParam.roomId = m_room; SetState(SNM_INT_STATE_LEAVING); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1274,7 +1274,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1326,7 +1326,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; // Sync this back out to our networked clients... SyncRoomData(); @@ -1367,7 +1367,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1388,7 +1388,7 @@ void SQRNetworkManager_Orbis::UpdateRemotePlay() int localPlayerCount = 0; for(int i = 0; i < XUSER_MAX_COUNT; i++) { - if(GetLocalPlayerByUserIndex(i) != nullptr) localPlayerCount++; + if(GetLocalPlayerByUserIndex(i) != NULL) localPlayerCount++; } InputManager.SetLocalMultiplayer(localPlayerCount > 1); } @@ -1427,7 +1427,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI() messData.body.assign(body); messData.dialogFlag = SCE_TOOLKIT_NP_DIALOG_TYPE_USER_EDITABLE; messData.npIdsCount = 2; // TODO: Set this to the number of available slots - messData.npIds = nullptr; + messData.npIds = NULL; messData.userInfo.userId = userId; // Set expire to maximum @@ -1602,7 +1602,7 @@ void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerT } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = nullptr; + PlayerUID *pUID = NULL; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || (m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST )) ) @@ -1669,7 +1669,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1725,7 +1725,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1817,7 +1817,7 @@ void SQRNetworkManager_Orbis::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) +bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) { assert( m_isHosting ); @@ -1939,7 +1939,7 @@ void SQRNetworkManager_Orbis::RemoveRemotePlayersAndSync( SceNpMatching2RoomMemb } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; } else { @@ -1984,7 +1984,7 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } // And delete the reference from the ctx->player map @@ -2037,7 +2037,7 @@ void SQRNetworkManager_Orbis::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -2159,7 +2159,7 @@ bool SQRNetworkManager_Orbis::GetServerContext(SceNpMatching2ServerId serverId) // { // // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // // the context *really* is valid. -// int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); +// int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); // // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again // if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment // ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -2253,7 +2253,7 @@ void SQRNetworkManager_Orbis::RoomCreateTick() SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM); app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2493,7 +2493,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro // create this connection if we don't have it already SQRVoiceConnection* pConnection = SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID(peerMemberId); - if(pConnection == nullptr) + if(pConnection == NULL) { // Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host @@ -2573,7 +2573,7 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId, if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); } else { @@ -2611,7 +2611,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return nullptr; + return NULL; } @@ -2625,7 +2625,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(in return it->second; } } - return nullptr; + return NULL; } @@ -2720,7 +2720,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp if( manager->m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); + manager->GetExtDataForRoom(0, NULL, NULL, NULL); break; } @@ -2759,7 +2759,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } @@ -2966,12 +2966,12 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id, // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); } else { - if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == nullptr) + if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == NULL) { // the host doesn't send out data, so this must be the host we're connecting to @@ -3213,7 +3213,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); } else { @@ -3349,7 +3349,7 @@ void SQRNetworkManager_Orbis::ProcessSignallingEvent(SceNpMatching2ContextId ctx reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_roomMemberDataRequestId); } break; } @@ -3358,7 +3358,7 @@ void SQRNetworkManager_Orbis::ProcessSignallingEvent(SceNpMatching2ContextId ctx void SQRNetworkManager_Orbis::SignallingEventsTick() { EnterCriticalSection(&m_signallingEventListCS); - for(size_t i=0;i= sizeof(SQRNetworkPlayer::InitSendData) ) { SQRNetworkPlayer::InitSendData ISD; - int bytesRead = sceRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, nullptr ); + int bytesRead = sceRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL ); if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) ) { manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD); @@ -3555,7 +3555,7 @@ void SQRNetworkManager_Orbis::RudpContextCallback(int ctx_id, int event_id, int if( dataSize > 0 ) { unsigned char *data = new unsigned char [ dataSize ]; - int bytesRead = sceRudpRead( ctx_id, data, dataSize, 0, nullptr ); + int bytesRead = sceRudpRead( ctx_id, data, dataSize, 0, NULL ); if( bytesRead > 0 ) { SQRNetworkPlayer *playerFrom, *playerTo; @@ -3571,7 +3571,7 @@ void SQRNetworkManager_Orbis::RudpContextCallback(int ctx_id, int event_id, int playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) + if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3632,7 +3632,7 @@ void SQRNetworkManager_Orbis::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); } if (ret < 0) { @@ -3661,7 +3661,7 @@ void SQRNetworkManager_Orbis::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3722,9 +3722,9 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != nullptr ) + // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != NULL ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3748,14 +3748,14 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3769,7 +3769,7 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3907,7 +3907,7 @@ void SQRNetworkManager_Orbis::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(v //s_signInCompleteCallbackIfFailed=false; //s_SignInCompleteCallbackFn(s_SignInCompleteParam, false, iPad); } - //s_SignInCompleteCallbackFn = nullptr; + //s_SignInCompleteCallbackFn = NULL; } } } @@ -4145,11 +4145,11 @@ void SQRNetworkManager_Orbis::NotifyRealtimePlusFeature(int iQuadrant) // bool isSignedIn = ProfileManager.IsSignedInLive(s_SignInCompleteCallbackPad); // // s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad); -// s_SignInCompleteCallbackFn = nullptr; +// s_SignInCompleteCallbackFn = NULL; // s_SignInCompleteCallbackPad = -1; // } // else // { -// app.DebugPrintf("============ Calling CallSignInCompleteCallback but s_SignInCompleteCallbackFn is nullptr\n"); +// app.DebugPrintf("============ Calling CallSignInCompleteCallback but s_SignInCompleteCallbackFn is NULL\n"); // } //} \ No newline at end of file diff --git a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h index 0217e4c5..cb7cafa9 100644 --- a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h +++ b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h @@ -139,7 +139,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp index 67ae639b..34ab67e4 100644 --- a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp @@ -9,22 +9,22 @@ bool SonyCommerce_Orbis::m_bCommerceInitialised = false; // SceNpCommerce2SessionInfo SonyCommerce_Orbis::m_sessionInfo; SonyCommerce_Orbis::State SonyCommerce_Orbis::m_state = e_state_noSession; int SonyCommerce_Orbis::m_errorCode = 0; -LPVOID SonyCommerce_Orbis::m_callbackParam = nullptr; +LPVOID SonyCommerce_Orbis::m_callbackParam = NULL; -void* SonyCommerce_Orbis::m_receiveBuffer = nullptr; +void* SonyCommerce_Orbis::m_receiveBuffer = NULL; SonyCommerce_Orbis::Event SonyCommerce_Orbis::m_event; std::queue SonyCommerce_Orbis::m_messageQueue; -std::vector* SonyCommerce_Orbis::m_pProductInfoList = nullptr; -SonyCommerce_Orbis::ProductInfoDetailed* SonyCommerce_Orbis::m_pProductInfoDetailed = nullptr; -SonyCommerce_Orbis::ProductInfo* SonyCommerce_Orbis::m_pProductInfo = nullptr; +std::vector* SonyCommerce_Orbis::m_pProductInfoList = NULL; +SonyCommerce_Orbis::ProductInfoDetailed* SonyCommerce_Orbis::m_pProductInfoDetailed = NULL; +SonyCommerce_Orbis::ProductInfo* SonyCommerce_Orbis::m_pProductInfo = NULL; -SonyCommerce_Orbis::CategoryInfo* SonyCommerce_Orbis::m_pCategoryInfo = nullptr; -const char* SonyCommerce_Orbis::m_pProductID = nullptr; -char* SonyCommerce_Orbis::m_pCategoryID = nullptr; +SonyCommerce_Orbis::CategoryInfo* SonyCommerce_Orbis::m_pCategoryInfo = NULL; +const char* SonyCommerce_Orbis::m_pProductID = NULL; +char* SonyCommerce_Orbis::m_pCategoryID = NULL; SonyCommerce_Orbis::CheckoutInputParams SonyCommerce_Orbis::m_checkoutInputParams; SonyCommerce_Orbis::DownloadListInputParams SonyCommerce_Orbis::m_downloadInputParams; -SonyCommerce_Orbis::CallbackFunc SonyCommerce_Orbis::m_callbackFunc = nullptr; +SonyCommerce_Orbis::CallbackFunc SonyCommerce_Orbis::m_callbackFunc = NULL; // sys_memory_container_t SonyCommerce_Orbis::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_Orbis::m_bUpgradingTrial = false; @@ -38,7 +38,7 @@ bool SonyCommerce_Orbis::m_contextCreated=false; ///< npcommerce2 cont SonyCommerce_Orbis::Phase SonyCommerce_Orbis::m_currentPhase = e_phase_stopped; ///< Current commerce2 util // char SonyCommerce_Orbis::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_Orbis::m_tickThread = nullptr; +C4JThread* SonyCommerce_Orbis::m_tickThread = NULL; bool SonyCommerce_Orbis::m_bLicenseChecked=false; // Check the trial/full license for the game @@ -52,12 +52,12 @@ sce::Toolkit::NP::Utilities::Future g_d SonyCommerce_Orbis::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_Orbis::Delete() { - m_pProductInfoList=nullptr; - m_pProductInfoDetailed=nullptr; - m_pProductInfo=nullptr; - m_pCategoryInfo = nullptr; - m_pProductID = nullptr; - m_pCategoryID = nullptr; + m_pProductInfoList=NULL; + m_pProductInfoDetailed=NULL; + m_pProductInfo=NULL; + m_pCategoryInfo = NULL; + m_pProductID = NULL; + m_pCategoryID = NULL; } void SonyCommerce_Orbis::Init() @@ -95,7 +95,7 @@ bool SonyCommerce_Orbis::LicenseChecked() void SonyCommerce_Orbis::CheckForTrialUpgradeKey() { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); } int SonyCommerce_Orbis::Shutdown() @@ -112,7 +112,7 @@ int SonyCommerce_Orbis::Shutdown() DeleteCriticalSection(&m_queueLock); // clear any possible callback function - m_callbackFunc = nullptr; + m_callbackFunc = NULL; return ret; } @@ -582,7 +582,7 @@ int SonyCommerce_Orbis::createContext() // } // // // Create commerce2 context -// ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); +// ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); // if (ret < 0) // { // app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -657,7 +657,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotCategoryInfo: { copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get()); - m_pCategoryInfo = nullptr; + m_pCategoryInfo = NULL; m_event = e_event_commerceGotCategoryInfo; break; } @@ -665,7 +665,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList: { copyProductList(m_pProductInfoList, g_productList.get()); - m_pProductInfoDetailed = nullptr; + m_pProductInfoDetailed = NULL; m_event = e_event_commerceGotProductList; break; } @@ -675,12 +675,12 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) if(m_pProductInfoDetailed) { copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get()); - m_pProductInfoDetailed = nullptr; + m_pProductInfoDetailed = NULL; } else { copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get()); - m_pProductInfo = nullptr; + m_pProductInfo = NULL; } m_event = e_event_commerceGotDetailedProductInfo; break; @@ -1027,7 +1027,7 @@ void SonyCommerce_Orbis::processEvent() case e_event_commerceProductBrowseFinished: app.DebugPrintf(4,"e_event_commerceProductBrowseFinished succeeded: 0x%x\n", m_errorCode); - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1076,7 +1076,7 @@ void SonyCommerce_Orbis::processEvent() } // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1094,7 +1094,7 @@ void SonyCommerce_Orbis::processEvent() } // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1154,8 +1154,8 @@ void SonyCommerce_Orbis::CreateSession( CallbackFunc cb, LPVOID lpParam ) m_messageQueue.push(e_message_commerceEnd); m_event = e_event_commerceSessionCreated; - if(m_tickThread == nullptr) - m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_Orbis tick"); + if(m_tickThread == NULL) + m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_Orbis tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; diff --git a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h index dc7671f4..a2a42d57 100644 --- a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h +++ b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h @@ -107,14 +107,14 @@ class SonyCommerce_Orbis : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = nullptr; + m_callbackFunc = NULL; if(func) func(m_callbackParam, m_errorCode); m_errorCode = SCE_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == nullptr); + assert(m_callbackFunc == NULL); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp index 3387839f..7f7c62d6 100644 --- a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp @@ -100,16 +100,16 @@ void SonyHttp_Orbis::printSslError(SceInt32 sslErr, SceUInt32 sslErrDetail) void SonyHttp_Orbis::printSslCertInfo(int libsslCtxId,SceSslCert *sslCert) { SceInt32 ret; - SceUChar8 *sboData = nullptr ; + SceUChar8 *sboData = NULL ; SceSize sboLen, counter; - ret = sceSslGetSerialNumber(libsslCtxId, sslCert, nullptr, &sboLen); + ret = sceSslGetSerialNumber(libsslCtxId, sslCert, NULL, &sboLen); if (ret < 0){ app.DebugPrintf("sceSslGetSerialNumber() returns 0x%x\n", ret); } else { - sboData = static_cast(malloc(sboLen)); - if ( sboData != nullptr ) { + sboData = (SceUChar8*)malloc(sboLen); + if ( sboData != NULL ) { ret = sceSslGetSerialNumber(libsslCtxId, sslCert, sboData, &sboLen); if (ret < 0){ app.DebugPrintf ("sceSslGetSerialNumber() returns 0x%x\n", ret); @@ -141,10 +141,10 @@ SceInt32 SonyHttp_Orbis::sslCallback(int libsslCtxId,unsigned int verifyErr,SceS (void)userArg; app.DebugPrintf("Ssl callback:\n"); - app.DebugPrintf("\tbase tmpl[%x]\n", (*static_cast(userArg)) ); + app.DebugPrintf("\tbase tmpl[%x]\n", (*(SceInt32*)(userArg)) ); if (verifyErr != 0){ - printSslError(static_cast(SCE_HTTPS_ERROR_CERT), verifyErr); + printSslError((SceInt32)SCE_HTTPS_ERROR_CERT, verifyErr); } for (i = 0; i < certNum; i++){ printSslCertInfo(libsslCtxId,sslCert[i]); @@ -202,7 +202,7 @@ bool SonyHttp_Orbis::http_get(const char *targetUrl, void** ppOutData, int* pDat } /* Register SSL callback */ - ret = sceHttpsSetSslCallback(tmplId, sslCallback, static_cast(&tmplId)); + ret = sceHttpsSetSslCallback(tmplId, sslCallback, (void*)&tmplId); if (ret < 0) { app.DebugPrintf("sceHttpsSetSslCallback() error: 0x%08X\n", ret); @@ -225,7 +225,7 @@ bool SonyHttp_Orbis::http_get(const char *targetUrl, void** ppOutData, int* pDat } reqId = ret; - ret = sceHttpSendRequest(reqId, nullptr, 0); + ret = sceHttpSendRequest(reqId, NULL, 0); if (ret < 0) { app.DebugPrintf("sceHttpSendRequest() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp index 008879cb..e248f602 100644 --- a/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp @@ -26,7 +26,7 @@ static SceRemoteStorageData s_getDataOutput; void SonyRemoteStorage_Orbis::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) { - static_cast(userData)->internalCallback(event, retCode); + ((SonyRemoteStorage_Orbis*)userData)->internalCallback(event, retCode); } void SonyRemoteStorage_Orbis::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) { @@ -196,7 +196,7 @@ bool SonyRemoteStorage_Orbis::init(CallbackFunc cb, LPVOID lpParam) // memcpy(clientId.id, CLIENT_ID, strlen(CLIENT_ID)); // authParams.pClientId = &clientId; -// ret = sceNpAuthGetAuthorizationCode(reqId, &authParams, &authCode, nullptr); +// ret = sceNpAuthGetAuthorizationCode(reqId, &authParams, &authCode, NULL); // if (ret < 0) { // app.DebugPrintf("Failed to get auth code 0x%x\n", ret); // } @@ -223,7 +223,7 @@ bool SonyRemoteStorage_Orbis::init(CallbackFunc cb, LPVOID lpParam) params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == nullptr) + if(m_memPoolBuffer == NULL) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; diff --git a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp index c075badb..d869d38b 100644 --- a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp @@ -67,7 +67,7 @@ void LoadPCMVoiceData() { char filename[64]; sprintf(filename, "voice%d.pcm", i+1); - HANDLE file = CreateFile(filename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); DWORD dwHigh=0; g_loadedPCMVoiceDataSizes[i] = GetFileSize(file,&dwHigh); @@ -75,7 +75,7 @@ void LoadPCMVoiceData() { g_loadedPCMVoiceData[i] = new char[g_loadedPCMVoiceDataSizes[i]]; DWORD bytesRead; - BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, nullptr); + BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, NULL); assert(bSuccess); } g_loadedPCMVoiceDataPos[i] = 0; @@ -274,7 +274,7 @@ void SQRVoiceConnection::readRemoteData() if( dataSize > 0 ) { VoicePacket packet; - int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, nullptr ); + int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, NULL ); unsigned int writeSize; if( bytesRead > 0 ) { @@ -468,7 +468,7 @@ void SonyVoiceChat_Orbis::sendAllVoiceData() if(m_localVoiceDevices[i].isValid()) { bool bChatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,NULL,NULL); if(bChatRestricted) { @@ -928,7 +928,7 @@ void SonyVoiceChat_Orbis::initLocalPlayer(int playerIndex) if(m_localVoiceDevices[playerIndex].isValid() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); // create all device ports required m_localVoiceDevices[playerIndex].init(ProfileManager.getUserID(playerIndex), chatRestricted); @@ -965,7 +965,7 @@ SQRVoiceConnection* SonyVoiceChat_Orbis::GetVoiceConnectionFromRudpCtx( int Rudp if(m_remoteConnections[i]->m_rudpCtx == RudpCtx) return m_remoteConnections[i]; } - return nullptr; + return NULL; } void SonyVoiceChat_Orbis::connectPlayerToAll( int playerIndex ) @@ -990,7 +990,7 @@ SQRVoiceConnection* SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID( Sce } } - return nullptr; + return NULL; } void SonyVoiceChat_Orbis::disconnectLocalPlayer( int localIdx ) diff --git a/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp b/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp index 21e73a80..661a1528 100644 --- a/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp +++ b/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp @@ -34,7 +34,7 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src ) { wchar_t f,l; - // validation section + // validation section // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); @@ -51,7 +51,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) { size_t n; -// Note that we do not check if s == nullptr, because we do not +// Note that we do not check if s == NULL, because we do not // return errno_t... for (n = 0; n < maxsize && *wcs; n++, wcs++) @@ -95,8 +95,8 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) } HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return NULL; } -VOID Sleep(DWORD dwMilliseconds) -{ +VOID Sleep(DWORD dwMilliseconds) +{ C4JThread::Sleep(dwMilliseconds); } @@ -203,7 +203,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) CriticalSection->m_cLock = 0; assert(err == SCE_OK); #ifdef _DEBUG - CriticalSection->m_pOwnerThread = nullptr; + CriticalSection->m_pOwnerThread = NULL; #endif } @@ -247,7 +247,7 @@ VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) int err = scePthreadMutexUnlock(&CriticalSection->mutex); assert(err == SCE_OK ); #ifdef _DEBUG - CriticalSection->m_pOwnerThread = nullptr; + CriticalSection->m_pOwnerThread = NULL; #endif } @@ -266,8 +266,8 @@ ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection) DWORD WaitForMultipleObjects(DWORD nCount, CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds) { ORBIS_STUBBED; return 0; } -BOOL CloseHandle(HANDLE hObject) -{ +BOOL CloseHandle(HANDLE hObject) +{ sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)hObject)); return true; // ORBIS_STUBBED; @@ -342,7 +342,7 @@ public: if(err != SCE_OK) { assert(0); - return nullptr; + return NULL; } // work out where the next page should be in virtual addr space, and pass that to the mapping function void* pageVirtualAddr = ((char*)m_virtualAddr) + m_allocatedSize; @@ -359,12 +359,12 @@ public: if(inAddr != pageVirtualAddr) // make sure we actually get the virtual address that we requested { assert(0); - return nullptr; + return NULL; } if(err != SCE_OK) { assert(0); - return nullptr; + return NULL; } m_pagesAllocated.push_back(PageInfo(physAddr, pageVirtualAddr, sizeToAdd)); m_allocatedSize += sizeToAdd; @@ -393,8 +393,8 @@ public: static std::vector s_orbisVAllocs; -LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) -{ +LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) +{ if(lpAddress == NULL) { void *pAddr = (void*)SCE_KERNEL_APP_MAP_AREA_START_ADDR; @@ -402,7 +402,7 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO if( err != SCE_OK ) { app.DebugPrintf("sceKernelReserveVirtualRange failed: 0x%08X\n", err); - return nullptr; + return NULL; } s_orbisVAllocs.push_back(new OrbisVAlloc(pAddr, dwSize)); return (LPVOID)pAddr; @@ -419,10 +419,10 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO } } assert(0); // failed to find the virtual alloc in our table - return nullptr; + return NULL; } } - return nullptr; + return NULL; } BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) @@ -483,7 +483,7 @@ BOOL WriteFile( { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHWriteSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToWrite); + SceFiosSize bytesRead = sceFiosFHWriteSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToWrite); if(bytesRead < 0) { // error @@ -500,7 +500,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHReadSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); + SceFiosSize bytesRead = sceFiosFHReadSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); *lpNumberOfBytesRead = (DWORD)bytesRead; if(bytesRead < 0) { @@ -520,7 +520,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi uint64_t bitsToMove = (int64_t) lDistanceToMove; SceFiosOffset pos = 0; - if (lpDistanceToMoveHigh != nullptr) + if (lpDistanceToMoveHigh != NULL) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; SceFiosWhence whence = SCE_FIOS_SEEK_SET; @@ -581,7 +581,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, case TRUNCATE_EXISTING: break; } - int err = sceFiosFHOpenSync(nullptr, &fh, filePath, &openParams); + int err = sceFiosFHOpenSync(NULL, &fh, filePath, &openParams); if(err != SCE_FIOS_OK) { @@ -597,7 +597,7 @@ BOOL DeleteFileA(LPCSTR lpFileName) { ORBIS_STUBBED; return false; } // BOOL XCloseHandle(HANDLE a) // { -// sceFiosFHCloseSync(nullptr,(SceFiosFH)((int64_t)a)); +// sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)a)); // return true; // } @@ -617,7 +617,7 @@ DWORD GetFileAttributesA(LPCSTR lpFileName) // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return -1; diff --git a/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp b/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp index 4229b61d..9f17e999 100644 --- a/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp +++ b/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp @@ -4,7 +4,7 @@ -TLSStorageOrbis* TLSStorageOrbis::m_pInstance = nullptr; +TLSStorageOrbis* TLSStorageOrbis::m_pInstance = NULL; BOOL TLSStorageOrbis::m_activeList[sc_maxSlots]; __thread LPVOID TLSStorageOrbis::m_values[sc_maxSlots]; @@ -16,7 +16,7 @@ TLSStorageOrbis::TLSStorageOrbis() for(int i=0;isecond; } @@ -124,7 +124,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfoFromKeyname(char *pchKeyName) } } - return nullptr; + return NULL; } #define WRAPPED_READFILE(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped) {if(ReadFile(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped)==FALSE) { return FALSE;}} @@ -133,8 +133,8 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() char chDLCTitle[64]; // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - //HANDLE file = CreateFile("orbis/DLCImages/TP01_360x360.png", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); - HANDLE file = CreateFile("orbis/PS4ProductCodes.bin", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + //HANDLE file = CreateFile("orbis/DLCImages/TP01_360x360.png", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile("orbis/PS4ProductCodes.bin", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -149,12 +149,12 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() { DWORD bytesRead; - WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,NULL); app.DebugPrintf("ProductCodes.chProductCode %s\n",ProductCodes.chProductCode); app.DebugPrintf("ProductCodes.chSaveFolderPrefix %s\n",ProductCodes.chSaveFolderPrefix); @@ -165,7 +165,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // DLC unsigned int uiDLC; - WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,NULL); for(unsigned int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,pDLCInfo->chDLCPicname,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,pDLCInfo->chDLCPicname,sizeof(char)*uiVal,&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); // push this into a vector @@ -310,7 +310,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages() { free(pDLCInfo->pbImageData); pDLCInfo->dwImageBytes=0; - pDLCInfo->pbImageData=nullptr; + pDLCInfo->pbImageData=NULL; } } } @@ -323,7 +323,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(SONYDLC *pDLCInfo) sprintf(pchFilename,"orbis/DLCImages/%s_360x360.png",pDLCInfo->chDLCPicname); // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - HANDLE hFile = CreateFile(pchFilename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE hFile = CreateFile(pchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( hFile == INVALID_HANDLE_VALUE ) { @@ -339,7 +339,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(SONYDLC *pDLCInfo) DWORD dwBytesRead; pDLCInfo->pbImageData=(PBYTE)malloc(pDLCInfo->dwImageBytes); - if(ReadFile(hFile,pDLCInfo->pbImageData,pDLCInfo->dwImageBytes,&dwBytesRead,nullptr)==FALSE) + if(ReadFile(hFile,pDLCInfo->pbImageData,pDLCInfo->dwImageBytes,&dwBytesRead,NULL)==FALSE) { // failed free(pDLCInfo->pbImageData); @@ -375,7 +375,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -404,7 +404,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -620,7 +620,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return nullptr; + return NULL; } return &m_CategoryInfo; @@ -636,10 +636,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=nullptr) + if(m_ProductListA!=NULL) { delete [] m_ProductListA; - m_ProductListA=nullptr; + m_ProductListA=NULL; } m_ProductListRetrievedC=0; @@ -665,7 +665,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; for ( SonyCommerce::ProductInfo& : *pProductList ) @@ -727,7 +727,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return nullptr; + return NULL; } return &m_ProductListA[iIndex]; @@ -1175,7 +1175,7 @@ int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pP StorageManager.CancelIncompleteOperation(); break; case C4JStorage::EMessage_ResultThirdOption: - ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, nullptr, eUILayer_Error, eUIGroup_Fullscreen); + ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, NULL, eUILayer_Error, eUIGroup_Fullscreen); break; } return 0; @@ -1186,7 +1186,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=nullptr) + if(pCategories!=NULL) { if(pCategories->countOfProducts>0) { @@ -1244,7 +1244,7 @@ void CConsoleMinecraftApp::PatchAvailableDialogTick() UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr, app.GetStringTable()); + ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); m_bPatchAvailableDialogRunning=false; } } diff --git a/Minecraft.Client/Orbis/Orbis_App.h b/Minecraft.Client/Orbis/Orbis_App.h index 06b6e83a..1c09579f 100644 --- a/Minecraft.Client/Orbis/Orbis_App.h +++ b/Minecraft.Client/Orbis/Orbis_App.h @@ -86,7 +86,7 @@ public: // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} - C4JStringTable *GetStringTable() { return nullptr;} + C4JStringTable *GetStringTable() { return NULL;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp index 7531b25d..20b9dd03 100644 --- a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp @@ -363,7 +363,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - nullptr, + NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -382,16 +382,16 @@ void MemSect(int sect) #endif #ifndef __ORBIS__ -HINSTANCE g_hInst = nullptr; -HWND g_hWnd = nullptr; +HINSTANCE g_hInst = NULL; +HWND g_hWnd = NULL; D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = nullptr; -ID3D11DeviceContext* g_pImmediateContext = nullptr; -IDXGISwapChain* g_pSwapChain = nullptr; -ID3D11RenderTargetView* g_pRenderTargetView = nullptr; -ID3D11DepthStencilView* g_pDepthStencilView = nullptr; -ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; +ID3D11Device* g_pd3dDevice = NULL; +ID3D11DeviceContext* g_pImmediateContext = NULL; +IDXGISwapChain* g_pSwapChain = NULL; +ID3D11RenderTargetView* g_pRenderTargetView = NULL; +ID3D11DepthStencilView* g_pDepthStencilView = NULL; +ID3D11Texture2D* g_pDepthStencilBuffer = NULL; // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) @@ -456,7 +456,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = "Minecraft"; wcex.lpszClassName = "MinecraftClass"; @@ -480,7 +480,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) g_hInst = hInstance; // Store instance handle in our global variable g_hWnd = CreateWindow("MinecraftClass", "Minecraft", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!g_hWnd) { @@ -544,7 +544,7 @@ HRESULT InitDevice() for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, + hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); if( HRESULT_SUCCEEDED( hr ) ) break; @@ -553,7 +553,7 @@ HRESULT InitDevice() return hr; // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; + ID3D11Texture2D* pBackBuffer = NULL; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) return hr; @@ -572,7 +572,7 @@ HRESULT InitDevice() descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; @@ -581,7 +581,7 @@ HRESULT InitDevice() hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView ); + hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) return hr; @@ -774,7 +774,7 @@ int main(int argc, const char *argv[] ) MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -920,7 +920,7 @@ int main(int argc, const char *argv[] ) StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,""); StorageManager.SetSaveTitleExtraFileSuffix(app.GetString(IDS_SAVE_SUBTITLE_SUFFIX)); StorageManager.SetDLCInfoMap(app.GetSonyDLCMap()); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -940,7 +940,7 @@ int main(int argc, const char *argv[] ) } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -1090,7 +1090,7 @@ int main(int argc, const char *argv[] ) // Minecraft::main () used to call Minecraft::Start, but this takes ~2.5 seconds, so now running this in another thread // so we can do some basic renderer calls whilst it is happening. This is at attempt to stop getting TRC failure on SubmitDone taking > 5 seconds on boot - C4JThread *minecraftThread = new C4JThread(&StartMinecraftThreadProc, nullptr, "Running minecraft start"); + C4JThread *minecraftThread = new C4JThread(&StartMinecraftThreadProc, NULL, "Running minecraft start"); minecraftThread->Run(); do { @@ -1195,7 +1195,7 @@ int main(int argc, const char *argv[] ) // We should track down why though... app.DebugPrintf("---init sound engine()\n"); - pMinecraft->soundEngine->init(nullptr); + pMinecraft->soundEngine->init(NULL); while (TRUE) { @@ -1250,7 +1250,7 @@ int main(int argc, const char *argv[] ) else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1491,7 +1491,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != nullptr ) + if( strUtf8 != NULL ) { vRichPresenceStrings.push_back(strUtf8); } @@ -1501,7 +1501,7 @@ uint8_t * AddRichPresenceString(int iID) void FreeRichPresenceStrings() { uint8_t *strUtf8; - for(size_t i=0;i& fileList); std::string GetMountedPath(std::string szMount); C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; } @@ -400,7 +400,7 @@ typedef struct bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=nullptr*/,LPVOID lpParam/*=nullptr*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=NULL*/,LPVOID lpParam/*=NULL*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} // PROFILE DATA int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); diff --git a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp index 1c7edba3..fcce5f05 100644 --- a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp +++ b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp @@ -37,7 +37,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = ch_pcm; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; /* No downmixer is used */ - cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ); + cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ); ret = ch_pcm; } @@ -51,7 +51,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 6; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_B; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) { return 0; // error - the downmixer didn't init } @@ -83,7 +83,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) ret = 8; } - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) == CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) == CELL_OK ) { break; } @@ -94,7 +94,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 2; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_A; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) { return 0; // error - downmixer didn't work } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp index e8bd0367..997e8d83 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp @@ -751,7 +751,7 @@ static void api_free_resource(GDrawHandle *r) S32 i; for (i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = nullptr; + gdraw->active_tex[i] = NULL; } static void RADLINK gdraw_UnlockHandles(GDrawStats *stats) @@ -772,7 +772,7 @@ extern GDrawTexture *gdraw_GCM_WrappedTextureCreate(CellGcmTexture *gcm_tex) memset(&stats, 0, sizeof(stats)); GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle p->handle.tex.gcm_ptr = 0; - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); gdraw_GCM_WrappedTextureChange((GDrawTexture *) p, gcm_tex); return (GDrawTexture *) p; } @@ -816,11 +816,11 @@ static bool is_texture_swizzled(S32 w, S32 h) static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; bool swizzled = false; if (width > 4096 || height > 4096) { - IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); + IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); return false; } @@ -893,7 +893,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, if (swizzled || (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap)) { rrbool ok; - assert(p->temp_buffer != nullptr); + assert(p->temp_buffer != NULL); ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps, bytes_pixel, p->temp_buffer, p->temp_buffer_bytes); assert(ok); // this should never hit unless the temp_buffer is way too small @@ -1023,8 +1023,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == NULL) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -1121,7 +1121,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); // @GDRAW_ASSERT + assert(h != NULL); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -1152,19 +1152,19 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); return t; } void *ptr = gdraw_arena_alloc(&gdraw->rt_arena, size, 1); if (!ptr) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); gdraw_HandleCacheAllocateFail(t); - return nullptr; + return NULL; } t->fence = get_next_fence(); // we're about to start using it immediately, so... - t->raw_ptr = nullptr; + t->raw_ptr = NULL; t->handle.tex.gcm_ptr = ptr; @@ -1329,14 +1329,14 @@ static void set_common_renderstate() // reset our state caching for (i=0; i < MAX_SAMPLERS; i++) { - gdraw->active_tex[i] = nullptr; + gdraw->active_tex[i] = NULL; cellGcmSetTextureControl(gcm, i, CELL_GCM_FALSE, 0, 0, 0); } assert(gdraw->aa_tex.offset != 0); // if you hit this, your initialization is screwed up. set_rsx_texture(gdraw->gcm, AATEX_SAMPLER, &gdraw->aa_tex, GDRAW_WRAP_clamp, 0); - gdraw->cur_fprog = nullptr; + gdraw->cur_fprog = NULL; gdraw->vert_format = -1; gdraw->scissor_state = ~0u; gdraw->blend_mode = -1; @@ -1363,7 +1363,7 @@ static void clear_renderstate(void) static void set_render_target() { - GcmTexture *tex = nullptr; + GcmTexture *tex = NULL; S32 i; CellGcmSurface surf = gdraw->main_surface; @@ -1384,7 +1384,7 @@ static void set_render_target() // invalidate current textures (need to reset them to force L1 texture cache flush) for (i=0; i < MAX_SAMPLERS; ++i) - gdraw->active_tex[i] = nullptr; + gdraw->active_tex[i] = NULL; } //////////////////////////////////////////////////////////////////////// @@ -1513,19 +1513,19 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawFramebufferState *n = gdraw->cur+1; GDrawHandle *t; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { // @TODO implement - t = nullptr; + t = NULL; assert(0); // nyi } else { t = get_color_rendertarget(stats); @@ -1534,9 +1534,9 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex } n->color_buffer = t; - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT - n->cached = owner != nullptr; + n->cached = owner != NULL; if (owner) { n->base_x = region->x0; n->base_y = region->y0; @@ -1617,9 +1617,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != nullptr); // @GDRAW_ASSERT + assert(m->color_buffer != NULL); // @GDRAW_ASSERT } - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT // wait for render to texture operation to finish // can't put down a backend fence directly, there might still be @@ -1694,7 +1694,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, if (para == -1) return; - gd->cur_fprog = nullptr; // need to re-set shader after patching + gd->cur_fprog = NULL; // need to re-set shader after patching const U64 *inv = (const U64 *) values; const int *patch_offs = (const int *) para; @@ -1728,7 +1728,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, static RADINLINE void set_texture(S32 texunit, GDrawTexture *tex) { assert(texunit < MAX_SAMPLERS); - assert(tex != nullptr); + assert(tex != NULL); if (gdraw->active_tex[texunit] != tex) { gdraw->active_tex[texunit] = tex; @@ -1983,7 +1983,7 @@ static RADINLINE void set_vertex_decl(GDraw * RADRESTRICT gd, CellGcmContextData // Draw triangles with a given renderstate // -static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) +static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) { GDrawFence fence; fence.value = gd->next_fence_index; @@ -2046,7 +2046,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti while (pos < p->num_indices) { S32 vert_count = RR_MIN(p->num_indices - pos, verts_per_chunk); void *ring = gdraw_bufring_alloc(&gd->dyn_vb, vert_count * vsize, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != nullptr); // we specifically chunked so this alloc succeeds! + assert(ring != NULL); // we specifically chunked so this alloc succeeds! // prepare for painting... cellGcmSetInvalidateVertexCache(gcm); @@ -2083,7 +2083,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti S32 vert_count = RR_MIN(p->num_vertices - pos, verts_per_chunk); U32 chunk_bytes = vert_count * vsize; void *ring = gdraw_bufring_alloc(&gd->dyn_vb, chunk_bytes, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != nullptr); // we picked the chunk size so this alloc succeeds! + assert(ring != NULL); // we picked the chunk size so this alloc succeeds! memcpy(ring, (U8 *)p->vertices + pos * vsize, chunk_bytes); cellGcmSetInvalidateVertexCache(gcm); @@ -2203,7 +2203,7 @@ static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbe { ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode]; U32 ucode_offs = prg->cfg.offset; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) return; set_texture(0, r->tex[0]); @@ -2287,14 +2287,14 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = nullptr; + GDrawHandle *blend_tex = NULL; GDraw *gd = gdraw; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. so we need to copy the // relevant pixels from our active render target into a texture. if (r->blend_mode == GDRAW_BLEND_special && - (blend_tex = get_color_rendertarget(stats)) != nullptr) { + (blend_tex = get_color_rendertarget(stats)) != NULL) { // slightly different logic depending on whether we were rendering // to the main color buffer or a render target, because the former // has tile origin-based coordinates while the latter don't. also, @@ -2344,7 +2344,7 @@ static void create_fragment_program(ProgramWithCachedVariableLocations *p, Progr cellGcmCgGetUCode(p->program, &ucode_main, &ucode_size); ucode_local = gdraw_arena_alloc(&gdraw->local_arena, ucode_size + 400, CELL_GCM_FRAGMENT_UCODE_LOCAL_ALIGN_OFFSET); // 400 for overfetch - assert(ucode_local != nullptr); // if this triggers, it's a GDraw bug + assert(ucode_local != NULL); // if this triggers, it's a GDraw bug memcpy(ucode_local, ucode_main, ucode_size); cellGcmCgGetCgbFragmentProgramConfiguration(p->program, &p->cfg, 0, 1, 0); @@ -2408,7 +2408,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig U32 header_size = is_vertex ? 0 : sizeof(GcmTexture) * num_handles; if (!num_handles) - return nullptr; + return NULL; GDrawHandleCache *cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size); if (cache) { @@ -2427,7 +2427,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig cache->alloc = gfxalloc_create(gdraw_mem[type].ptr, num_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - cache = nullptr; + cache = NULL; } } @@ -2496,14 +2496,14 @@ int gdraw_GCM_SetResourceMemory(gdraw_gcm_resourcetype type, S32 num_handles, vo free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_GCM_RESOURCE_texture, CELL_GCM_TEXTURE_SWIZZLE_ALIGN_OFFSET); gdraw->tex_loc = get_location(ptr); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_GCM_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_GCM_RESOURCE_vertexbuffer, CELL_GCM_SURFACE_LINEAR_ALIGN_OFFSET); gdraw->vbuf_base = ptr ? (U8 *) ptr - addr2offs(ptr) : 0; gdraw->vbuf_loc = get_location(ptr); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; case GDRAW_GCM_RESOURCE_dyn_vertexbuffer: gdraw_bufring_shutdown(&gdraw->dyn_vb); @@ -2549,10 +2549,10 @@ int gdraw_GCM_SetRendertargetMemory(void *ptr, S32 num_bytes, S32 width, S32 hei void gdraw_GCM_ResetAllResourceMemory() { - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, nullptr, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, nullptr, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, nullptr, 0); - gdraw_GCM_SetRendertargetMemory(nullptr, 0, 0, 0, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, NULL, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, NULL, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, NULL, 0); + gdraw_GCM_SetRendertargetMemory(NULL, 0, 0, 0, 0); } GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_workmem, U8 rsx_label_index) @@ -2560,7 +2560,7 @@ GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_wor S32 i; gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); // make sure gdraw struct is PPU cache line aligned - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -2648,7 +2648,7 @@ void gdraw_GCM_DestroyContext(void) free_handle_cache(gdraw->texturecache); free_handle_cache(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h index cf691d06..f8ec8705 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h @@ -108,7 +108,7 @@ IDOC extern GDrawFunctions * gdraw_GCM_CreateContext(CellGcmContextData *gcm, vo There can only be one GCM GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_GCM_DestroyContext(void); /* Destroys the current GDraw context, if any. */ diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl index 4d3c91bb..811f524a 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl @@ -273,24 +273,24 @@ static int pshader_basic_econst[28] = { }; static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { - { { pshader_basic_0 }, { nullptr }, { -1, 7, -1, -1, -1, } }, - { { pshader_basic_1 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, - { { pshader_basic_2 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, - { { pshader_basic_3 }, { nullptr }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_4 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, - { { pshader_basic_5 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 4)), -1, } }, - { { pshader_basic_6 }, { nullptr }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_7 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, - { { pshader_basic_8 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, - { { pshader_basic_9 }, { nullptr }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_10 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 8)), -1, } }, - { { pshader_basic_11 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 10)), -1, } }, - { { pshader_basic_12 }, { nullptr }, { 0, 7, -1, -1, static_cast((intptr_t)(pshader_basic_econst + 12)), } }, - { { pshader_basic_13 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 16)), static_cast((intptr_t)(pshader_basic_econst + 18)), } }, - { { pshader_basic_14 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 22)), static_cast((intptr_t)(pshader_basic_econst + 24)), } }, - { { pshader_basic_15 }, { nullptr }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_16 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, - { { pshader_basic_17 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_0 }, { NULL }, { -1, 7, -1, -1, -1, } }, + { { pshader_basic_1 }, { NULL }, { -1, 7, -1, (int) (intptr_t) (pshader_basic_econst + 0), -1, } }, + { { pshader_basic_2 }, { NULL }, { -1, 7, -1, (int) (intptr_t) (pshader_basic_econst + 0), -1, } }, + { { pshader_basic_3 }, { NULL }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_4 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 2), -1, } }, + { { pshader_basic_5 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 4), -1, } }, + { { pshader_basic_6 }, { NULL }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_7 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, + { { pshader_basic_8 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, + { { pshader_basic_9 }, { NULL }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_10 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 8), -1, } }, + { { pshader_basic_11 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 10), -1, } }, + { { pshader_basic_12 }, { NULL }, { 0, 7, -1, -1, (int) (intptr_t) (pshader_basic_econst + 12), } }, + { { pshader_basic_13 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 16), (int) (intptr_t) (pshader_basic_econst + 18), } }, + { { pshader_basic_14 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 22), (int) (intptr_t) (pshader_basic_econst + 24), } }, + { { pshader_basic_15 }, { NULL }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_16 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 2), -1, } }, + { { pshader_basic_17 }, { NULL }, { 0, 7, -1, (int) (intptr_t) (pshader_basic_econst + 6), -1, } }, }; static unsigned char pshader_exceptional_blend_1[368] = { @@ -536,19 +536,19 @@ static int pshader_exceptional_blend_econst[4] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { { nullptr }, { nullptr }, { -1, -1, -1, -1, } }, - { { pshader_exceptional_blend_1 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_4 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_5 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_8 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_9 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_11 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, - { { pshader_exceptional_blend_12 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, } }, + { { pshader_exceptional_blend_1 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_2 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_3 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_4 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_5 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_6 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_7 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_8 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_9 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_10 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 0), } }, + { { pshader_exceptional_blend_11 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 2), } }, + { { pshader_exceptional_blend_12 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_exceptional_blend_econst + 2), } }, }; static unsigned char pshader_filter_0[416] = { @@ -1121,38 +1121,38 @@ static int pshader_filter_econst[90] = { }; static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { { pshader_filter_0 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 0)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_1 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_4 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 19)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_5 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_8 }, { nullptr }, { -1, 1, static_cast((intptr_t)(pshader_filter_econst + 21)), -1, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 24)), -1, } }, - { { pshader_filter_9 }, { nullptr }, { -1, -1, static_cast((intptr_t)(pshader_filter_econst + 27)), -1, -1, -1, -1, -1, } }, - { { pshader_filter_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_11 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 29)), 2, static_cast((intptr_t)(pshader_filter_econst + 32)), -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { pshader_filter_16 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_17 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, - { { pshader_filter_18 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 54)), static_cast((intptr_t)(pshader_filter_econst + 59)), -1, } }, - { { pshader_filter_19 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, - { { pshader_filter_20 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_21 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, - { { pshader_filter_22 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 69)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 73)), -1, } }, - { { pshader_filter_23 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, - { { pshader_filter_24 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_25 }, { nullptr }, { 0, -1, static_cast((intptr_t)(pshader_filter_econst + 76)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, static_cast((intptr_t)(pshader_filter_econst + 67)), } }, - { { pshader_filter_26 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 78)), 2, static_cast((intptr_t)(pshader_filter_econst + 82)), static_cast((intptr_t)(pshader_filter_econst + 87)), -1, } }, - { { pshader_filter_27 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_0 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 0), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_1 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 11), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_2 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, + { { pshader_filter_3 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, + { { pshader_filter_4 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 19), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_5 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 11), (int) (intptr_t) (pshader_filter_econst + 2), -1, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_6 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 2), 2, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_7 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 13), 2, (int) (intptr_t) (pshader_filter_econst + 16), (int) (intptr_t) (pshader_filter_econst + 5), -1, } }, + { { pshader_filter_8 }, { NULL }, { -1, 1, (int) (intptr_t) (pshader_filter_econst + 21), -1, -1, -1, (int) (intptr_t) (pshader_filter_econst + 24), -1, } }, + { { pshader_filter_9 }, { NULL }, { -1, -1, (int) (intptr_t) (pshader_filter_econst + 27), -1, -1, -1, -1, -1, } }, + { { pshader_filter_10 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 2), 2, (int) (intptr_t) (pshader_filter_econst + 5), (int) (intptr_t) (pshader_filter_econst + 8), -1, } }, + { { pshader_filter_11 }, { NULL }, { 0, -1, -1, (int) (intptr_t) (pshader_filter_econst + 29), 2, (int) (intptr_t) (pshader_filter_econst + 32), -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_16 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, + { { pshader_filter_17 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 47), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 51), (int) (intptr_t) (pshader_filter_econst + 35), } }, + { { pshader_filter_18 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 37), 2, (int) (intptr_t) (pshader_filter_econst + 54), (int) (intptr_t) (pshader_filter_econst + 59), -1, } }, + { { pshader_filter_19 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 62), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 66), -1, } }, + { { pshader_filter_20 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, + { { pshader_filter_21 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 47), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 51), (int) (intptr_t) (pshader_filter_econst + 35), } }, + { { pshader_filter_22 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 69), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 73), -1, } }, + { { pshader_filter_23 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 62), 2, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 66), -1, } }, + { { pshader_filter_24 }, { NULL }, { 0, 1, (int) (intptr_t) (pshader_filter_econst + 35), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), (int) (intptr_t) (pshader_filter_econst + 46), (int) (intptr_t) (pshader_filter_econst + 49), } }, + { { pshader_filter_25 }, { NULL }, { 0, -1, (int) (intptr_t) (pshader_filter_econst + 76), (int) (intptr_t) (pshader_filter_econst + 37), -1, (int) (intptr_t) (pshader_filter_econst + 41), -1, (int) (intptr_t) (pshader_filter_econst + 67), } }, + { { pshader_filter_26 }, { NULL }, { 0, 1, -1, (int) (intptr_t) (pshader_filter_econst + 78), 2, (int) (intptr_t) (pshader_filter_econst + 82), (int) (intptr_t) (pshader_filter_econst + 87), -1, } }, + { { pshader_filter_27 }, { NULL }, { 0, -1, -1, (int) (intptr_t) (pshader_filter_econst + 37), 2, (int) (intptr_t) (pshader_filter_econst + 41), -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, }; static unsigned char pshader_blur_2[368] = { @@ -1560,16 +1560,16 @@ static int pshader_blur_econst[256] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { { nullptr }, { nullptr }, { -1, -1, -1, } }, - { { nullptr }, { nullptr }, { -1, -1, -1, } }, - { { pshader_blur_2 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 0)), static_cast((intptr_t)(pshader_blur_econst + 13)), } }, - { { pshader_blur_3 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 18)), static_cast((intptr_t)(pshader_blur_econst + 33)), } }, - { { pshader_blur_4 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 40)), static_cast((intptr_t)(pshader_blur_econst + 57)), } }, - { { pshader_blur_5 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 66)), static_cast((intptr_t)(pshader_blur_econst + 85)), } }, - { { pshader_blur_6 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 96)), static_cast((intptr_t)(pshader_blur_econst + 117)), } }, - { { pshader_blur_7 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 130)), static_cast((intptr_t)(pshader_blur_econst + 153)), } }, - { { pshader_blur_8 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 168)), static_cast((intptr_t)(pshader_blur_econst + 193)), } }, - { { pshader_blur_9 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 210)), static_cast((intptr_t)(pshader_blur_econst + 237)), } }, + { { NULL }, { NULL }, { -1, -1, -1, } }, + { { NULL }, { NULL }, { -1, -1, -1, } }, + { { pshader_blur_2 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 0), (int) (intptr_t) (pshader_blur_econst + 13), } }, + { { pshader_blur_3 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 18), (int) (intptr_t) (pshader_blur_econst + 33), } }, + { { pshader_blur_4 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 40), (int) (intptr_t) (pshader_blur_econst + 57), } }, + { { pshader_blur_5 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 66), (int) (intptr_t) (pshader_blur_econst + 85), } }, + { { pshader_blur_6 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 96), (int) (intptr_t) (pshader_blur_econst + 117), } }, + { { pshader_blur_7 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 130), (int) (intptr_t) (pshader_blur_econst + 153), } }, + { { pshader_blur_8 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 168), (int) (intptr_t) (pshader_blur_econst + 193), } }, + { { pshader_blur_9 }, { NULL }, { 0, (int) (intptr_t) (pshader_blur_econst + 210), (int) (intptr_t) (pshader_blur_econst + 237), } }, }; static unsigned char pshader_color_matrix_0[336] = { @@ -1598,7 +1598,7 @@ static int pshader_color_matrix_econst[12] = { }; static ProgramWithCachedVariableLocations pshader_color_matrix_arr[1] = { - { { pshader_color_matrix_0 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_color_matrix_econst + 0)), } }, + { { pshader_color_matrix_0 }, { NULL }, { 0, (int) (intptr_t) (pshader_color_matrix_econst + 0), } }, }; static unsigned char vshader_vsps3_0[272] = { @@ -1655,8 +1655,8 @@ static unsigned char vshader_vsps3_2[240] = { }; static ProgramWithCachedVariableLocations vshader_vsps3_arr[3] = { - { { vshader_vsps3_0 }, { nullptr }, { } }, - { { vshader_vsps3_1 }, { nullptr }, { } }, - { { vshader_vsps3_2 }, { nullptr }, { } }, + { { vshader_vsps3_0 }, { NULL }, { } }, + { { vshader_vsps3_1 }, { NULL }, { } }, + { { vshader_vsps3_2 }, { NULL }, { } }, }; diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl index 6f8dd9c0..86293ab6 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != nullptr) { + while (s != NULL) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! + assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, nullptr); + return gdraw_HandleCacheLockStats(t, owner, NULL); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = nullptr; - c->state[i].cache = nullptr; // should never follow cache link from sentinels! + c->state[i].owner = NULL; + c->state[i].cache = NULL; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = nullptr; + c->state[i].raw_ptr = NULL; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = nullptr; + c->handle[i].raw_ptr = NULL; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = nullptr; + c->alloc = NULL; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = nullptr; + c->alloc_other = NULL; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = nullptr; + t->raw_ptr = NULL; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -563,7 +563,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : nullptr; + return (sentinel->next != sentinel) ? sentinel->next : NULL; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -778,7 +778,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -830,7 +830,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -842,7 +842,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -949,7 +949,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); + S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1095,7 +1095,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = nullptr; + *start = NULL; *num_bytes = 0; return; } else { @@ -1132,7 +1132,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return nullptr; + return NULL; arena->current = ptr + size; return ptr; @@ -1157,7 +1157,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, nullptr-terminated list of elements in each hash +// There's a single-linked, NULL-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1166,7 +1166,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, nullptr-terminated list of unused blocks. Every block is either +// single-linked, NULL-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1384,7 +1384,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != nullptr); + GFXALLOC_ASSERT(alloc->unused_list != NULL); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1457,7 +1457,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return nullptr; + return NULL; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1465,7 +1465,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return nullptr; + return NULL; memset(a, 0, size); @@ -1506,16 +1506,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, nullptr, 0,0); + debug_complete_check(a, NULL, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = nullptr; + gfx_block_info *cur, *best = NULL; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, nullptr, 0,0); +debug_complete_check(alloc, NULL, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1565,7 +1565,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return nullptr; // not enough space! + return NULL; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1735,7 +1735,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = nullptr; + b->prev = NULL; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1748,7 +1748,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1910,7 +1910,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = nullptr; + void *ptr = NULL; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2300,7 +2300,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = nullptr; + ring->cur = NULL; ring->seg_size = 0; } @@ -2310,7 +2310,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return nullptr; // nope, won't fit + return NULL; // nope, won't fit assert(align <= ring->align); @@ -2415,7 +2415,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2435,8 +2435,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return nullptr; + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return NULL; } #ifndef GDRAW_MANAGE_MEM @@ -2445,7 +2445,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2453,7 +2453,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, nullptr, "memory"); + gdraw_res_alloc_outofmem(c, NULL, "memory"); break; } } @@ -2468,8 +2468,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == nullptr) { - gdraw_res_alloc_outofmem(c, nullptr, "handles"); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); } } } @@ -2513,7 +2513,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = nullptr; + r->owner = NULL; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2521,11 +2521,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = nullptr; + void *ptr = NULL; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2537,7 +2537,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, nullptr, "handles"); + return gdraw_res_alloc_outofmem(c, NULL, "handles"); } // try to allocate first diff --git a/Minecraft.Client/PS3/Iggy/include/gdraw.h b/Minecraft.Client/PS3/Iggy/include/gdraw.h index 7cc4ddd0..404a2642 100644 --- a/Minecraft.Client/PS3/Iggy/include/gdraw.h +++ b/Minecraft.Client/PS3/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is nullptr, then the pointers in 'prim' are machine pointers, and + If buf is NULL, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-nullptr, then use the appropriate vertex buffer, and the + If buf is non-NULL, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or nullptr if an error occured + $:return Handle for the newly created texture, or NULL if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h index a42ccbff..1f1a90a1 100644 --- a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP +Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp index 27406186..38380bfb 100644 --- a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -30,7 +30,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = nullptr; //m_stats = nullptr; + m_scores = NULL; //m_stats = NULL; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -42,7 +42,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = nullptr; + m_threadScoreboard = NULL; } PS3LeaderboardManager::~PS3LeaderboardManager() @@ -196,7 +196,7 @@ bool PS3LeaderboardManager::getScoreByIds() CellRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = nullptr; + SceNpId *npIds = NULL; int ret; @@ -246,7 +246,7 @@ bool PS3LeaderboardManager::getScoreByIds() sceNpScoreDestroyTransactionCtx(ret); - if (npIds != nullptr) delete [] npIds; + if (npIds != NULL) delete [] npIds; return false; } else if (ret < 0) @@ -256,7 +256,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != nullptr) delete [] npIds; + if (npIds != NULL) delete [] npIds; return false; } else @@ -270,7 +270,7 @@ bool PS3LeaderboardManager::getScoreByIds() comments = new SceNpScoreComment[num]; /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -285,14 +285,14 @@ bool PS3LeaderboardManager::getScoreByIds() comments, sizeof(SceNpScoreComment) * num, //OUT: Comments - nullptr, 0, // GameData. (unused) + NULL, 0, // GameData. (unused) num, &last_sort_date, &mTotalRecord, - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -319,7 +319,7 @@ bool PS3LeaderboardManager::getScoreByIds() delete [] comments; delete [] npIds; - m_scores = nullptr; + m_scores = NULL; m_readCount = 0; m_maxRank = num; @@ -335,7 +335,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -368,7 +368,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != nullptr) delete [] npIds; + if (npIds != NULL) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -422,14 +422,14 @@ bool PS3LeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - nullptr, 0, // GameData. + NULL, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - nullptr // Reserved, specify null. + NULL // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -454,7 +454,7 @@ bool PS3LeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = nullptr; + m_scores = NULL; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -472,7 +472,7 @@ bool PS3LeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != nullptr) delete [] m_scores; + if (m_scores != NULL) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != nullptr) + if (m_readListener != NULL) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -621,16 +621,16 @@ void PS3LeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = nullptr; + m_scores = NULL; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = nullptr; + view.m_queries = NULL; - if ( m_readListener != nullptr ) + if ( m_readListener != NULL ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -652,7 +652,7 @@ bool PS3LeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == nullptr) + if (m_threadScoreboard == NULL) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -747,7 +747,7 @@ void PS3LeaderboardManager::FlushStats() {} void PS3LeaderboardManager::CancelOperation() { - m_readListener = nullptr; + m_readListener = NULL; m_eStatsState = eStatsState_Canceled; if (m_transactionCtx != 0) @@ -897,7 +897,7 @@ void PS3LeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = in->data[i]; - unsigned char fivebits = strtol(ch, nullptr, 32) << 3; + unsigned char fivebits = strtol(ch, NULL, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -958,7 +958,7 @@ bool PS3LeaderboardManager::test_string(string testing) int ctx = sceNpScoreCreateTransactionCtx(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, nullptr); + int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, NULL); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp index a1a57443..8ab30beb 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp @@ -19,8 +19,8 @@ #include "..\PS3Extras\PS3Strings.h" #include "PS3\Network\SonyRemoteStorage_PS3.h" -int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; -void * SQRNetworkManager_PS3::s_SignInCompleteParam = nullptr; +int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; +void * SQRNetworkManager_PS3::s_SignInCompleteParam = NULL; SceNpBasicPresenceDetails2 SQRNetworkManager_PS3::s_lastPresenceInfo = { 0 }; int SQRNetworkManager_PS3::s_resendPresenceCountdown = 0; bool SQRNetworkManager_PS3::s_presenceStatusDirty = false; @@ -96,8 +96,8 @@ SQRNetworkManager_PS3::SQRNetworkManager_PS3(ISQRNetworkManagerListener *listene m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = nullptr; - m_gameBootInvite = nullptr; + m_aServerId = NULL; + m_gameBootInvite = NULL; m_onlineStatus = false; m_bLinkDisconnected = false; @@ -151,7 +151,7 @@ void SQRNetworkManager_PS3::Initialise() // Initialise RUDP #ifdef __PS3__ - ret = cellRudpInit(nullptr); + ret = cellRudpInit(NULL); #else const int RUDP_POOL_SIZE = (500 * 1024); // TODO - find out what we need, this size is copied from library reference uint8_t *rudp_pool = (uint8_t *)malloc(RUDP_POOL_SIZE); @@ -258,7 +258,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } return; } @@ -268,7 +268,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, nullptr); + ret = sceNpMatching2Init2(0, 0, NULL); } #else SceNpMatching2InitializeParameter initParam; @@ -339,7 +339,7 @@ void SQRNetworkManager_PS3::Tick() if( ( m_gameBootInvite ) && ( s_safeToRespondToGameBootInvite ) ) { m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - m_gameBootInvite = nullptr; + m_gameBootInvite = NULL; } ErrorHandlingTick(); @@ -399,12 +399,12 @@ void SQRNetworkManager_PS3::Tick() if( s_signInCompleteCallbackIfFailed ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } @@ -421,7 +421,7 @@ void SQRNetworkManager_PS3::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineGame) // m_offlineSQR ) // MGH - changed this to m_offlineGame, as m_offlineSQR can be true when running an online game but the init has failed because the servers are down @@ -531,7 +531,7 @@ void SQRNetworkManager_PS3::UpdateExternalRoomData() reqParam.roomBinAttrExternalNum = 1; reqParam.roomBinAttrExternal = &roomBinAttr; - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -564,7 +564,7 @@ bool SQRNetworkManager_PS3::FriendRoomManagerSearch() for( int i = 0; i < m_searchResultCount; i++ ) { free(m_aSearchResultRoomExtDataReceived[i]); - m_aSearchResultRoomExtDataReceived[i] = nullptr; + m_aSearchResultRoomExtDataReceived[i] = NULL; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -639,7 +639,7 @@ void SQRNetworkManager_PS3::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = nullptr; + m_getFriendCountThread = NULL; FriendRoomManagerSearch2(); } } @@ -813,7 +813,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByIndex(int idx) } else { - return nullptr; + return NULL; } } @@ -830,7 +830,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) @@ -846,7 +846,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) @@ -862,7 +862,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() @@ -875,11 +875,11 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == nullptr ) return nullptr; + if( player == NULL ) return NULL; if( player->IsReady() ) return player; - return nullptr; + return NULL; } // Update state internally @@ -930,7 +930,7 @@ bool SQRNetworkManager_PS3::JoinRoom(SQRNetworkManager_PS3::SessionSearchResult { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -996,7 +996,7 @@ void SQRNetworkManager_PS3::LeaveRoom(bool bActuallyLeaveRoom) reqParam.roomId = m_room; SetState(SNM_INT_STATE_LEAVING); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1100,7 +1100,7 @@ bool SQRNetworkManager_PS3::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1148,7 +1148,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; // Sync this back out to our networked clients... SyncRoomData(); @@ -1184,7 +1184,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1216,7 +1216,7 @@ void SQRNetworkManager_PS3::SendInviteGUI() msg.mainType = SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE; msg.subType = SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT; msg.msgFeatures = SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE; - msg.npids = nullptr; + msg.npids = NULL; msg.count = 0; uint8_t *subject = mallocAndCreateUTF8ArrayFromString(IDS_INVITATION_SUBJECT_MAX_18_CHARS); @@ -1284,7 +1284,7 @@ void SQRNetworkManager_PS3::FindOrCreateNonNetworkPlayer(int slot, int playerTyp } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = nullptr; + PlayerUID *pUID = NULL; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1351,7 +1351,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1407,7 +1407,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1499,7 +1499,7 @@ void SQRNetworkManager_PS3::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) +bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) { assert( m_isHosting ); @@ -1618,7 +1618,7 @@ void SQRNetworkManager_PS3::RemoveRemotePlayersAndSync( SceNpMatching2RoomMember } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; } else { @@ -1660,7 +1660,7 @@ void SQRNetworkManager_PS3::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } // And delete the reference from the ctx->player map @@ -1711,7 +1711,7 @@ void SQRNetworkManager_PS3::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -1724,7 +1724,7 @@ bool SQRNetworkManager_PS3::GetMatchingContext(eSQRNetworkManagerInternalState a int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, nullptr); + ret = sceNpMatching2Init2(0, 0, NULL); } if( ret < 0 ) { @@ -1797,7 +1797,7 @@ bool SQRNetworkManager_PS3::GetServerContext() bool SQRNetworkManager_PS3::GetServerContext2() { // Get list of server IDs of servers allocated to the application - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1852,7 +1852,7 @@ bool SQRNetworkManager_PS3::GetServerContext(SceNpMatching2ServerId serverId) { // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // the context *really* is valid. - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1906,7 +1906,7 @@ void SQRNetworkManager_PS3::ServerContextTick() reqParam.serverId = m_serverId; SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_CREATING_CONTEXT:SNM_INT_STATE_JOINING_SERVER_SEARCH_CREATING_CONTEXT); // Found a server - now try and create a context for it - int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); + int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT) ) { SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_FAILED:SNM_INT_STATE_JOINING_SERVER_SEARCH_FAILED); @@ -1958,7 +1958,7 @@ void SQRNetworkManager_PS3::RoomCreateTick() SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM); app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2105,7 +2105,7 @@ bool SQRNetworkManager_PS3::SelectRandomServer() // Kick off the search - we'll get a callback to DefaultRequestCallback with the result from this app.DebugPrintf(CMinecraftApp::USER_RR,"Kicking off sceNpMatching2GetServerInfo for server id %d\n",reqParam.serverId); - int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, nullptr, &m_serverSearchRequestId); + int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, NULL, &m_serverSearchRequestId); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_GET_SERVER_INFO) ) { // Jump straight to an error state for this server @@ -2125,7 +2125,7 @@ void SQRNetworkManager_PS3::DeleteServerContext() reqParam.serverId = m_serverId; m_serverContextValid = false; SetState(SNM_INT_STATE_SERVER_DELETING_CONTEXT); - int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); + int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_DELETE_SERVER_CONTEXT) ) { ResetToIdle(); @@ -2203,7 +2203,7 @@ bool SQRNetworkManager_PS3::CreateRudpConnections(SceNpMatching2RoomId roomId, S if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); } else { @@ -2237,7 +2237,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx) @@ -2249,7 +2249,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int return it->second; } } - return nullptr; + return NULL; } @@ -2342,7 +2342,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); + manager->GetExtDataForRoom(0, NULL, NULL, NULL); break; } @@ -2373,7 +2373,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); -// s_SignInCompleteCallbackFn = nullptr; +// s_SignInCompleteCallbackFn = NULL; // } @@ -2510,7 +2510,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S } } - // If there was some problem getting data, then silently ignore as we don't want to go any further with a nullptr data pointer, and this will just be indicating that the networking context + // If there was some problem getting data, then silently ignore as we don't want to go any further with a NULL data pointer, and this will just be indicating that the networking context // is invalid which will be picked up elsewhere to shut everything down properly if( dataError ) { @@ -2706,7 +2706,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); break; } @@ -2814,7 +2814,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM case SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed: { SonyVoiceChat::signalRoomDestroyed(); - SceNpMatching2RoomUpdateInfo *pUpdateInfo=nullptr; + SceNpMatching2RoomUpdateInfo *pUpdateInfo=NULL; if( dataSize <= SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo ) { @@ -2937,7 +2937,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); } } @@ -3037,7 +3037,7 @@ void SQRNetworkManager_PS3::SignallingCallback(SceNpMatching2ContextId ctxId, Sc reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_roomMemberDataRequestId); } else { @@ -3118,7 +3118,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } return; } @@ -3133,7 +3133,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } @@ -3204,7 +3204,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) ) { SQRNetworkPlayer::InitSendData ISD; - unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, nullptr ); + unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL ); if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) ) { manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD); @@ -3225,7 +3225,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize > 0 ) { unsigned char *data = new unsigned char [ dataSize ]; - unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, nullptr ); + unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, NULL ); if( bytesRead > 0 ) { SQRNetworkPlayer *playerFrom, *playerTo; @@ -3241,7 +3241,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) + if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3306,7 +3306,7 @@ void SQRNetworkManager_PS3::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); } if (ret < 0) { @@ -3335,7 +3335,7 @@ void SQRNetworkManager_PS3::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3386,9 +3386,9 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != nullptr ) + // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != NULL ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3412,14 +3412,14 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3434,7 +3434,7 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3530,7 +3530,7 @@ void SQRNetworkManager_PS3::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h index 4953b08f..6143bbb5 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h @@ -125,7 +125,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp index 7bd10110..230e0309 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp @@ -9,22 +9,22 @@ bool SonyCommerce_PS3::m_bCommerceInitialised = false; SceNpCommerce2SessionInfo SonyCommerce_PS3::m_sessionInfo; SonyCommerce_PS3::State SonyCommerce_PS3::m_state = e_state_noSession; int SonyCommerce_PS3::m_errorCode = 0; -LPVOID SonyCommerce_PS3::m_callbackParam = nullptr; +LPVOID SonyCommerce_PS3::m_callbackParam = NULL; -void* SonyCommerce_PS3::m_receiveBuffer = nullptr; +void* SonyCommerce_PS3::m_receiveBuffer = NULL; SonyCommerce_PS3::Event SonyCommerce_PS3::m_event; std::queue SonyCommerce_PS3::m_messageQueue; -std::vector* SonyCommerce_PS3::m_pProductInfoList = nullptr; -SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = nullptr; -SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = nullptr; +std::vector* SonyCommerce_PS3::m_pProductInfoList = NULL; +SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = NULL; +SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = NULL; -SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = nullptr; -const char* SonyCommerce_PS3::m_pProductID = nullptr; -char* SonyCommerce_PS3::m_pCategoryID = nullptr; +SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = NULL; +const char* SonyCommerce_PS3::m_pProductID = NULL; +char* SonyCommerce_PS3::m_pCategoryID = NULL; SonyCommerce_PS3::CheckoutInputParams SonyCommerce_PS3::m_checkoutInputParams; SonyCommerce_PS3::DownloadListInputParams SonyCommerce_PS3::m_downloadInputParams; -SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = nullptr; +SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = NULL; sys_memory_container_t SonyCommerce_PS3::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_PS3::m_bUpgradingTrial = false; @@ -40,19 +40,19 @@ bool SonyCommerce_PS3::m_contextCreated=false; ///< npcommerce2 context ID c SonyCommerce_PS3::Phase SonyCommerce_PS3::m_currentPhase = e_phase_stopped; ///< Current commerce2 util char SonyCommerce_PS3::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_PS3::m_tickThread = nullptr; +C4JThread* SonyCommerce_PS3::m_tickThread = NULL; bool SonyCommerce_PS3::m_bLicenseChecked=false; // Check the trial/full license for the game SonyCommerce_PS3::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_PS3::Delete() { - m_pProductInfoList=nullptr; - m_pProductInfoDetailed=nullptr; - m_pProductInfo=nullptr; - m_pCategoryInfo = nullptr; - m_pProductID = nullptr; - m_pCategoryID = nullptr; + m_pProductInfoList=NULL; + m_pProductInfoDetailed=NULL; + m_pProductInfo=NULL; + m_pCategoryInfo = NULL; + m_pProductID = NULL; + m_pCategoryID = NULL; } void SonyCommerce_PS3::Init() { @@ -106,11 +106,11 @@ void SonyCommerce_PS3::CheckForTrialUpgradeKey() // 4J-PB - If we are the blu ray disc then we are the full version if(StorageManager.GetBootTypeDisc()) { - CheckForTrialUpgradeKey_Callback(nullptr,true); + CheckForTrialUpgradeKey_Callback(NULL,true); } else { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); } } @@ -498,7 +498,7 @@ int SonyCommerce_PS3::getDetailedProductInfo(ProductInfoDetailed *pInfo, const c if (categoryId && categoryId[0] != 0) { ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); } else { - ret = sceNpCommerce2GetProductInfoStart(requestId, nullptr, productId); + ret = sceNpCommerce2GetProductInfoStart(requestId, NULL, productId); } if (ret < 0) { sceNpCommerce2DestroyReq(requestId); @@ -766,7 +766,7 @@ int SonyCommerce_PS3::checkout(CheckoutInputParams ¶ms) } } - for (size_t i = 0; i < params.skuIds.size(); i++) { + for (int i = 0; i < params.skuIds.size(); i++) { skuIdsTemp[i] = (const char *)(*iter); iter++; } @@ -794,7 +794,7 @@ int SonyCommerce_PS3::downloadList(DownloadListInputParams ¶ms) } } - for (size_t i = 0; i < params.skuIds.size(); i++) { + for (int i = 0; i < params.skuIds.size(); i++) { skuIdsTemp[i] = (const char *)(*iter); iter++; } @@ -887,7 +887,7 @@ int SonyCommerce_PS3::createContext() } // Create commerce2 context - ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); + ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); if (ret < 0) { app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -1325,7 +1325,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1349,7 +1349,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1410,8 +1410,8 @@ void SonyCommerce_PS3::CreateSession( CallbackFunc cb, LPVOID lpParam ) EnterCriticalSection(&m_queueLock); setCallback(cb,lpParam); m_messageQueue.push(e_message_commerceCreateSession); - if(m_tickThread == nullptr) - m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_PS3 tick"); + if(m_tickThread == NULL) + m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_PS3 tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h index 05b48cf8..1f43341a 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h @@ -114,14 +114,14 @@ class SonyCommerce_PS3 : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = nullptr; + m_callbackFunc = NULL; if(func) func(m_callbackParam, m_errorCode); m_errorCode = CELL_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == nullptr); + assert(m_callbackFunc == NULL); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp index 4e681354..d38a1bc9 100644 --- a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp @@ -10,10 +10,10 @@ static const int sc_SSLPoolSize = (512 * 1024U); static const int sc_CookiePoolSize = (256 * 1024U); -void* SonyHttp_PS3::uriPool = nullptr; -void* SonyHttp_PS3::httpPool = nullptr; -void* SonyHttp_PS3::sslPool = nullptr; -void* SonyHttp_PS3::cookiePool = nullptr; +void* SonyHttp_PS3::uriPool = NULL; +void* SonyHttp_PS3::httpPool = NULL; +void* SonyHttp_PS3::sslPool = NULL; +void* SonyHttp_PS3::cookiePool = NULL; CellHttpClientId SonyHttp_PS3::client; CellHttpTransId SonyHttp_PS3::trans; bool SonyHttp_PS3:: bInitialised = false; @@ -22,31 +22,31 @@ bool SonyHttp_PS3:: bInitialised = false; bool SonyHttp_PS3::loadCerts(size_t *numBufPtr, CellHttpsData **caListPtr) { - CellHttpsData *caList = nullptr; + CellHttpsData *caList = NULL; size_t size = 0; int ret = 0; - char *buf = nullptr; + char *buf = NULL; - caList = static_cast(malloc(sizeof(CellHttpsData) * 2)); - if (nullptr == caList) { + caList = (CellHttpsData *)malloc(sizeof(CellHttpsData)*2); + if (NULL == caList) { app.DebugPrintf("failed to malloc cert data"); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, nullptr, 0, &size); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, NULL, 0, &size); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(1): 0x%08x", ret); return ret; } - buf = static_cast(malloc(size)); - if (nullptr == buf) { + buf = (char*)malloc(size); + if (NULL == buf) { app.DebugPrintf("failed to malloc cert buffer"); free(caList); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, nullptr); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, NULL); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(2): 0x%08x", ret); free(buf); @@ -72,7 +72,7 @@ bool SonyHttp_PS3::init() /*E startup procedures */ httpPool = malloc(sc_HTTPPoolSize); - if (httpPool == nullptr) { + if (httpPool == NULL) { app.DebugPrintf("failed to malloc libhttp memory pool\n"); return false; } @@ -84,7 +84,7 @@ bool SonyHttp_PS3::init() } cookiePool = malloc(sc_CookiePoolSize); - if (cookiePool == nullptr) { + if (cookiePool == NULL) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -97,7 +97,7 @@ bool SonyHttp_PS3::init() sslPool = malloc(sc_SSLPoolSize); - if (sslPool == nullptr) { + if (sslPool == NULL) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -109,7 +109,7 @@ bool SonyHttp_PS3::init() } size_t numBuf = 0; - CellHttpsData *caList = nullptr; + CellHttpsData *caList = NULL; if(!loadCerts(&numBuf, &caList)) return false; @@ -153,18 +153,18 @@ bool SonyHttp_PS3::parseUri(const char* szUri, CellHttpUri& parsedUri) { /*E the main part */ size_t poolSize = 0; - int ret = cellHttpUtilParseUri(nullptr, szUri, nullptr, 0, &poolSize); + int ret = cellHttpUtilParseUri(NULL, szUri, NULL, 0, &poolSize); if (0 > ret) { app.DebugPrintf("error parsing URI... (0x%x)\n\n", ret); return false; } - if (nullptr == (uriPool = malloc(poolSize))) + if (NULL == (uriPool = malloc(poolSize))) { app.DebugPrintf("error mallocing uriPool (%d)\n", poolSize); return false; } - ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, nullptr); + ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, NULL); if (0 > ret) { free(uriPool); @@ -185,7 +185,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) size_t localRecv = 0; if(!parseUri(url, uri)) - return nullptr; + return NULL; app.DebugPrintf(" scheme: %s\n", uri.scheme); app.DebugPrintf(" hostname: %s\n", uri.hostname); @@ -199,10 +199,10 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) if (0 > ret) { app.DebugPrintf("failed to create http transaction... (0x%x)\n\n", ret); - return nullptr; + return NULL; } - ret = cellHttpSendRequest(trans, nullptr, 0, nullptr); + ret = cellHttpSendRequest(trans, NULL, 0, NULL); if (0 > ret) { app.DebugPrintf("failed to complete http transaction... (0x%x)\n\n", ret); @@ -219,7 +219,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("failed to receive http response... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return nullptr; + return NULL; } app.DebugPrintf("Status Code is %d\n", code); } @@ -232,19 +232,19 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("Only supporting data that has a content length : CELL_HTTP_ERROR_NO_CONTENT_LENGTH\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return nullptr; + return NULL; } else { app.DebugPrintf("error in receiving content length... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return nullptr; + return NULL; } } int bufferSize = length; - char* buffer = static_cast(malloc(bufferSize + 1)); + char* buffer = (char*)malloc(bufferSize+1); recvd = 0; @@ -261,7 +261,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) free(buffer); cellHttpDestroyTransaction(trans); trans = 0; - return nullptr; + return NULL; } else { diff --git a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp index ab7b4770..e1d8dffa 100644 --- a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -35,11 +35,7 @@ void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg) { psnTicketSize = result; psnTicket = malloc(psnTicketSize); -<<<<<<< HEAD - if (psnTicket == nullptr) -======= if (psnTicket == NULL) ->>>>>>> origin/main { app.DebugPrintf("Failed to allocate for ticket\n"); } @@ -82,7 +78,7 @@ int SonyRemoteStorage_PS3::initPreconditions() cellSysutilCheckCallback(); sys_timer_usleep(50000); //50 milliseconds. } - if(psnTicket == nullptr) + if(psnTicket == NULL) return -1; return 0; @@ -90,7 +86,7 @@ int SonyRemoteStorage_PS3::initPreconditions() void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) { - static_cast(userData)->internalCallback(event, retCode); + ((SonyRemoteStorage_PS3*)userData)->internalCallback(event, retCode); } void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) @@ -243,7 +239,7 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam) params.timeout.receiveMs = 120 * 1000; //120 seconds is the default params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == nullptr) + if(m_memPoolBuffer == NULL) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; @@ -347,9 +343,9 @@ bool SonyRemoteStorage_PS3::setDataInternal() bool bHostOptionsRead; DWORD uiTexturePack; char seed[22]; - app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,reinterpret_cast(seed), uiHostOptions, bHostOptionsRead, uiTexturePack); + app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - int64_t iSeed = strtoll(seed, nullptr,10); + int64_t iSeed = strtoll(seed,NULL,10); char seedHex[17]; sprintf(seedHex,"%016llx",iSeed); memcpy(descData.m_seed,seedHex,16); // Don't copy null @@ -434,20 +430,20 @@ void SonyRemoteStorage_PS3::runCallback() int SonyRemoteStorage_PS3::SaveCompressCallback(LPVOID lpParam,bool bRes) { - SonyRemoteStorage_PS3* pRS = static_cast(lpParam); + SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)lpParam; pRS->m_compressedSaveState = e_state_Idle; return 0; } int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bool bIsOwner) { - SonyRemoteStorage_PS3* pRS = static_cast(pParam); + SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)pParam; int origFilesize = StorageManager.GetSaveSize(); void* pOrigSaveData = malloc(origFilesize); unsigned int retFilesize; StorageManager.GetSaveData( pOrigSaveData, &retFilesize ); // check if this save file is already compressed - if(*static_cast(pOrigSaveData) != 0) + if(*((int*)pOrigSaveData) != 0) { app.DebugPrintf("compressing save data\n"); @@ -455,7 +451,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size unsigned int compLength = origFilesize+8; - byte *compData = static_cast(malloc(compLength)); + byte *compData = (byte *)malloc( compLength ); Compression::UseDefaultThreadStorage(); Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize); ZeroMemory(compData,8); diff --git a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp index 7a4d95aa..41c52bed 100644 --- a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp +++ b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp @@ -49,7 +49,7 @@ void SonyVoiceChat::init( SQRNetworkManager_PS3* pNetMan ) sm_pNetworkManager = pNetMan; setState(AVC_STATE_CHAT_INIT); - ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,NULL,NULL); } void SonyVoiceChat::shutdown() @@ -225,11 +225,11 @@ void SonyVoiceChat::eventcb( CellSysutilAvc2EventId event_id, CellSysutilAvc2Eve { CELL_AVC2_EVENT_LEAVE_FAILED, eventcb_leave }, { CELL_AVC2_EVENT_UNLOAD_SUCCEEDED, eventcb_unload }, { CELL_AVC2_EVENT_UNLOAD_FAILED, eventcb_unload }, - { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, nullptr }, - { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, nullptr }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, nullptr }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,nullptr }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, NULL }, + { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, NULL }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, NULL }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,NULL }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, NULL }, { CELL_AVC2_EVENT_SYSTEM_VOICE_DETECTED, eventcb_voiceDetected }, }; @@ -258,7 +258,7 @@ int SonyVoiceChat::load() ret = cellSysutilAvc2LoadAsync( sm_pNetworkManager->m_matchingContext, SYS_MEMORY_CONTAINER_ID_INVALID, eventcb, - nullptr, + NULL, &g_chat_avc2param ); if( ret != CELL_OK ) { diff --git a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp index bce76078..fd8ddd9a 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp @@ -16,13 +16,13 @@ static const unsigned int NUM_SUBMIT_JOBS = 128; #define DMA_ALIGNMENT (128) #define JOBHEADER_SYMBOL(JobName) _binary_jqjob_##JobName##_jobbin2_jobheader -C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = nullptr; +C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = NULL; uint16_t C4JSpursJobQueue::Port::s_jobTagBitmask = 0; -C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {nullptr,nullptr,nullptr,nullptr, - nullptr,nullptr,nullptr,nullptr, - nullptr,nullptr,nullptr,nullptr, - nullptr,nullptr,nullptr,nullptr }; +C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL }; bool C4JSpursJobQueue::Port::s_initialised; CRITICAL_SECTION C4JSpursJobQueue::Port::s_lock; @@ -43,7 +43,7 @@ C4JSpursJobQueue::C4JSpursJobQueue() //E create jobQueue pJobQueue = (JobQueue*)memalign(CELL_SPURS_JOBQUEUE_ALIGN, sizeof(JobQueue)); - assert(pJobQueue != nullptr); + assert(pJobQueue != NULL); ret = JobQueue::create( pJobQueue, spurs, @@ -168,7 +168,7 @@ int C4JSpursJobQueue::Port::getFreeJobTag() void C4JSpursJobQueue::Port::releaseJobTag( int tag ) { s_jobTagBitmask &= ~(1< *pJobQueue; public: - static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == nullptr) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} + static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == NULL) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} C4JSpursJobQueue(); void shutdown(); diff --git a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp index 56dd9878..94d7ef87 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp @@ -17,7 +17,7 @@ static const bool sc_verbose = true; -cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = nullptr; +cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = NULL; void C4JThread_SPU::initSPURS() { diff --git a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp index 53a8639d..2b0a523f 100644 --- a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp +++ b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp @@ -3,7 +3,7 @@ #include "EdgeZLib.h" #include "edge/zlib/edgezlib_ppu.h" -static CellSpurs* s_pSpurs = nullptr; +static CellSpurs* s_pSpurs = NULL; //Set this to 5 if you want deflate/inflate to run in parallel on 5 SPUs. @@ -12,7 +12,7 @@ const uint32_t kMaxNumDeflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagDeflate; //Cannot be on stack static CellSpursTaskset s_taskSetDeflate; //Cannot be on stack static EdgeZlibDeflateQHandle s_deflateQueue; -static void* s_pDeflateQueueBuffer = nullptr; +static void* s_pDeflateQueueBuffer = NULL; static void* s_pDeflateTaskContext[kNumDeflateTasks]; static uint32_t s_numElementsToCompress; //Cannot be on stack @@ -22,7 +22,7 @@ const uint32_t kMaxNumInflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagInflate; //Cannot be on stack static CellSpursTaskset s_taskSetInflate; //Cannot be on stack static EdgeZlibInflateQHandle s_inflateQueue; -static void* s_pInflateQueueBuffer = nullptr; +static void* s_pInflateQueueBuffer = NULL; static void* s_pInflateTaskContext[kNumInflateTasks]; static uint32_t s_numElementsToDecompress; //Cannot be on stack @@ -195,9 +195,9 @@ bool EdgeZLib::Compress(void* pDestination, uint32_t* pDestSize, const void* pSo // The Deflate Task will wake up and process this work. // ////////////////////////////////////////////////////////////////////////// - uint32_t* pDst = nullptr; + uint32_t* pDst = NULL; bool findingSizeOnly = false; - if(pDestination == nullptr && *pDestSize == 0) + if(pDestination == NULL && *pDestSize == 0) { pDst = (uint32_t*)malloc(SrcSize); findingSizeOnly = true; diff --git a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp index 442aab06..03d916ab 100644 --- a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp +++ b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp @@ -13,18 +13,18 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( (cd = l10n_get_converter( L10N_UTF16, L10N_UTF8 )) == -1 ) { app.DebugPrintf("l10n_get_converter: no such converter\n"); - return nullptr; + return NULL; } - l10n_convert_str( cd, wchString, &src_len, nullptr, &dst_len ); - uint8_t *strUtf8=static_cast(malloc(dst_len)); + l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len ); + uint8_t *strUtf8=(uint8_t *)malloc(dst_len); memset(strUtf8,0,dst_len); result = l10n_convert_str( cd, wchString, &src_len, strUtf8, &dst_len ); if( result != ConversionOK ) { app.DebugPrintf("l10n_convert: conversion error : 0x%x\n", result); - return nullptr; + return NULL; } return strUtf8; diff --git a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp index c11a8593..4143c555 100644 --- a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp +++ b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp @@ -74,8 +74,8 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src ) wchar_t f,l; // validation section - // _VALIDATE_RETURN(dst != nullptr, EINVAL, _NLSCMPERROR); - // _VALIDATE_RETURN(src != nullptr, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); do { f = towlower(*dst); @@ -90,7 +90,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) { size_t n; -// Note that we do not check if s == nullptr, because we do not +// Note that we do not check if s == NULL, because we do not // return errno_t... for (n = 0; n < maxsize && *wcs; n++, wcs++) @@ -134,7 +134,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) lpSystemTime->wMilliseconds = cellRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return nullptr; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return NULL; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -267,8 +267,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return TLSStoragePS3::In LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { int err; - sys_addr_t newAddress = nullptr; - if(lpAddress == nullptr) + sys_addr_t newAddress = NULL; + if(lpAddress == NULL) { // reserve, and possibly commit also int commitSize = 0; @@ -382,7 +382,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi int fd = (int) hFile; uint64_t pos = 0, bitsToMove = (int64_t) lDistanceToMove; - if (lpDistanceToMoveHigh != nullptr) + if (lpDistanceToMoveHigh != NULL) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; int whence = 0; @@ -490,7 +490,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, } else { - err = cellFsOpen(filePath, flags, &fd ,nullptr, 0); + err = cellFsOpen(filePath, flags, &fd ,NULL, 0); iFilesOpen++; //printf("\n\nFiles Open - %d\n\n",iFilesOpen); } @@ -675,7 +675,7 @@ errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_ int _wtoi(const wchar_t *_Str) { - return wcstol(_Str, nullptr, 10); + return wcstol(_Str, NULL, 10); } diff --git a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp index a04e45d9..e7eca53f 100644 --- a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp +++ b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp @@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount]; void ShutdownManager::Initialise() { #ifdef __PS3__ - cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr ); + cellSysutilRegisterCallback( 1, SysUtilCallback, NULL ); for( int i = 0; i < eThreadIdCount; i++ ) { s_threadShouldRun[i] = true; s_threadRunning[i] = 0; - s_eventArray[i] = nullptr; + s_eventArray[i] = NULL; } // Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required s_threadRunning[eStorageManagerThreads] = true; diff --git a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp index a3b09d6d..0906802d 100644 --- a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp +++ b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp @@ -4,7 +4,7 @@ -TLSStoragePS3* TLSStoragePS3::m_pInstance = nullptr; +TLSStoragePS3* TLSStoragePS3::m_pInstance = NULL; BOOL TLSStoragePS3::m_activeList[sc_maxSlots]; __thread LPVOID TLSStoragePS3::m_values[sc_maxSlots]; @@ -16,7 +16,7 @@ TLSStoragePS3::TLSStoragePS3() for(int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); // push this into a vector @@ -345,7 +345,7 @@ void CConsoleMinecraftApp::FatalLoadError() } app.DebugPrintf("Requesting Message Box for Fatal Error\n"); - EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); + EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); while ((eResult==EMsgBox_Busy) || (eResult==EMsgBox_SysUtilBusy)) { @@ -359,7 +359,7 @@ void CConsoleMinecraftApp::FatalLoadError() _Exit(0); } app.DebugPrintf("Requesting Message Box for Fatal Error again due to BUSY\n"); - eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); + eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); } while(1) @@ -483,7 +483,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -521,7 +521,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() #ifdef SAVE_GAME_TO_LOAD param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD)); #else - param->saveData = nullptr; + param->saveData = NULL; #endif app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -728,7 +728,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return nullptr; + return NULL; } return &m_CategoryInfo; @@ -742,10 +742,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=nullptr) + if(m_ProductListA!=NULL) { delete [] m_ProductListA; - m_ProductListA=nullptr; + m_ProductListA=NULL; } m_ProductListRetrievedC=0; @@ -769,7 +769,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -831,7 +831,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return nullptr; + return NULL; } return &m_ProductListA[iIndex]; @@ -842,7 +842,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle) // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -1181,7 +1181,7 @@ char *PatchFilelist[] = - nullptr + NULL }; bool CConsoleMinecraftApp::IsFileInPatchList(LPCSTR lpFileName) @@ -1226,7 +1226,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=nullptr) + if(pCategories!=NULL) { if(pCategories->countOfProducts>0) { diff --git a/Minecraft.Client/PS3/PS3_App.h b/Minecraft.Client/PS3/PS3_App.h index f9293b6f..d1ecdb6f 100644 --- a/Minecraft.Client/PS3/PS3_App.h +++ b/Minecraft.Client/PS3/PS3_App.h @@ -88,7 +88,7 @@ public: // void SetVoiceChatAndUGCRestricted(bool bRestricted); // bool GetVoiceChatAndUGCRestricted(void); - StringTable *GetStringTable() { return nullptr;} + StringTable *GetStringTable() { return NULL;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/PS3/PS3_Minecraft.cpp b/Minecraft.Client/PS3/PS3_Minecraft.cpp index fb987a9e..82dd7c50 100644 --- a/Minecraft.Client/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/PS3/PS3_Minecraft.cpp @@ -356,9 +356,9 @@ void MemSect(int sect) #endif -ID3D11Device* g_pd3dDevice = nullptr; -ID3D11DeviceContext* g_pImmediateContext = nullptr; -IDXGISwapChain* g_pSwapChain = nullptr; +ID3D11Device* g_pd3dDevice = NULL; +ID3D11DeviceContext* g_pImmediateContext = NULL; +IDXGISwapChain* g_pSwapChain = NULL; bool g_bBootedFromInvite = false; //-------------------------------------------------------------------------------------- @@ -420,7 +420,7 @@ static void * load_file( char const * name ) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -447,7 +447,7 @@ int simpleMessageBoxCallback( UINT uiTitle, UINT uiText, ui.RequestMessageBox( uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, app.GetStringTable(), - nullptr, 0 + NULL, 0 ); return 0; @@ -633,7 +633,7 @@ int LoadSysModules() DEBUG_PRINTF("contentInfoPath - %s\n",contentInfoPath); DEBUG_PRINTF("usrdirPath - %s\n",usrdirPath); - ret=cellGamePatchCheck(&sizeBD,nullptr); + ret=cellGamePatchCheck(&sizeBD,NULL); if(ret < 0) { DEBUG_PRINTF("cellGamePatchCheck() Error: 0x%x\n", ret); @@ -839,7 +839,7 @@ int main() else ui.init(1280,480); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -862,7 +862,7 @@ int main() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -977,24 +977,24 @@ int main() free(szTemp); StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=nullptr) + if(baOptionsIcon.data!=NULL) { delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=nullptr) + if(baSaveThumbnail.data!=NULL) { delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=nullptr) + if(baSaveImage.data!=NULL) { delete [] baSaveImage.data; } wstring wsName=L"Graphics\\SaveChest.png"; byteArray baSaveLoadIcon = app.getArchiveFile(wsName); - if(baSaveLoadIcon.data!=nullptr) + if(baSaveLoadIcon.data!=NULL) { StorageManager.SetSaveLoadIcon((PBYTE)baSaveLoadIcon.data, baSaveLoadIcon.length); delete [] baSaveLoadIcon.data; @@ -1039,7 +1039,7 @@ int main() }*/ // set the achievement text for a trial achievement, now we have the string table loaded - ProfileManager.SetTrialTextStringTable(nullptr, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); + ProfileManager.SetTrialTextStringTable(NULL, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); ProfileManager.SetTrialAwardText(eAwardType_Achievement,IDS_UNLOCK_TITLE,IDS_UNLOCK_ACHIEVEMENT_TEXT); #ifndef __PS3__ ProfileManager.SetTrialAwardText(eAwardType_GamerPic,IDS_UNLOCK_TITLE,IDS_UNLOCK_GAMERPIC_TEXT); @@ -1109,7 +1109,7 @@ int main() // It's ok to do this for the primary PSN player here - it has this data locally. All other players need to do it on PSN sign in. // bool bChatRestricted=false; -// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,nullptr,nullptr); +// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,NULL,NULL); // 4J-PB - really want to wait until we've read the options, so we can set the right language if they've chosen one other than the default // bool bOptionsRead=false; @@ -1198,7 +1198,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1369,7 +1369,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != nullptr ) + if( strUtf8 != NULL ) { vRichPresenceStrings.push_back(strUtf8); } @@ -1379,7 +1379,7 @@ uint8_t * AddRichPresenceString(int iID) void FreeRichPresenceStrings() { uint8_t *strUtf8; - for(size_t i=0;igetData(x, y, z); int dir = data & 7; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h index e617e84c..07eb3d86 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h @@ -5,7 +5,7 @@ class CakeTile_SPU : public Tile_SPU { public: CakeTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { int d = level->getData(x, y, z); float r = 1 / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h index 199fceb6..2854b48b 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h @@ -6,7 +6,7 @@ class CauldronTile_SPU : public Tile_SPU { public: CauldronTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } + virtual Icon_SPU *getTexture(int face, int data) { return NULL; } //@Override // virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index ac71c572..1cb5e2ee 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp @@ -241,12 +241,12 @@ void ChunkRebuildData::createTileData() m_tileData.signalSource.set(i, Tile::tiles[i]->isSignalSource()); m_tileData.cubeShaped.set(i, Tile::tiles[i]->isCubeShaped()); - m_tileData.xx0[i] = static_cast(Tile::tiles[i]->getShapeX0()); - m_tileData.yy0[i] = static_cast(Tile::tiles[i]->getShapeY0()); - m_tileData.zz0[i] = static_cast(Tile::tiles[i]->getShapeZ0()); - m_tileData.xx1[i] = static_cast(Tile::tiles[i]->getShapeX1()); - m_tileData.yy1[i] = static_cast(Tile::tiles[i]->getShapeY1()); - m_tileData.zz1[i] = static_cast(Tile::tiles[i]->getShapeZ1()); + m_tileData.xx0[i] = (float)Tile::tiles[i]->getShapeX0(); + m_tileData.yy0[i] = (float)Tile::tiles[i]->getShapeY0(); + m_tileData.zz0[i] = (float)Tile::tiles[i]->getShapeZ0(); + m_tileData.xx1[i] = (float)Tile::tiles[i]->getShapeX1(); + m_tileData.yy1[i] = (float)Tile::tiles[i]->getShapeY1(); + m_tileData.zz1[i] = (float)Tile::tiles[i]->getShapeZ1(); Icon* pTex = Tile::tiles[i]->icon; if(pTex) { @@ -269,17 +269,17 @@ void ChunkRebuildData::createTileData() setIconSPUFromIcon(&m_tileData.grass_iconSideOverlay, Tile::grass->iconSideOverlay); // ThinFence - setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, static_cast(Tile::ironFence)->getEdgeTexture()); - setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, static_cast(Tile::thinGlass)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, ((ThinFenceTile*)Tile::ironFence)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, ((ThinFenceTile*)Tile::thinGlass)->getEdgeTexture()); //FarmTile - setIconSPUFromIcon(&m_tileData.farmTile_Dry, static_cast(Tile::farmland)->iconDry); - setIconSPUFromIcon(&m_tileData.farmTile_Wet, static_cast(Tile::farmland)->iconWet); + setIconSPUFromIcon(&m_tileData.farmTile_Dry, ((FarmTile*)Tile::farmland)->iconDry); + setIconSPUFromIcon(&m_tileData.farmTile_Wet, ((FarmTile*)Tile::farmland)->iconWet); // DoorTile for(int i=0;i<8; i++) { - setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], static_cast(Tile::door_wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], ((DoorTile*)Tile::door_wood)->icons[i]); // we're not supporting flipped icons, so manually flip here if(i>=4) m_tileData.doorTile_Icons[i].flipHorizontal(); @@ -291,20 +291,20 @@ void ChunkRebuildData::createTileData() // SandStoneTile for(int i=0;i<3; i++) - setIconSPUFromIcon(&m_tileData.sandStone_icons[i], static_cast(Tile::sandStone)->icons[i]); - setIconSPUFromIcon(&m_tileData.sandStone_iconTop, static_cast(Tile::sandStone)->iconTop); - setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, static_cast(Tile::sandStone)->iconBottom); + setIconSPUFromIcon(&m_tileData.sandStone_icons[i], ((SandStoneTile*)Tile::sandStone)->icons[i]); + setIconSPUFromIcon(&m_tileData.sandStone_iconTop, ((SandStoneTile*)Tile::sandStone)->iconTop); + setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, ((SandStoneTile*)Tile::sandStone)->iconBottom); // WoodTile // assert(WoodTile_SPU::WOOD_NAMES_LENGTH == 4); for(int i=0;i<4; i++) - setIconSPUFromIcon(&m_tileData.woodTile_icons[i], static_cast(Tile::wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.woodTile_icons[i], ((WoodTile*)Tile::wood)->icons[i]); // TreeTile // assert(TreeTile_SPU::TREE_NAMES_LENGTH == 4); for(int i=0;i<4; i++) - setIconSPUFromIcon(&m_tileData.treeTile_icons[i], static_cast(Tile::treeTrunk)->icons[i]); - setIconSPUFromIcon(&m_tileData.treeTile_iconTop, static_cast(Tile::treeTrunk)->iconTop); + setIconSPUFromIcon(&m_tileData.treeTile_icons[i], ((TreeTile*)Tile::treeTrunk)->icons[i]); + setIconSPUFromIcon(&m_tileData.treeTile_iconTop, ((TreeTile*)Tile::treeTrunk)->iconTop); // LeafTile for(int i=0;i<2; i++) @@ -313,12 +313,12 @@ void ChunkRebuildData::createTileData() // CropTile for(int i=0;i<8; i++) - setIconSPUFromIcon(&m_tileData.cropTile_icons[i], static_cast(Tile::crops)->icons[i]); + setIconSPUFromIcon(&m_tileData.cropTile_icons[i], ((CropTile*)Tile::crops)->icons[i]); // FurnaceTile - setIconSPUFromIcon(&m_tileData.furnaceTile_iconTop, static_cast(Tile::furnace)->iconTop); - setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront, static_cast(Tile::furnace)->iconFront); - setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront_lit, static_cast(Tile::furnace_lit)->iconFront); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconTop, ((FurnaceTile*)Tile::furnace)->iconTop); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront, ((FurnaceTile*)Tile::furnace)->iconFront); + setIconSPUFromIcon(&m_tileData.furnaceTile_iconFront_lit, ((FurnaceTile*)Tile::furnace_lit)->iconFront); //LiquidTile setIconSPUFromIcon(&m_tileData.liquidTile_iconWaterStill, (Tile::water)->icons[0]); @@ -332,64 +332,64 @@ void ChunkRebuildData::createTileData() // Sapling for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.sapling_icons[i], static_cast(Tile::sapling)->icons[i]); + setIconSPUFromIcon(&m_tileData.sapling_icons[i], ((Sapling*)Tile::sapling)->icons[i]); - m_tileData.glassTile_allowSame = static_cast(Tile::glass)->allowSame; - m_tileData.iceTile_allowSame = static_cast(Tile::ice)->allowSame; + m_tileData.glassTile_allowSame = ((GlassTile*)Tile::glass)->allowSame; + m_tileData.iceTile_allowSame = ((IceTile*)Tile::ice)->allowSame; // DispenserTile - setIconSPUFromIcon(&m_tileData.dispenserTile_iconTop, static_cast(Tile::dispenser)->iconTop); - setIconSPUFromIcon(&m_tileData.dispenserTile_iconFront, static_cast(Tile::dispenser)->iconFront); - setIconSPUFromIcon(&m_tileData.dispenserTile_iconFrontVertical, static_cast(Tile::dispenser)->iconFrontVertical); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconTop, ((DispenserTile*)Tile::dispenser)->iconTop); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconFront, ((DispenserTile*)Tile::dispenser)->iconFront); + setIconSPUFromIcon(&m_tileData.dispenserTile_iconFrontVertical, ((DispenserTile*)Tile::dispenser)->iconFrontVertical); // RailTile - setIconSPUFromIcon(&m_tileData.railTile_iconTurn, static_cast(Tile::rail)->iconTurn); - setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, static_cast(Tile::goldenRail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurn, ((RailTile*)Tile::rail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, ((RailTile*)Tile::goldenRail)->iconTurn); for(int i=0;i<2;i++) - setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], static_cast(Tile::detectorRail)->icons[i]); + setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], ((DetectorRailTile*)Tile::detectorRail)->icons[i]); // tntTile - setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, static_cast(Tile::tnt)->iconBottom); - setIconSPUFromIcon(&m_tileData.tntTile_iconTop, static_cast(Tile::tnt)->iconTop); + setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, ((TntTile*)Tile::tnt)->iconBottom); + setIconSPUFromIcon(&m_tileData.tntTile_iconTop, ((TntTile*)Tile::tnt)->iconTop); // workbenchTile - setIconSPUFromIcon(&m_tileData.workBench_iconFront, static_cast(Tile::workBench)->iconFront); - setIconSPUFromIcon(&m_tileData.workBench_iconTop, static_cast(Tile::workBench)->iconTop); + setIconSPUFromIcon(&m_tileData.workBench_iconFront, ((WorkbenchTile*)Tile::workBench)->iconFront); + setIconSPUFromIcon(&m_tileData.workBench_iconTop, ((WorkbenchTile*)Tile::workBench)->iconTop); // cactusTile - setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, static_cast(Tile::cactus)->iconTop); - setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, static_cast(Tile::cactus)->iconBottom); + setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, ((CactusTile*)Tile::cactus)->iconTop); + setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, ((CactusTile*)Tile::cactus)->iconBottom); // recordPlayer - setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, static_cast(Tile::recordPlayer)->iconTop); + setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, ((RecordPlayerTile*)Tile::recordPlayer)->iconTop); // pumpkin - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, static_cast(Tile::pumpkin)->iconTop); - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, static_cast(Tile::pumpkin)->iconFace); - setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, static_cast(Tile::litPumpkin)->iconFace); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconTop, ((PumpkinTile*)Tile::pumpkin)->iconTop); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFace, ((PumpkinTile*)Tile::pumpkin)->iconFace); + setIconSPUFromIcon(&m_tileData.pumpkinTile_iconFaceLit, ((PumpkinTile*)Tile::litPumpkin)->iconFace); // cakeTile - setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, static_cast(Tile::cake)->iconTop); - setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, static_cast(Tile::cake)->iconBottom); - setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, static_cast(Tile::cake)->iconInner); + setIconSPUFromIcon(&m_tileData.cakeTile_iconTop, ((CakeTile*)Tile::cake)->iconTop); + setIconSPUFromIcon(&m_tileData.cakeTile_iconBottom, ((CakeTile*)Tile::cake)->iconBottom); + setIconSPUFromIcon(&m_tileData.cakeTile_iconInner, ((CakeTile*)Tile::cake)->iconInner); // SmoothStoneBrickTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], static_cast(Tile::stoneBrickSmooth)->icons[i]); + setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], ((SmoothStoneBrickTile*)Tile::stoneBrickSmooth)->icons[i]); // HugeMushroomTile for(int i=0;i<2;i++) - setIconSPUFromIcon(&m_tileData.hugeMushroom_icons[i], static_cast(Tile::hugeMushroom1)->icons[i]); - setIconSPUFromIcon(&m_tileData.hugeMushroom_iconStem, static_cast(Tile::hugeMushroom1)->iconStem); - setIconSPUFromIcon(&m_tileData.hugeMushroom_iconInside, static_cast(Tile::hugeMushroom1)->iconInside); + setIconSPUFromIcon(&m_tileData.hugeMushroom_icons[i], ((HugeMushroomTile*)Tile::hugeMushroom1)->icons[i]); + setIconSPUFromIcon(&m_tileData.hugeMushroom_iconStem, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconStem); + setIconSPUFromIcon(&m_tileData.hugeMushroom_iconInside, ((HugeMushroomTile*)Tile::hugeMushroom1)->iconInside); // MelonTile - setIconSPUFromIcon(&m_tileData.melonTile_iconTop, static_cast(Tile::melon)->iconTop); + setIconSPUFromIcon(&m_tileData.melonTile_iconTop, ((MelonTile*)Tile::melon)->iconTop); // StemTile - setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, static_cast(Tile::melonStem)->iconAngled); + setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, ((StemTile*)Tile::melonStem)->iconAngled); // MycelTile setIconSPUFromIcon(&m_tileData.mycelTile_iconTop, (Tile::mycel)->iconTop); @@ -397,14 +397,14 @@ void ChunkRebuildData::createTileData() // NetherStalkTile for(int i=0;i<3;i++) - setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], static_cast(Tile::netherStalk)->icons[i]); + setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], ((NetherStalkTile*)Tile::netherStalk)->icons[i]); // EnchantmentTableTile - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, static_cast(Tile::enchantTable)->iconTop); - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, static_cast(Tile::enchantTable)->iconBottom); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, ((EnchantmentTableTile*)Tile::enchantTable)->iconTop); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, ((EnchantmentTableTile*)Tile::enchantTable)->iconBottom); //BrewingStandTile - setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, static_cast(Tile::brewingStand)->iconBase); + setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, ((BrewingStandTile*)Tile::brewingStand)->iconBase); //RedStoneDust setIconSPUFromIcon(&m_tileData.redStoneDust_iconCross, (Tile::redStoneDust)->iconCross); @@ -412,32 +412,32 @@ void ChunkRebuildData::createTileData() setIconSPUFromIcon(&m_tileData.redStoneDust_iconCrossOver, (Tile::redStoneDust)->iconCrossOver); setIconSPUFromIcon(&m_tileData.redStoneDust_iconLineOver, (Tile::redStoneDust)->iconLineOver); - setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, static_cast(Tile::stoneSlab)->iconSide); + setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, ((StoneSlabTile*)(Tile::stoneSlab))->iconSide); for(int i=0;i<16;i++) - setIconSPUFromIcon(&m_tileData.clothTile_icons[i], static_cast(Tile::cloth)->icons[i]); + setIconSPUFromIcon(&m_tileData.clothTile_icons[i], ((ClothTile*)Tile::cloth)->icons[i]); // CarrotTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.carrot_icons[i], static_cast(Tile::carrots)->icons[i]); + setIconSPUFromIcon(&m_tileData.carrot_icons[i], ((CarrotTile*)Tile::carrots)->icons[i]); // PotatoTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.potato_icons[i], static_cast(Tile::potatoes)->icons[i]); + setIconSPUFromIcon(&m_tileData.potato_icons[i], ((PotatoTile*)Tile::potatoes)->icons[i]); // AnvilTile for(int i=0;i<3;i++) - setIconSPUFromIcon(&m_tileData.anvil_icons[i], static_cast(Tile::anvil)->icons[i]); + setIconSPUFromIcon(&m_tileData.anvil_icons[i], ((AnvilTile*)Tile::anvil)->icons[i]); // QuartzBlockTile for(int i=0;i<5;i++) - setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], static_cast(Tile::quartzBlock)->icons[i]); + setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], ((QuartzBlockTile*)Tile::quartzBlock)->icons[i]); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconChiseledTop, static_cast(Tile::quartzBlock)->iconChiseledTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconLinesTop, static_cast(Tile::quartzBlock)->iconLinesTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconTop, static_cast(Tile::quartzBlock)->iconTop); - setIconSPUFromIcon(&m_tileData.quartzBlock_iconBottom, static_cast(Tile::quartzBlock)->iconBottom); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconChiseledTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconChiseledTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconLinesTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconLinesTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconTop, ((QuartzBlockTile*)Tile::quartzBlock)->iconTop); + setIconSPUFromIcon(&m_tileData.quartzBlock_iconBottom, ((QuartzBlockTile*)Tile::quartzBlock)->iconBottom); } // extern int g_lastHitBlockX; @@ -696,7 +696,7 @@ bool ChunkRebuildData::isEmptyTile(int x, int y, int z) bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) { TileRef_SPU tile(getTile(x,y,z)); - if (tile.getPtr() == nullptr) return false; + if (tile.getPtr() == NULL) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so @@ -727,7 +727,7 @@ bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) bool ChunkRebuildData::isSolidBlockingTile(int x, int y, int z) { TileRef_SPU tile(getTile(x, y, z)); - if (tile.getPtr() == nullptr) return false; + if (tile.getPtr() == NULL) return false; bool ret = tile->getMaterial()->blocksMotion() && tile->isCubeShaped(); return ret; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h index 2fcb1514..f6671db4 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h @@ -24,7 +24,7 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return Tile_SPU::SHAPE_DOOR; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param int getDir(ChunkRebuildData *level, int x, int y, int z); bool isOpen(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h index 5e99cc32..6e86d1f0 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h @@ -12,7 +12,7 @@ public: Icon_SPU *getTexture(int face, int data) { return TileRef_SPU(wood_Id)->getTexture(face); } static int getDirection(int data) { return (data & DIRECTION_MASK); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 { int data = getDirection(level->getData(x, y, z)); if (data == Direction::NORTH || data == Direction::SOUTH) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp index 63c206d1..fcb3baef 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp @@ -59,7 +59,7 @@ bool FenceTile_SPU::connectsTo(ChunkRebuildData *level, int x, int y, int z) return true; } TileRef_SPU tileInstance(tile); - if (tileInstance.getPtr() != nullptr) + if (tileInstance.getPtr() != NULL) { if (tileInstance->getMaterial()->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h index bed2e3b7..50a775fb 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h @@ -5,7 +5,7 @@ class FenceTile_SPU : public Tile_SPU { public: FenceTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp index 1dba9757..1cf83821 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp @@ -3,7 +3,7 @@ #include "Facing_SPU.h" #include "ChunkRebuildData.h" -void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = nullptr */) +void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = NULL */) { if (fullSize()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h index c89581ad..fd525e96 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h @@ -9,7 +9,7 @@ public: static const int TOP_SLOT_BIT = 8; HalfSlabTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h index 0597c1fc..f4ba6ccf 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h @@ -24,29 +24,29 @@ public: void set(int16_t _x, int16_t _y, int16_t _w, int16_t _h, int texWidth, int texHeight) { - x0 = static_cast(4096 * (float(_x) / texWidth)); - y0 = static_cast(4096 * (float(_y) / texHeight)); - x1 = x0 + static_cast(4096 * (float(_w) / texWidth)); - y1 = y0 + static_cast(4096 * (float(_h) / texHeight)); + x0 = (int16_t)(4096 * (float(_x) / texWidth)); + y0 = (int16_t)(4096 * (float(_y) / texHeight)); + x1 = x0 + (int16_t)(4096 * (float(_w) / texWidth)); + y1 = y0 + (int16_t)(4096 * (float(_h) / texHeight)); } void flipHorizontal() { int16_t temp = x0; x0 = x1; x1 = temp; } void flipVertical() { int16_t temp = y0; y0 = y1; y1 = temp; } - float getU0() const { return (static_cast(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); } - float getU1() const { return (static_cast(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); } + float getU0() const { return (float(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); } + float getU1() const { return (float(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); } float getU(double offset) const { float diff = getU1() - getU0(); - return getU0() + (diff * (static_cast(offset) / 16));//SharedConstants::WORLD_RESOLUTION)); + return getU0() + (diff * ((float) offset / 16));//SharedConstants::WORLD_RESOLUTION)); } - float getV0() const { return (static_cast(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); } - float getV1() const { return (static_cast(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); } + float getV0() const { return (float(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); } + float getV1() const { return (float(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); } float getV(double offset) const { float diff = getV1() - getV0(); - return getV0() + (diff * (static_cast(offset) / 16)); //SharedConstants::WORLD_RESOLUTION)); + return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION)); } // virtual wstring getName() const = 0; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp index fa075e71..7f13fd4f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp @@ -211,12 +211,12 @@ double LiquidTile_SPU::getSlopeAngle(ChunkRebuildData *level, int x, int y, int if (m->getID() == Material_SPU::water_Id) { TileRef_SPU tRef(Tile_SPU::water_Id); - flow = static_cast(tRef.getPtr())->getFlow(level, x, y, z); + flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); } if (m->getID() == Material_SPU::lava_Id) { TileRef_SPU tRef(Tile_SPU::lava_Id); - flow = static_cast(tRef.getPtr())->getFlow(level, x, y, z); + flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); } if (flow.x == 0 && flow.z == 0) return -1000; return atan2(flow.z, flow.x) - MATH_PI / 2; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h index 81ba68c1..e8411c88 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h @@ -8,7 +8,7 @@ class PistonBaseTile_SPU : public Tile_SPU public: PistonBaseTile_SPU(int id) : Tile_SPU(id) {} // virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1); - virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } + virtual Icon_SPU *getTexture(int face, int data) { return NULL; } virtual int getRenderShape() { return SHAPE_PISTON_BASE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h index ee559eff..d5460492 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h @@ -6,7 +6,7 @@ class PistonExtensionTile_SPU : public Tile_SPU public: PistonExtensionTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } + virtual Icon_SPU *getTexture(int face, int data) { return NULL; } virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h index 6ea12648..48fc52e9 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h @@ -10,7 +10,7 @@ public: virtual int getRenderShape() { return SHAPE_INVISIBLE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { // should never get here. } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h index a5a4652d..f01313a1 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h @@ -5,7 +5,7 @@ class PortalTile_SPU : public HalfTransparentTile_SPU { public: PortalTile_SPU(int id): HalfTransparentTile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { if (level->getTile(x - 1, y, z) == id || level->getTile(x + 1, y, z) == id) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h index 6742e6f6..133ec52e 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h @@ -16,6 +16,6 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual bool blocksLight(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h index 2f8639d4..615ebec9 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h @@ -10,7 +10,7 @@ public: RailTile_SPU(int id) : Tile_SPU(id) {} virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); if (data >= 2 && data <= 5) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h index 218cbd64..0e461118 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h @@ -26,7 +26,7 @@ public: case TEXTURE_CROSS_OVERLAY: return &ms_pTileData->redStoneDust_iconCrossOver; case TEXTURE_LINE_OVERLAY: return &ms_pTileData->redStoneDust_iconLineOver; } - return nullptr; + return NULL; } static bool shouldConnectTo(ChunkRebuildData *level, int x, int y, int z, int direction) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h index 74bdb95d..7fe54d99 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h @@ -16,7 +16,7 @@ public: } Icon_SPU *getTexture(int face, int data){ return TileRef_SPU(wood_Id)->getTexture(face); } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { if (onGround()) return; int face = level->getData(x, y, z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h index ca5ba279..eefa36b2 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h @@ -15,7 +15,7 @@ public: public: StairTile_SPU(int id) : Tile_SPU(id) {} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param bool isSolidRender(bool isServerLevel = false); int getRenderShape(); void setBaseShape(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h index 4923e862..89cd3739 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h @@ -35,7 +35,7 @@ public: this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { ms_pTileData->yy1[id] = (level->getData(x, y, z) * 2 + 2) / 16.0f; float ss = 0.125f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp index efcd44f0..3d1007af 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp @@ -68,7 +68,7 @@ typedef unsigned short hfloat; hfloat convertFloatToHFloat(float f) { unsigned int x = *(unsigned int *)&f; - unsigned int sign = static_cast(x >> 31); + unsigned int sign = (unsigned short)(x >> 31); unsigned int mantissa; unsigned int exp; hfloat hf; @@ -90,8 +90,8 @@ hfloat convertFloatToHFloat(float f) // 16-bit half-float representation stores number as Inf mantissa = 0; } - hf = (static_cast(sign) << 15) | static_cast(HALF_FLOAT_MAX_BIASED_EXP) | - static_cast(mantissa >> 13); + hf = (((hfloat)sign) << 15) | (hfloat)(HALF_FLOAT_MAX_BIASED_EXP) | + (hfloat)(mantissa >> 13); } // check if exponent is <= -15 else if (exp <= HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) @@ -101,13 +101,13 @@ hfloat convertFloatToHFloat(float f) exp = (HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP - exp) >> 23; mantissa >>= (14 + exp); - hf = (static_cast(sign) << 15) | static_cast(mantissa); + hf = (((hfloat)sign) << 15) | (hfloat)(mantissa); } else { - hf = (static_cast(sign) << 15) | - static_cast((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | - static_cast(mantissa >> 13); + hf = (((hfloat)sign) << 15) | + (hfloat)((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | + (hfloat)(mantissa >> 13); } return hf; @@ -115,8 +115,8 @@ hfloat convertFloatToHFloat(float f) float convertHFloatToFloat(hfloat hf) { - unsigned int sign = static_cast(hf >> 15); - unsigned int mantissa = static_cast(hf & ((1 << 10) - 1)); + unsigned int sign = (unsigned int)(hf >> 15); + unsigned int mantissa = (unsigned int)(hf & ((1 << 10) - 1)); unsigned int exp = (unsigned int)(hf & HALF_FLOAT_MAX_BIASED_EXP); unsigned int f; @@ -170,7 +170,7 @@ float convertHFloatToFloat(hfloat hf) // Tesselator_SPU *Tesselator_SPU::getInstance() { - return nullptr; + return NULL; // return (Tesselator_SPU *)TlsGetValue(tlsIdx); } @@ -329,12 +329,12 @@ void Tesselator_SPU::tex2(int tex2) void Tesselator_SPU::color(float r, float g, float b) { - color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255)); + color((int) (r * 255), (int) (g * 255), (int) (b * 255)); } void Tesselator_SPU::color(float r, float g, float b, float a) { - color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), static_cast(a * 255)); + color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); } void Tesselator_SPU::color(int r, int g, int b) @@ -539,7 +539,7 @@ void Tesselator_SPU::vertex(float x, float y, float z) // see comments in packCompactQuad() for exact format if( useCompactFormat360 ) { - unsigned int ucol = static_cast(col); + unsigned int ucol = (unsigned int)col; #ifdef _XBOX // Pack as 4:4:4 RGB_ @@ -564,7 +564,7 @@ void Tesselator_SPU::vertex(float x, float y, float z) unsigned short packedcol = ((col & 0xf8000000 ) >> 16 ) | ((col & 0x00fc0000 ) >> 13 ) | ((col & 0x0000f800 ) >> 11 ); - int ipackedcol = static_cast(packedcol) & 0xffff; // 0 to 65535 range + int ipackedcol = ((int)packedcol) & 0xffff; // 0 to 65535 range ipackedcol -= 32768; // -32768 to 32767 range ipackedcol &= 0xffff; @@ -597,12 +597,12 @@ void Tesselator_SPU::vertex(float x, float y, float z) pShortData[7] = ((INT_ROUND(tex2V * (8192.0f/256.0f)))&0xffff); incData(4); #else - pShortData[0] = (static_cast((x + xo) * 1024.0f)&0xffff); - pShortData[1] = (static_cast((y + yo) * 1024.0f)&0xffff); - pShortData[2] = (static_cast((z + zo) * 1024.0f)&0xffff); + pShortData[0] = (((int)((x + xo ) * 1024.0f))&0xffff); + pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff); + pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff); pShortData[3] = ipackedcol; - pShortData[4] = (static_cast(uu * 8192.0f)&0xffff); - pShortData[5] = (static_cast(v * 8192.0f)&0xffff); + pShortData[4] = (((int)(uu * 8192.0f))&0xffff); + pShortData[5] = (((int)(v * 8192.0f))&0xffff); pShortData[6] = ((int16_t*)&_tex2)[0]; pShortData[7] = ((int16_t*)&_tex2)[1]; incData(4); @@ -723,9 +723,9 @@ void Tesselator_SPU::noColor() void Tesselator_SPU::normal(float x, float y, float z) { hasNormal = true; - byte xx = static_cast(x * 127); - byte yy = static_cast(y * 127); - byte zz = static_cast(z * 127); + byte xx = (byte) (x * 127); + byte yy = (byte) (y * 127); + byte zz = (byte) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h index 87d87bcf..8aab31a3 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h @@ -5,7 +5,7 @@ class TheEndPortalFrameTile_SPU : public Tile_SPU { public: TheEndPortalFrameTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } + virtual Icon_SPU *getTexture(int face, int data) { return NULL; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return SHAPE_PORTAL_FRAME; } // virtual void updateDefaultShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp index 9e7d30de..20393f6e 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp @@ -74,7 +74,7 @@ Icon_SPU *ThinFenceTile_SPU::getEdgeTexture() #ifndef SN_TARGET_PS3_SPU assert(0); #endif - return nullptr; + return NULL; } bool ThinFenceTile_SPU::attachsTo(int tile) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h index 8f7b601b..61c39201 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h @@ -11,7 +11,7 @@ public: virtual int getRenderShape(); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); virtual void updateDefaultShape(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param virtual Icon_SPU *getEdgeTexture(); bool attachsTo(int tile); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp index 22c3a26d..ab9b2c94 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp @@ -71,7 +71,7 @@ const float smallUV = ( 1.0f / 16.0f ); void TileRenderer_SPU::_init() { - fixedTexture = nullptr; + fixedTexture = NULL; xFlipTexture = false; noCulling = false; blsmooth = 1; @@ -103,7 +103,7 @@ TileRenderer_SPU::TileRenderer_SPU( ChunkRebuildData* level ) TileRenderer_SPU::TileRenderer_SPU() { - this->level = nullptr; + this->level = NULL; _init(); } @@ -122,12 +122,12 @@ void TileRenderer_SPU::setFixedTexture( Icon_SPU *fixedTexture ) void TileRenderer_SPU::clearFixedTexture() { - this->fixedTexture = nullptr; + this->fixedTexture = NULL; } bool TileRenderer_SPU::hasFixedTexture() { - return fixedTexture != nullptr; + return fixedTexture != NULL; } void TileRenderer_SPU::setShape(float x0, float y0, float z0, float x1, float y1, float z1) @@ -270,7 +270,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateStemInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_LILYPAD: - retVal = tesselateLilypadInWorld( static_cast(tt), x, y, z ); + retVal = tesselateLilypadInWorld( (WaterlilyTile_SPU*)tt, x, y, z ); break; case Tile_SPU::SHAPE_ROWS: retVal = tesselateRowInWorld( tt, x, y, z ); @@ -279,7 +279,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateTorchInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_FIRE: - retVal = tesselateFireInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFireInWorld( (FireTile_SPU *)tt, x, y, z ); break; case Tile_SPU::SHAPE_RED_DUST: retVal = tesselateDustInWorld( tt, x, y, z ); @@ -291,19 +291,19 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateDoorInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_RAIL: - retVal = tesselateRailInWorld( static_cast(tt), x, y, z ); + retVal = tesselateRailInWorld( ( RailTile_SPU* )tt, x, y, z ); break; case Tile_SPU::SHAPE_STAIRS: - retVal = tesselateStairsInWorld( static_cast(tt), x, y, z ); + retVal = tesselateStairsInWorld( (StairTile_SPU *)tt, x, y, z ); break; case Tile_SPU::SHAPE_EGG: - retVal = tesselateEggInWorld(static_cast(tt), x, y, z); + retVal = tesselateEggInWorld((EggTile_SPU*) tt, x, y, z); break; case Tile_SPU::SHAPE_FENCE: - retVal = tesselateFenceInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFenceInWorld( ( FenceTile_SPU* )tt, x, y, z ); break; case Tile_SPU::SHAPE_WALL: - retVal = tesselateWallInWorld( static_cast(tt), x, y, z); + retVal = tesselateWallInWorld( (WallTile_SPU *) tt, x, y, z); break; case Tile_SPU::SHAPE_LEVER: retVal = tesselateLeverInWorld( tt, x, y, z ); @@ -318,7 +318,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateBedInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_DIODE: - retVal = tesselateDiodeInWorld( static_cast(tt), x, y, z ); + retVal = tesselateDiodeInWorld( (DiodeTile_SPU *)tt, x, y, z ); break; case Tile_SPU::SHAPE_PISTON_BASE: retVal = tesselatePistonBaseInWorld( tt, x, y, z, false, forceData ); @@ -333,7 +333,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateVineInWorld( tt, x, y, z ); break; case Tile_SPU::SHAPE_FENCE_GATE: - retVal = tesselateFenceGateInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFenceGateInWorld( ( FenceGateTile_SPU* )tt, x, y, z ); break; case Tile_SPU::SHAPE_CAULDRON: retVal = tesselateCauldronInWorld((CauldronTile_SPU* ) tt, x, y, z); @@ -345,7 +345,7 @@ bool TileRenderer_SPU::tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int retVal = tesselateAnvilInWorld((AnvilTile_SPU *) tt, x, y, z); break; case Tile_SPU::SHAPE_BREWING_STAND: - retVal = tesselateBrewingStandInWorld(static_cast(tt), x, y, z); + retVal = tesselateBrewingStandInWorld((BrewingStandTile_SPU* ) tt, x, y, z); break; case Tile_SPU::SHAPE_PORTAL_FRAME: retVal = tesselateAirPortalFrameInWorld((TheEndPortalFrameTile *)tt, x, y, z); @@ -838,7 +838,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i float xOff = 0; float yOff = 4; float zOff = 0; - Tile *plant = nullptr; + Tile *plant = NULL; switch (type) { @@ -858,7 +858,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i t->addOffset(xOff / 16.0f, yOff / 16.0f, zOff / 16.0f); - if (plant != nullptr) + if (plant != NULL) { tesselateInWorld(plant, x, y, z); } @@ -1099,23 +1099,23 @@ bool TileRenderer_SPU::tesselateTorchInWorld( Tile_SPU* tt, int x, int y, int z float h = 0.20f; if ( dir == 1 ) { - tesselateTorch( tt, static_cast(x) - r2, static_cast(y) + h, static_cast(z), -r, 0.0f, 0 ); + tesselateTorch( tt, (float)x - r2, (float)y + h, (float)z, -r, 0.0f, 0 ); } else if ( dir == 2 ) { - tesselateTorch( tt, static_cast(x) + r2, static_cast(y) + h, static_cast(z), +r, 0.0f, 0 ); + tesselateTorch( tt, (float)x + r2, (float)y + h, (float)z, +r, 0.0f, 0 ); } else if ( dir == 3 ) { - tesselateTorch( tt, static_cast(x), static_cast(y) + h, z - r2, 0.0f, -r, 0 ); + tesselateTorch( tt, (float)x, (float)y + h, z - r2, 0.0f, -r, 0 ); } else if ( dir == 4 ) { - tesselateTorch( tt, static_cast(x), static_cast(y) + h, static_cast(z) + r2, 0.0f, +r, 0 ); + tesselateTorch( tt, (float)x, (float)y + h, (float)z + r2, 0.0f, +r, 0 ); } else { - tesselateTorch( tt, static_cast(x), static_cast(y), static_cast(z), 0.0f, 0.0f, 0 ); + tesselateTorch( tt, (float)x, (float)y, (float)z, 0.0f, 0.0f, 0 ); } return true; @@ -1724,7 +1724,7 @@ bool TileRenderer_SPU::tesselateLeverInWorld( Tile_SPU* tt, int x, int y, int z } } - Vec3* c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; + Vec3* c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; for ( int i = 0; i < 6; i++ ) { if ( i == 0 ) @@ -1897,7 +1897,7 @@ bool TileRenderer_SPU::tesselateTripwireSourceInWorld(Tile_SPU *tt, int x, int y corners[i]->z += z + 0.5; } - Vec3 *c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; + Vec3 *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; int stickX0 = 7; int stickX1 = 9; int stickY0 = 9; @@ -2321,15 +2321,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int float z0_ = z + 0.5f - 0.3f; float z1_ = z + 0.5f + 0.3f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(); @@ -2337,15 +2337,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int u1 = tex->getU1(); v1 = tex->getV1(); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); x0 = x + 0.5f - 0.5f; x1 = x + 0.5f + 0.5f; @@ -2357,15 +2357,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int z0_ = z + 0.5f - 0.4f; z1_ = z + 0.5f + 0.4f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); tex = firstTex; u0 = tex->getU0(); @@ -2373,15 +2373,15 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int u1 = tex->getU1(); v1 = tex->getV1(); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); } else { @@ -2425,10 +2425,10 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int { t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + - 0.0f ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + - 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); @@ -2504,14 +2504,14 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int if ( ( ( x + y + z ) & 1 ) == 0 ) { - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + - 0), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + - 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + - 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + - 1), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(); @@ -2523,10 +2523,10 @@ bool TileRenderer_SPU::tesselateFireInWorld( FireTile_SPU* tt, int x, int y, int 1.0f ), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), static_cast(z + - 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + - 0), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v0 ) ); } else { @@ -2789,15 +2789,15 @@ bool TileRenderer_SPU::tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int float r = 1 / 16.0f; - float x0 = static_cast(x + 1); - float x1 = static_cast(x + 1); - float x2 = static_cast(x + 0); - float x3 = static_cast(x + 0); + float x0 = ( float )( x + 1 ); + float x1 = ( float )( x + 1 ); + float x2 = ( float )( x + 0 ); + float x3 = ( float )( x + 0 ); - float z0 = static_cast(z + 0); - float z1 = static_cast(z + 1); - float z2 = static_cast(z + 1); - float z3 = static_cast(z + 0); + float z0 = ( float )( z + 0 ); + float z1 = ( float )( z + 1 ); + float z2 = ( float )( z + 1 ); + float z3 = ( float )( z + 0 ); float y0 = ( float )( y + r ); float y1 = ( float )( y + r ); @@ -2806,24 +2806,24 @@ bool TileRenderer_SPU::tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int if ( data == 1 || data == 2 || data == 3 || data == 7 ) { - x0 = x3 = static_cast(x + 1); - x1 = x2 = static_cast(x + 0); - z0 = z1 = static_cast(z + 1); - z2 = z3 = static_cast(z + 0); + x0 = x3 = ( float )( x + 1 ); + x1 = x2 = ( float )( x + 0 ); + z0 = z1 = ( float )( z + 1 ); + z2 = z3 = ( float )( z + 0 ); } else if ( data == 8 ) { - x0 = x1 = static_cast(x + 0); - x2 = x3 = static_cast(x + 1); - z0 = z3 = static_cast(z + 1); - z1 = z2 = static_cast(z + 0); + x0 = x1 = ( float )( x + 0 ); + x2 = x3 = ( float )( x + 1 ); + z0 = z3 = ( float )( z + 1 ); + z1 = z2 = ( float )( z + 0 ); } else if ( data == 9 ) { - x0 = x3 = static_cast(x + 0); - x1 = x2 = static_cast(x + 1); - z0 = z1 = static_cast(z + 0); - z2 = z3 = static_cast(z + 1); + x0 = x3 = ( float )( x + 0 ); + x1 = x2 = ( float )( x + 1 ); + z0 = z1 = ( float )( z + 0 ); + z2 = z3 = ( float )( z + 1 ); } if ( data == 2 || data == 4 ) @@ -3555,9 +3555,9 @@ bool TileRenderer_SPU::tesselateCrossInWorld( Tile_SPU* tt, int x, int y, int z } t->color( br * r, br * g, br * b ); - float xt = static_cast(x); - float yt = static_cast(y); - float zt = static_cast(z); + float xt = (float)x; + float yt = (float)y; + float zt = (float)z; if (tt->id == Tile_SPU::tallgrass_Id) { @@ -3575,7 +3575,7 @@ bool TileRenderer_SPU::tesselateCrossInWorld( Tile_SPU* tt, int x, int y, int z bool TileRenderer_SPU::tesselateStemInWorld( Tile_SPU* _tt, int x, int y, int z ) { - StemTile_SPU* tt = static_cast(_tt); + StemTile_SPU* tt = ( StemTile_SPU* )_tt; Tesselator_SPU* t = getTesselator(); float br; @@ -3805,7 +3805,7 @@ bool TileRenderer_SPU::tesselateLilypadInWorld(WaterlilyTile_SPU *tt, int x, int int64_t seed = (x * 3129871) ^ (z * 116129781l) ^ (y); seed = seed * seed * 42317861 + seed * 11; - int dir = static_cast((seed >> 16) & 0x3); + int dir = (int) ((seed >> 16) & 0x3); @@ -4017,7 +4017,7 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { changed = true; Icon_SPU *tex = getTexture( tt, 1, data ); - float angle = static_cast(LiquidTile_SPU::getSlopeAngle(level, x, y, z, m)); + float angle = ( float )LiquidTile_SPU::getSlopeAngle( level, x, y, z, m ); if ( angle > -999 ) { tex = getTexture( tt, 2, data ); @@ -4112,8 +4112,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { hh0 = ( float )( h0 ); hh1 = ( float )( h3 ); - x0 = static_cast(x); - x1 = static_cast(x + 1); + x0 = ( float )( x ); + x1 = ( float )( x + 1 ); z0 = ( float )( z + offs); z1 = ( float )( z + offs); } @@ -4121,8 +4121,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z { hh0 = ( float )( h2 ); hh1 = ( float )( h1 ); - x0 = static_cast(x + 1); - x1 = static_cast(x); + x0 = ( float )( x + 1 ); + x1 = ( float )( x ); z0 = ( float )( z + 1 - offs); z1 = ( float )( z + 1 - offs); } @@ -4132,8 +4132,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z hh1 = ( float )( h0 ); x0 = ( float )( x + offs); x1 = ( float )( x + offs); - z0 = static_cast(z + 1); - z1 = static_cast(z); + z0 = ( float )( z + 1 ); + z1 = ( float )( z ); } else { @@ -4141,8 +4141,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z hh1 = ( float )( h2 ); x0 = ( float )( x + 1 - offs); x1 = ( float )( x + 1 - offs); - z0 = static_cast(z); - z1 = static_cast(z + 1); + z0 = ( float )( z ); + z1 = ( float )( z + 1 ); } @@ -4172,8 +4172,8 @@ bool TileRenderer_SPU::tesselateWaterInWorld( Tile_SPU* tt, int x, int y, int z t->color( c11 * br * r, c11 * br * g, c11 * br * b ); t->vertexUV( ( float )( x0 ), ( float )( y + hh0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v01 ) ); t->vertexUV( ( float )( x1 ), ( float )( y + hh1 ), ( float )( z1 ), ( float )( u1 ), ( float )( v02 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); } @@ -4586,7 +4586,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti else { /*#ifdef _DEBUG - if(dynamic_cast(tt)!=nullptr) + if(dynamic_cast(tt)!=NULL) { // stair tile faceFlags |= tt->shouldRenderFace( level, pX, pY - 1, pZ, 0 ) ? 0x01 : 0; @@ -4786,7 +4786,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; - renderFaceDown( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture( tt, level, pX, pY, pZ, 0 ) ); + renderFaceDown( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 0 ) ); } if ( faceFlags & 0x02 ) { @@ -4878,7 +4878,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= ll4; - renderFaceUp( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture( tt, level, pX, pY, pZ, 1 ) ); + renderFaceUp( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 1 ) ); } if ( faceFlags & 0x04 ) { @@ -4946,14 +4946,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll2 = (ll00z + ll0Yz + llX0z + llXYz) / 4.0f; float _ll3 = (ll0yz + ll00z + llXyz + llX0z) / 4.0f; float _ll4 = (llxyz + llx0z + ll0yz + ll00z) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); - ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); + ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); + ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); int _tc1 = blend(ccx0z, ccxYz, cc0Yz, cc00z); int _tc2 = blend(cc0Yz, ccX0z, ccXYz, cc00z); @@ -4998,7 +4998,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 2); - renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); + renderNorth( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5015,7 +5015,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); + renderNorth( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5082,14 +5082,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll4 = (ll00Z + ll0YZ + llX0Z + llXYZ) / 4.0f; float _ll3 = (ll0yZ + ll00Z + llXyZ + llX0Z) / 4.0f; float _ll2 = (llxyZ + llx0Z + ll0yZ + ll00Z) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); - ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); + ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); + ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); int _tc1 = blend(ccx0Z, ccxYZ, cc0YZ, cc00Z); int _tc4 = blend(cc0YZ, ccX0Z, ccXYZ, cc00Z); @@ -5134,7 +5134,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 3); - renderSouth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture(tt, level, pX, pY, pZ, 3 ) ); + renderSouth( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture(tt, level, pX, pY, pZ, 3 ) ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5151,7 +5151,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderSouth( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); + renderSouth( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5217,14 +5217,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll1 = (llx00 + llx0Z + llxY0 + llxYZ) / 4.0f; float _ll2 = (llx0z + llx00 + llxYz + llxY0) / 4.0f; float _ll3 = (llxyz + llxy0 + llx0z + llx00) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ1); - ll2 = static_cast(_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ0); - ll3 = static_cast(_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ0); - ll4 = static_cast(_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ1); + ll1 = (float) (_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ1); + ll2 = (float) (_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ0); + ll3 = (float) (_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ0); + ll4 = (float) (_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ1); int _tc4 = blend(ccxy0, ccxyZ, ccx0Z, ccx00); int _tc1 = blend(ccx0Z, ccxY0, ccxYZ, ccx00); @@ -5269,7 +5269,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 4); - renderWest( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); + renderWest( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { @@ -5286,7 +5286,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c3b *= pBaseBlue; c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderWest( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); + renderWest( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -5352,14 +5352,14 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti float _ll2 = (llXyz + llXy0 + llX0z + llX00) / 4.0f; float _ll3 = (llX0z + llX00 + llXYz + llXY0) / 4.0f; float _ll4 = (llX00 + llX0Z + llXY0 + llXYZ) / 4.0f; - ll1 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 - * tileShapeZ1); - ll2 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 - * tileShapeZ0); - ll3 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 - * tileShapeZ0); - ll4 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 - * tileShapeZ1); + ll1 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 + * tileShapeZ1); + ll2 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 + * tileShapeZ0); + ll3 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 + * tileShapeZ0); + ll4 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 + * tileShapeZ1); int _tc1 = blend(ccXy0, ccXyZ, ccX0Z, ccX00); int _tc4 = blend(ccX0Z, ccXY0, ccXYZ, ccX00); @@ -5405,7 +5405,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= ll4; Icon_SPU *tex = getTexture(tt, level, pX, pY, pZ, 5); - renderEast( tt, static_cast(pX), static_cast(pY), static_cast(pZ), tex ); + renderEast( tt, ( float )pX, ( float )pY, ( float )pZ, tex ); if ( fancy && (tex == &Tile_SPU::ms_pTileData->iconData[Tile_SPU::grass_Id] && !hasFixedTexture() )) { c1r *= pBaseRed; @@ -5422,7 +5422,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= pBaseBlue; bool prev = t->setMipmapEnable( false ); // 4J added - this is rendering the little bit of grass at the top of the side of dirt, don't mipmap it - renderEast( tt, static_cast(pX), static_cast(pY), static_cast(pZ), GrassTile_SPU::getSideTextureOverlay() ); + renderEast( tt, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); t->setMipmapEnable( prev ); } } @@ -6005,8 +6005,8 @@ int TileRenderer_SPU::blend( int a, int b, int c, int def ) int TileRenderer_SPU::blend(int a, int b, int c, int d, float fa, float fb, float fc, float fd) { - int top = static_cast((float)((a >> 16) & 0xff) * fa + (float)((b >> 16) & 0xff) * fb + (float)((c >> 16) & 0xff) * fc + (float)((d >> 16) & 0xff) * fd) & 0xff; - int bottom = static_cast((float)(a & 0xff) * fa + (float)(b & 0xff) * fb + (float)(c & 0xff) * fc + (float)(d & 0xff) * fd) & 0xff; + int top = (int) ((float) ((a >> 16) & 0xff) * fa + (float) ((b >> 16) & 0xff) * fb + (float) ((c >> 16) & 0xff) * fc + (float) ((d >> 16) & 0xff) * fd) & 0xff; + int bottom = (int) ((float) (a & 0xff) * fa + (float) (b & 0xff) * fb + (float) (c & 0xff) * fc + (float) (d & 0xff) * fd) & 0xff; return (top << 16) | bottom; } @@ -7626,7 +7626,7 @@ Icon_SPU *TileRenderer_SPU::getTexture(Tile_SPU *tile) Icon_SPU *TileRenderer_SPU::getTextureOrMissing(Icon_SPU *Icon_SPU) { - if (Icon_SPU == nullptr) + if (Icon_SPU == NULL) { assert(0); // return minecraft->textures->getMissingIcon_SPU(Icon_SPU::TYPE_TERRAIN); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h index 3f34a778..2c484faa 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h @@ -72,8 +72,8 @@ public: void tesselateInWorldFixedTexture( Tile_SPU* tile, int x, int y, int z, Icon_SPU *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld void tesselateInWorldNoCulling( Tile_SPU* tile, int x, int y, int z, int forceData = -1, - TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param - bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param + TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param + bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param private: bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index c5a9be4d..f2dfeaac 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -92,7 +92,7 @@ #include #include "AnvilTile_SPU.h" -TileData_SPU* Tile_SPU::ms_pTileData = nullptr; +TileData_SPU* Tile_SPU::ms_pTileData = NULL; Tile_SPU Tile_SPU::m_tiles[256]; @@ -181,7 +181,7 @@ Icon_SPU *Tile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int } - Icon_SPU *icon = nullptr; + Icon_SPU *icon = NULL; if(opaque) { LeafTile_SPU::setFancy(false); @@ -215,13 +215,13 @@ Icon_SPU *Tile_SPU::getTexture(int face) // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); // } // // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); // } // // AABB *Tile_SPU::getAABB(Level *level, int x, int y, int z) @@ -368,18 +368,18 @@ Icon_SPU *Tile_SPU::getTexture(int face) // Vec3 *zh0 = a->clipZ(b, zz0); // Vec3 *zh1 = a->clipZ(b, zz1); // -// Vec3 *closest = nullptr; +// Vec3 *closest = NULL; // -// if (containsX(xh0) && (closest == nullptr || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; -// if (containsX(xh1) && (closest == nullptr || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; -// if (containsY(yh0) && (closest == nullptr || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; -// if (containsY(yh1) && (closest == nullptr || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; -// if (containsZ(zh0) && (closest == nullptr || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; -// if (containsZ(zh1) && (closest == nullptr || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; +// if (containsX(xh0) && (closest == NULL || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; +// if (containsX(xh1) && (closest == NULL || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; +// if (containsY(yh0) && (closest == NULL || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; +// if (containsY(yh1) && (closest == NULL || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; +// if (containsZ(zh0) && (closest == NULL || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; +// if (containsZ(zh1) && (closest == NULL || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; // // LeaveCriticalSection(&m_csShape); // -// if (closest == nullptr) return nullptr; +// if (closest == NULL) return NULL; // // int face = -1; // @@ -395,19 +395,19 @@ Icon_SPU *Tile_SPU::getTexture(int face) // // bool Tile_SPU::containsX(Vec3 *v) // { -// if( v == nullptr) return false; +// if( v == NULL) return false; // return v->y >= yy0 && v->y <= yy1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsY(Vec3 *v) // { -// if( v == nullptr) return false; +// if( v == NULL) return false; // return v->x >= xx0 && v->x <= xx1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsZ(Vec3 *v) // { -// if( v == nullptr) return false; +// if( v == NULL) return false; // return v->x >= xx0 && v->x <= xx1 && v->y >= yy0 && v->y <= yy1; // } // @@ -516,7 +516,7 @@ void Tile_SPU::updateDefaultShape() // // 4J Stu - Special case - only record a crop destroy if is fully grown // if(id==Tile_SPU::crops_Id) // { -// if( Tile_SPU::crops->getResource(data, nullptr, 0) > 0 ) +// if( Tile_SPU::crops->getResource(data, NULL, 0) > 0 ) // player->awardStat(Stats::blocksMined[id], 1); // } // else @@ -533,7 +533,7 @@ void Tile_SPU::updateDefaultShape() // if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory)) // { // shared_ptr item = getSilkTouchItemInstance(data); -// if (item != nullptr) +// if (item != NULL) // { // popResource(level, x, y, z, item); // } @@ -625,7 +625,7 @@ float Tile_SPU::getShadeBrightness(ChunkRebuildData *level, int x, int y, int z) Tile_SPU* Tile_SPU::createFromID( int tileID ) { if(tileID == 0) - return nullptr; + return NULL; if(m_tiles[tileID].id != -1) return &m_tiles[tileID]; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h index e3d11f04..484823ef 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h @@ -242,7 +242,7 @@ public: Icon_SPU *getTexture(int face, int data); Icon_SPU *getTexture(int face); public: - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param double getShapeX0(); double getShapeX1(); double getShapeY0(); @@ -465,7 +465,7 @@ public: double getShapeZ1() { return ms_pTileData->zz1[id]; } Material_SPU* getMaterial(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual void setShape(float x0, float y0, float z0, float x1, float y1, float z1); virtual float getBrightness(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h index 43cffbf8..2b5f86a5 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h @@ -14,7 +14,7 @@ public: bool blocksLight() { return false; } bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { int height = level->getData(x, y, z) & HEIGHT_MASK; float o = 2 * (1 + height) / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h index 4f72c543..6f096a17 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h @@ -21,7 +21,7 @@ public: bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } int getRenderShape() { return Tile_SPU::SHAPE_BLOCK;} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h index 7d94e750..e2f4a4ad 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h @@ -27,7 +27,7 @@ public: return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param { const float thickness = 1.0f / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h index 7065210f..e298ae2d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h @@ -172,15 +172,15 @@ public: // { // public: // ZipFile(File *file) {} -// InputStream *getInputStream(ZipEntry *entry) { return nullptr; } -// ZipEntry *getEntry(const wstring& name) {return nullptr;} +// InputStream *getInputStream(ZipEntry *entry) { return NULL; } +// ZipEntry *getEntry(const wstring& name) {return NULL;} // void close() {} // }; // // class ImageIO // { // public: -// static BufferedImage *read(InputStream *in) { return nullptr; } +// static BufferedImage *read(InputStream *in) { return NULL; } // }; // // class Keyboard diff --git a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp index 16ea17bb..dc134eca 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp @@ -315,7 +315,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int // tile IDs first // --------------------------- - if(m_lowerBlocks[block] != nullptr) + if(m_lowerBlocks[block] != NULL) { int dmaSize = padTo16(m_lowerBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_lowerBlocks[block], dmaSize); @@ -366,7 +366,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int void TileCompressData_SPU::loadAndUncompressUpperSection(int block, int x0, int z0, int x1, int z1) { - if(m_upperBlocks[block] != nullptr) + if(m_upperBlocks[block] != NULL) { int dmaSize = padTo16(m_upperBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_upperBlocks[block], dmaSize); @@ -507,7 +507,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_lowerBlocks[i*3+j] = nullptr; + m_lowerBlocks[i*3+j] = NULL; m_lowerBlocksSize[i*3+j] = 0; m_lowerSkyLight[i*3+j] = 0; m_lowerBlockLight[i*3+j] = 0; @@ -527,7 +527,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_upperBlocks[i*3+j] = nullptr; + m_upperBlocks[i*3+j] = NULL; m_upperBlocksSize[i*3+j] = 0; m_upperSkyLight[i*3+j] = 0; m_upperBlockLight[i*3+j] = 0; diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h index 644ab3e7..c0209eb6 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h @@ -145,8 +145,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h index 4c1f4e01..ab6b6131 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h @@ -191,7 +191,7 @@ public: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void InitialiseTrophies(); //CD - Don't use this, auto setup after login void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h index e5d19e20..b08c9fba 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h @@ -20,8 +20,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = nullptr; } - bool Allocated() { return m_pBuffer != nullptr; } + void Release() { free(m_pBuffer); m_pBuffer = NULL; } + bool Allocated() { return m_pBuffer != NULL; } }; typedef struct @@ -63,7 +63,7 @@ public: void InitialiseContext(); void StartFrame(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = nullptr); + void Clear(int flags, D3D11_RECT *pRect = NULL); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h index 4c9219a9..552c247d 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h @@ -298,7 +298,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -374,8 +374,8 @@ public: EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); CONTENT_DATA& GetDLC(DWORD dw); DWORD GetAvailableDLCCount( int iPad ); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); void SetDLCProductCode(const char* szProductCode); diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp index 7594f7ec..fc5b190a 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp @@ -311,7 +311,7 @@ extern "C" void gdraw_psp2_wait(U64 fence_val) // // (once or several times) here // SceGxmNotification notify = gdraw_psp2_End(); // // --- again, may issue rendering calls here (but not draw Iggys) - // sceGxmEndScene(imm_ctx, nullptr, ¬ify); + // sceGxmEndScene(imm_ctx, NULL, ¬ify); // // That is, exactly one gdraw_psp2_Begin/_End pair for that scene, and // all IggyPlayerDraws must be inside that pair. That's it. @@ -360,7 +360,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_ 0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size, - nullptr, 0, nullptr); + NULL, 0, NULL); offs += num_rows * row_size; } @@ -375,7 +375,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_ 0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size, - nullptr, 0, nullptr); + NULL, 0, NULL); } if (c->is_vertex) @@ -436,7 +436,7 @@ static void api_free_resource(GDrawHandle *r) if (!r->cache->is_vertex) { for (S32 i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = nullptr; + gdraw->active_tex[i] = NULL; } } @@ -462,7 +462,7 @@ static void track_dynamic_alloc_attempt(U32 size, U32 align) static void track_dynamic_alloc_failed() { if (gdraw->dynamic_stats.allocs_attempted == gdraw->dynamic_stats.allocs_succeeded + 1) { // warn the first time we run out of mem - IggyGDrawSendWarning(nullptr, "GDraw out of dynamic memory"); + IggyGDrawSendWarning(NULL, "GDraw out of dynamic memory"); } } @@ -506,7 +506,7 @@ GDrawTexture * RADLINK gdraw_psp2_WrappedTextureCreate(SceGxmTexture *tex) { GDrawStats stats = {}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); gdraw_psp2_WrappedTextureChange((GDrawTexture *) p, tex); return (GDrawTexture *) p; } @@ -561,11 +561,11 @@ static U32 tex_linear_stride(U32 width) static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; SceGxmTextureFormat format = SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR; if (width > MAX_TEXTURE2D_DIM || height > MAX_TEXTURE2D_DIM) { - IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); + IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); return false; } @@ -611,7 +611,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) { rrbool ok; - assert(p->temp_buffer != nullptr); + assert(p->temp_buffer != NULL); ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps, bytes_pixel, p->temp_buffer, p->temp_buffer_bytes); if (!ok) @@ -626,7 +626,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, p->i2 = height; } else { // non-mipmapped textures, we just upload straight to their destination - p->p1 = nullptr; + p->p1 = NULL; p->texture_data = (U8 *)t->raw_ptr; p->num_rows = height; p->stride_in_bytes = base_stride * bytes_pixel; @@ -723,8 +723,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); + if (t->owner == unique_id || unique_id == NULL) { gdraw_res_kill(t, stats); } } @@ -744,7 +744,7 @@ static void RADLINK gdraw_DescribeTexture(GDrawTexture *tex, GDraw_Texture_Descr static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) { - if (sceGxmTextureGetData(&gdraw->aa_tex) != nullptr) + if (sceGxmTextureGetData(&gdraw->aa_tex) != NULL) return; assert(width <= MAX_AATEX_WIDTH); @@ -801,7 +801,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); // @GDRAW_ASSERT + assert(h != NULL); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -931,8 +931,8 @@ static void set_common_renderstate() // clear our state caching memset(gdraw->active_tex, 0, sizeof(gdraw->active_tex)); gdraw->scissor_state = 0; - gdraw->cur_fp = nullptr; - gdraw->cur_vp = nullptr; + gdraw->cur_fp = NULL; + gdraw->cur_vp = NULL; // all the state we won't touch again until we're done rendering sceGxmSetCullMode(gxm, SCE_GXM_CULL_NONE); @@ -1032,7 +1032,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 // must include anything necessary for texture creation/update static void RADLINK gdraw_RenderingBegin(void) { - assert(gdraw->gxm != nullptr); // call after gdraw_psp2_Begin + assert(gdraw->gxm != NULL); // call after gdraw_psp2_Begin set_common_renderstate(); } @@ -1061,7 +1061,7 @@ static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, S32 pa // clear our depth/stencil buffers (and also color if requested) clear_whole_surf(true, true, gdraw->next_tile_clear, stats); - gdraw->next_tile_clear = nullptr; + gdraw->next_tile_clear = NULL; } static void RADLINK gdraw_RenderTileEnd(GDrawStats *stats) @@ -1079,7 +1079,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c { U32 xmin, ymin, xmax, ymax; - assert(gdraw->gxm == nullptr); // may not nest Begin calls + assert(gdraw->gxm == NULL); // may not nest Begin calls // need to wait for the buffer to become idle before we can use it! gdraw_psp2_WaitForDynamicBufferIdle(dynamic_buf); @@ -1106,7 +1106,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c // - We need the stencil buffer to support Flash masking operations. // - We need the mask bit to perform pixel-accurate scissor testing. // There's only one format that satisfies both requirements. - IggyGDrawSendWarning(nullptr, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided."); + IggyGDrawSendWarning(NULL, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided."); } // For immediate contexts, we need to flush pending vertex transfers before @@ -1125,15 +1125,15 @@ SceGxmNotification gdraw_psp2_End() GDrawStats gdraw_stats = {}; SceGxmNotification notify; - assert(gdraw->gxm != nullptr); // please keep Begin / End pairs properly matched + assert(gdraw->gxm != NULL); // please keep Begin / End pairs properly matched notify = scene_end_notification(); gdraw->dyn_buf->sync = gdraw->scene_end_fence.value; gdraw->dyn_buf->stats = gdraw->dynamic_stats; - gdraw_arena_init(&gdraw->dynamic, nullptr, 0); - gdraw->gxm = nullptr; - gdraw->dyn_buf = nullptr; + gdraw_arena_init(&gdraw->dynamic, NULL, 0); + gdraw->gxm = NULL; + gdraw->dyn_buf = NULL; // NOTE: the stats from these go nowhere. That's a bit unfortunate, but the // GDrawStats model is that things can be accounted to something in the @@ -1173,13 +1173,13 @@ static void RADLINK gdraw_GetInfo(GDrawInfo *d) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format format, U32 flags, void *owner, GDrawStats *stats) { - IggyGDrawSendWarning(nullptr, "GDraw no rendertarget support on PSP2"); + IggyGDrawSendWarning(NULL, "GDraw no rendertarget support on PSP2"); return false; } static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) { - return nullptr; + return NULL; } //////////////////////////////////////////////////////////////////////// @@ -1190,13 +1190,13 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) static void RADLINK gdraw_ClearStencilBits(U32 bits) { GDrawStats stats = {}; - clear_whole_surf(false, true, nullptr, &stats); + clear_whole_surf(false, true, NULL, &stats); } static void RADLINK gdraw_ClearID(void) { GDrawStats stats = {}; - clear_whole_surf(true, false, nullptr, &stats); + clear_whole_surf(true, false, NULL, &stats); } //////////////////////////////////////////////////////////////////////// @@ -1451,7 +1451,7 @@ static GDrawHandle *check_resource(void *ptr) #define check_resource(ptr) ((GDrawHandle *)(ptr)) #endif -static RADINLINE void fence_resources(void *r1, void *r2=nullptr, void *r3=nullptr) +static RADINLINE void fence_resources(void *r1, void *r2=NULL, void *r3=NULL) { GDrawFence fence = get_next_fence(); if (r1) check_resource(r1)->fence = fence; @@ -1592,7 +1592,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 // actual filter effects and special blends aren't supported on PSP2. if (r->blend_mode == GDRAW_BLEND_filter || r->blend_mode == GDRAW_BLEND_special) { - IggyGDrawSendWarning(nullptr, "GDraw no filter or special blend support on PSP2"); + IggyGDrawSendWarning(NULL, "GDraw no filter or special blend support on PSP2"); // just don't do anything. } else { // just a plain quad. @@ -1614,7 +1614,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 static bool gxm_check(SceGxmErrorCode err) { if (err != SCE_OK) - IggyGDrawSendWarning(nullptr, "GXM error"); + IggyGDrawSendWarning(NULL, "GXM error"); return err == SCE_OK; } @@ -1643,9 +1643,9 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG SceGxmVertexStream stream; if (!register_shader(patcher, shader)) - return nullptr; + return NULL; - *out_prog = nullptr; + *out_prog = NULL; if (attr_bytes) { attr.streamIndex = 0; @@ -1659,7 +1659,7 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, &attr, 1, &stream, 1, out_prog)); } else - return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, nullptr, 0, nullptr, 0, out_prog)); + return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, NULL, 0, NULL, 0, out_prog)); } static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgram *prog) @@ -1670,8 +1670,8 @@ static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgra static bool create_fragment_prog(SceGxmFragmentProgram **out_prog, SceGxmShaderPatcher *patcher, ShaderCode *shader, const SceGxmBlendInfo *blend, SceGxmOutputRegisterFormat out_fmt) { - *out_prog = nullptr; - return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, nullptr, out_prog)); + *out_prog = NULL; + return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, NULL, out_prog)); } static void destroy_fragment_prog(SceGxmShaderPatcher *patcher, SceGxmFragmentProgram *prog) @@ -1731,10 +1731,10 @@ static bool create_all_programs(SceGxmOutputRegisterFormat reg_format) } if (!register_shader(patcher, pshader_manual_clear_arr) || - !create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, nullptr, reg_format)) + !create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, NULL, reg_format)) return false; - gdraw->mask_update_fp = nullptr; + gdraw->mask_update_fp = NULL; return gxm_check(sceGxmShaderPatcherCreateMaskUpdateFragmentProgram(patcher, &gdraw->mask_update_fp)); } @@ -1786,7 +1786,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali one_pool_bytes = align_down(one_pool_bytes / 2, align); if (one_pool_bytes < (S32)align) - return nullptr; + return NULL; cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size); if (cache) { @@ -1805,7 +1805,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali cache->alloc = gfxalloc_create(gdraw_limits[type].ptr, one_pool_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - return nullptr; + return NULL; } if (use_twopool) { @@ -1813,7 +1813,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali if (!cache->alloc_other) { IggyGDrawFree(cache->alloc); IggyGDrawFree(cache); - return nullptr; + return NULL; } // two dummy copies to make sure we have gpu read/write access @@ -1898,12 +1898,12 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles, case GDRAW_PSP2_RESOURCE_texture: free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_PSP2_RESOURCE_texture, GDRAW_PSP2_TEXTURE_ALIGNMENT, true); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_PSP2_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_PSP2_RESOURCE_vertexbuffer, GDRAW_PSP2_VERTEXBUFFER_ALIGNMENT, true); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; default: return 0; @@ -1912,8 +1912,8 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles, void gdraw_psp2_ResetAllResourceMemory() { - gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, nullptr, 0); - gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, nullptr, 0); + gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, NULL, 0); + gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, NULL, 0); } GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, void *context_mem, volatile U32 *notification, SceGxmOutputRegisterFormat reg_format) @@ -1935,7 +1935,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo }; gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -1961,7 +1961,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo if (!gdraw->quad_ib || !gdraw->mask_ib || !create_all_programs(reg_format)) { gdraw_psp2_DestroyContext(); - return nullptr; + return NULL; } // init quad index buffer @@ -1977,7 +1977,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo gdraw->mask_draw_gpu = gdraw_arena_alloc(&gdraw->context_arena, sceGxmGetPrecomputedDrawSize(gdraw->mask_vp), SCE_GXM_PRECOMPUTED_ALIGNMENT); if (!gdraw->mask_draw_gpu) { gdraw_psp2_DestroyContext(); - return nullptr; + return NULL; } memcpy(gdraw->mask_ib, mask_ib_data, sizeof(mask_ib_data)); @@ -2048,7 +2048,7 @@ void gdraw_psp2_DestroyContext(void) free_handle_cache(gdraw->vbufcache); destroy_all_programs(); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } } @@ -2070,7 +2070,7 @@ void RADLINK gdraw_psp2_EndCustomDraw(IggyCustomDrawCallbackRegion *region) GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S32 len, IggyFileTexturePSP2 *tex) { - SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = nullptr; + SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = NULL; switch (tex->texture.type) { case SCE_GXM_TEXTURE_SWIZZLED: init_func = sceGxmTextureInitSwizzled; break; @@ -2080,15 +2080,15 @@ GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S3 } if (!init_func) { - IggyGDrawSendWarning(nullptr, "Unsupported texture type in MakeTextureFromResource"); - return nullptr; + IggyGDrawSendWarning(NULL, "Unsupported texture type in MakeTextureFromResource"); + return NULL; } SceGxmTexture gxm; SceGxmErrorCode err = init_func(&gxm, file_in_memory + tex->file_offset, (SceGxmTextureFormat)tex->texture.format, tex->texture.width, tex->texture.height, tex->texture.mip_count); if (err != SCE_OK) { - IggyGDrawSendWarning(nullptr, "Texture init failed in MakeTextureFromResource (bad data?)"); - return nullptr; + IggyGDrawSendWarning(NULL, "Texture init failed in MakeTextureFromResource (bad data?)"); + return NULL; } return gdraw_psp2_WrappedTextureCreate(&gxm); diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h index da31de70..a606fbe3 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h @@ -68,7 +68,7 @@ IDOC extern int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 n mapped to the GPU and *writeable*. If it isn't, the GPU will crash during either this function or CreateContext! - Pass in nullptr for "ptr" and zero "num_bytes" to free the memory allocated to + Pass in NULL for "ptr" and zero "num_bytes" to free the memory allocated to a specific pool. GDraw can run into cases where resource memory gets fragmented; we defragment @@ -121,7 +121,7 @@ IDOC extern GDrawFunctions * gdraw_psp2_CreateContext(SceGxmShaderPatcher *shade be valid for as long as a GDraw context is alive. If initialization fails for some reason (the main reason would be an out of memory condition), - nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_psp2_DestroyContext(void); /* Destroys the current GDraw context, if any. diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl index 6b0448f5..9e2870eb 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl @@ -532,24 +532,24 @@ static unsigned char pshader_basic_17[436] = { }; static ShaderCode pshader_basic_arr[18] = { - { pshader_basic_0, { nullptr } }, - { pshader_basic_1, { nullptr } }, - { pshader_basic_2, { nullptr } }, - { pshader_basic_3, { nullptr } }, - { pshader_basic_4, { nullptr } }, - { pshader_basic_5, { nullptr } }, - { pshader_basic_6, { nullptr } }, - { pshader_basic_7, { nullptr } }, - { pshader_basic_8, { nullptr } }, - { pshader_basic_9, { nullptr } }, - { pshader_basic_10, { nullptr } }, - { pshader_basic_11, { nullptr } }, - { pshader_basic_12, { nullptr } }, - { pshader_basic_13, { nullptr } }, - { pshader_basic_14, { nullptr } }, - { pshader_basic_15, { nullptr } }, - { pshader_basic_16, { nullptr } }, - { pshader_basic_17, { nullptr } }, + { pshader_basic_0, { NULL } }, + { pshader_basic_1, { NULL } }, + { pshader_basic_2, { NULL } }, + { pshader_basic_3, { NULL } }, + { pshader_basic_4, { NULL } }, + { pshader_basic_5, { NULL } }, + { pshader_basic_6, { NULL } }, + { pshader_basic_7, { NULL } }, + { pshader_basic_8, { NULL } }, + { pshader_basic_9, { NULL } }, + { pshader_basic_10, { NULL } }, + { pshader_basic_11, { NULL } }, + { pshader_basic_12, { NULL } }, + { pshader_basic_13, { NULL } }, + { pshader_basic_14, { NULL } }, + { pshader_basic_15, { NULL } }, + { pshader_basic_16, { NULL } }, + { pshader_basic_17, { NULL } }, }; static unsigned char pshader_manual_clear_0[220] = { @@ -570,7 +570,7 @@ static unsigned char pshader_manual_clear_0[220] = { }; static ShaderCode pshader_manual_clear_arr[1] = { - { pshader_manual_clear_0, { nullptr } }, + { pshader_manual_clear_0, { NULL } }, }; static unsigned char vshader_vspsp2_0[360] = { @@ -664,9 +664,9 @@ static unsigned char vshader_vspsp2_2[336] = { }; static ShaderCode vshader_vspsp2_arr[3] = { - { vshader_vspsp2_0, { nullptr } }, - { vshader_vspsp2_1, { nullptr } }, - { vshader_vspsp2_2, { nullptr } }, + { vshader_vspsp2_0, { NULL } }, + { vshader_vspsp2_1, { NULL } }, + { vshader_vspsp2_2, { NULL } }, }; static unsigned char vshader_vspsp2_mask_0[304] = { @@ -692,6 +692,6 @@ static unsigned char vshader_vspsp2_mask_0[304] = { }; static ShaderCode vshader_vspsp2_mask_arr[1] = { - { vshader_vspsp2_mask_0, { nullptr } }, + { vshader_vspsp2_mask_0, { NULL } }, }; diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl index 6a439d8f..4fae9c12 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != nullptr) { + while (s != NULL) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! + assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, nullptr); + return gdraw_HandleCacheLockStats(t, owner, NULL); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = nullptr; - c->state[i].cache = nullptr; // should never follow cache link from sentinels! + c->state[i].owner = NULL; + c->state[i].cache = NULL; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = nullptr; + c->state[i].raw_ptr = NULL; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = nullptr; + c->handle[i].raw_ptr = NULL; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = nullptr; + c->alloc = NULL; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = nullptr; + c->alloc_other = NULL; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = nullptr; + t->raw_ptr = NULL; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -562,7 +562,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : nullptr; + return (sentinel->next != sentinel) ? sentinel->next : NULL; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -777,7 +777,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -829,7 +829,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -841,7 +841,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -948,7 +948,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); + S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1094,7 +1094,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = nullptr; + *start = NULL; *num_bytes = 0; return; } else { @@ -1131,7 +1131,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return nullptr; + return NULL; arena->current = ptr + size; return ptr; @@ -1156,7 +1156,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, nullptr-terminated list of elements in each hash +// There's a single-linked, NULL-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1165,7 +1165,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, nullptr-terminated list of unused blocks. Every block is either +// single-linked, NULL-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1383,7 +1383,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != nullptr); + GFXALLOC_ASSERT(alloc->unused_list != NULL); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1456,7 +1456,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return nullptr; + return NULL; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1464,7 +1464,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return nullptr; + return NULL; memset(a, 0, size); @@ -1505,16 +1505,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, nullptr, 0,0); + debug_complete_check(a, NULL, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = nullptr; + gfx_block_info *cur, *best = NULL; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, nullptr, 0,0); +debug_complete_check(alloc, NULL, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1564,7 +1564,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return nullptr; // not enough space! + return NULL; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1734,7 +1734,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = nullptr; + b->prev = NULL; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1747,7 +1747,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1909,7 +1909,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = nullptr; + void *ptr = NULL; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2299,7 +2299,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = nullptr; + ring->cur = NULL; ring->seg_size = 0; } @@ -2309,7 +2309,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return nullptr; // nope, won't fit + return NULL; // nope, won't fit assert(align <= ring->align); @@ -2414,7 +2414,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2434,8 +2434,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return nullptr; + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return NULL; } #ifndef GDRAW_MANAGE_MEM @@ -2444,7 +2444,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2452,7 +2452,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, nullptr, "memory"); + gdraw_res_alloc_outofmem(c, NULL, "memory"); break; } } @@ -2467,8 +2467,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == nullptr) { - gdraw_res_alloc_outofmem(c, nullptr, "handles"); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); } } } @@ -2512,7 +2512,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = nullptr; + r->owner = NULL; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2520,11 +2520,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = nullptr; + void *ptr = NULL; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2536,7 +2536,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, nullptr, "handles"); + return gdraw_res_alloc_outofmem(c, NULL, "handles"); } // try to allocate first diff --git a/Minecraft.Client/PSVita/Iggy/include/gdraw.h b/Minecraft.Client/PSVita/Iggy/include/gdraw.h index 7cc4ddd0..404a2642 100644 --- a/Minecraft.Client/PSVita/Iggy/include/gdraw.h +++ b/Minecraft.Client/PSVita/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is nullptr, then the pointers in 'prim' are machine pointers, and + If buf is NULL, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-nullptr, then use the appropriate vertex buffer, and the + If buf is non-NULL, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or nullptr if an error occured + $:return Handle for the newly created texture, or NULL if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h b/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h index a42ccbff..1f1a90a1 100644 --- a/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP +Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp index c5a44878..958999e4 100644 --- a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp +++ b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp @@ -20,7 +20,7 @@ PSVitaLeaderboardManager::PSVitaLeaderboardManager() : SonyLeaderboardManager() HRESULT PSVitaLeaderboardManager::initialiseScoreUtility() { - return sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, nullptr); + return sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, NULL); } bool PSVitaLeaderboardManager::scoreUtilityAlreadyInitialised(HRESULT hr) diff --git a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp index 9ed61d21..1c5c45e3 100644 --- a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp +++ b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp @@ -331,7 +331,7 @@ void hexStrToBin( val <<= 4; } else { - if (pBinBuf != nullptr && binOffset < binBufSize) { + if (pBinBuf != NULL && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); val = 0; } @@ -339,7 +339,7 @@ void hexStrToBin( } } - if (val != 0 && pBinBuf != nullptr && binOffset < binBufSize) { + if (val != 0 && pBinBuf != NULL && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); } @@ -403,7 +403,7 @@ void PSVitaNPToolkit::init() // extern void npStateCallback(SceNpServiceState state, int retCode, void *userdata); - ret = sceNpRegisterServiceStateCallback(npStateCallback, nullptr); + ret = sceNpRegisterServiceStateCallback(npStateCallback, NULL); if (ret < 0) { app.DebugPrintf("sceNpRegisterServiceStateCallback() failed. ret = 0x%x\n", ret); diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp index 4ba6ae2e..dc9ad61e 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp @@ -45,8 +45,8 @@ int SQRNetworkManager_AdHoc_Vita::m_adhocStatus = false; static unsigned char s_Matching2Pool[SCE_NET_ADHOC_MATCHING_POOLSIZE_DEFAULT]; -int (* SQRNetworkManager_AdHoc_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; -void * SQRNetworkManager_AdHoc_Vita::s_SignInCompleteParam = nullptr; +int (* SQRNetworkManager_AdHoc_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; +void * SQRNetworkManager_AdHoc_Vita::s_SignInCompleteParam = NULL; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_AdHoc_Vita::s_lastPresenceInfo; int SQRNetworkManager_AdHoc_Vita::s_resendPresenceCountdown = 0; bool SQRNetworkManager_AdHoc_Vita::s_presenceStatusDirty = false; @@ -127,8 +127,8 @@ SQRNetworkManager_AdHoc_Vita::SQRNetworkManager_AdHoc_Vita(ISQRNetworkManagerLis m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = nullptr; -// m_gameBootInvite = nullptr; + m_aServerId = NULL; +// m_gameBootInvite = NULL; m_adhocStatus = false; m_bLinkDisconnected = false; m_bIsInitialised=false; @@ -166,7 +166,7 @@ void SQRNetworkManager_AdHoc_Vita::Initialise() int32_t ret = 0; // int32_t libCtxId = 0; -// ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, nullptr); +// ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, NULL); // assert (ret >= 0); // libCtxId = ret; @@ -203,7 +203,7 @@ void SQRNetworkManager_AdHoc_Vita::Initialise() // npConf.commId = &s_npCommunicationId; // npConf.commPassphrase = &s_npCommunicationPassphrase; // npConf.commSignature = &s_npCommunicationSignature; -// ret = sceNpInit(&npConf, nullptr); +// ret = sceNpInit(&npConf, NULL); // if (ret < 0 && ret != SCE_NP_ERROR_ALREADY_INITIALIZED) // { // app.DebugPrintf("sceNpInit failed, ret=%x\n", ret); @@ -388,14 +388,14 @@ bool SQRNetworkManager_AdHoc_Vita::CreateMatchingContext(bool bServer /*= false* // Free up any external data that we received from the previous search - for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ ) + for( int i = 0; i < m_aFriendSearchResults.size(); i++ ) { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; + m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; if(m_aFriendSearchResults[i].m_gameSessionData) free(m_aFriendSearchResults[i].m_gameSessionData); - m_aFriendSearchResults[i].m_gameSessionData = nullptr; + m_aFriendSearchResults[i].m_gameSessionData = NULL; } m_friendCount = 0; m_aFriendSearchResults.clear(); @@ -406,7 +406,7 @@ bool SQRNetworkManager_AdHoc_Vita::CreateMatchingContext(bool bServer /*= false* ret = sceNetAdhocMatchingStart(m_matchingContext, SCE_KERNEL_DEFAULT_PRIORITY_USER, MATCHING_EVENT_HANDLER_STACK_SIZE, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, - 0, nullptr);//sizeof(g_myInfo.name), &g_myInfo.name); + 0, NULL);//sizeof(g_myInfo.name), &g_myInfo.name); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CONTEXT_START_ASYNC ) ) { @@ -448,7 +448,7 @@ void SQRNetworkManager_AdHoc_Vita::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } return; } @@ -512,7 +512,7 @@ void SQRNetworkManager_AdHoc_Vita::Tick() // if( ( m_gameBootInvite m) && ( s_safeToRespondToGameBootInvite ) ) // { // m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); -// m_gameBootInvite = nullptr; +// m_gameBootInvite = NULL; // } ErrorHandlingTick(); @@ -585,7 +585,7 @@ void SQRNetworkManager_AdHoc_Vita::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineSQR ) @@ -777,7 +777,7 @@ void SQRNetworkManager_AdHoc_Vita::FriendSearchTick() // { // m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; // delete m_getFriendCountThread; -// m_getFriendCountThread = nullptr; +// m_getFriendCountThread = NULL; FriendRoomManagerSearch2(); // } } @@ -797,7 +797,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventThreadProc( void *lpParameter ) // // do // { -// ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); +// ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); // // // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread // if( event.udata == 0 ) @@ -855,7 +855,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventThreadProc( void *lpParameter ) // // There shouldn't ever be more than 100 friends returned but limit here just in case // if( manager->m_friendCount > 100 ) manager->m_friendCount = 100; // -// SceNpId* friendIDs = nullptr; +// SceNpId* friendIDs = NULL; // if(manager->m_friendCount > 0) // { // // grab all the friend IDs first @@ -995,7 +995,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerByIndex(int idx) } else { - return nullptr; + return NULL; } } @@ -1012,7 +1012,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetLocalPlayerByUserIndex(int idx) @@ -1028,7 +1028,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetLocalPlayerByUserIndex(int id } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetHostPlayer() @@ -1041,11 +1041,11 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == nullptr ) return nullptr; + if( player == NULL ) return NULL; if( player->IsReady() ) return player; - return nullptr; + return NULL; } // Update state internally @@ -1086,7 +1086,7 @@ void SQRNetworkManager_AdHoc_Vita::ResetToIdle() { memberIDs.push_back(m_aRoomSlotPlayers[i]->m_roomMemberId); } - for(size_t i=0;im_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_netAddr, localPlayerMask, nullptr); + return JoinRoom(searchResult->m_netAddr, localPlayerMask, NULL); } bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId, int localPlayerMask, const PresenceSyncInfo *presence) @@ -1137,7 +1137,7 @@ bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNetInAddr netAddr, int localPlaye } else { - for(size_t i=0;im_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1446,7 +1446,7 @@ void SQRNetworkManager_AdHoc_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*= if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1538,7 +1538,7 @@ void SQRNetworkManager_AdHoc_Vita::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_AdHoc_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) +bool SQRNetworkManager_AdHoc_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) { assert( m_isHosting ); @@ -1658,7 +1658,7 @@ void SQRNetworkManager_AdHoc_Vita::RemoveRemotePlayersAndSync( SceNpMatching2Roo } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; } else { @@ -1701,7 +1701,7 @@ void SQRNetworkManager_AdHoc_Vita::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } // And delete the reference from the ctx->player map @@ -1807,7 +1807,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe // check we don't have this already int currIndex = -1; bool bChanged = false; - for(size_t i=0; im_aFriendSearchResults.size(); i++) + for(int i=0; im_aFriendSearchResults.size(); i++) { if(manager->m_aFriendSearchResults[i].m_netAddr.s_addr == peer->s_addr) { @@ -1843,7 +1843,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe case SCE_NET_ADHOC_MATCHING_EVENT_REQUEST: // A join request was received app.DebugPrintf("P2P SCE_NET_ADHOC_MATCHING_EVENT_REQUEST Received!!\n"); - if (optlen > 0 && opt != nullptr) + if (optlen > 0 && opt != NULL) { ret = SCE_OK;// parentRequestAdd(opt); if (ret != SCE_OK) @@ -1987,7 +1987,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe { app.DebugPrintf("P2P SCE_NET_ADHOC_MATCHING_EVENT_DATA Received!!\n"); - if (optlen <= 0 || opt == nullptr) + if (optlen <= 0 || opt == NULL) { assert(0); break; @@ -2270,7 +2270,7 @@ bool SQRNetworkManager_AdHoc_Vita::CreateRudpConnections(SceNetInAddr peer) if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, getRoomMemberID((&peer)), 0, rudpCtx, nullptr ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, getRoomMemberID((&peer)), 0, rudpCtx, NULL ); m_RudpCtxToIPAddrMap[ rudpCtx ] = peer; } else @@ -2311,7 +2311,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerFromRudpCtx(int rudpCtx { return it->second; } - return nullptr; + return NULL; } @@ -2322,7 +2322,7 @@ SceNetInAddr* SQRNetworkManager_AdHoc_Vita::GetIPAddrFromRudpCtx(int rudpCtx) { return &it->second; } - return nullptr; + return NULL; } @@ -2336,7 +2336,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerFromRoomMemberAndLocalI return it->second; } } - return nullptr; + return NULL; } @@ -2406,7 +2406,7 @@ void SQRNetworkManager_AdHoc_Vita::HandleMatchingContextStart() if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { SetState( SNM_INT_STATE_IDLE ); - GetExtDataForRoom(0, nullptr, nullptr, nullptr); + GetExtDataForRoom(0, NULL, NULL, NULL); } else if( m_state == SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT ) { @@ -2431,7 +2431,7 @@ void SQRNetworkManager_AdHoc_Vita::HandleMatchingContextStart() if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } @@ -2446,7 +2446,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventCallback(int event, int retCode, uin PSVITA_STUBBED; // SQRNetworkManager_AdHoc_Vita *manager = (SQRNetworkManager_AdHoc_Vita *)arg; // // We aren't allowed to actually get the event directly from this callback, so send our own internal event to a thread dedicated to doing this - // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, nullptr); + // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, NULL); return 0; } @@ -2490,7 +2490,7 @@ void SQRNetworkManager_AdHoc_Vita::SysUtilCallback(uint64_t status, uint64_t par // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } // return; // } @@ -2505,7 +2505,7 @@ void SQRNetworkManager_AdHoc_Vita::SysUtilCallback(uint64_t status, uint64_t par // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } // } // @@ -2542,7 +2542,7 @@ void SQRNetworkManager_AdHoc_Vita::updateNetCheckDialog() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } else @@ -2561,7 +2561,7 @@ void SQRNetworkManager_AdHoc_Vita::updateNetCheckDialog() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } @@ -2577,7 +2577,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, { case SCE_RUDP_CONTEXT_EVENT_CLOSED: { - SQRVoiceConnection* pVoice = nullptr; + SQRVoiceConnection* pVoice = NULL; if(sc_voiceChatEnabled) SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx(ctx_id); @@ -2638,7 +2638,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, case SCE_RUDP_CONTEXT_EVENT_READABLE: if( manager->m_listener ) { - SQRVoiceConnection* pVoice = nullptr; + SQRVoiceConnection* pVoice = NULL; if(sc_voiceChatEnabled) { SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx(ctx_id); @@ -2698,7 +2698,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) + if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -2761,7 +2761,7 @@ void SQRNetworkManager_AdHoc_Vita::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); } if (ret < 0) { @@ -2790,7 +2790,7 @@ void SQRNetworkManager_AdHoc_Vita::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -2814,14 +2814,14 @@ const SceNpCommunicationSignature* SQRNetworkManager_AdHoc_Vita::GetSceNpCommsSi const SceNpTitleId* SQRNetworkManager_AdHoc_Vita::GetSceNpTitleId() { PSVITA_STUBBED; - return nullptr; + return NULL; // return &s_npTitleId; } const SceNpTitleSecret* SQRNetworkManager_AdHoc_Vita::GetSceNpTitleSecret() { PSVITA_STUBBED; - return nullptr; + return NULL; // return &s_npTitleSecret; } @@ -2852,7 +2852,7 @@ int SQRNetworkManager_AdHoc_Vita::GetRemovedMask(int newMask, int oldMask) void SQRNetworkManager_AdHoc_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, void *extData, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ) { - for(size_t i=0;i= 0); // libCtxId = ret; @@ -162,7 +162,7 @@ void SQRNetworkManager_Vita::Initialise() } SetState(SNM_INT_STATE_SIGNING_IN); - // AttemptPSNSignIn(nullptr, nullptr); + // AttemptPSNSignIn(NULL, NULL); // SonyHttp::init(); @@ -170,7 +170,7 @@ void SQRNetworkManager_Vita::Initialise() // npConf.commId = &s_npCommunicationId; // npConf.commPassphrase = &s_npCommunicationPassphrase; // npConf.commSignature = &s_npCommunicationSignature; - // ret = sceNpInit(&npConf, nullptr); + // ret = sceNpInit(&npConf, NULL); // if (ret < 0 && ret != SCE_NP_ERROR_ALREADY_INITIALIZED) // { // app.DebugPrintf("sceNpInit failed, ret=%x\n", ret); @@ -295,7 +295,7 @@ void SQRNetworkManager_Vita::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } return; } @@ -329,7 +329,7 @@ void SQRNetworkManager_Vita::InitialiseAfterOnline() app.DebugPrintf("sceNpMatching2CreateContext\n"); ret = sceNpMatching2CreateContext(&npID, GetSceNpCommsId(), &s_npCommunicationPassphrase, &m_matchingContext); - //ret = sceNpMatching2CreateContext(&npID, nullptr, nullptr, &m_matchingContext); + //ret = sceNpMatching2CreateContext(&npID, NULL, NULL, &m_matchingContext); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT ) ) { @@ -377,7 +377,7 @@ void SQRNetworkManager_Vita::Tick() if( ( m_gameBootInvite ) && ( s_safeToRespondToGameBootInvite ) ) { m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - m_gameBootInvite = nullptr; + m_gameBootInvite = NULL; } ErrorHandlingTick(); @@ -444,12 +444,12 @@ void SQRNetworkManager_Vita::Tick() if( s_signInCompleteCallbackIfFailed ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } @@ -467,7 +467,7 @@ void SQRNetworkManager_Vita::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineGame) // m_offlineSQR ) // MGH - changed this to m_offlineGame, as m_offlineSQR can be true when running an online game but the init has failed because the servers are down @@ -578,7 +578,7 @@ void SQRNetworkManager_Vita::UpdateExternalRoomData() reqParam.roomBinAttrExternal = &roomBinAttr; app.DebugPrintf("sceNpMatching2SetRoomDataExternal\n"); - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -608,11 +608,11 @@ bool SQRNetworkManager_Vita::FriendRoomManagerSearch() } // Free up any external data that we received from the previous search - for( size_t i = 0; i < m_aFriendSearchResults.size(); i++ ) + for( int i = 0; i < m_aFriendSearchResults.size(); i++ ) { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; + m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -675,7 +675,7 @@ void SQRNetworkManager_Vita::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = nullptr; + m_getFriendCountThread = NULL; FriendRoomManagerSearch2(); } } @@ -695,7 +695,7 @@ int SQRNetworkManager_Vita::BasicEventThreadProc( void *lpParameter ) // // do // { - // ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); + // ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); // // // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread // if( event.udata == 0 ) @@ -753,7 +753,7 @@ int SQRNetworkManager_Vita::GetFriendsThreadProc( void* lpParameter ) // There shouldn't ever be more than 100 friends returned but limit here just in case if( manager->m_friendCount > 100 ) manager->m_friendCount = 100; - SceNpId* friendIDs = nullptr; + SceNpId* friendIDs = NULL; if(manager->m_friendCount > 0) { // grab all the friend IDs first @@ -890,7 +890,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerByIndex(int idx) } else { - return nullptr; + return NULL; } } @@ -907,7 +907,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_Vita::GetLocalPlayerByUserIndex(int idx) @@ -923,7 +923,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } SQRNetworkPlayer *SQRNetworkManager_Vita::GetHostPlayer() @@ -936,11 +936,11 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == nullptr ) return nullptr; + if( player == NULL ) return NULL; if( player->IsReady() ) return player; - return nullptr; + return NULL; } // Update state internally @@ -1039,7 +1039,7 @@ bool SQRNetworkManager_Vita::JoinRoom(SQRNetworkManager_Vita::SessionSearchResul { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -1106,7 +1106,7 @@ void SQRNetworkManager_Vita::LeaveRoom(bool bActuallyLeaveRoom) SetState(SNM_INT_STATE_LEAVING); app.DebugPrintf("sceNpMatching2LeaveRoom\n"); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1214,7 +1214,7 @@ bool SQRNetworkManager_Vita::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternal = &binAttr; app.DebugPrintf("sceNpMatching2SetRoomMemberDataInternal\n"); - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1264,7 +1264,7 @@ bool SQRNetworkManager_Vita::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; // Sync this back out to our networked clients... SyncRoomData(); @@ -1302,7 +1302,7 @@ bool SQRNetworkManager_Vita::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1526,14 +1526,14 @@ void SQRNetworkManager_Vita::TickJoinablePresenceData() // // Signed in to PSN but not connected (no internet access) // UINT uiIDA[1]; // uiIDA[0] = IDS_OK; - // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr, app.GetStringTable()); + // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); // } // else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, nullptr); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, NULL); } } @@ -1573,7 +1573,7 @@ void SQRNetworkManager_Vita::FindOrCreateNonNetworkPlayer(int slot, int playerTy } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = nullptr; + PlayerUID *pUID = NULL; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1640,7 +1640,7 @@ void SQRNetworkManager_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1696,7 +1696,7 @@ void SQRNetworkManager_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } } @@ -1788,7 +1788,7 @@ void SQRNetworkManager_Vita::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) +bool SQRNetworkManager_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) { assert( m_isHosting ); @@ -1908,7 +1908,7 @@ void SQRNetworkManager_Vita::RemoveRemotePlayersAndSync( SceNpMatching2RoomMembe } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; } else { @@ -1951,7 +1951,7 @@ void SQRNetworkManager_Vita::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = nullptr; + m_aRoomSlotPlayers[i] = NULL; } } // And delete the reference from the ctx->player map @@ -2004,7 +2004,7 @@ void SQRNetworkManager_Vita::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -2037,7 +2037,7 @@ bool SQRNetworkManager_Vita::GetMatchingContext(eSQRNetworkManagerInternalState // Create context app.DebugPrintf("sceNpMatching2CreateContext\n"); ret = sceNpMatching2CreateContext(&npId, &s_npCommunicationId, &s_npCommunicationPassphrase, &m_matchingContext/*, option*/); - //ret = sceNpMatching2CreateContext(&npId, nullptr,nullptr, &m_matchingContext/*, option*/); + //ret = sceNpMatching2CreateContext(&npId, NULL,NULL, &m_matchingContext/*, option*/); if( ret < 0 ) { app.DebugPrintf("SQRNetworkManager::GetMatchingContext - sceNpMatching2CreateContext failed with code 0x%08x\n", ret); @@ -2137,7 +2137,7 @@ bool SQRNetworkManager_Vita::GetServerContext(SceNpMatching2ServerId serverId) // { // // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // // the context *really* is valid. - // int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); + // int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); // // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again // if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment // ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -2233,7 +2233,7 @@ void SQRNetworkManager_Vita::RoomCreateTick() app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); app.DebugPrintf("sceNpMatching2CreateJoinRoom\n"); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2468,7 +2468,7 @@ bool SQRNetworkManager_Vita::CreateVoiceRudpConnections(SceNpMatching2RoomId roo // create this connection if we don't have it already SQRVoiceConnection* pConnection = SonyVoiceChat_Vita::getVoiceConnectionFromRoomMemberID(peerMemberId); - if(pConnection == nullptr) + if(pConnection == NULL) { // Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host @@ -2542,7 +2542,7 @@ bool SQRNetworkManager_Vita::CreateRudpConnections(SceNpMatching2RoomId roomId, if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); } else { @@ -2576,7 +2576,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return nullptr; + return NULL; } @@ -2590,7 +2590,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerFromRoomMemberAndLocalIdx(int return it->second; } } - return nullptr; + return NULL; } @@ -2693,7 +2693,7 @@ void SQRNetworkManager_Vita::ContextCallback(SceNpMatching2ContextId id, SceNpM if( manager->m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); + manager->GetExtDataForRoom(0, NULL, NULL, NULL); break; } @@ -2729,7 +2729,7 @@ void SQRNetworkManager_Vita::ContextCallback(SceNpMatching2ContextId id, SceNpM // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } @@ -2966,12 +2966,12 @@ void SQRNetworkManager_Vita::DefaultRequestCallback(SceNpMatching2ContextId id, // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); } else { - if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == nullptr) + if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == NULL) { // the host doesn't send out data, so this must be the host we're connecting to @@ -3220,7 +3220,7 @@ void SQRNetworkManager_Vita::RoomEventCallback(SceNpMatching2ContextId id, SceNp reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); } else { @@ -3309,7 +3309,7 @@ void SQRNetworkManager_Vita::SignallingCallback(SceNpMatching2ContextId ctxId, S { SonyVoiceChat_Vita::disconnectRemoteConnection(pVoice); } - if(peerMemberId == manager->m_hostMemberId || pVoice == nullptr) // MGH - added check for voice, as we sometime get here before m_hostMemberId has been filled in + if(peerMemberId == manager->m_hostMemberId || pVoice == NULL) // MGH - added check for voice, as we sometime get here before m_hostMemberId has been filled in { // Host has left the game... so its all over for this client too. Finish everything up now, including deleting the server context which belongs to this gaming session // This also might be a response to a request to leave the game from our end too so don't need to do anything in that case @@ -3336,7 +3336,7 @@ void SQRNetworkManager_Vita::SignallingCallback(SceNpMatching2ContextId ctxId, S reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_roomMemberDataRequestId); } break; } @@ -3349,7 +3349,7 @@ int SQRNetworkManager_Vita::BasicEventCallback(int event, int retCode, uint32_t PSVITA_STUBBED; // SQRNetworkManager_Vita *manager = (SQRNetworkManager_Vita *)arg; // // We aren't allowed to actually get the event directly from this callback, so send our own internal event to a thread dedicated to doing this - // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, nullptr); + // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, NULL); return 0; } @@ -3408,7 +3408,7 @@ void SQRNetworkManager_Vita::SysUtilCallback(uint64_t status, uint64_t param, vo // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } // return; // } @@ -3423,7 +3423,7 @@ void SQRNetworkManager_Vita::SysUtilCallback(uint64_t status, uint64_t param, vo // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = nullptr; + // s_SignInCompleteCallbackFn = NULL; // } // } // @@ -3472,7 +3472,7 @@ void SQRNetworkManager_Vita::updateNetCheckDialog() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } else @@ -3488,7 +3488,7 @@ void SQRNetworkManager_Vita::updateNetCheckDialog() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } @@ -3611,7 +3611,7 @@ void SQRNetworkManager_Vita::RudpContextCallback(int ctx_id, int event_id, int e playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) + if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3677,7 +3677,7 @@ void SQRNetworkManager_Vita::ServerContextValid_CreateRoom() { app.DebugPrintf("sceNpMatching2GetWorldInfoList\n"); m_getWorldRequestId=0; - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); } if (ret < 0) { @@ -3706,7 +3706,7 @@ void SQRNetworkManager_Vita::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3730,14 +3730,14 @@ const SceNpCommunicationSignature* SQRNetworkManager_Vita::GetSceNpCommsSig() const SceNpTitleId* SQRNetworkManager_Vita::GetSceNpTitleId() { PSVITA_STUBBED; - return nullptr; + return NULL; // return &s_npTitleId; } const SceNpTitleSecret* SQRNetworkManager_Vita::GetSceNpTitleSecret() { PSVITA_STUBBED; - return nullptr; + return NULL; // return &s_npTitleSecret; } @@ -3771,9 +3771,9 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != nullptr ) + // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != NULL ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3797,14 +3797,14 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3818,7 +3818,7 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3957,7 +3957,7 @@ void SQRNetworkManager_Vita::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(vo { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = nullptr; + s_SignInCompleteCallbackFn = NULL; } } } @@ -4127,6 +4127,6 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return nullptr; + return NULL; } diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h index 79befe03..0fd0b414 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h @@ -149,7 +149,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp index 88e661c6..09852ccb 100644 --- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp @@ -10,22 +10,22 @@ bool SonyCommerce_Vita::m_bCommerceInitialised = false; // SceNpCommerce2SessionInfo SonyCommerce_Vita::m_sessionInfo; SonyCommerce_Vita::State SonyCommerce_Vita::m_state = e_state_noSession; int SonyCommerce_Vita::m_errorCode = 0; -LPVOID SonyCommerce_Vita::m_callbackParam = nullptr; +LPVOID SonyCommerce_Vita::m_callbackParam = NULL; -void* SonyCommerce_Vita::m_receiveBuffer = nullptr; +void* SonyCommerce_Vita::m_receiveBuffer = NULL; SonyCommerce_Vita::Event SonyCommerce_Vita::m_event; std::queue SonyCommerce_Vita::m_messageQueue; -std::vector* SonyCommerce_Vita::m_pProductInfoList = nullptr; -SonyCommerce_Vita::ProductInfoDetailed* SonyCommerce_Vita::m_pProductInfoDetailed = nullptr; -SonyCommerce_Vita::ProductInfo* SonyCommerce_Vita::m_pProductInfo = nullptr; +std::vector* SonyCommerce_Vita::m_pProductInfoList = NULL; +SonyCommerce_Vita::ProductInfoDetailed* SonyCommerce_Vita::m_pProductInfoDetailed = NULL; +SonyCommerce_Vita::ProductInfo* SonyCommerce_Vita::m_pProductInfo = NULL; -SonyCommerce_Vita::CategoryInfo* SonyCommerce_Vita::m_pCategoryInfo = nullptr; -const char* SonyCommerce_Vita::m_pProductID = nullptr; -char* SonyCommerce_Vita::m_pCategoryID = nullptr; +SonyCommerce_Vita::CategoryInfo* SonyCommerce_Vita::m_pCategoryInfo = NULL; +const char* SonyCommerce_Vita::m_pProductID = NULL; +char* SonyCommerce_Vita::m_pCategoryID = NULL; SonyCommerce_Vita::CheckoutInputParams SonyCommerce_Vita::m_checkoutInputParams; SonyCommerce_Vita::DownloadListInputParams SonyCommerce_Vita::m_downloadInputParams; -SonyCommerce_Vita::CallbackFunc SonyCommerce_Vita::m_callbackFunc = nullptr; +SonyCommerce_Vita::CallbackFunc SonyCommerce_Vita::m_callbackFunc = NULL; // sys_memory_container_t SonyCommerce_Vita::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_Vita::m_bUpgradingTrial = false; @@ -39,7 +39,7 @@ bool SonyCommerce_Vita::m_contextCreated=false; ///< npcommerce2 conte SonyCommerce_Vita::Phase SonyCommerce_Vita::m_currentPhase = e_phase_stopped; ///< Current commerce2 util // char SonyCommerce_Vita::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_Vita::m_tickThread = nullptr; +C4JThread* SonyCommerce_Vita::m_tickThread = NULL; bool SonyCommerce_Vita::m_bLicenseChecked=false; // Check the trial/full license for the game bool SonyCommerce_Vita::m_bLicenseInstalled=false; // set to true when the licence has been downloaded and installed (but maybe not checked yet) bool SonyCommerce_Vita::m_bDownloadsPending=false; // set to true if there are any downloads happening in the background, so we check for them completing, and install when finished @@ -60,12 +60,12 @@ static bool s_showingPSStoreIcon = false; SonyCommerce_Vita::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_Vita::Delete() { - m_pProductInfoList=nullptr; - m_pProductInfoDetailed=nullptr; - m_pProductInfo=nullptr; - m_pCategoryInfo = nullptr; - m_pProductID = nullptr; - m_pCategoryID = nullptr; + m_pProductInfoList=NULL; + m_pProductInfoDetailed=NULL; + m_pProductInfo=NULL; + m_pCategoryInfo = NULL; + m_pProductID = NULL; + m_pCategoryID = NULL; } void SonyCommerce_Vita::Init() @@ -108,7 +108,7 @@ bool SonyCommerce_Vita::LicenseChecked() void SonyCommerce_Vita::CheckForTrialUpgradeKey() { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); } int SonyCommerce_Vita::Shutdown() @@ -163,7 +163,7 @@ void SonyCommerce_Vita::checkBackgroundDownloadStatus() // install the content if(bInstallContent) { - InstallContent(InstallContentCallback, nullptr); + InstallContent(InstallContentCallback, NULL); } } } @@ -665,7 +665,7 @@ int SonyCommerce_Vita::createContext() // } // // // Create commerce2 context - // ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); + // ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); // if (ret < 0) // { // app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -771,7 +771,7 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) // if(ret == SCE_OK) // { copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get()); - m_pCategoryInfo = nullptr; + m_pCategoryInfo = NULL; m_event = e_event_commerceGotCategoryInfo; // } @@ -781,7 +781,7 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList: { copyProductList(m_pProductInfoList, g_productList.get()); - m_pProductInfoDetailed = nullptr; + m_pProductInfoDetailed = NULL; m_event = e_event_commerceGotProductList; break; } @@ -791,12 +791,12 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) if(m_pProductInfoDetailed) { copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get()); - m_pProductInfoDetailed = nullptr; + m_pProductInfoDetailed = NULL; } else { copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get()); - m_pProductInfo = nullptr; + m_pProductInfo = NULL; } m_event = e_event_commerceGotDetailedProductInfo; break; @@ -1180,7 +1180,7 @@ void SonyCommerce_Vita::processEvent() break; case e_event_commerceProductBrowseFinished: app.DebugPrintf(4,"e_event_commerceProductBrowseFinished succeeded: 0x%x\n", m_errorCode); - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1232,7 +1232,7 @@ void SonyCommerce_Vita::processEvent() ProfileManager.SetSysUIShowing(false); // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { // get the detailed product info again, to see if the purchase has happened or not EnterCriticalSection(&m_queueLock); @@ -1260,7 +1260,7 @@ void SonyCommerce_Vita::processEvent() ProfileManager.SetSysUIShowing(false); // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=nullptr) + if(m_callbackFunc!=NULL) { runCallback(); } @@ -1328,10 +1328,10 @@ void SonyCommerce_Vita::CreateSession( CallbackFunc cb, LPVOID lpParam ) if(m_tickThread && (m_tickThread->isRunning() == false)) { delete m_tickThread; - m_tickThread = nullptr; + m_tickThread = NULL; } - if(m_tickThread == nullptr) - m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_Vita tick"); + if(m_tickThread == NULL) + m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_Vita tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; @@ -1439,7 +1439,7 @@ void SonyCommerce_Vita::DownloadAlreadyPurchased_Game( CallbackFunc cb, LPVOID l void SonyCommerce_Vita::InstallContent( CallbackFunc cb, LPVOID lpParam ) { - if(m_callbackFunc == nullptr && m_messageQueue.size() == 0) // wait till other processes have finished + if(m_callbackFunc == NULL && m_messageQueue.size() == 0) // wait till other processes have finished { EnterCriticalSection(&m_queueLock); m_bInstallingContent = true; diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h index c8f76bf7..6285832c 100644 --- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h +++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h @@ -121,14 +121,14 @@ class SonyCommerce_Vita : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = nullptr; + m_callbackFunc = NULL; if(func) func(m_callbackParam, m_errorCode); m_errorCode = SCE_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == nullptr); + assert(m_callbackFunc == NULL); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp index 2015f930..9110edf5 100644 --- a/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp @@ -131,10 +131,10 @@ int SonyHttp_Vita::sslCallback(SceUInt32 verifyErr, SceSslCert * const sslCert[] (void)userArg; app.DebugPrintf("Ssl callback:\n"); - app.DebugPrintf("\tbase tmpl[%x]\n", static_cast(userArg)); + app.DebugPrintf("\tbase tmpl[%x]\n", (SceInt32)userArg); if (verifyErr != 0){ - printSslError(static_cast(SCE_HTTPS_ERROR_CERT), verifyErr); + printSslError((SceInt32)SCE_HTTPS_ERROR_CERT, verifyErr); } for (i = 0; i < certNum; i++){ printSslCertInfo(sslCert[i]); @@ -192,7 +192,7 @@ bool SonyHttp_Vita::http_get(const char *targetUrl, void** ppOutData, int* pData } /* Register SSL callback */ - ret = sceHttpsSetSslCallback(tmplId, sslCallback, static_cast(&tmplId)); + ret = sceHttpsSetSslCallback(tmplId, sslCallback, (void*)&tmplId); if (ret < 0) { app.DebugPrintf("sceHttpsSetSslCallback() error: 0x%08X\n", ret); @@ -215,7 +215,7 @@ bool SonyHttp_Vita::http_get(const char *targetUrl, void** ppOutData, int* pData } reqId = ret; - ret = sceHttpSendRequest(reqId, nullptr, 0); + ret = sceHttpSendRequest(reqId, NULL, 0); if (ret < 0) { app.DebugPrintf("sceHttpSendRequest() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp index dd6c8372..c103b32f 100644 --- a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp @@ -26,7 +26,7 @@ static SceRemoteStorageData s_getDataOutput; void SonyRemoteStorage_Vita::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) { - static_cast(userData)->internalCallback(event, retCode); + ((SonyRemoteStorage_Vita*)userData)->internalCallback(event, retCode); } void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) @@ -218,7 +218,7 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam) params.timeout.receiveMs = 120 * 1000; //120 seconds is the default params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == nullptr) + if(m_memPoolBuffer == NULL) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; @@ -298,8 +298,8 @@ bool SonyRemoteStorage_Vita::setDataInternal() snprintf(m_saveFilename, sizeof(m_saveFilename), "%s:%s/GAMEDATA.bin", "savedata0", m_setDataSaveInfo->UTF8SaveFilename); - SceFiosSize outSize = sceFiosFileGetSizeSync(nullptr, m_saveFilename); - m_uploadSaveSize = static_cast(outSize); + SceFiosSize outSize = sceFiosFileGetSizeSync(NULL, m_saveFilename); + m_uploadSaveSize = (int)outSize; strcpy(m_saveFileDesc, m_setDataSaveInfo->UTF8SaveTitle); m_status = e_setDataInProgress; diff --git a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp index cf1ce9ad..842e6b8d 100644 --- a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp @@ -67,7 +67,7 @@ void LoadPCMVoiceData() { char filename[64]; sprintf(filename, "voice%d.pcm", i+1); - HANDLE file = CreateFile(filename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); DWORD dwHigh=0; g_loadedPCMVoiceDataSizes[i] = GetFileSize(file,&dwHigh); @@ -75,7 +75,7 @@ void LoadPCMVoiceData() { g_loadedPCMVoiceData[i] = new char[g_loadedPCMVoiceDataSizes[i]]; DWORD bytesRead; - BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, nullptr); + BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, NULL); assert(bSuccess); } g_loadedPCMVoiceDataPos[i] = 0; @@ -285,7 +285,7 @@ void SQRVoiceConnection::readRemoteData() if( dataSize > 0 ) { VoicePacket packet; - unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, nullptr ); + unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, NULL ); unsigned int writeSize; if( bytesRead > 0 ) { @@ -378,7 +378,7 @@ uint32_t lastReadFrameCnt = 0; void PrintAllOutputVoiceStates( std::vector& connections) { - for(size_t rIdx=0;rIdxm_bConnected) @@ -668,7 +668,7 @@ void SonyVoiceChat_Vita::tick() EnterCriticalSection(&m_csRemoteConnections); - for(size_t i=m_remoteConnections.size()-1;i>=0;i--) + for(int i=m_remoteConnections.size()-1;i>=0;i--) { if(m_remoteConnections[i]->m_bFlaggedForShutdown) { @@ -911,7 +911,7 @@ void SonyVoiceChat_Vita::initLocalPlayer(int playerIndex) if(m_localVoiceDevices[playerIndex].isValid() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); // create all device ports required m_localVoiceDevices[playerIndex].init(chatRestricted); @@ -948,7 +948,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx( int RudpC if(m_remoteConnections[i]->m_rudpCtx == RudpCtx) return m_remoteConnections[i]; } - return nullptr; + return NULL; } void SonyVoiceChat_Vita::connectPlayerToAll( int playerIndex ) @@ -973,7 +973,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::getVoiceConnectionFromRoomMemberID( SceN } } - return nullptr; + return NULL; } void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx ) @@ -998,7 +998,7 @@ void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx ) if(m_numLocalDevicesConnected == 0) // no more local players, kill all the remote connections { - for(size_t i=0;i(malloc(m_HashSize * sizeof(SCustomMapNode))); + m_HashTable = (SCustomMapNode**) malloc(m_HashSize * sizeof(SCustomMapNode)); clear(); } @@ -87,7 +87,7 @@ void CustomMap::insert(const ChunkPos &Key, bool Value) Node->Hash = Hash; Node->first = Key; Node->second = Value; - Node->Next = nullptr; + Node->Next = NULL; // are any nodes in this hash index if( !m_HashTable[Index] ) @@ -115,16 +115,16 @@ void CustomMap::resize() SCustomMapNode **NodePool; if( m_NodePool ) { - NodePool = static_cast(realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomMapNode))); + NodePool = (SCustomMapNode**) realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomMapNode)); } else { - NodePool = static_cast(malloc(m_NodePoolSize * sizeof(SCustomMapNode))); + NodePool = (SCustomMapNode**) malloc(m_NodePoolSize * sizeof(SCustomMapNode)); } for( int i = 0;i < m_NodePoolSize - OldPoolSize;i += 1 ) { - NodePool[i + OldPoolSize] = static_cast(malloc(sizeof(SCustomMapNode))); + NodePool[i + OldPoolSize] = (SCustomMapNode*) malloc(sizeof(SCustomMapNode)); } m_NodePool = NodePool; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp index 4b96f1aa..6538a236 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp @@ -4,12 +4,12 @@ CustomSet::CustomSet() { - m_NodePool = nullptr; + m_NodePool = NULL; m_NodePoolSize = 0; m_NodePoolIndex = 0; m_HashSize = 1024; - m_HashTable = static_cast(malloc(m_HashSize * sizeof(SCustomSetNode))); + m_HashTable = (SCustomSetNode**) malloc(m_HashSize * sizeof(SCustomSetNode)); clear(); } @@ -85,7 +85,7 @@ void CustomSet::insert(const ChunkPos &Key) unsigned int Index = Hash & (m_HashSize-1); Node->Hash = Hash; Node->key = Key; - Node->Next = nullptr; + Node->Next = NULL; // are any nodes in this hash index if( !m_HashTable[Index] ) @@ -113,16 +113,16 @@ void CustomSet::resize() SCustomSetNode **NodePool; if( m_NodePool ) { - NodePool = static_cast(realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomSetNode))); + NodePool = (SCustomSetNode**) realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomSetNode)); } else { - NodePool = static_cast(malloc(m_NodePoolSize * sizeof(SCustomSetNode))); + NodePool = (SCustomSetNode**) malloc(m_NodePoolSize * sizeof(SCustomSetNode)); } for( int i = 0;i < m_NodePoolSize - OldPoolSize;i += 1 ) { - NodePool[i + OldPoolSize] = static_cast(malloc(sizeof(SCustomSetNode))); + NodePool[i + OldPoolSize] = (SCustomSetNode*) malloc(sizeof(SCustomSetNode)); } m_NodePool = NodePool; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp index b33a5601..ad9e423b 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp @@ -15,7 +15,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( result != S_OK ) { app.DebugPrintf("sceCesUcsContextInit failed\n"); - return nullptr; + return NULL; } uint32_t utf16Len; @@ -44,7 +44,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( result != SCE_OK ) { app.DebugPrintf("sceCesUtf16StrToUtf8Str: conversion error : 0x%x\n", result); - return nullptr; + return NULL; } return strUtf8; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp index 054e9f02..0261f318 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp @@ -137,7 +137,7 @@ BOOL PSVitaTLSStorage::SetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) #else -PSVitaTLSStorage* m_pInstance = nullptr; +PSVitaTLSStorage* m_pInstance = NULL; #define sc_maxSlots 64 BOOL m_activeList[sc_maxSlots]; @@ -157,7 +157,7 @@ void PSVitaTLSStorage::Init() for(int i=0;iwMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return nullptr; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return NULL; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -186,7 +186,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) { char name[1] = {0}; - int err = sceKernelCreateLwMutex((SceKernelLwMutexWork *)(&CriticalSection->mutex), name, SCE_KERNEL_LW_MUTEX_ATTR_TH_PRIO | SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE, 0, nullptr); + int err = sceKernelCreateLwMutex((SceKernelLwMutexWork *)(&CriticalSection->mutex), name, SCE_KERNEL_LW_MUTEX_ATTR_TH_PRIO | SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE, 0, NULL); PSVITA_ASSERT_SCE_ERROR(err); } @@ -207,7 +207,7 @@ extern CRITICAL_SECTION g_singleThreadCS; VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) { - int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, nullptr); + int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, NULL); PSVITA_ASSERT_SCE_ERROR(err); } @@ -233,7 +233,7 @@ VOID InitializeCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection) { char name[1] = {0}; - CriticalSection->RWLock = sceKernelCreateRWLock(name, SCE_KERNEL_RW_LOCK_ATTR_TH_PRIO | SCE_KERNEL_RW_LOCK_ATTR_RECURSIVE, nullptr); + CriticalSection->RWLock = sceKernelCreateRWLock(name, SCE_KERNEL_RW_LOCK_ATTR_TH_PRIO | SCE_KERNEL_RW_LOCK_ATTR_RECURSIVE, NULL); } VOID DeleteCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection) @@ -270,9 +270,11 @@ VOID LeaveCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection, bool Write) PSVITA_ASSERT_SCE_ERROR(err); } + + BOOL CloseHandle(HANDLE hObject) { - sceFiosFHCloseSync(nullptr,(SceFiosFH)(reinterpret_cast(hObject))); + sceFiosFHCloseSync(NULL,(SceFiosFH)((int32_t)hObject)); return true; } @@ -512,7 +514,7 @@ BOOL VirtualWriteFile(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfBytesT void* Data = VirtualAllocs[Page]; DWORD numberOfBytesWritten=0; - WriteFileWithName(lpFileName, Data, BytesToWrite, &numberOfBytesWritten,nullptr); + WriteFileWithName(lpFileName, Data, BytesToWrite, &numberOfBytesWritten,NULL); *lpNumberOfBytesWritten += numberOfBytesWritten; nNumberOfBytesToWrite -= BytesToWrite; @@ -654,7 +656,7 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) //SceFiosSize FileSize; //FileSize=sceFiosFHGetSize(fh); SceFiosStat statData; - int err = sceFiosFHStatSync(nullptr,fh,&statData); + int err = sceFiosFHStatSync(NULL,fh,&statData); SceFiosOffset FileSize = statData.fileSize; if(lpFileSizeHigh) @@ -673,7 +675,7 @@ BOOL WriteFileWithName(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfByte { char filePath[256]; sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); - SceFiosSize bytesWritten = sceFiosFileWriteSync( nullptr, filePath, lpBuffer, nNumberOfBytesToWrite, 0 ); + SceFiosSize bytesWritten = sceFiosFileWriteSync( NULL, filePath, lpBuffer, nNumberOfBytesToWrite, 0 ); if(bytesWritten != nNumberOfBytesToWrite) { // error @@ -696,7 +698,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHReadSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); + SceFiosSize bytesRead = sceFiosFHReadSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); if(bytesRead < 0) { // error @@ -716,7 +718,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi uint64_t bitsToMove = (int64_t) lDistanceToMove; SceFiosOffset pos = 0; - if (lpDistanceToMoveHigh != nullptr) + if (lpDistanceToMoveHigh != NULL) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; SceFiosWhence whence = SCE_FIOS_SEEK_SET; @@ -759,7 +761,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, if( dwDesiredAccess == GENERIC_WRITE ) { //CD - Create a blank file - int err = sceFiosFileWriteSync( nullptr, filePath, nullptr, 0, 0 ); + int err = sceFiosFileWriteSync( NULL, filePath, NULL, 0, 0 ); assert( err == SCE_FIOS_OK ); } @@ -768,7 +770,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, #endif SceFiosFH fh; - int err = sceFiosFHOpenSync(nullptr, &fh, filePath, nullptr); + int err = sceFiosFHOpenSync(NULL, &fh, filePath, NULL); assert( err == SCE_FIOS_OK ); return (void*)fh; @@ -814,7 +816,7 @@ DWORD GetFileAttributesA(LPCSTR lpFileName) // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return -1; @@ -902,7 +904,7 @@ BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId, // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return false; @@ -935,7 +937,7 @@ errno_t _i64toa_s(long long _Val, char * _DstBuf, size_t _Size, int _Radix) { if int _wtoi(const wchar_t *_Str) { - return wcstol(_Str, nullptr, 10); + return wcstol(_Str, NULL, 10); } DWORD XGetLanguage() diff --git a/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp b/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp index a04e45d9..e7eca53f 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp @@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount]; void ShutdownManager::Initialise() { #ifdef __PS3__ - cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr ); + cellSysutilRegisterCallback( 1, SysUtilCallback, NULL ); for( int i = 0; i < eThreadIdCount; i++ ) { s_threadShouldRun[i] = true; s_threadRunning[i] = 0; - s_eventArray[i] = nullptr; + s_eventArray[i] = NULL; } // Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required s_threadRunning[eStorageManagerThreads] = true; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h index 33837875..007a8416 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h @@ -210,7 +210,7 @@ LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) { uint64_t xl = x, yl = y; uint64_t rl = xl * yl; - return static_cast(rl >> 32); + return (uint32_t)(rl >> 32); } static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { @@ -221,12 +221,12 @@ static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { #else //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) const uint32_t mask = 0xFFFFFFFF; - const uint32_t x0 = static_cast(x & mask), x1 = static_cast(x >> 32); - const uint32_t y0 = static_cast(y & mask), y1 = static_cast(y >> 32); + const uint32_t x0 = (uint32_t)(x & mask), x1 = (uint32_t)(x >> 32); + const uint32_t y0 = (uint32_t)(y & mask), y1 = (uint32_t)(y >> 32); const uint32_t x0y0_hi = libdivide__mullhi_u32(x0, y0); - const uint64_t x0y1 = x0 * static_cast(y1); - const uint64_t x1y0 = x1 * static_cast(y0); - const uint64_t x1y1 = x1 * static_cast(y1); + const uint64_t x0y1 = x0 * (uint64_t)y1; + const uint64_t x1y0 = x1 * (uint64_t)y0; + const uint64_t x1y1 = x1 * (uint64_t)y1; uint64_t temp = x1y0 + x0y0_hi; uint64_t temp_lo = temp & mask, temp_hi = temp >> 32; @@ -242,12 +242,12 @@ static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) { #else //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) const uint32_t mask = 0xFFFFFFFF; - const uint32_t x0 = static_cast(x & mask), y0 = static_cast(y & mask); - const int32_t x1 = static_cast(x >> 32), y1 = static_cast(y >> 32); + const uint32_t x0 = (uint32_t)(x & mask), y0 = (uint32_t)(y & mask); + const int32_t x1 = (int32_t)(x >> 32), y1 = (int32_t)(y >> 32); const uint32_t x0y0_hi = libdivide__mullhi_u32(x0, y0); - const int64_t t = x1*static_cast(y0) + x0y0_hi; - const int64_t w1 = x0*static_cast(y1) + (t & mask); - return x1*static_cast(y1) + (t >> 32) + (w1 >> 32); + const int64_t t = x1*(int64_t)y0 + x0y0_hi; + const int64_t w1 = x0*(int64_t)y1 + (t & mask); + return x1*(int64_t)y1 + (t >> 32) + (w1 >> 32); #endif } @@ -398,7 +398,7 @@ static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) { /* Pretty good way to count trailing zeros. Note that this hangs for val = 0! */ uint32_t lo = val & 0xFFFFFFFF; if (lo != 0) return libdivide__count_trailing_zeros32(lo); - return 32 + libdivide__count_trailing_zeros32(static_cast(val >> 32)); + return 32 + libdivide__count_trailing_zeros32((uint32_t)(val >> 32)); #endif } @@ -444,9 +444,9 @@ static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, } #else static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, uint32_t *r) { - uint64_t n = (static_cast(u1) << 32) | u0; - uint32_t result = static_cast(n / v); - *r = static_cast(n - result * static_cast(v)); + uint64_t n = (((uint64_t)u1) << 32) | u0; + uint32_t result = (uint32_t)(n / v); + *r = (uint32_t)(n - result * (uint64_t)v); return result; } #endif @@ -478,9 +478,9 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, int s; // Shift amount for norm. if (u1 >= v) { // If overflow, set rem. - if (r != nullptr) // to an impossible value, - *r = static_cast(-1); // and return the largest - return static_cast(-1);} // possible quotient. + if (r != NULL) // to an impossible value, + *r = (uint64_t)(-1); // and return the largest + return (uint64_t)(-1);} // possible quotient. /* count leading zeros */ s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. @@ -513,7 +513,7 @@ again2: rhat = rhat + vn1; if (rhat < b) goto again2;} - if (r != nullptr) // If remainder is wanted, + if (r != NULL) // If remainder is wanted, *r = (un21*b + un0 - q0*v) >> s; // return it. return q1*b + q0; } @@ -770,14 +770,14 @@ __m128i libdivide_u64_do_vector_alg2(__m128i numers, const struct libdivide_u64_ static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) { int64_t xl = x, yl = y; int64_t rl = xl * yl; - return static_cast(rl >> 32); //needs to be arithmetic shift + return (int32_t)(rl >> 32); //needs to be arithmetic shift } struct libdivide_s32_t libdivide_s32_gen(int32_t d) { struct libdivide_s32_t result; /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ - uint32_t absD = static_cast(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick + uint32_t absD = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero result.magic = 0; result.more = libdivide__count_trailing_zeros32(absD) | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0) | LIBDIVIDE_S32_SHIFT_PATH; @@ -805,7 +805,7 @@ struct libdivide_s32_t libdivide_s32_gen(int32_t d) { more = floor_log_2_d | LIBDIVIDE_ADD_MARKER | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); //use the general algorithm } proposed_m += 1; - result.magic = (d < 0 ? -static_cast(proposed_m) : static_cast(proposed_m)); + result.magic = (d < 0 ? -(int32_t)proposed_m : (int32_t)proposed_m); result.more = more; } @@ -818,14 +818,14 @@ int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom) { uint8_t shifter = more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); q = q >> shifter; - int32_t shiftMask = static_cast(more) >> 7; //must be arithmetic shift and then sign-extend + int32_t shiftMask = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend q = (q ^ shiftMask) - shiftMask; return q; } else { int32_t q = libdivide__mullhi_s32(denom->magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { - int32_t sign = static_cast(more) >> 7; //must be arithmetic shift and then sign extend + int32_t sign = (int8_t)more >> 7; //must be arithmetic shift and then sign extend q += ((numer ^ sign) - sign); } q >>= more & LIBDIVIDE_32_SHIFT_MASK; @@ -946,7 +946,7 @@ struct libdivide_s64_t libdivide_s64_gen(int64_t d) { struct libdivide_s64_t result; /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ - const uint64_t absD = static_cast(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick + const uint64_t absD = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero result.more = libdivide__count_trailing_zeros64(absD) | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); result.magic = 0; @@ -974,7 +974,7 @@ struct libdivide_s64_t libdivide_s64_gen(int64_t d) { } proposed_m += 1; result.more = more; - result.magic = (d < 0 ? -static_cast(proposed_m) : static_cast(proposed_m)); + result.magic = (d < 0 ? -(int64_t)proposed_m : (int64_t)proposed_m); } return result; } @@ -986,14 +986,14 @@ int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom) { uint32_t shifter = more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); q = q >> shifter; - int64_t shiftMask = static_cast(more) >> 7; //must be arithmetic shift and then sign-extend + int64_t shiftMask = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend q = (q ^ shiftMask) - shiftMask; return q; } else { int64_t q = libdivide__mullhi_s64(magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { - int64_t sign = static_cast(more) >> 7; //must be arithmetic shift and then sign extend + int64_t sign = (int8_t)more >> 7; //must be arithmetic shift and then sign extend q += ((numer ^ sign) - sign); } q >>= more & LIBDIVIDE_64_SHIFT_MASK; @@ -1141,11 +1141,11 @@ namespace libdivide_internal { #endif /* Some bogus unswitch functions for unsigned types so the same (presumably templated) code can work for both signed and unsigned. */ - uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *static_cast(nullptr); } - uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *static_cast(nullptr); } + uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *(uint32_t *)NULL; } + uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *(uint64_t *)NULL; } #if LIBDIVIDE_USE_SSE2 - __m128i crash_u32_vector(__m128i, const libdivide_u32_t *) { abort(); return *(__m128i *)nullptr; } - __m128i crash_u64_vector(__m128i, const libdivide_u64_t *) { abort(); return *(__m128i *)nullptr; } + __m128i crash_u32_vector(__m128i, const libdivide_u32_t *) { abort(); return *(__m128i *)NULL; } + __m128i crash_u64_vector(__m128i, const libdivide_u64_t *) { abort(); return *(__m128i *)NULL; } #endif template diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c index 6b0e67b7..7036728f 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c @@ -52,14 +52,14 @@ typedef struct int Malloc_BlocksAlloced; // this shows how many block node chunks have been allocated in Malloc_BlocksMemory } SThreadStorage; -__thread SThreadStorage *Malloc_ThreadStorage = nullptr; +__thread SThreadStorage *Malloc_ThreadStorage = NULL; /**E Replace _malloc_init function. */ /**J _malloc_init 関数ã¨ç½®ãæ›ã‚ã‚‹ */ void user_malloc_init(void) { int res; - void *base = nullptr; + void *base = NULL; /**E Allocate a memory block from the kernel */ /**J カーãƒãƒ«ã‹ã‚‰ãƒ¡ãƒ¢ãƒªãƒ–ロックを確ä¿ã™ã‚‹ */ @@ -80,7 +80,7 @@ void user_malloc_init(void) /**E Generate mspace */ /**J mspace を生æˆã™ã‚‹ */ s_mspace = mspace_create(base, HEAP_SIZE); - if (s_mspace == nullptr) { + if (s_mspace == NULL) { /**E Error handling */ /**J ã‚¨ãƒ©ãƒ¼å‡¦ç† */ sceLibcSetHeapInitError(HEAP_ERROR3); @@ -95,7 +95,7 @@ void user_malloc_finalize(void) { int res; - if (s_mspace != nullptr) { + if (s_mspace != NULL) { /**E Free mspace */ /**J mspace を解放ã™ã‚‹ */ res = mspace_destroy(s_mspace); @@ -104,7 +104,7 @@ void user_malloc_finalize(void) /**J ã‚¨ãƒ©ãƒ¼å‡¦ç† */ __breakpoint(0); } - s_mspace = nullptr; + s_mspace = NULL; } if (SCE_OK <= s_heapUid) { @@ -125,9 +125,9 @@ void user_malloc_finalize(void) void user_registerthread() { Malloc_ThreadStorage = mspace_malloc(s_mspace, sizeof(SThreadStorage)); - Malloc_ThreadStorage->Malloc_Blocks = nullptr; + Malloc_ThreadStorage->Malloc_Blocks = NULL; Malloc_ThreadStorage->Malloc_BlocksAlloced = 0; - Malloc_ThreadStorage->Malloc_MemoryPool = nullptr; + Malloc_ThreadStorage->Malloc_MemoryPool = NULL; } // before a thread is destroyed make sure we free any space it might be holding on to @@ -157,7 +157,7 @@ void user_removethread() } mspace_free(s_mspace, psStorage); - Malloc_ThreadStorage = nullptr; + Malloc_ThreadStorage = NULL; } } @@ -165,19 +165,19 @@ void user_removethread() /**J malloc 関数ã¨ç½®ãæ›ã‚ã‚‹ */ void *user_malloc(size_t size) { - void *p = nullptr; + void *p = NULL; SThreadStorage *psStorage = Malloc_ThreadStorage; if( psStorage ) { // is this the first time we've malloced - if( psStorage->Malloc_MemoryPool == nullptr ) + if( psStorage->Malloc_MemoryPool == NULL ) { // create an array of pointers to Block nodes, one pointer for each memory bytes size up to 1036 psStorage->Malloc_MemoryPool = mspace_malloc(s_mspace, (MaxRetainedBytes+1) * 4); for( int i = 0;i < (MaxRetainedBytes+1);i += 1 ) { - psStorage->Malloc_MemoryPool[i] = nullptr; + psStorage->Malloc_MemoryPool[i] = NULL; } } @@ -261,7 +261,7 @@ void user_free(void *ptr) } // we need a block node to retain the memory on our stack. do we have any block nodes available - if( psStorage->Malloc_Blocks == nullptr ) + if( psStorage->Malloc_Blocks == NULL ) { if( psStorage->Malloc_BlocksAlloced == Malloc_BlocksMemorySize ) { @@ -319,7 +319,7 @@ void *user_calloc(size_t nelem, size_t size) /**J realloc 関数ã¨ç½®ãæ›ã‚ã‚‹ */ void *user_realloc(void *ptr, size_t size) { - void* p = nullptr; + void* p = NULL; if( Malloc_ThreadStorage ) { diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c index 54cc0d72..531bbd60 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c @@ -27,7 +27,7 @@ void user_free_for_tls(void *ptr); void user_malloc_for_tls_init(void) { int res; - void *base = nullptr; + void *base = NULL; /**E Allocate a memory block from the kernel */ /**J カーãƒãƒ«ã‹ã‚‰ãƒ¡ãƒ¢ãƒªãƒ–ロックを確ä¿ã™ã‚‹ */ @@ -48,7 +48,7 @@ void user_malloc_for_tls_init(void) /**E Generate mspace */ /**J mspace を生æˆã™ã‚‹ */ s_mspace = mspace_create(base, HEAP_SIZE); - if (s_mspace == nullptr) { + if (s_mspace == NULL) { /**E Error handling */ /**J ã‚¨ãƒ©ãƒ¼å‡¦ç† */ sceLibcSetHeapInitError(HEAP_ERROR3); @@ -63,7 +63,7 @@ void user_malloc_for_tls_finalize(void) { int res; - if (s_mspace != nullptr) { + if (s_mspace != NULL) { /**E Free mspace */ /**J mspace を解放ã™ã‚‹ */ res = mspace_destroy(s_mspace); diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp index b9cc4850..1f71f6d2 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp @@ -28,13 +28,13 @@ void *user_new(std::size_t size) throw(std::bad_alloc) if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == nullptr) { + while ((ptr = (void *)std::malloc(size)) == NULL) { /**E Obtain new_handler */ /**J new_handler ã‚’å–å¾—ã™ã‚‹ */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a nullptr pointer, bad_alloc is send. If not, new_handler is called. */ - /**J new_handler ㌠nullptr ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€bad_alloc ã‚’é€å‡ºã™ã‚‹ã€ãã†ã§ãªã„å ´åˆã€new_handler を呼ã³å‡ºã™ */ + /**E When new_handler is a NULL pointer, bad_alloc is send. If not, new_handler is called. */ + /**J new_handler ㌠NULL ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€bad_alloc ã‚’é€å‡ºã™ã‚‹ã€ãã†ã§ãªã„å ´åˆã€new_handler を呼ã³å‡ºã™ */ if (!handler) throw std::bad_alloc(); else @@ -56,22 +56,22 @@ void *user_new(std::size_t size, const std::nothrow_t& x) throw() if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == nullptr) { + while ((ptr = (void *)std::malloc(size)) == NULL) { /**E Obtain new_handler */ /**J new_handler ã‚’å–å¾—ã™ã‚‹ */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a nullptr pointer, nullptr is returned. */ - /**J new_handler ㌠nullptr ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€nullptr を返㙠*/ + /**E When new_handler is a NULL pointer, NULL is returned. */ + /**J new_handler ㌠NULL ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€NULL を返㙠*/ if (!handler) - return nullptr; + return NULL; - /**E Call new_handler. If new_handler sends bad_alloc, nullptr is returned. */ - /**J new_handler を呼ã³å‡ºã™ã€new_handler ㌠bad_alloc ã‚’é€å‡ºã—ãŸå ´åˆã€nullptr を返㙠*/ + /**E Call new_handler. If new_handler sends bad_alloc, NULL is returned. */ + /**J new_handler を呼ã³å‡ºã™ã€new_handler ㌠bad_alloc ã‚’é€å‡ºã—ãŸå ´åˆã€NULL を返㙠*/ try { (*handler)(); } catch (std::bad_alloc) { - return nullptr; + return NULL; } } return ptr; @@ -98,9 +98,9 @@ void *user_new_array(std::size_t size, const std::nothrow_t& x) throw() void user_delete(void *ptr) throw() { // SCE_DBG_LOG_TRACE("Called operator delete(%p)", ptr); - /**E In the case of the nullptr pointer, no action will be taken. */ - /**J nullptr ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€ä½•も行ã‚ãªã„ */ - if (ptr != nullptr) + /**E In the case of the NULL pointer, no action will be taken. */ + /**J NULL ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆã€ä½•も行ã‚ãªã„ */ + if (ptr != NULL) std::free(ptr); } diff --git a/Minecraft.Client/PSVita/PSVitaExtras/zlib.h b/Minecraft.Client/PSVita/PSVitaExtras/zlib.h index b0e74c45..3e0c7672 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/zlib.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/zlib.h @@ -91,7 +91,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ - z_const char *msg; /* last error message, nullptr if no error */ + z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -1254,7 +1254,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); reading, this will be detected automatically by looking for the magic two- byte gzip header. - gzopen returns nullptr if the file could not be opened, if there was + gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the @@ -1277,7 +1277,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); close the associated file descriptor, so they need to have different file descriptors. - gzdopen returns nullptr if there was insufficient memory to allocate the + gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen @@ -1377,7 +1377,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. - gzgets returns buf which is a null-terminated string, or it returns nullptr + gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ @@ -1393,7 +1393,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is nullptr, nor whether the structure file + it does not check to see if file is NULL, nor whether the structure file points to has been clobbered or not. */ diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp index 8c9236c7..542102d2 100644 --- a/Minecraft.Client/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/PSVita/PSVita_App.cpp @@ -32,15 +32,15 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bVoiceChatAndUGCRestricted=false; m_bDisplayFullVersionPurchase=false; - m_ProductListA=nullptr; + m_ProductListA=NULL; m_pRemoteStorage = new SonyRemoteStorage_Vita; m_bSaveIncompleteDialogRunning = false; m_bSaveDataDeleteDialogState = eSaveDataDeleteState_idle; - m_pSaveToDelete = nullptr; - m_pCheckoutProductInfo = nullptr; + m_pSaveToDelete = NULL; + m_pCheckoutProductInfo = NULL; } void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) @@ -62,7 +62,7 @@ char *CConsoleMinecraftApp::GetCommerceCategory() } char *CConsoleMinecraftApp::GetTexturePacksCategoryID() { - return nullptr; // ProductCodes.chTexturePackID; + return NULL; // ProductCodes.chTexturePackID; } char *CConsoleMinecraftApp::GetUpgradeKey() { @@ -101,7 +101,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { app.DebugPrintf("Couldn't find DLC info for %s\n", pchTitle); assert(0); - return nullptr; + return NULL; } return it->second; @@ -118,7 +118,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(int iTexturePackID) if(it->second->iConfig == iTexturePackID) return it->second; } - return nullptr; + return NULL; } @@ -128,7 +128,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() char chDLCTitle[64]; // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - HANDLE file = CreateFile("PSVita/PSVitaProductCodes.bin", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile("PSVita/PSVitaProductCodes.bin", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -143,13 +143,13 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() { DWORD bytesRead; - WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); - //WRAPPED_READFILE(file,ProductCodes.chDiscSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); - WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,nullptr); - //WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,nullptr); // TODO - WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,nullptr); - //WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); + //WRAPPED_READFILE(file,ProductCodes.chDiscSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,NULL); + //WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,NULL); // TODO + WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,NULL); + //WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,NULL); app.DebugPrintf("ProductCodes.chProductCode %s\n",ProductCodes.chProductCode); app.DebugPrintf("ProductCodes.chSaveFolderPrefix %s\n",ProductCodes.chSaveFolderPrefix); @@ -161,7 +161,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // DLC unsigned int uiDLC; - WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,NULL); for(unsigned int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); // push this into a vector @@ -296,7 +296,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -322,7 +322,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; g_NetworkManager.HostGame(0,false,true,MINECRAFT_NET_MAX_PLAYERS,0); @@ -545,7 +545,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return nullptr; + return NULL; } return &m_CategoryInfo; @@ -561,10 +561,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=nullptr) + if(m_ProductListA!=NULL) { delete [] m_ProductListA; - m_ProductListA=nullptr; + m_ProductListA=NULL; } m_ProductListRetrievedC=0; @@ -590,7 +590,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -613,11 +613,11 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch void CConsoleMinecraftApp::Checkout(char *pchSkuID) { - SonyCommerce::ProductInfo* productInfo = nullptr; + SonyCommerce::ProductInfo* productInfo = NULL; for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -684,7 +684,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return nullptr; + return NULL; } return &m_ProductListA[iIndex]; @@ -697,7 +697,7 @@ bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle) // find the DLC for(int i=0;i* pProductList=&m_ProductListA[i]; auto itEnd = pProductList->end(); @@ -1076,7 +1076,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=nullptr) + if(pCategories!=NULL) { if(pCategories->countOfProducts>0) { @@ -1288,7 +1288,7 @@ int CConsoleMinecraftApp::cbConfirmDeleteMessageBox(void *pParam, int iPad, cons { CConsoleMinecraftApp *pClass = (CConsoleMinecraftApp*) pParam; - if (pClass != nullptr && pClass->m_pSaveToDelete != nullptr) + if (pClass != NULL && pClass->m_pSaveToDelete != NULL) { if (result == C4JStorage::EMessage_ResultDecline) { @@ -1408,12 +1408,12 @@ void CConsoleMinecraftApp::initSaveDataDeleteDialog() ui.SetSysUIShowing(true); // Start getting saves data to use when deleting. - if (StorageManager.ReturnSavesInfo() == nullptr) + if (StorageManager.ReturnSavesInfo() == NULL) { C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( ProfileManager.GetPrimaryPad(), - nullptr, + NULL, this, "save" ); @@ -1471,15 +1471,15 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() if ( dialogResult.result == SCE_COMMON_DIALOG_RESULT_OK ) { SceAppUtilSaveDataSlotParam slotParam; - ret = sceAppUtilSaveDataSlotGetParam( dialogResult.slotId, &slotParam, nullptr ); + ret = sceAppUtilSaveDataSlotGetParam( dialogResult.slotId, &slotParam, NULL ); if (ret == SCE_OK) { int saveindex = -1; - PSAVE_INFO pSaveInfo = nullptr; + PSAVE_INFO pSaveInfo = NULL; PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - if (pSaveDetails != nullptr) + if (pSaveDetails != NULL) { app.DebugPrintf("[SaveDataDeleteDialog] Searching for save files:\n"); @@ -1504,7 +1504,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() app.DebugPrintf("[SaveDataDeleteDialog] ERROR: PERFORMING DELETE OPERATION, pSavesDetails is null.\n"); } - if (pSaveInfo != nullptr) + if (pSaveInfo != NULL) { app.DebugPrintf( "[SaveDataDeleteDialog] User wishes to delete slot_%d:\n\t" @@ -1603,7 +1603,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * for (unsigned int i = 2; i < SCE_APPUTIL_SAVEDATA_SLOT_MAX; i++) { SceAppUtilSaveDataSlotParam slotParam; - int ret = sceAppUtilSaveDataSlotGetParam( i, &slotParam, nullptr ); + int ret = sceAppUtilSaveDataSlotGetParam( i, &slotParam, NULL ); if (ret == SCE_OK) { @@ -1645,8 +1645,8 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * // baseParam->commonParam.dimmerColor = &s_dColor; - static uint8_t *strPtr = nullptr; - if (strPtr != nullptr) delete strPtr; + static uint8_t *strPtr = NULL; + if (strPtr != NULL) delete strPtr; strPtr = mallocAndCreateUTF8ArrayFromString( IDS_TOOLTIPS_DELETESAVE ); listParam.listTitle = (const SceChar8 *) strPtr; diff --git a/Minecraft.Client/PSVita/PSVita_App.h b/Minecraft.Client/PSVita/PSVita_App.h index 5e31a3be..209fb91a 100644 --- a/Minecraft.Client/PSVita/PSVita_App.h +++ b/Minecraft.Client/PSVita/PSVita_App.h @@ -83,7 +83,7 @@ public: // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} - C4JStringTable *GetStringTable() { return nullptr;} + C4JStringTable *GetStringTable() { return NULL;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp index db1e7f0f..7544c98d 100644 --- a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp @@ -289,7 +289,7 @@ void MemSect(int sect) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -521,7 +521,7 @@ int main() PSVitaNPToolkit::init(); // initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message - StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, nullptr); + StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, NULL); StorageManager.SetDLCProductCode(app.GetProductCode()); StorageManager.SetProductUpgradeKey(app.GetUpgradeKey()); ProfileManager.SetServiceID(app.GetCommerceCategory()); @@ -625,9 +625,9 @@ int main() StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=nullptr){ delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=nullptr){ delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=nullptr){ delete [] baSaveImage.data; } + if(baOptionsIcon.data!=NULL){ delete [] baOptionsIcon.data; } + if(baSaveThumbnail.data!=NULL){ delete [] baSaveThumbnail.data; } + if(baSaveImage.data!=NULL){ delete [] baSaveImage.data; } StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, (LPVOID)&app); @@ -656,7 +656,7 @@ int main() #endif StorageManager.SetDLCInfoMap(app.GetSonyDLCMap()); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -857,7 +857,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1068,7 +1068,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != nullptr ) + if( strUtf8 != NULL ) { vRichPresenceStrings.push_back(strUtf8); } @@ -1078,7 +1078,7 @@ uint8_t * AddRichPresenceString(int iID) void FreeRichPresenceStrings() { uint8_t *strUtf8; - for(size_t i=0;i _painting, double x, double y, random->setSeed(187); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float)x, (float)y, (float)z); glRotatef(rot, 0, 1, 0); glEnable(GL_RESCALE_NORMAL); bindTexture(painting); // 4J was L"/art/kz.png" diff --git a/Minecraft.Client/Particle.cpp b/Minecraft.Client/Particle.cpp index 643dc669..1091a26a 100644 --- a/Minecraft.Client/Particle.cpp +++ b/Minecraft.Client/Particle.cpp @@ -19,7 +19,7 @@ void Particle::_init(Level *level, double x, double y, double z) { // 4J - added these initialisers alpha = 1.0f; - tex = nullptr; + tex = NULL; gravity = 0.0f; setSize(0.2f, 0.2f); @@ -35,7 +35,7 @@ void Particle::_init(Level *level, double x, double y, double z) size = (random->nextFloat() * 0.5f + 0.5f) * 2; - lifetime = static_cast(4 / (random->nextFloat() * 0.9f + 0.1f)); + lifetime = (int) (4 / (random->nextFloat() * 0.9f + 0.1f)); age = 0; texX = 0; @@ -51,10 +51,10 @@ Particle::Particle(Level *level, double x, double y, double z, double xa, double { _init(level,x,y,z); - xd = xa + static_cast(Math::random() * 2 - 1) * 0.4f; - yd = ya + static_cast(Math::random() * 2 - 1) * 0.4f; - zd = za + static_cast(Math::random() * 2 - 1) * 0.4f; - float speed = static_cast(Math::random() + Math::random() + 1) * 0.15f; + xd = xa + (float) (Math::random() * 2 - 1) * 0.4f; + yd = ya + (float) (Math::random() * 2 - 1) * 0.4f; + zd = za + (float) (Math::random() * 2 - 1) * 0.4f; + float speed = (float) (Math::random() + Math::random() + 1) * 0.15f; float dd = (float) (Mth::sqrt(xd * xd + yd * yd + zd * zd)); xd = xd / dd * speed * 0.4f; @@ -156,7 +156,7 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa float v1 = v0 + 0.999f / 16.0f; float r = 0.1f * size; - if (tex != nullptr) + if (tex != NULL) { u0 = tex->getU0(); u1 = tex->getU1(); @@ -164,9 +164,9 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa v1 = tex->getV1(); } - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); float br = 1.0f; // 4J - change brought forward from 1.8.2 if( !SharedConstants::TEXTURE_LIGHTING ) diff --git a/Minecraft.Client/ParticleEngine.cpp b/Minecraft.Client/ParticleEngine.cpp index efc09c9a..7fe26063 100644 --- a/Minecraft.Client/ParticleEngine.cpp +++ b/Minecraft.Client/ParticleEngine.cpp @@ -17,7 +17,7 @@ ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTIC ParticleEngine::ParticleEngine(Level *level, Textures *textures) { -// if (level != nullptr) // 4J - removed - we want level to be initialised to *something* +// if (level != NULL) // 4J - removed - we want level to be initialised to *something* { this->level = level; } @@ -188,8 +188,8 @@ void ParticleEngine::renderLit(shared_ptr player, float a, int list) void ParticleEngine::setLevel(Level *level) { this->level = level; - // 4J - we've now got a set of particle vectors for each dimension, and only clearing them when its game over & the level is set to nullptr - if( level == nullptr ) + // 4J - we've now got a set of particle vectors for each dimension, and only clearing them when its game over & the level is set to NULL + if( level == NULL ) { for( int l = 0; l < 3; l++ ) { @@ -218,7 +218,7 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data) double yp = y + (yy + 0.5) / SD; double zp = z + (zz + 0.5) / SD; int face = random->nextInt(6); - add((std::make_shared(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures))->init(x, y, z, data)); + add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); } } @@ -237,7 +237,7 @@ void ParticleEngine::crack(int x, int y, int z, int face) if (face == 3) zp = z + tile->getShapeZ1() + r; if (face == 4) xp = x + tile->getShapeX0() - r; if (face == 5) xp = x + tile->getShapeX1() + r; - add((std::make_shared(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures))->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); + add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); } diff --git a/Minecraft.Client/PauseScreen.cpp b/Minecraft.Client/PauseScreen.cpp index a17e52df..18d066b5 100644 --- a/Minecraft.Client/PauseScreen.cpp +++ b/Minecraft.Client/PauseScreen.cpp @@ -54,12 +54,12 @@ void PauseScreen::buttonClicked(Button button) minecraft->level->disconnect(); } - minecraft->setLevel(nullptr); + minecraft->setLevel(NULL); minecraft->setScreen(new TitleScreen()); } if (button.id == 4) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft->grabMouse(); // 4J - removed } @@ -88,7 +88,7 @@ void PauseScreen::render(int xm, int ym, float a) { float col = ((visibleTime % 10) + a) / 10.0f; col = Mth::sin(col * PI * 2) * 0.2f + 0.8f; - int br = static_cast(255 * col); + int br = (int) (255 * col); drawString(font, L"Saving level..", 8, height - 16, br << 16 | br << 8 | br); } diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp index 36e37520..29ab7c28 100644 --- a/Minecraft.Client/PendingConnection.cpp +++ b/Minecraft.Client/PendingConnection.cpp @@ -45,7 +45,7 @@ PendingConnection::~PendingConnection() void PendingConnection::tick() { - if (acceptedLogin != nullptr) + if (acceptedLogin != NULL) { this->handleAcceptedLogin(acceptedLogin); acceptedLogin = nullptr; @@ -65,7 +65,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // try { // 4J - removed try/catch // logger.info("Disconnecting " + getName() + ": " + reason); app.DebugPrintf("Pending connection disconnect: %d\n", reason ); - connection->send(std::make_shared(reason)); + connection->send( shared_ptr( new DisconnectPacket(reason) ) ); connection->sendAndQuit(); done = true; // } catch (Exception e) { @@ -121,7 +121,7 @@ void PendingConnection::sendPreLoginResponse() // Need to use the online XUID otherwise friend checks will fail on the client ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID; - if( player->connection->getNetworkPlayer() != nullptr && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount; + if( player->connection->getNetworkPlayer() != NULL && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount; ++ugcXuidCount; } @@ -136,9 +136,9 @@ void PendingConnection::sendPreLoginResponse() else #endif { - DWORD cappedCount = (ugcXuidCount > 255u) ? 255u : ugcXuidCount; + DWORD cappedCount = (ugcXuidCount > 255u) ? 255u : static_cast(ugcXuidCount); BYTE cappedHostIndex = (hostIndex >= 255u) ? 254 : static_cast(hostIndex); - connection->send(std::make_shared(L"-", ugcXuids, cappedCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName, app.GetGameHostOption(eGameHostOption_All), cappedHostIndex, server->m_texturePackId)); + connection->send( shared_ptr( new PreLoginPacket(L"-", ugcXuids, cappedCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),cappedHostIndex, server->m_texturePackId) ) ); } } @@ -201,7 +201,7 @@ void PendingConnection::handleLogin(shared_ptr packet) vector >& pl = server->getPlayers()->players; for (const auto& i : pl) { - if (i != nullptr && i->name == name) + if (i != NULL && i->name == name) { nameTaken = true; break; @@ -264,10 +264,10 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid; shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); - if (playerEntity != nullptr) + if (playerEntity != NULL) { server->getPlayers()->placeNewPlayer(connection, playerEntity, packet); - connection = nullptr; // We've moved responsibility for this over to the new PlayerConnection, nullptr so we don't delete our reference to it here in our dtor + connection = NULL; // We've moved responsibility for this over to the new PlayerConnection, NULL so we don't delete our reference to it here in our dtor } done = true; @@ -284,7 +284,7 @@ void PendingConnection::handleGetInfo(shared_ptr packet) //try { //String message = server->motd + "�" + server->players->getPlayerCount() + "�" + server->players->getMaxPlayers(); //connection->send(new DisconnectPacket(message)); - connection->send(std::make_shared(DisconnectPacket::eDisconnect_ServerFull)); + connection->send(shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) ); connection->sendAndQuit(); server->connection->removeSpamProtection(connection->getSocket()); done = true; diff --git a/Minecraft.Client/PistonPieceRenderer.cpp b/Minecraft.Client/PistonPieceRenderer.cpp index 0982e69a..c51d2e0f 100644 --- a/Minecraft.Client/PistonPieceRenderer.cpp +++ b/Minecraft.Client/PistonPieceRenderer.cpp @@ -12,7 +12,7 @@ ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_S PistonPieceRenderer::PistonPieceRenderer() { - tileRenderer = nullptr; + tileRenderer = NULL; } void PistonPieceRenderer::render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) @@ -21,7 +21,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl shared_ptr entity = dynamic_pointer_cast(_entity); Tile *tile = Tile::tiles[entity->getId()]; - if (tile != nullptr && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 + if (tile != NULL && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 { Tesselator *t = Tesselator::getInstance(); bindTexture(&TextureAtlas::LOCATION_BLOCKS); @@ -35,7 +35,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl t->begin(); - t->offset(static_cast(x) - entity->x + entity->getXOff(a), static_cast(y) - entity->y + entity->getYOff(a), static_cast(z) - entity->z + entity->getZOff(a)); + t->offset((float) x - entity->x + entity->getXOff(a), (float) y - entity->y + entity->getYOff(a), (float) z - entity->z + entity->getZOff(a)); t->color(1, 1, 1); if (tile == Tile::pistonExtension && entity->getProgress(a) < 0.5f) { @@ -45,11 +45,11 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl else if (entity->isSourcePiston() && !entity->isExtending()) { // special case for withdrawing the arm back into the base - Tile::pistonExtension->setOverrideTopTexture(static_cast(tile)->getPlatformTexture()); + Tile::pistonExtension->setOverrideTopTexture(((PistonBaseTile *) tile)->getPlatformTexture()); tileRenderer->tesselatePistonArmNoCulling(Tile::pistonExtension, entity->x, entity->y, entity->z, entity->getProgress(a) < 0.5f, entity->getData()); Tile::pistonExtension->clearOverrideTopTexture(); - t->offset(static_cast(x) - entity->x, static_cast(y) - entity->y, static_cast(z) - entity->z); + t->offset((float) x - entity->x, (float) y - entity->y, (float) z - entity->z); tileRenderer->tesselatePistonBaseForceExtended(tile, entity->x, entity->y, entity->z, entity->getData()); } else diff --git a/Minecraft.Client/PlayerChunkMap.cpp b/Minecraft.Client/PlayerChunkMap.cpp index bcc3f6ba..42df6284 100644 --- a/Minecraft.Client/PlayerChunkMap.cpp +++ b/Minecraft.Client/PlayerChunkMap.cpp @@ -65,7 +65,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send player->seenChunks.insert(pos); // 4J Added the sendPacket check. See PlayerChunkMap::add for the usage - if( sendPacket ) player->connection->send(std::make_shared(pos.x, pos.z, true)); + if( sendPacket ) player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, true) ) ); if (players.empty()) { @@ -83,7 +83,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) { - PlayerChunkMap::PlayerChunk *toDelete = nullptr; + PlayerChunkMap::PlayerChunk *toDelete = NULL; //app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove x=%d\tz=%d\n",x,z); auto it = find(players.begin(), players.end(), player); @@ -122,7 +122,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) // 4J - I don't think there's any point sending these anymore, as we don't need to unload chunks with fixed sized maps // 4J - We do need to send these to unload entities in chunks when players are dead. If we do not and the entity is removed // while they are dead, that entity will remain in the clients world - if (player->connection != nullptr && player->seenChunks.find(pos) != player->seenChunks.end()) + if (player->connection != NULL && player->seenChunks.find(pos) != player->seenChunks.end()) { INetworkPlayer *thisNetPlayer = player->connection->getNetworkPlayer(); bool noOtherPlayersFound = true; @@ -134,7 +134,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) if ( currPlayer ) { INetworkPlayer *currNetPlayer = currPlayer->connection->getNetworkPlayer(); - if( currNetPlayer != nullptr && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) + if( currNetPlayer != NULL && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) { noOtherPlayersFound = false; break; @@ -144,12 +144,12 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) if(noOtherPlayersFound) { //wprintf(L"Sending ChunkVisiblity packet false for chunk (%d,%d) to player %ls\n", x, z, player->name.c_str() ); - player->connection->send(std::make_shared(pos.x, pos.z, false)); + player->connection->send( shared_ptr( new ChunkVisibilityPacket(pos.x, pos.z, false) ) ); } } else { - //app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer is nullptr\n"); + //app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer is NULL\n"); } } @@ -188,7 +188,7 @@ void PlayerChunkMap::PlayerChunk::tileChanged(int x, int y, int z) if (changes < MAX_CHANGES_BEFORE_RESEND) { - short id = static_cast((x << 12) | (z << 8) | (y)); + short id = (short) ((x << 12) | (z << 8) | (y)); for (int i = 0; i < changes; i++) { @@ -208,7 +208,7 @@ void PlayerChunkMap::PlayerChunk::prioritiseTileChanges() // One system id per machine so we send at most once per system. Local = 256, remote = GetSmallId(). static int getSystemIdForSentTo(INetworkPlayer* np) { - if (np == nullptr) return -1; + if (np == NULL) return -1; return np->IsLocal() ? 256 : (int)np->GetSmallId(); } @@ -219,7 +219,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { shared_ptr player = players[i]; INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer(); - if (thisPlayer == nullptr) continue; + if (thisPlayer == NULL) continue; int sysId = getSystemIdForSentTo(thisPlayer); if (sysId >= 0 && sentToSystemIds.find(sysId) != sentToSystemIds.end()) continue; @@ -239,15 +239,15 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) for (size_t i = 0; i < allPlayers.size(); i++) { shared_ptr player = allPlayers[i]; - if (player->connection == nullptr || player->connection->isLocal()) continue; + if (player->connection == NULL || player->connection->isLocal()) continue; INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer(); - if (thisPlayer == nullptr) continue; + if (thisPlayer == NULL) continue; int sysId = getSystemIdForSentTo(thisPlayer); if (sysId >= 0 && sentToSystemIds.find(sysId) != sentToSystemIds.end()) continue; - const int flagIndex = ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); + int flagIndex = ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); if (!g_NetworkManager.SystemFlagGet(thisPlayer, flagIndex)) continue; player->connection->send(packet); @@ -270,7 +270,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) int x = pos.x * 16 + xChangeMin; int y = yChangeMin; int z = pos.z * 16 + zChangeMin; - broadcast(std::make_shared(x, y, z, level)); + broadcast( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (level->isEntityTile(x, y, z)) { broadcast(level->getTileEntity(x, y, z)); @@ -300,7 +300,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) // Block region update packets can only encode ys in a range of 1 - 256 if( ys > 256 ) ys = 256; - broadcast(std::make_shared(xp, yp, zp, xs, ys, zs, level)); + broadcast( shared_ptr( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) ); vector > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs); for (unsigned int i = 0; i < tes->size(); i++) { @@ -313,7 +313,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) else { // 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet - broadcast(std::make_shared(pos.x, pos.z, changedTiles, static_cast(changes), level)); + broadcast( shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (byte)changes, level) ) ); for (int i = 0; i < changes; i++) { int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); @@ -334,10 +334,10 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr te) { - if (te != nullptr) + if (te != NULL) { shared_ptr p = te->getUpdatePacket(); - if (p != nullptr) + if (p != NULL) { broadcast(p); } @@ -375,7 +375,7 @@ void PlayerChunkMap::tick() { lastInhabitedUpdate = time; - for (size_t i = 0; i < knownChunks.size(); i++) + for (int i = 0; i < knownChunks.size(); i++) { PlayerChunk *chunk = knownChunks.at(i); @@ -492,8 +492,8 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) if( addRequests.size() ) { // Find the nearest chunk request to the player - int px = static_cast(player->x); - int pz = static_cast(player->z); + int px = (int)player->x; + int pz = (int)player->z; int minDistSq = -1; auto itNearest = addRequests.end(); @@ -527,7 +527,7 @@ void PlayerChunkMap::broadcastTileUpdate(shared_ptr packet, int x, int y int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != nullptr) + if (chunk != NULL) { chunk->broadcast(packet); } @@ -538,7 +538,7 @@ void PlayerChunkMap::tileChanged(int x, int y, int z) int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != nullptr) + if (chunk != NULL) { chunk->tileChanged(x & 15, y, z & 15); } @@ -559,7 +559,7 @@ void PlayerChunkMap::prioritiseTileChanges(int x, int y, int z) int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != nullptr) + if (chunk != NULL) { chunk->prioritiseTileChanges(); } @@ -569,8 +569,8 @@ void PlayerChunkMap::add(shared_ptr player) { static int direction[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, {0, -1} }; - int xc = static_cast(player->x) >> 4; - int zc = static_cast(player->z) >> 4; + int xc = (int) player->x >> 4; + int zc = (int) player->z >> 4; player->lastMoveX = player->x; player->lastMoveZ = player->z; @@ -660,7 +660,7 @@ void PlayerChunkMap::add(shared_ptr player) } // CraftBukkit end - player->connection->send(std::make_shared(minX, maxX, minZ, maxZ)); + player->connection->send( shared_ptr( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) ); #ifdef _LARGE_WORLDS getLevel()->cache->dontDrop(xc,zc); @@ -672,14 +672,14 @@ void PlayerChunkMap::add(shared_ptr player) void PlayerChunkMap::remove(shared_ptr player) { - int xc = static_cast(player->lastMoveX) >> 4; - int zc = static_cast(player->lastMoveZ) >> 4; + int xc = ((int) player->lastMoveX) >> 4; + int zc = ((int) player->lastMoveZ) >> 4; for (int x = xc - radius; x <= xc + radius; x++) for (int z = zc - radius; z <= zc + radius; z++) { PlayerChunk *playerChunk = getChunk(x, z, false); - if (playerChunk != nullptr) playerChunk->remove(player); + if (playerChunk != NULL) playerChunk->remove(player); } auto it = find(players.begin(), players.end(), player); @@ -715,16 +715,16 @@ bool PlayerChunkMap::chunkInRange(int x, int z, int xc, int zc) // need to be created, so that we aren't creating potentially 20 chunks per player per tick void PlayerChunkMap::move(shared_ptr player) { - int xc = static_cast(player->x) >> 4; - int zc = static_cast(player->z) >> 4; + int xc = ((int) player->x) >> 4; + int zc = ((int) player->z) >> 4; double _xd = player->lastMoveX - player->x; double _zd = player->lastMoveZ - player->z; double dist = _xd * _xd + _zd * _zd; if (dist < 8 * 8) return; - int last_xc = static_cast(player->lastMoveX) >> 4; - int last_zc = static_cast(player->lastMoveZ) >> 4; + int last_xc = ((int) player->lastMoveX) >> 4; + int last_zc = ((int) player->lastMoveZ) >> 4; int xd = xc - last_xc; int zd = zc - last_zc; @@ -759,7 +759,7 @@ bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int { PlayerChunk *chunk = getChunk(xChunk, zChunk, false); - if(chunk == nullptr) + if(chunk == NULL) { return false; } @@ -770,7 +770,7 @@ bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int return it1 != chunk->players.end() && it2 == player->chunksToSend.end(); } - //return chunk == nullptr ? false : chunk->players->contains(player) && !player->chunksToSend->contains(chunk->pos); + //return chunk == NULL ? false : chunk->players->contains(player) && !player->chunksToSend->contains(chunk->pos); } int PlayerChunkMap::convertChunkRangeToBlock(int radius) @@ -784,13 +784,13 @@ void PlayerChunkMap::setRadius(int newRadius) if( radius != newRadius ) { PlayerList* players = level->getServer()->getPlayerList(); - for( size_t i = 0;i < players->players.size();i += 1 ) + for( int i = 0;i < players->players.size();i += 1 ) { shared_ptr player = players->players[i]; if( player->level == level ) { - int xc = static_cast(player->x) >> 4; - int zc = static_cast(player->z) >> 4; + int xc = ((int) player->x) >> 4; + int zc = ((int) player->z) >> 4; for (int x = xc - newRadius; x <= xc + newRadius; x++) for (int z = zc - newRadius; z <= zc + newRadius; z++) diff --git a/Minecraft.Client/PlayerCloudParticle.cpp b/Minecraft.Client/PlayerCloudParticle.cpp index 476803a3..6976fbab 100644 --- a/Minecraft.Client/PlayerCloudParticle.cpp +++ b/Minecraft.Client/PlayerCloudParticle.cpp @@ -15,12 +15,12 @@ PlayerCloudParticle::PlayerCloudParticle(Level *level, double x, double y, doubl yd += ya; zd += za; - rCol = gCol = bCol = 1 - static_cast(Math::random() * 0.3f); + rCol = gCol = bCol = 1 - (float) (Math::random() * 0.3f); size *= 0.75f; size *= scale; oSize = size; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.3)); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.3)); lifetime *= scale; noPhysics = false; } @@ -50,7 +50,7 @@ void PlayerCloudParticle::tick() yd *= 0.96f; zd *= 0.96f; shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); - if (p != nullptr) + if (p != NULL) { if (y > p->bb->y0) { diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index 8e056cd8..9404a5d6 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -96,7 +96,7 @@ void PlayerConnection::tick() lastKeepAliveTick = tickCount; lastKeepAliveTime = System::nanoTime() / 1000000; lastKeepAliveId = random.nextInt(); - send(std::make_shared(lastKeepAliveId)); + send( shared_ptr( new KeepAlivePacket(lastKeepAliveId) ) ); } if (chatSpamTickCount > 0) @@ -123,17 +123,17 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) // 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system server->getPlayers()->removePlayerFromReceiving( player ); - send(std::make_shared(reason)); + send( shared_ptr( new DisconnectPacket(reason) )); connection->sendAndQuit(); // 4J-PB - removed, since it needs to be localised in the language the client is in //server->players->broadcastAll( shared_ptr( new ChatPacket(L"�e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerKickedFromGame)); + server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerLeftGame)); + server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); @@ -166,7 +166,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) if (synched) { - if (player->riding != nullptr) + if (player->riding != NULL) { float yRotT = player->yRot; @@ -187,7 +187,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) player->doTick(false); player->ySlideOffset = 0; player->absMoveTo(xt, yt, zt, yRotT, xRotT); - if (player->riding != nullptr) player->riding->positionRider(); + if (player->riding != NULL) player->riding->positionRider(); server->getPlayers()->move(player); // player may have been kicked off the mount during the tick, so @@ -197,7 +197,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) yLastOk = player->y; zLastOk = player->z; } - static_cast(level)->tick(player); + ((Level *)level)->tick(player); return; } @@ -206,7 +206,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) { player->doTick(false); player->absMoveTo(xLastOk, yLastOk, zLastOk, player->yRot, player->xRot); - static_cast(level)->tick(player); + ((Level *)level)->tick(player); return; } @@ -378,7 +378,7 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot, float player->absMoveTo(x, y, z, yRot, xRot); // 4J - note that 1.62 is added to the height here as the client connection that receives this will presume it represents y + heightOffset at that end // This is different to the way that height is sent back to the server, where it represents the bottom of the player bounding volume - if(sendPacket) player->connection->send(std::make_shared(x, y + 1.62f, y, z, yRot, xRot, false, false)); + if(sendPacket) player->connection->send( shared_ptr( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) ); } void PlayerConnection::handlePlayerAction(shared_ptr packet) @@ -431,19 +431,19 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) { if (true) player->gameMode->startDestroyBlock(x, y, z, packet->face); // 4J - condition was !server->isUnderSpawnProtection(level, x, y, z, player) (from Java 1.6.4) but putting back to old behaviour - else player->connection->send(std::make_shared(x, y, z, level)); + else player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK) { player->gameMode->stopDestroyBlock(x, y, z); server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates - if (level->getTile(x, y, z) != 0) player->connection->send(std::make_shared(x, y, z, level)); + if (level->getTile(x, y, z) != 0) player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK) { player->gameMode->abortDestroyBlock(x, y, z); - if (level->getTile(x, y, z) != 0) player->connection->send(std::make_shared(x, y, z, level)); + if (level->getTile(x, y, z) != 0) player->connection->send(shared_ptr( new TileUpdatePacket(x, y, z, level))); } } @@ -462,7 +462,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) bool canEditSpawn = level->canEditSpawn; // = level->dimension->id != 0 || server->players->isOp(player->name); if (packet->getFace() == 255) { - if (item == nullptr) return; + if (item == NULL) return; player->gameMode->useItem(player, level, item); } else if ((packet->getY() < server->getMaxBuildHeight() - 1) || (packet->getFace() != Facing::UP && packet->getY() < server->getMaxBuildHeight())) @@ -486,7 +486,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) if (informClient) { - player->connection->send(std::make_shared(x, y, z, level)); + player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); if (face == 0) y--; if (face == 1) y++; @@ -502,7 +502,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) // isn't what it is expecting. if( level->getTile(x,y,z) != Tile::pistonMovingPiece_Id ) { - player->connection->send(std::make_shared(x, y, z, level)); + player->connection->send( shared_ptr( new TileUpdatePacket(x, y, z, level) ) ); } } @@ -510,17 +510,17 @@ void PlayerConnection::handleUseItem(shared_ptr packet) item = player->inventory->getSelected(); bool forceClientUpdate = false; - if(item != nullptr && packet->getItem() == nullptr) + if(item != NULL && packet->getItem() == NULL) { forceClientUpdate = true; } - if (item != nullptr && item->count == 0) + if (item != NULL && item->count == 0) { player->inventory->items[player->inventory->selected] = nullptr; item = nullptr; } - if (item == nullptr || item->getUseDuration() == 0) + if (item == NULL || item->getUseDuration() == 0) { player->ignoreSlotUpdateHack = true; player->inventory->items[player->inventory->selected] = ItemInstance::clone(player->inventory->items[player->inventory->selected]); @@ -530,7 +530,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) if (forceClientUpdate || !ItemInstance::matches(player->inventory->getSelected(), packet->getItem())) { - send(std::make_shared(player->containerMenu->containerId, s->index, player->inventory->getSelected())); + send( shared_ptr( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) ); } } } @@ -544,11 +544,11 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, //server->players->broadcastAll( shared_ptr( new ChatPacket(L"�e" + player->name + L" left the game.") ) ); if(getWasKicked()) { - server->getPlayers()->broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerKickedFromGame)); + server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) ); } else { - server->getPlayers()->broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerLeftGame)); + server->getPlayers()->broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) ); } server->getPlayers()->remove(player); done = true; @@ -563,7 +563,7 @@ void PlayerConnection::onUnhandledPacket(shared_ptr packet) void PlayerConnection::send(shared_ptr packet) { - if( connection->getSocket() != nullptr ) + if( connection->getSocket() != NULL ) { if( !server->getPlayers()->canReceiveAllPackets( player ) ) { @@ -581,7 +581,7 @@ void PlayerConnection::send(shared_ptr packet) // 4J Added void PlayerConnection::queueSend(shared_ptr packet) { - if( connection->getSocket() != nullptr ) + if( connection->getSocket() != NULL ) { if( !server->getPlayers()->canReceiveAllPackets( player ) ) { @@ -675,7 +675,7 @@ void PlayerConnection::handlePlayerCommand(shared_ptr packe else if (packet->action == PlayerCommandPacket::RIDING_JUMP) { // currently only supported by horses... - if ( (player->riding != nullptr) && player->riding->GetType() == eTYPE_HORSE) + if ( (player->riding != NULL) && player->riding->GetType() == eTYPE_HORSE) { dynamic_pointer_cast(player->riding)->onPlayerJump(packet->data); } @@ -683,7 +683,7 @@ void PlayerConnection::handlePlayerCommand(shared_ptr packe else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { // also only supported by horses... - if ( (player->riding != nullptr) && player->riding->instanceof(eTYPE_HORSE) ) + if ( (player->riding != NULL) && player->riding->instanceof(eTYPE_HORSE) ) { dynamic_pointer_cast(player->riding)->openInventory(player); } @@ -742,7 +742,7 @@ void PlayerConnection::handleInteract(shared_ptr packet) // 4J Stu - If the client says that we hit something, then agree with it. The canSee can fail here as it checks // a ray from head->head, but we may actually be looking at a different part of the entity that can be seen // even though the ray is blocked. - if (target != nullptr) // && player->canSee(target) && player->distanceToSqr(target) < 6 * 6) + if (target != NULL) // && player->canSee(target) && player->distanceToSqr(target) < 6 * 6) { //boole canSee = player->canSee(target); //double maxDist = 6 * 6; @@ -787,13 +787,13 @@ void PlayerConnection::handleTexture(shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); if(dwBytes!=0) { - send(std::make_shared(packet->textureName, pbData, dwBytes)); + send( shared_ptr( new TexturePacket(packet->textureName,pbData,dwBytes) ) ); } else { @@ -821,7 +821,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptrtextureName.c_str()); #endif - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwTextureBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); @@ -833,11 +833,11 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptrgetAdditionalBoxesCount()!=0) { - send(std::make_shared(packet->textureName, pbData, dwTextureBytes, pDLCSkinFile)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { - send(std::make_shared(packet->textureName, pbData, dwTextureBytes)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) ); } } else @@ -846,7 +846,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID); - send(std::make_shared(packet->textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask)); + send( shared_ptr( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) ); } } else @@ -885,13 +885,13 @@ void PlayerConnection::handleTextureReceived(const wstring &textureName) auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), textureName); if( it != m_texturesRequested.end() ) { - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwBytes); if(dwBytes!=0) { - send(std::make_shared(textureName, pbData, dwBytes)); + send( shared_ptr( new TexturePacket(textureName,pbData,dwBytes) ) ); m_texturesRequested.erase(it); } } @@ -903,7 +903,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), textureName); if( it != m_texturesRequested.end() ) { - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwTextureBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName); @@ -912,7 +912,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa { if(pDLCSkinFile && (pDLCSkinFile->getAdditionalBoxesCount()!=0)) { - send(std::make_shared(textureName, pbData, dwTextureBytes, pDLCSkinFile)); + send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) ); } else { @@ -921,7 +921,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa vector *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID); - send(std::make_shared(textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask)); + send( shared_ptr( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) ); } m_texturesRequested.erase(it); } @@ -948,25 +948,20 @@ void PlayerConnection::handleTextureChange(shared_ptr packe } if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path)) { - if (server->connection->addPendingTextureRequest(packet->path)) - { + if( server->connection->addPendingTextureRequest(packet->path)) + { #ifndef _CONTENT_PACKAGE - wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n", packet->path.c_str(), player->name.c_str()); + wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(std::make_shared( - packet->path, - nullptr, - static_cast(0) - )); - - } - } + send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); + } + } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,nullptr,0); + app.AddMemoryTextureFile(packet->path,NULL,0); } - server->getPlayers()->broadcastAll(std::make_shared(player, packet->action, packet->path), player->dimension ); + server->getPlayers()->broadcastAll( shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); } void PlayerConnection::handleTextureAndGeometryChange(shared_ptr packet) @@ -985,16 +980,13 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(std::make_shared( - packet->path, - nullptr, - static_cast(0))); + send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,nullptr,0); + app.AddMemoryTextureFile(packet->path,NULL,0); player->setCustomSkin(packet->dwSkinID); @@ -1002,7 +994,7 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrdwSkinID,) //DebugBreak(); } - server->getPlayers()->broadcastAll(std::make_shared(player, packet->path), player->dimension ); + server->getPlayers()->broadcastAll( shared_ptr( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension ); } void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) @@ -1012,7 +1004,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrIsHost()) || player->isModerator()) + if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator()) { app.SetGameHostOption(eGameHostOption_FireSpreads, app.GetGameHostOption(packet->data,eGameHostOption_FireSpreads)); app.SetGameHostOption(eGameHostOption_TNT, app.GetGameHostOption(packet->data,eGameHostOption_TNT)); @@ -1024,7 +1016,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrdata, eGameHostOption_DoDaylightCycle)); app.SetGameHostOption(eGameHostOption_NaturalRegeneration, app.GetGameHostOption(packet->data, eGameHostOption_NaturalRegeneration)); - server->getPlayers()->broadcastAll(std::make_shared(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All))); + server->getPlayers()->broadcastAll( shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) ); // Update the QoS data g_NetworkManager.UpdateAndSetGameSessionData(); @@ -1035,7 +1027,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); - if( (networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator()) + if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator()) { server->getPlayers()->kickPlayerByShortId(packet->m_networkSmallId); } @@ -1104,9 +1096,9 @@ void PlayerConnection::handleContainerSetSlot(shared_ptr if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY && packet->slot >= 36 && packet->slot < 36 + 9) { shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); - if (packet->item != nullptr) + if (packet->item != NULL) { - if (lastItem == nullptr || lastItem->count < packet->item->count) + if (lastItem == NULL || lastItem->count < packet->item->count) { packet->item->popTime = Inventory::POP_TIME_DURATION; } @@ -1139,7 +1131,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac if (ItemInstance::matches(packet->item, clicked)) { // Yep, you sure did click what you claimed to click! - player->connection->send(std::make_shared(packet->containerId, packet->uid, true)); + player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, true) ) ); player->ignoreSlotUpdateHack = true; player->containerMenu->broadcastChanges(); player->broadcastCarriedItem(); @@ -1149,7 +1141,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac { // No, you clicked the wrong thing! expectedAcks[player->containerMenu->containerId] = packet->uid; - player->connection->send(std::make_shared(packet->containerId, packet->uid, false)); + player->connection->send( shared_ptr( new ContainerAckPacket(packet->containerId, packet->uid, false) ) ); player->containerMenu->setSynched(player, false); vector > items; @@ -1182,13 +1174,13 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrslotNum < 0; shared_ptr item = packet->item; - if(item != nullptr && item->id == Item::map_Id) + if(item != NULL && item->id == Item::map_Id) { int mapScale = 3; #ifdef _LARGE_WORLDS int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale); - int centreXC = static_cast(Math::round(player->x / scale) * scale); - int centreZC = static_cast(Math::round(player->z / scale) * scale); + int centreXC = (int) (Math::round(player->x / scale) * scale); + int centreZC = (int) (Math::round(player->z / scale) * scale); #else // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map int centreXC = 0; @@ -1202,9 +1194,9 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrgetAuxValue()); std::wstring id = wstring(buf); - if( data == nullptr ) + if( data == NULL ) { - data = std::make_shared(id); + data = shared_ptr( new MapItemSavedData(id) ); } player->level->setSavedData(id, (shared_ptr ) data); @@ -1212,17 +1204,17 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrx = centreXC; data->z = centreZC; - data->dimension = static_cast(player->level->dimension->id); + data->dimension = (byte) player->level->dimension->id; data->setDirty(); } bool validSlot = (packet->slotNum >= InventoryMenu::CRAFT_SLOT_START && packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START + Inventory::getSelectionSize())); - bool validItem = item == nullptr || (item->id < Item::items.length && item->id >= 0 && Item::items[item->id] != nullptr); - bool validData = item == nullptr || (item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64); + bool validItem = item == NULL || (item->id < Item::items.length && item->id >= 0 && Item::items[item->id] != NULL); + bool validData = item == NULL || (item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64); if (validSlot && validItem && validData) { - if (item == nullptr) + if (item == NULL) { player->inventoryMenu->setItem(packet->slotNum, nullptr); } @@ -1240,14 +1232,14 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr dropped = player->drop(item); - if (dropped != nullptr) + if (dropped != NULL) { dropped->setShortLifeTime(); } } } - if( item != nullptr && item->id == Item::map_Id ) + if( item != NULL && item->id == Item::map_Id ) { // 4J Stu - Maps need to have their aux value update, so the client should always be assumed to be wrong // This is how the Java works, as the client also incorrectly predicts the auxvalue of the mapItem @@ -1281,7 +1273,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) { shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); - if (dynamic_pointer_cast(te) != nullptr) + if (dynamic_pointer_cast(te) != NULL) { shared_ptr ste = dynamic_pointer_cast(te); if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) @@ -1292,7 +1284,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) } // 4J-JEV: Changed to allow characters to display as a []. - if (dynamic_pointer_cast(te) != nullptr) + if (dynamic_pointer_cast(te) != NULL) { int x = packet->x; int y = packet->y; @@ -1315,7 +1307,7 @@ void PlayerConnection::handleKeepAlive(shared_ptr packet) { if (packet->id == lastKeepAliveId) { - int time = static_cast(System::nanoTime() / 1000000 - lastKeepAliveTime); + int time = (int) (System::nanoTime() / 1000000 - lastKeepAliveTime); player->latency = (player->latency * 3 + time) / 4; } } @@ -1325,20 +1317,20 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) // Need to check that this player has permission to change each individual setting? INetworkPlayer *networkPlayer = getNetworkPlayer(); - if( (networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator() ) + if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator() ) { shared_ptr serverPlayer; // Find the player being edited for(auto& checkingPlayer : server->getPlayers()->players) { - if(checkingPlayer->connection->getNetworkPlayer() != nullptr && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) + if(checkingPlayer->connection->getNetworkPlayer() != NULL && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) { serverPlayer = checkingPlayer; break; } } - if(serverPlayer != nullptr) + if(serverPlayer != NULL) { unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); @@ -1355,7 +1347,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) #endif serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) ); serverPlayer->gameMode->setGameModeForPlayer(gameType); - serverPlayer->connection->send(std::make_shared(GameEventPacket::CHANGE_GAME_MODE, gameType->getId())); + serverPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) )); } else { @@ -1407,7 +1399,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) } } - server->getPlayers()->broadcastAll(std::make_shared(serverPlayer)); + server->getPlayers()->broadcastAll( shared_ptr( new PlayerInfoPacket( serverPlayer ) ) ); } } } @@ -1491,7 +1483,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo AbstractContainerMenu *menu = player->containerMenu; if (dynamic_cast(menu)) { - static_cast(menu)->setSelectionHint(selection); + ((MerchantMenu *) menu)->setSelectionHint(selection); } } else if (CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET.compare(customPayloadPacket->identifier) == 0) @@ -1512,7 +1504,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo shared_ptr tileEntity = player->level->getTileEntity(x, y, z); shared_ptr cbe = dynamic_pointer_cast(tileEntity); - if (tileEntity != nullptr && cbe != nullptr) + if (tileEntity != NULL && cbe != NULL) { cbe->setCommand(command); player->level->sendTileUpdated(x, y, z); @@ -1526,14 +1518,14 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo } else if (CustomPayloadPacket::SET_BEACON_PACKET.compare(customPayloadPacket->identifier) == 0) { - if ( dynamic_cast( player->containerMenu) != nullptr) + if ( dynamic_cast( player->containerMenu) != NULL) { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream input(&bais); int primary = input.readInt(); int secondary = input.readInt(); - BeaconMenu *beaconMenu = static_cast(player->containerMenu); + BeaconMenu *beaconMenu = (BeaconMenu *) player->containerMenu; Slot *slot = beaconMenu->getSlot(0); if (slot->hasItem()) { @@ -1550,7 +1542,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo AnvilMenu *menu = dynamic_cast( player->containerMenu); if (menu) { - if (customPayloadPacket->data.data == nullptr || customPayloadPacket->data.length < 1) + if (customPayloadPacket->data.data == NULL || customPayloadPacket->data.length < 1) { menu->setItemName(L""); } @@ -1606,7 +1598,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } else if (pTempItemInst->id == Item::fireworksCharge_Id || pTempItemInst->id == Item::fireworks_Id) { - CraftingMenu *menu = static_cast(player->containerMenu); + CraftingMenu *menu = (CraftingMenu *)player->containerMenu; player->openFireworks(menu->getX(), menu->getY(), menu->getZ() ); } else @@ -1614,7 +1606,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) Recipy::INGREDIENTS_REQUIRED &req = pRecipeIngredientsRequired[iRecipe]; - if (req.iType == RECIPE_TYPE_3x3 && dynamic_cast(player->containerMenu) == nullptr) + if (req.iType == RECIPE_TYPE_3x3 && dynamic_cast(player->containerMenu) == NULL) { server->warn(L"Player " + player->getName() + L" tried to craft a 3x3 recipe without a crafting bench"); return; @@ -1649,12 +1641,12 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } // 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake - if (ingItemInst != nullptr) + if (ingItemInst != NULL) { if (ingItemInst->getItem()->hasCraftingRemainingItem()) { // replace item with remaining result - player->inventory->add(std::make_shared(ingItemInst->getItem()->getCraftingRemainingItem())); + player->inventory->add( shared_ptr( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) ); } } @@ -1715,7 +1707,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId) { - MerchantMenu *menu = static_cast(player->containerMenu); + MerchantMenu *menu = (MerchantMenu *)player->containerMenu; MerchantRecipeList *offers = menu->getMerchant()->getOffers(player); @@ -1733,7 +1725,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); - if( (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || buyBMatches >= buyBItem->count) ) + if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) { menu->getMerchant()->notifyTrade(activeRecipe); @@ -1767,13 +1759,13 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) INetworkPlayer *PlayerConnection::getNetworkPlayer() { - if( connection != nullptr && connection->getSocket() != nullptr) return connection->getSocket()->getPlayer(); - else return nullptr; + if( connection != NULL && connection->getSocket() != NULL) return connection->getSocket()->getPlayer(); + else return NULL; } bool PlayerConnection::isLocal() { - if( connection->getSocket() == nullptr ) + if( connection->getSocket() == NULL ) { return false; } @@ -1786,7 +1778,7 @@ bool PlayerConnection::isLocal() bool PlayerConnection::isGuest() { - if( connection->getSocket() == nullptr ) + if( connection->getSocket() == NULL ) { return false; } @@ -1794,7 +1786,7 @@ bool PlayerConnection::isGuest() { INetworkPlayer *networkPlayer = connection->getSocket()->getPlayer(); bool isGuest = false; - if(networkPlayer != nullptr) + if(networkPlayer != NULL) { isGuest = networkPlayer->IsGuest() == TRUE; } diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index ee0ba156..1742756e 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -38,12 +38,12 @@ PlayerList::PlayerList(MinecraftServer *server) { - playerIo = nullptr; + playerIo = NULL; this->server = server; sendAllPlayerInfoIn = 0; - overrideGameMode = nullptr; + overrideGameMode = NULL; allowCheatsForAllPlayers = false; #ifdef __PSVITA__ @@ -57,7 +57,7 @@ PlayerList::PlayerList(MinecraftServer *server) //int viewDistance = server->settings->getInt(L"view-distance", 10); int rawMax = server->settings->getInt(L"max-players", 8); - maxPlayers = static_cast(Mth::clamp(rawMax, 1, MINECRAFT_NET_MAX_PLAYERS)); + maxPlayers = (unsigned int)Mth::clamp(rawMax, 1, MINECRAFT_NET_MAX_PLAYERS); doWhiteList = false; InitializeCriticalSection(&m_kickPlayersCS); InitializeCriticalSection(&m_closePlayersCS); @@ -80,14 +80,14 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr { CompoundTag *playerTag = load(player); - bool newPlayer = playerTag == nullptr; + bool newPlayer = playerTag == NULL; player->setLevel(server->getLevel(player->dimension)); - player->gameMode->setLevel(static_cast(player->level)); + player->gameMode->setLevel((ServerLevel *)player->level); // Make sure these privileges are always turned off for the host player INetworkPlayer *networkPlayer = connection->getSocket()->getPlayer(); - if(networkPlayer != nullptr && networkPlayer->IsHost()) + if(networkPlayer != NULL && networkPlayer->IsHost()) { player->enableAllPlayerPrivileges(true); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST,1); @@ -97,18 +97,18 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr // PS3 networking library doesn't automatically assign PlayerUIDs to the network players for anything remote, so need to tell it what to set from the data in this packet now if( !g_NetworkManager.IsLocalGame() ) { - if( networkPlayer != nullptr ) + if( networkPlayer != NULL ) { ((NetworkPlayerSony *)networkPlayer)->SetUID( packet->m_onlineXuid ); } } #endif #ifdef _WINDOWS64 - if (networkPlayer != nullptr) + if (networkPlayer != NULL) { - NetworkPlayerXbox* nxp = static_cast(networkPlayer); + NetworkPlayerXbox* nxp = (NetworkPlayerXbox*)networkPlayer; IQNetPlayer* qnp = nxp->GetQNetPlayer(); - if (qnp != nullptr) + if (qnp != NULL) { if (!networkPlayer->IsLocal()) { @@ -143,9 +143,9 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr } } } - if (playerIndex >= static_cast(MINECRAFT_NET_MAX_PLAYERS)) + if (playerIndex >= (unsigned int)MINECRAFT_NET_MAX_PLAYERS) { - connection->send(std::make_shared(DisconnectPacket::eDisconnect_ServerFull)); + connection->send(shared_ptr(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull))); connection->sendAndQuit(); return false; } @@ -154,7 +154,7 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setCustomCape( packet->m_playerCapeId ); // 4J-JEV: Moved this here so we can send player-model texture and geometry data. - shared_ptr playerConnection = std::make_shared(server, connection, player); + shared_ptr playerConnection = shared_ptr(new PlayerConnection(server, connection, player)); //player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr if(newPlayer) @@ -162,39 +162,35 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr int mapScale = 3; #ifdef _LARGE_WORLDS int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale); - int centreXC = static_cast(Math::round(player->x / scale) * scale); - int centreZC = static_cast(Math::round(player->z / scale) * scale); + int centreXC = (int) (Math::round(player->x / scale) * scale); + int centreZC = (int) (Math::round(player->z / scale) * scale); #else // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map int centreXC = 0; int centreZC = 0; #endif // 4J Added - Give every player a map the first time they join a server - player->inventory->setItem( 9, std::make_shared(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(), 0, centreXC, centreZC, mapScale))); - if(app.getGameRuleDefinitions() != nullptr) + player->inventory->setItem( 9, shared_ptr( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) ); + if(app.getGameRuleDefinitions() != NULL) { app.getGameRuleDefinitions()->postProcessPlayer(player); } } if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl)) - { - if (server->getConnection()->addPendingTextureRequest(player->customTextureUrl)) - { + { + if( server->getConnection()->addPendingTextureRequest(player->customTextureUrl)) + { #ifndef _CONTENT_PACKAGE - wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n", player->customTextureUrl.c_str(), player->name.c_str()); + wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); #endif - playerConnection->send(std::make_shared( - player->customTextureUrl, - nullptr, - static_cast(0))); - + playerConnection->send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl,nullptr,0); + app.AddMemoryTextureFile(player->customTextureUrl,NULL,0); } if(!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -204,17 +200,13 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); #endif - playerConnection->send(std::make_shared( - player->customTextureUrl, - nullptr, - static_cast(0) - )); + playerConnection->send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2,nullptr,0); + app.AddMemoryTextureFile(player->customTextureUrl2,NULL,0); } player->setIsGuest( packet->m_isGuest ); @@ -245,22 +237,22 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr addPlayerToReceiving( player ); int maxPlayersForPacket = getMaxPlayers() > 255 ? 255 : getMaxPlayers(); - playerConnection->send(std::make_shared(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), - static_cast(level->dimension->id), static_cast(level->getMaxBuildHeight()), static_cast(maxPlayersForPacket), - level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), static_cast(playerIndex), level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), - level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale())); - playerConnection->send(std::make_shared(spawnPos->x, spawnPos->y, spawnPos->z)); - playerConnection->send(std::make_shared(&player->abilities)); - playerConnection->send(std::make_shared(player->inventory->selected)); + playerConnection->send( shared_ptr( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), + (byte) level->dimension->id, (byte) level->getMaxBuildHeight(), (byte) maxPlayersForPacket, + level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), + level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); + playerConnection->send( shared_ptr( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); + playerConnection->send( shared_ptr( new PlayerAbilitiesPacket(&player->abilities)) ); + playerConnection->send( shared_ptr( new SetCarriedItemPacket(player->inventory->selected))); delete spawnPos; - updateEntireScoreboard(reinterpret_cast(level->getScoreboard()), player); + updateEntireScoreboard((ServerScoreboard *) level->getScoreboard(), player); sendLevelInfo(player, level); // 4J-PB - removed, since it needs to be localised in the language the client is in //server->players->broadcastAll( shared_ptr( new ChatPacket(L"�e" + playerEntity->name + L" joined the game.") ) ); - broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerJoinedGame)); + broadcastAll( shared_ptr( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) ); MemSect(14); add(player); @@ -270,21 +262,21 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr playerConnection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); server->getConnection()->addPlayerConnection(playerConnection); - playerConnection->send(std::make_shared(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))); + playerConnection->send( shared_ptr( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) ) ); auto activeEffects = player->getActiveEffects(); for(MobEffectInstance *effect : *player->getActiveEffects()) { - playerConnection->send(std::make_shared(player->entityId, effect)); + playerConnection->send(shared_ptr( new UpdateMobEffectPacket(player->entityId, effect) ) ); } player->initMenu(); - if (playerTag != nullptr && playerTag->contains(Entity::RIDING_TAG)) + if (playerTag != NULL && playerTag->contains(Entity::RIDING_TAG)) { // this player has been saved with a mount tag shared_ptr mount = EntityIO::loadStatic(playerTag->getCompound(Entity::RIDING_TAG), level); - if (mount != nullptr) + if (mount != NULL) { mount->forcedLoading = true; level->addEntity(mount); @@ -324,7 +316,7 @@ void PlayerList::updateEntireScoreboard(ServerScoreboard *scoreboard, shared_ptr //{ // Objective objective = scoreboard->getDisplayObjective(slot); - // if (objective != nullptr && !objectives->contains(objective)) + // if (objective != NULL && !objectives->contains(objective)) // { // vector > *packets = scoreboard->getStartTrackingPackets(objective); @@ -347,10 +339,10 @@ void PlayerList::changeDimension(shared_ptr player, ServerLevel *f { ServerLevel *to = player->getLevel(); - if (from != nullptr) from->getChunkMap()->remove(player); + if (from != NULL) from->getChunkMap()->remove(player); to->getChunkMap()->add(player); - to->cache->create(static_cast(player->x) >> 4, static_cast(player->z) >> 4); + to->cache->create(((int) player->x) >> 4, ((int) player->z) >> 4); } int PlayerList::getMaxRange() @@ -419,10 +411,10 @@ void PlayerList::validatePlayerSpawnPosition(shared_ptr player) delete levelSpawn; Pos *bedPosition = player->getRespawnPosition(); - if (bedPosition != nullptr) + if (bedPosition != NULL) { Pos *respawnPosition = Player::checkBedValidRespawnPosition(server->getLevel(player->dimension), bedPosition, spawnForced); - if (respawnPosition != nullptr) + if (respawnPosition != NULL) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); player->setRespawnPosition(bedPosition, spawnForced); @@ -443,7 +435,7 @@ void PlayerList::add(shared_ptr player) //broadcastAll(shared_ptr( new PlayerInfoPacket(player->name, true, 1000) ) ); if( player->connection->getNetworkPlayer() ) { - broadcastAll(std::make_shared(player)); + broadcastAll(shared_ptr( new PlayerInfoPacket( player ) ) ); } players.push_back(player); @@ -460,16 +452,16 @@ void PlayerList::add(shared_ptr player) // 4J Stu - Swapped these lines about so that we get the chunk visiblity packet way ahead of all the add tracked entity packets // Fix for #9169 - ART : Sign text is replaced with the words �Awaiting approval�. - changeDimension(player, nullptr); + changeDimension(player, NULL); level->addEntity(player); - for (size_t i = 0; i < players.size(); i++) + for (int i = 0; i < players.size(); i++) { shared_ptr op = players.at(i); //player->connection->send(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - player->connection->send(std::make_shared(op)); + player->connection->send(shared_ptr( new PlayerInfoPacket( op ) ) ); } } @@ -481,11 +473,11 @@ void PlayerList::add(shared_ptr player) shared_ptr thisPlayer = players[i]; if(thisPlayer->isSleeping()) { - if(firstSleepingPlayer == nullptr) firstSleepingPlayer = thisPlayer; - thisPlayer->connection->send(std::make_shared(thisPlayer->name, ChatPacket::e_ChatBedMeSleep)); + if(firstSleepingPlayer == NULL) firstSleepingPlayer = thisPlayer; + thisPlayer->connection->send(shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); } } - player->connection->send(std::make_shared(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep)); + player->connection->send(shared_ptr( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep))); } } @@ -500,7 +492,7 @@ void PlayerList::remove(shared_ptr player) //4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map if(player->isGuest()) playerIo->deleteMapFilesForPlayer(player); ServerLevel *level = player->getLevel(); -if (player->riding != nullptr) +if (player->riding != NULL) { level->removeEntityImmediately(player->riding); app.DebugPrintf("removing player mount"); @@ -518,10 +510,10 @@ if (player->riding != nullptr) removePlayerFromReceiving(player); player->connection = nullptr; // Must remove reference to connection, or else there is a circular dependency delete player->gameMode; // Gamemode also needs deleted as it references back to this player - player->gameMode = nullptr; + player->gameMode = NULL; // 4J Stu - Save all the players currently in the game, which will also free up unused map id slots if required, and remove old players - saveAll(nullptr,false); + saveAll(NULL,false); } shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) @@ -531,7 +523,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull); return shared_ptr(); } - shared_ptr player = std::make_shared(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0))); + shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) )); player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor player->setXuid( xuid ); // 4J Added player->setOnlineXuid( onlineXuid ); // 4J Added @@ -540,7 +532,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin // Use packet-supplied identity from LoginPacket. // Do not recompute from name here: mixed-version clients must stay compatible. INetworkPlayer* np = pendingConnection->connection->getSocket()->getPlayer(); - if (np != nullptr) + if (np != NULL) { player->setOnlineXuid(np->GetUID()); @@ -556,14 +548,14 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin #endif // Work out the base server player settings INetworkPlayer *networkPlayer = pendingConnection->connection->getSocket()->getPlayer(); - if(networkPlayer != nullptr && !networkPlayer->IsHost()) + if(networkPlayer != NULL && !networkPlayer->IsHost()) { player->enableAllPlayerPrivileges( app.GetGameHostOption(eGameHostOption_TrustPlayers)>0 ); } // 4J Added LevelRuleset *serverRuleDefs = app.getGameRuleDefinitions(); - if(serverRuleDefs != nullptr) + if(serverRuleDefs != NULL) { player->gameMode->setGameRules( GameRuleDefinition::generateNewGameRulesInstance(GameRulesInstance::eGameRulesInstanceType_ServerPlayer, serverRuleDefs, pendingConnection->connection) ); } @@ -590,7 +582,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay if( ep->dimension != oldDimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { // There's another player here in the same dimension - we're not the last one out isEmptying = false; @@ -643,7 +635,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay PlayerUID playerXuid = serverPlayer->getXuid(); PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid(); - shared_ptr player = std::make_shared(server, server->getLevel(serverPlayer->dimension), serverPlayer->getName(), new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension))); + shared_ptr player = shared_ptr(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->getName(), new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)))); player->connection = serverPlayer->connection; player->restoreFrom(serverPlayer, keepAllPlayerData); if (keepAllPlayerData) @@ -683,7 +675,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay { // If the player is still alive and respawning to the same dimension, they are just being added back from someone else viewing the Win screen player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z, serverPlayer->yRot, serverPlayer->xRot); - if(bedPosition != nullptr) + if(bedPosition != NULL) { player->setRespawnPosition(bedPosition, spawnForced); delete bedPosition; @@ -691,30 +683,30 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay // Fix for #81759 - TU9: Content: Gameplay: Entering The End Exit Portal replaces the Player's currently held item with the first one from the Quickbar player->inventory->selected = serverPlayer->inventory->selected; } - else if (bedPosition != nullptr) + else if (bedPosition != NULL) { Pos *respawnPosition = Player::checkBedValidRespawnPosition(server->getLevel(serverPlayer->dimension), bedPosition, spawnForced); - if (respawnPosition != nullptr) + if (respawnPosition != NULL) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); player->setRespawnPosition(bedPosition, spawnForced); } else { - player->connection->send(std::make_shared(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0)); + player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) ); } delete bedPosition; } // Ensure the area the player is spawning in is loaded! - level->cache->create(static_cast(player->x) >> 4, static_cast(player->z) >> 4); + level->cache->create(((int) player->x) >> 4, ((int) player->z) >> 4); while (!level->getCubes(player, player->bb)->empty()) { player->setPos(player->x, player->y + 1, player->z); } - player->connection->send( std::make_shared( static_cast(player->dimension), player->level->getSeed(), player->level->getMaxBuildHeight(), + player->connection->send( std::make_shared( (char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), player->gameMode->getGameModeForPlayer(), level->difficulty, level->getLevelData()->getGenerator(), player->level->useNewSeaLevel(), player->entityId, level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ); player->connection->teleport(player->x, player->y, player->z, player->yRot, player->xRot); @@ -774,7 +766,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime if( ep->dimension != lastDimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { // There's another player here in the same dimension - we're not the last one out isEmptying = false; @@ -831,9 +823,9 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime // 4J Stu Added so that we remove entities from the correct level, after the respawn packet we will be in the wrong level player->flushEntitiesToRemove(); - player->connection->send(std::make_shared(static_cast(player->dimension), newLevel->getSeed(), newLevel->getMaxBuildHeight(), - player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(), - newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale())); + player->connection->send( shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), + player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(), + newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale()) ) ); oldLevel->removeEntityImmediately(player); player->removed = false; @@ -930,8 +922,8 @@ void PlayerList::repositionAcrossDimension(shared_ptr entity, int lastDi if (lastDimension != 1) { - xt = static_cast(Mth::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128)); - zt = static_cast(Mth::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128)); + xt = (double) Mth::clamp((int) xt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128); + zt = (double) Mth::clamp((int) zt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128); if (entity->isAlive()) { newLevel->addEntity(entity); @@ -960,7 +952,7 @@ void PlayerList::tick() //broadcastAll(shared_ptr( new PlayerInfoPacket(op->name, true, op->latency) ) ); if( op->connection->getNetworkPlayer() ) { - broadcastAll(std::make_shared(op)); + broadcastAll(shared_ptr( new PlayerInfoPacket( op ) ) ); } } @@ -975,15 +967,15 @@ void PlayerList::tick() for(unsigned int i = 0; i < players.size(); i++) { shared_ptr p = players.at(i); - // 4J Stu - May be being a bit overprotective with all the nullptr checks, but adding late in TU7 so want to be safe - if (p != nullptr && p->connection != nullptr && p->connection->connection != nullptr && p->connection->connection->getSocket() != nullptr && p->connection->connection->getSocket()->getSmallId() == smallId ) + // 4J Stu - May be being a bit overprotective with all the NULL checks, but adding late in TU7 so want to be safe + if (p != NULL && p->connection != NULL && p->connection->connection != NULL && p->connection->connection->getSocket() != NULL && p->connection->connection->getSocket()->getSmallId() == smallId ) { player = p; break; } } - if (player != nullptr) + if (player != NULL) { player->connection->disconnect( DisconnectPacket::eDisconnect_Closed ); } @@ -996,7 +988,7 @@ void PlayerList::tick() BYTE smallId = m_smallIdsToKick.front(); m_smallIdsToKick.pop_front(); INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId); - if( selectedPlayer != nullptr ) + if( selectedPlayer != NULL ) { if( selectedPlayer->IsLocal() != TRUE ) { @@ -1009,20 +1001,20 @@ void PlayerList::tick() { shared_ptr p = players.at(i); PlayerUID playersXuid = p->getOnlineXuid(); - if (p != nullptr && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) + if (p != NULL && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) { player = p; break; } } - if (player != nullptr) + if (player != NULL) { m_bannedXuids.push_back( player->getOnlineXuid() ); // 4J Stu - If we have kicked a player, make sure that they have no privileges if they later try to join the world when trust players is off player->enableAllPlayerPrivileges( false ); player->connection->setWasKicked(); - player->connection->send(std::make_shared(DisconnectPacket::eDisconnect_Kicked)); + player->connection->send( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) )); } //#endif } @@ -1039,7 +1031,7 @@ void PlayerList::tick() if(currentPlayer->removed) { shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); - if(newPlayer != nullptr) + if(newPlayer != NULL) { receiveAllPlayers[dim][i] = newPlayer; app.DebugPrintf("Replacing primary player %ls with %ls in dimension %d\n", currentPlayer->name.c_str(), newPlayer->name.c_str(), dim); @@ -1106,7 +1098,7 @@ bool PlayerList::isOp(shared_ptr player) cheatsEnabled = cheatsEnabled || app.GetUseDPadForDebug(); #endif INetworkPlayer *networkPlayer = player->connection->getNetworkPlayer(); - bool isOp = cheatsEnabled && (player->isModerator() || (networkPlayer != nullptr && networkPlayer->IsHost())); + bool isOp = cheatsEnabled && (player->isModerator() || (networkPlayer != NULL && networkPlayer->IsHost())); return isOp; } @@ -1140,12 +1132,12 @@ shared_ptr PlayerList::getPlayer(PlayerUID uid) shared_ptr PlayerList::getNearestPlayer(Pos *position, int range) { if (players.empty()) return nullptr; - if (position == nullptr) return players.at(0); + if (position == NULL) return players.at(0); shared_ptr current = nullptr; double dist = -1; int rangeSqr = range * range; - for (size_t i = 0; i < players.size(); i++) + for (int i = 0; i < players.size(); i++) { shared_ptr next = players.at(i); double newDist = position->distSqr(next->getCommandSenderWorldPosition()); @@ -1163,9 +1155,9 @@ shared_ptr PlayerList::getNearestPlayer(Pos *position, int range) vector *PlayerList::getPlayers(Pos *position, int rangeMin, int rangeMax, int count, int mode, int levelMin, int levelMax, unordered_map *scoreRequirements, const wstring &playerName, const wstring &teamName, Level *level) { app.DebugPrintf("getPlayers NOT IMPLEMENTED!"); - return nullptr; + return NULL; - /*if (players.empty()) return nullptr; + /*if (players.empty()) return NULL; vector > result = new vector >(); bool reverse = count < 0; bool playerNameNot = !playerName.empty() && playerName.startsWith("!"); @@ -1177,7 +1169,7 @@ vector *PlayerList::getPlayers(Pos *position, int rangeMin, int ra if (playerNameNot) playerName = playerName.substring(1); if (teamNameNot) teamName = teamName.substring(1); - for (size_t i = 0; i < players.size(); i++) { + for (int i = 0; i < players.size(); i++) { ServerPlayer player = players.get(i); if (level != null && player.level != level) continue; @@ -1247,9 +1239,9 @@ bool PlayerList::meetsScoreRequirements(shared_ptr player, unordered_map void PlayerList::sendMessage(const wstring& name, const wstring& message) { shared_ptr player = getPlayer(name); - if (player != nullptr) + if (player != NULL) { - player->connection->send(std::make_shared(message)); + player->connection->send( shared_ptr( new ChatPacket(message) ) ); } } @@ -1263,7 +1255,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double // 4J - altered so that we don't send to the same machine more than once. Add the source player to the machines we have "sent" to as it doesn't need to go to that // machine either vector< shared_ptr > sentTo; - if( except != nullptr ) + if( except != NULL ) { sentTo.push_back(dynamic_pointer_cast(except)); } @@ -1279,7 +1271,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double if( sentTo.size() ) { INetworkPlayer *thisPlayer = p->connection->getNetworkPlayer(); - if( thisPlayer == nullptr ) + if( thisPlayer == NULL ) { dontSend = true; } @@ -1289,7 +1281,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double { shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -1327,8 +1319,8 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMaps /*= false*/) { - if(progressListener != nullptr) progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS); - // 4J - playerIo can be nullptr if we have have to exit a game really early on due to network failure + if(progressListener != NULL) progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS); + // 4J - playerIo can be NULL if we have have to exit a game really early on due to network failure if(playerIo) { playerIo->saveAllCachedData(); @@ -1339,7 +1331,7 @@ void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMa //4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map if(bDeleteGuestMaps && players[i]->isGuest()) playerIo->deleteMapFilesForPlayer(players[i]); - if(progressListener != nullptr) progressListener->progressStagePercentage((i * 100)/ static_cast(players.size())); + if(progressListener != NULL) progressListener->progressStagePercentage((i * 100)/ ((int)players.size())); } playerIo->clearOldPlayerFiles(); playerIo->saveMapIdLookup(); @@ -1360,22 +1352,22 @@ void PlayerList::reloadWhitelist() void PlayerList::sendLevelInfo(shared_ptr player, ServerLevel *level) { - player->connection->send(std::make_shared(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))); + player->connection->send( shared_ptr( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) ) ); if (level->isRaining()) { - player->connection->send(std::make_shared(GameEventPacket::START_RAINING, 0)); + player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } else { // 4J Stu - Fix for #44836 - Customer Encountered: Out of Sync Weather [A-10] // If it was raining when the player left the level, and is now not raining we need to make sure that state is updated - player->connection->send(std::make_shared(GameEventPacket::STOP_RAINING, 0)); + player->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } // send the stronghold position if there is one if((level->dimension->id==0) && level->getLevelData()->getHasStronghold()) { - player->connection->send(std::make_shared(XZPacket::STRONGHOLD, level->getLevelData()->getXStronghold(), level->getLevelData()->getZStronghold())); + player->connection->send( shared_ptr( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) ); } } @@ -1383,12 +1375,12 @@ void PlayerList::sendAllPlayerInfo(shared_ptr player) { player->refreshContainer(player->inventoryMenu); player->resetSentInfo(); - player->connection->send(std::make_shared(player->inventory->selected)); + player->connection->send( shared_ptr( new SetCarriedItemPacket(player->inventory->selected)) ); } int PlayerList::getPlayerCount() { - return static_cast(players.size()); + return (int)players.size(); } int PlayerList::getPlayerCount(ServerLevel *level) @@ -1428,11 +1420,11 @@ void PlayerList::updatePlayerGameMode(shared_ptr newPlayer, shared // reset the player's game mode (first pick from old, then copy level if // necessary) - if (oldPlayer != nullptr) + if (oldPlayer != NULL) { newPlayer->gameMode->setGameModeForPlayer(oldPlayer->gameMode->getGameModeForPlayer()); } - else if (overrideGameMode != nullptr) + else if (overrideGameMode != NULL) { newPlayer->gameMode->setGameModeForPlayer(overrideGameMode); } @@ -1516,10 +1508,10 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool } } } - else if( thisPlayer == nullptr ) + else if( thisPlayer == NULL ) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("Remove: Qnet player for %ls was nullptr so re-checking all players\n", player->name.c_str() ); + app.DebugPrintf("Remove: Qnet player for %ls was NULL so re-checking all players\n", player->name.c_str() ); #endif // 4J Stu - Something went wrong, or possibly the QNet player left before we got here. // Re-check all active players and make sure they have someone on their system to receive all packets @@ -1536,7 +1528,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool for(auto& primaryPlayer : receiveAllPlayers[newPlayerDim]) { INetworkPlayer *primPlayer = primaryPlayer->connection->getNetworkPlayer(); - if(primPlayer != nullptr && checkingPlayer->IsSameSystem( primPlayer ) ) + if(primPlayer != NULL && checkingPlayer->IsSameSystem( primPlayer ) ) { foundPrimary = true; break; @@ -1568,10 +1560,10 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == nullptr ) + if( thisPlayer == NULL ) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("Add: Qnet player for player %ls is nullptr so not adding them\n", player->name.c_str() ); + app.DebugPrintf("Add: Qnet player for player %ls is NULL so not adding them\n", player->name.c_str() ); #endif shouldAddPlayer = false; } @@ -1580,7 +1572,7 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) for(auto& oldPlayer : receiveAllPlayers[playerDim]) { INetworkPlayer *checkingPlayer = oldPlayer->connection->getNetworkPlayer(); - if(checkingPlayer != nullptr && checkingPlayer->IsSameSystem( thisPlayer ) ) + if(checkingPlayer != NULL && checkingPlayer->IsSameSystem( thisPlayer ) ) { shouldAddPlayer = false; break; diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 68dae2ee..ff930a13 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -57,7 +57,7 @@ ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f ) { - humanoidModel = static_cast(model); + humanoidModel = (HumanoidModel *) model; armorParts1 = new HumanoidModel(1.0f); armorParts2 = new HumanoidModel(0.5f); @@ -83,7 +83,7 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, fl } shared_ptr itemInstance = player->inventory->getArmor(3 - layer); - if (itemInstance != nullptr) + if (itemInstance != NULL) { Item *item = itemInstance->getItem(); if (dynamic_cast(item)) @@ -102,17 +102,17 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, fl armor->leg1->visible = layer == 2 || layer == 3; setArmor(armor); - if (armor != nullptr) armor->attackTime = model->attackTime; - if (armor != nullptr) armor->riding = model->riding; - if (armor != nullptr) armor->young = model->young; + if (armor != NULL) armor->attackTime = model->attackTime; + if (armor != NULL) armor->riding = model->riding; + if (armor != NULL) armor->young = model->young; float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) { int color = armorItem->getColor(itemInstance); - float red = static_cast((color >> 16) & 0xFF) / 0xFF; - float green = static_cast((color >> 8) & 0xFF) / 0xFF; - float blue = static_cast(color & 0xFF) / 0xFF; + float red = (float) ((color >> 16) & 0xFF) / 0xFF; + float green = (float) ((color >> 8) & 0xFF) / 0xFF; + float blue = (float) (color & 0xFF) / 0xFF; glColor3f(brightness * red, brightness * green, brightness * blue); if (itemInstance->isEnchanted()) return 0x1f; @@ -137,13 +137,13 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, in // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr player = dynamic_pointer_cast(_player); shared_ptr itemInstance = player->inventory->getArmor(3 - layer); - if (itemInstance != nullptr) + if (itemInstance != NULL) { Item *item = itemInstance->getItem(); if (dynamic_cast(item)) { ArmorItem *armorItem = dynamic_cast(item); - bindTexture(HumanoidMobRenderer::getArmorLocation(static_cast(item), layer, true)); + bindTexture(HumanoidMobRenderer::getArmorLocation((ArmorItem *)item, layer, true)); float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); glColor3f(brightness, brightness, brightness); @@ -159,8 +159,8 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double if(mob->hasInvisiblePrivilege()) return; shared_ptr item = mob->inventory->getSelected(); - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; - if (item != nullptr) + armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; + if (item != NULL) { if (mob->getUseItemDuration() > 0) { @@ -176,7 +176,7 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } } // 4J added, for 3rd person view of eating - if( item != nullptr && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat ) + if( item != NULL && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat ) { // These factors are largely lifted from ItemInHandRenderer to try and keep the 3rd person eating animation as similar as possible float t = (mob->getUseItemDuration() - a + 1); @@ -260,7 +260,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) shared_ptr mob = dynamic_pointer_cast(_mob); shared_ptr headGear = mob->inventory->getArmor(3); - if (headGear != nullptr) + if (headGear != NULL) { // don't render the pumpkin for the skins unsigned int uiAnimOverrideBitmask = mob->getSkinAnimOverrideBitmask( mob->getCustomSkin()); @@ -300,7 +300,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } // need to add a custom texture for deadmau5 - if (mob != nullptr && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" )) + if (mob != NULL && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" )) { for (int i = 0; i < 2; i++) { @@ -339,11 +339,11 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) double xa = Mth::sin(yr * PI / 180); double za = -Mth::cos(yr * PI / 180); - float flap = static_cast(yd) * 10; + float flap = (float) yd * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = static_cast(xd * xa + zd * za) * 100; - float lean2 = static_cast(xd * za - zd * xa) * 100; + float lean = (float) (xd * xa + zd * za) * 100; + float lean2 = (float) (xd * za - zd * xa) * 100; if (lean < 0) lean = 0; float pow = mob->oBob + (mob->bob - mob->oBob) * a; @@ -368,15 +368,15 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) shared_ptr item = mob->inventory->getSelected(); - if (item != nullptr) + if (item != NULL) { glPushMatrix(); humanoidModel->arm0->translateTo(1 / 16.0f); glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f); - if (mob->fishing != nullptr) + if (mob->fishing != NULL) { - item = std::make_shared(Item::stick); + item = shared_ptr( new ItemInstance(Item::stick) ); } UseAnim anim = UseAnim_none;//null; @@ -472,7 +472,7 @@ void PlayerRenderer::renderNameTags(shared_ptr player, double x, d Scoreboard *scoreboard = player->getScoreboard(); Objective *objective = scoreboard->getDisplayObjective(Scoreboard::DISPLAY_SLOT_BELOW_NAME); - if (objective != nullptr) + if (objective != NULL) { Score *score = scoreboard->getPlayerScore(player->getAName(), objective); @@ -558,7 +558,7 @@ void PlayerRenderer::renderShadow(shared_ptr e, double x, double y, doub if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { shared_ptr player = dynamic_pointer_cast(e); - if(player != nullptr && player->hasInvisiblePrivilege()) return; + if(player != NULL && player->hasInvisiblePrivilege()) return; } EntityRenderer::renderShadow(e,x,y,z,pow,a); } @@ -573,5 +573,5 @@ void PlayerRenderer::bindTexture(shared_ptr entity) ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr entity) { shared_ptr player = dynamic_pointer_cast(entity); - return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture())); + return new ResourceLocation((_TEXTURE_NAME)player->getTexture()); } \ No newline at end of file diff --git a/Minecraft.Client/Polygon.cpp b/Minecraft.Client/Polygon.cpp index 05cf9b07..00176511 100644 --- a/Minecraft.Client/Polygon.cpp +++ b/Minecraft.Client/Polygon.cpp @@ -58,17 +58,17 @@ void _Polygon::render(Tesselator *t, float scale) t->begin(); if (_flipNormal) { - t->normal(-static_cast(n->x), -static_cast(n->y), -static_cast(n->z)); + t->normal(-(float)n->x, -(float)n->y, -(float)n->z); } else { - t->normal(static_cast(n->x), static_cast(n->y), static_cast(n->z)); + t->normal((float)n->x, (float)n->y, (float)n->z); } for (int i = 0; i < 4; i++) { Vertex *v = vertices[i]; - t->vertexUV(static_cast(v->pos->x * scale), static_cast(v->pos->y * scale), static_cast(v->pos->z * scale), (float)( v->u), (float)( v->v)); + t->vertexUV((float)(v->pos->x * scale), (float)( v->pos->y * scale), (float)( v->pos->z * scale), (float)( v->u), (float)( v->v)); } t->end(); } diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index 33e0b59e..eeccb628 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -26,11 +26,11 @@ PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, cons this->missingTexture = missingTexture; // 4J Initialisers - missingPosition = nullptr; - stitchResult = nullptr; + missingPosition = NULL; + stitchResult = NULL; m_mipMap = mipmap; - missingPosition = static_cast(new SimpleIcon(NAME_MISSING_TEXTURE, NAME_MISSING_TEXTURE, 0, 0, 1, 1)); + missingPosition = (StitchedTexture *)(new SimpleIcon(NAME_MISSING_TEXTURE,NAME_MISSING_TEXTURE,0,0,1,1)); } void PreStitchedTextureMap::stitch() @@ -48,7 +48,7 @@ void PreStitchedTextureMap::stitch() //for (Tile tile : Tile.tiles) for(unsigned int i = 0; i < Tile::TILE_NUM_COUNT; ++i) { - if (Tile::tiles[i] != nullptr) + if (Tile::tiles[i] != NULL) { Tile::tiles[i]->registerIcons(this); } @@ -62,7 +62,7 @@ void PreStitchedTextureMap::stitch() for(unsigned int i = 0; i < Item::ITEM_NUM_COUNT; ++i) { Item *item = Item::items[i]; - if (item != nullptr && item->getIconType() == iconType) + if (item != NULL && item->getIconType() == iconType) { item->registerIcons(this); } @@ -121,7 +121,7 @@ void PreStitchedTextureMap::stitch() int height = image->getHeight(); int width = image->getWidth(); - if(stitchResult != nullptr) + if(stitchResult != NULL) { TextureManager::getInstance()->unregisterTexture(name, stitchResult); delete stitchResult; @@ -216,7 +216,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack *texturePack, Stitch // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); - if (frames == nullptr || frames->empty()) + if (frames == NULL || frames->empty()) { return; // Couldn't load a texture, skip it } @@ -248,10 +248,10 @@ StitchedTexture *PreStitchedTextureMap::getTexture(const wstring &name) app.DebugPrintf("Not implemented!\n"); __debugbreak(); #endif - return nullptr; + return NULL; #if 0 StitchedTexture *result = texturesByName.find(name)->second; - if (result == nullptr) result = missingPosition; + if (result == NULL) result = missingPosition; return result; #endif } @@ -272,10 +272,10 @@ Texture *PreStitchedTextureMap::getStitchedTexture() // 4J Stu - register is a reserved keyword in C++ Icon *PreStitchedTextureMap::registerIcon(const wstring &name) { - Icon *result = nullptr; + Icon *result = NULL; if (name.empty()) { - app.DebugPrintf("Don't register nullptr\n"); + app.DebugPrintf("Don't register NULL\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/Minecraft.Client/QuadrupedModel.cpp b/Minecraft.Client/QuadrupedModel.cpp index 23d1758b..ea041910 100644 --- a/Minecraft.Client/QuadrupedModel.cpp +++ b/Minecraft.Client/QuadrupedModel.cpp @@ -10,27 +10,27 @@ QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() head = new ModelPart(this, 0, 0); head->addBox(-4, -4, -8, 8, 8, 8, g); // Head - head->setPos(0, static_cast(12 + 6 - legSize), -6); + head->setPos(0, (float)(12 + 6 - legSize), -6); body = new ModelPart(this, 28, 8); body->addBox(-5, -10, -7, 10, 16, 8, g); // Body - body->setPos(0, static_cast(11 + 6 - legSize), 2); + body->setPos(0, (float)(11 + 6 - legSize), 2); leg0 = new ModelPart(this, 0, 16); leg0->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg0 - leg0->setPos(-3, static_cast(18 + 6 - legSize), 7); + leg0->setPos(-3, (float)(18 + 6 - legSize), 7); leg1 = new ModelPart(this, 0, 16); leg1->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg1 - leg1->setPos(3, static_cast(18 + 6 - legSize), 7); + leg1->setPos(3, (float)(18 + 6 - legSize), 7); leg2 = new ModelPart(this, 0, 16); leg2->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg2 - leg2->setPos(-3, static_cast(18 + 6 - legSize), -5); + leg2->setPos(-3, (float)(18 + 6 - legSize), -5); leg3 = new ModelPart(this, 0, 16); leg3->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg3 - leg3->setPos(3, static_cast(18 + 6 - legSize), -5); + leg3->setPos(3, (float)(18 + 6 - legSize), -5); // 4J added - compile now to avoid random performance hit first time cubes are rendered head->compile(1.0f/16.0f); diff --git a/Minecraft.Client/ReceivingLevelScreen.cpp b/Minecraft.Client/ReceivingLevelScreen.cpp index 2969b053..0e9fe3ec 100644 --- a/Minecraft.Client/ReceivingLevelScreen.cpp +++ b/Minecraft.Client/ReceivingLevelScreen.cpp @@ -23,9 +23,9 @@ void ReceivingLevelScreen::tick() tickCount++; if (tickCount % 20 == 0) { - connection->send(std::make_shared()); + connection->send( shared_ptr( new KeepAlivePacket() ) ); } - if (connection != nullptr) + if (connection != NULL) { connection->tick(); } diff --git a/Minecraft.Client/RedDustParticle.cpp b/Minecraft.Client/RedDustParticle.cpp index 69eb225a..6a6ad1e1 100644 --- a/Minecraft.Client/RedDustParticle.cpp +++ b/Minecraft.Client/RedDustParticle.cpp @@ -14,16 +14,16 @@ void RedDustParticle::init(Level *level, double x, double y, double z, float sca { rCol = 1; } - float brr = static_cast(Math::random()) * 0.4f + 0.6f; - this->rCol = (static_cast(Math::random() * 0.2f) + 0.8f) * rCol * brr; - this->gCol = (static_cast(Math::random() * 0.2f) + 0.8f) * gCol * brr; - this->bCol = (static_cast(Math::random() * 0.2f) + 0.8f) * bCol * brr; + float brr = (float) Math::random() * 0.4f + 0.6f; + this->rCol = ((float) (Math::random() * 0.2f) + 0.8f) * rCol * brr; + this->gCol = ((float) (Math::random() * 0.2f) + 0.8f) * gCol * brr; + this->bCol = ((float) (Math::random() * 0.2f) + 0.8f) * bCol * brr; size *= 0.75f; size *= scale; oSize = size; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); - lifetime = static_cast(lifetime * scale); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int)(lifetime * scale); noPhysics = false; } diff --git a/Minecraft.Client/RemotePlayer.cpp b/Minecraft.Client/RemotePlayer.cpp index dcfd6992..bea12842 100644 --- a/Minecraft.Client/RemotePlayer.cpp +++ b/Minecraft.Client/RemotePlayer.cpp @@ -58,7 +58,7 @@ void RemotePlayer::tick() walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f; walkAnimPos += walkAnimSpeed; - if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != nullptr) + if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != NULL) { shared_ptr item = inventory->items[inventory->selected]; startUsingItem(inventory->items[inventory->selected], Item::items[item->id]->getUseDuration(item)); @@ -103,8 +103,8 @@ void RemotePlayer::aiStep() while (yrd >= 180) yrd -= 360; - yRot += static_cast((yrd) / lSteps); - xRot += static_cast((lxr - xRot) / lSteps); + yRot += (float)((yrd) / lSteps); + xRot += (float)((lxr - xRot) / lSteps); lSteps--; setPos(xt, yt, zt); @@ -113,7 +113,7 @@ void RemotePlayer::aiStep() oBob = bob; float tBob = (float) Mth::sqrt(xd * xd + zd * zd); - float tTilt = static_cast(atan(-yd * 0.2f)) * 15.0f; + float tTilt = (float) atan(-yd * 0.2f) * 15.0f; if (tBob > 0.1f) tBob = 0.1f; if (!onGround || getHealth() <= 0) tBob = 0; if (onGround || getHealth() <= 0) tTilt = 0; diff --git a/Minecraft.Client/RenameWorldScreen.cpp b/Minecraft.Client/RenameWorldScreen.cpp index 4255201c..ea05039a 100644 --- a/Minecraft.Client/RenameWorldScreen.cpp +++ b/Minecraft.Client/RenameWorldScreen.cpp @@ -8,7 +8,7 @@ RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const wstring& levelId) { - nameEdit = nullptr; + nameEdit = NULL; this->lastScreen = lastScreen; this->levelId = levelId; } diff --git a/Minecraft.Client/ResourceLocation.h b/Minecraft.Client/ResourceLocation.h index 1274b25a..f53c46c8 100644 --- a/Minecraft.Client/ResourceLocation.h +++ b/Minecraft.Client/ResourceLocation.h @@ -34,7 +34,7 @@ public: m_texture = textureNameArray(textures.length); for(unsigned int i = 0; i < textures.length; ++i) { - m_texture[i] = static_cast<_TEXTURE_NAME>(textures[i]); + m_texture[i] = (_TEXTURE_NAME)textures[i]; } m_preloaded = true; } diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 041f8175..9b753146 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -14,13 +14,13 @@ Screen::Screen() // 4J added { - minecraft = nullptr; + minecraft = NULL; width = 0; height = 0; passEvents = false; - font = nullptr; - particles = nullptr; - clickedButton = nullptr; + font = NULL; + particles = NULL; + clickedButton = NULL; } void Screen::render(int xm, int ym, float a) @@ -36,7 +36,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) { if (eventKey == Keyboard::KEY_ESCAPE) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); // minecraft->grabMouse(); // 4J - removed } } @@ -44,12 +44,12 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) wstring Screen::getClipboard() { #ifdef _WINDOWS64 - if (!OpenClipboard(nullptr)) return wstring(); + if (!OpenClipboard(NULL)) return wstring(); HANDLE h = GetClipboardData(CF_UNICODETEXT); wstring out; if (h) { - const wchar_t *p = static_cast(GlobalLock(h)); + const wchar_t *p = reinterpret_cast(GlobalLock(h)); if (p) { out = p; GlobalUnlock(h); } } CloseClipboard(); @@ -62,7 +62,7 @@ wstring Screen::getClipboard() void Screen::setClipboard(const wstring& str) { #ifdef _WINDOWS64 - if (!OpenClipboard(nullptr)) return; + if (!OpenClipboard(NULL)) return; EmptyClipboard(); size_t len = (str.length() + 1) * sizeof(wchar_t); HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, len); @@ -89,10 +89,10 @@ void Screen::mouseClicked(int x, int y, int buttonNum) void Screen::mouseReleased(int x, int y, int buttonNum) { - if (clickedButton!=nullptr && buttonNum==0) + if (clickedButton!=NULL && buttonNum==0) { clickedButton->released(x, y); - clickedButton = nullptr; + clickedButton = NULL; } } @@ -284,7 +284,7 @@ void Screen::renderBackground() void Screen::renderBackground(int vo) { - if (minecraft->level != nullptr) + if (minecraft->level != NULL) { fillGradient(0, 0, width, height, 0xc0101010, 0xd0101010); } diff --git a/Minecraft.Client/ScreenSizeCalculator.cpp b/Minecraft.Client/ScreenSizeCalculator.cpp index 38aa75a8..32e942a7 100644 --- a/Minecraft.Client/ScreenSizeCalculator.cpp +++ b/Minecraft.Client/ScreenSizeCalculator.cpp @@ -21,10 +21,10 @@ ScreenSizeCalculator::ScreenSizeCalculator(Options *options, int width, int heig { scale = forceScale; } - rawWidth = w / static_cast(scale); - rawHeight = h / static_cast(scale); - w = static_cast(ceil(rawWidth)); - h = static_cast(ceil(rawHeight)); + rawWidth = w / (double) scale; + rawHeight = h / (double) scale; + w = (int) ceil(rawWidth); + h = (int) ceil(rawHeight); } int ScreenSizeCalculator::getWidth() diff --git a/Minecraft.Client/ScrolledSelectionList.cpp b/Minecraft.Client/ScrolledSelectionList.cpp index 953695ab..9b7367ce 100644 --- a/Minecraft.Client/ScrolledSelectionList.cpp +++ b/Minecraft.Client/ScrolledSelectionList.cpp @@ -72,7 +72,7 @@ void ScrolledSelectionList::renderDecorations(int mouseX, int mouseY) int x0 = width / 2 - (92 + 16 + 2); int x1 = width / 2 + (92 + 16 + 2); - int clickSlotPos = (y - y0 - headerHeight + static_cast(yo) - 4); + int clickSlotPos = (y - y0 - headerHeight + (int) yo - 4); int slot = clickSlotPos / itemHeight; if (x >= x0 && x <= x1 && slot >= 0 && clickSlotPos >= 0 && slot < getNumberOfItems()) { @@ -92,7 +92,7 @@ void ScrolledSelectionList::capYPosition() int max = getMaxPosition() - (y1 - y0 - 4); if (max < 0) max /= 2; if (yo < 0) yo = 0; - if (yo > max) yo = static_cast(max); + if (yo > max) yo = (float)max; } void ScrolledSelectionList::buttonClicked(Button *button) diff --git a/Minecraft.Client/SelectWorldScreen.cpp b/Minecraft.Client/SelectWorldScreen.cpp index c6d417c5..ebae8c83 100644 --- a/Minecraft.Client/SelectWorldScreen.cpp +++ b/Minecraft.Client/SelectWorldScreen.cpp @@ -16,11 +16,11 @@ SelectWorldScreen::SelectWorldScreen(Screen *lastScreen) title = L"Select world"; done = false; selectedWorld = 0; - worldSelectionList = nullptr; + worldSelectionList = NULL; isDeleting = false; - deleteButton = nullptr; - selectButton = nullptr; - renameButton = nullptr; + deleteButton = NULL; + selectButton = NULL; + renameButton = NULL; this->lastScreen = lastScreen; } @@ -115,14 +115,14 @@ void SelectWorldScreen::buttonClicked(Button *button) else { // create demo world - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); if (done) return; done = true; // 4J Stu - Not used, so commenting to stop the build failing #if 0 minecraft->gameMode = new DemoMode(minecraft); minecraft->selectLevel(CreateWorldScreen::findAvailableFolderName(minecraft->getLevelSource(), L"Demo"), L"Demo World", 0L); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); #endif } } @@ -142,20 +142,20 @@ void SelectWorldScreen::buttonClicked(Button *button) void SelectWorldScreen::worldSelected(int id) { - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); if (done) return; done = true; - minecraft->gameMode = nullptr; //new SurvivalMode(minecraft); + minecraft->gameMode = NULL; //new SurvivalMode(minecraft); wstring worldFolderName = getWorldId(id); - if (worldFolderName == L"") // 4J - was nullptr comparison + if (worldFolderName == L"") // 4J - was NULL comparison { worldFolderName = L"World" + std::to_wstring(id); } // 4J Stu - Not used, so commenting to stop the build failing #if 0 minecraft->selectLevel(worldFolderName, getWorldName(id), 0); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); #endif } @@ -235,7 +235,7 @@ SelectWorldScreen::WorldSelectionList::WorldSelectionList(SelectWorldScreen *sws int SelectWorldScreen::WorldSelectionList::getNumberOfItems() { - return static_cast(this->parent->levelList->size()); + return (int)this->parent->levelList->size(); } void SelectWorldScreen::WorldSelectionList::selectItem(int item, bool doubleClick) @@ -259,7 +259,7 @@ bool SelectWorldScreen::WorldSelectionList::isSelectedItem(int item) int SelectWorldScreen::WorldSelectionList::getMaxPosition() { - return static_cast(parent->levelList->size()) * 36; + return (int)parent->levelList->size() * 36; } void SelectWorldScreen::WorldSelectionList::renderBackground() diff --git a/Minecraft.Client/ServerChunkCache.cpp b/Minecraft.Client/ServerChunkCache.cpp index c7d70c7d..3af98ca6 100644 --- a/Minecraft.Client/ServerChunkCache.cpp +++ b/Minecraft.Client/ServerChunkCache.cpp @@ -71,7 +71,7 @@ bool ServerChunkCache::hasChunk(int x, int z) if( ( iz < 0 ) || ( iz >= XZSIZE ) ) return true; int idx = ix * XZSIZE + iz; LevelChunk *lc = cache[idx]; - if( lc == nullptr ) return false; + if( lc == NULL ) return false; return true; } @@ -148,13 +148,13 @@ LevelChunk *ServerChunkCache::create(int x, int z, bool asyncPostProcess) // 4J LevelChunk *chunk = cache[idx]; LevelChunk *lastChunk = chunk; - if( ( chunk == nullptr ) || ( chunk->x != x ) || ( chunk->z != z ) ) + if( ( chunk == NULL ) || ( chunk->x != x ) || ( chunk->z != z ) ) { EnterCriticalSection(&m_csLoadCreate); chunk = load(x, z); - if (chunk == nullptr) + if (chunk == NULL) { - if (source == nullptr) + if (source == NULL) { chunk = emptyChunk; } @@ -163,7 +163,7 @@ LevelChunk *ServerChunkCache::create(int x, int z, bool asyncPostProcess) // 4J chunk = source->getChunk(x, z); } } - if (chunk != nullptr) + if (chunk != NULL) { chunk->load(); } @@ -320,7 +320,7 @@ void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) if( ( iz < 0 ) || ( iz >= XZSIZE ) ) assert(0); int idx = ix * XZSIZE + iz; - LevelChunk *chunk = nullptr; + LevelChunk *chunk = NULL; chunk = source->getChunk(x, z); assert(chunk); if(chunk) @@ -389,22 +389,22 @@ void ServerChunkCache::dontDrop(int x, int z) LevelChunk *ServerChunkCache::load(int x, int z) { - if (storage == nullptr) return nullptr; + if (storage == NULL) return NULL; - LevelChunk *levelChunk = nullptr; + LevelChunk *levelChunk = NULL; #ifdef _LARGE_WORLDS int ix = x + XZOFFSET; int iz = z + XZOFFSET; int idx = ix * XZSIZE + iz; levelChunk = m_unloadedCache[idx]; - m_unloadedCache[idx] = nullptr; - if(levelChunk == nullptr) + m_unloadedCache[idx] = NULL; + if(levelChunk == NULL) #endif { levelChunk = storage->load(level, x, z); } - if (levelChunk != nullptr) + if (levelChunk != NULL) { levelChunk->lastSaveTime = level->getGameTime(); } @@ -413,14 +413,14 @@ LevelChunk *ServerChunkCache::load(int x, int z) void ServerChunkCache::saveEntities(LevelChunk *levelChunk) { - if (storage == nullptr) return; + if (storage == NULL) return; storage->saveEntities(level, levelChunk); } void ServerChunkCache::save(LevelChunk *levelChunk) { - if (storage == nullptr) return; + if (storage == NULL) return; levelChunk->lastSaveTime = level->getGameTime(); storage->save(level, levelChunk); @@ -542,7 +542,7 @@ void ServerChunkCache::postProcess(ChunkSource *parent, int x, int z ) LevelChunk *chunk = getChunk(x, z); if ( (chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) == 0 ) { - if (source != nullptr) + if (source != NULL) { PIXBeginNamedEvent(0,"Main post processing"); source->postProcess(parent, x, z); @@ -659,7 +659,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != nullptr) + if (progressListener != NULL) { if (++cc % 10 == 0) { @@ -679,19 +679,19 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) vector sortedChunkList; - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } @@ -712,7 +712,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != nullptr) + if (progressListener != NULL) { if (++cc % 10 == 0) { @@ -741,21 +741,21 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) for(unsigned int i = 0; i < 3; ++i) { - saveThreads[i] = nullptr; + saveThreads[i] = NULL; threadData[i].cache = this; - wakeEvent[i] = new C4JThread::Event(); //CreateEvent(nullptr,FALSE,FALSE,nullptr); + wakeEvent[i] = new C4JThread::Event(); //CreateEvent(NULL,FALSE,FALSE,NULL); threadData[i].wakeEvent = wakeEvent[i]; - notificationEvent[i] = new C4JThread::Event(); //CreateEvent(nullptr,FALSE,FALSE,nullptr); + notificationEvent[i] = new C4JThread::Event(); //CreateEvent(NULL,FALSE,FALSE,NULL); threadData[i].notificationEvent = notificationEvent[i]; if(i==0) threadData[i].useSharedThreadStorage = true; else threadData[i].useSharedThreadStorage = false; } - LevelChunk *chunk = nullptr; + LevelChunk *chunk = NULL; byte workingThreads; bool chunkSet = false; @@ -764,19 +764,19 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) vector sortedChunkList; - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z < 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x >= 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } - for( size_t i = 0; i < m_loadedChunkList.size(); i++ ) + for( int i = 0; i < m_loadedChunkList.size(); i++ ) { if( ( m_loadedChunkList[i]->x < 0 ) && ( m_loadedChunkList[i]->z >= 0 ) ) sortedChunkList.push_back(m_loadedChunkList[i]); } @@ -804,13 +804,13 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) //app.DebugPrintf("Chunk to save set for thread %d\n", j); - if(saveThreads[j] == nullptr) + if(saveThreads[j] == NULL) { char threadName[256]; sprintf(threadName,"Save thread %d\n",j); SetThreadName(threadId[j], threadName); - //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); + //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName); @@ -836,7 +836,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != nullptr) + if (progressListener != NULL) { if (count > 0 && ++cc % 10 == 0) { @@ -850,7 +850,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) if( !chunkSet ) { - threadData[j].chunkToSave = nullptr; + threadData[j].chunkToSave = NULL; //app.DebugPrintf("No chunk to save set for thread %d\n",j); } } @@ -882,13 +882,13 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) unsigned char validThreads = 0; for(unsigned int i = 0; i < 3; ++i) { - //app.DebugPrintf("Settings chunk to nullptr for save thread %d\n", i); - threadData[i].chunkToSave = nullptr; + //app.DebugPrintf("Settings chunk to NULL for save thread %d\n", i); + threadData[i].chunkToSave = NULL; //app.DebugPrintf("Setting wake event for save thread %d\n",i); threadData[i].wakeEvent->Set(); //SetEvent(threadData[i].wakeEvent); - if(saveThreads[i] != nullptr) ++validThreads; + if(saveThreads[i] != NULL) ++validThreads; } //WaitForMultipleObjects(validThreads,saveThreads,TRUE,INFINITE); @@ -910,7 +910,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) if (force) { - if (storage == nullptr) + if (storage == NULL) { LeaveCriticalSection(&m_csLoadCreate); return true; @@ -955,14 +955,14 @@ bool ServerChunkCache::tick() int iz = chunk->z + XZOFFSET; int idx = ix * XZSIZE + iz; m_unloadedCache[idx] = chunk; - cache[idx] = nullptr; + cache[idx] = NULL; } } m_toDrop.pop_front(); } } #endif - if (storage != nullptr) storage->tick(); + if (storage != NULL) storage->tick(); } return source->tick(); @@ -995,7 +995,7 @@ void ServerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ) int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) { - SaveThreadData *params = static_cast(lpParam); + SaveThreadData *params = (SaveThreadData *)lpParam; if(params->useSharedThreadStorage) { @@ -1013,7 +1013,7 @@ int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) //app.DebugPrintf("Save thread has started\n"); - while(params->chunkToSave != nullptr) + while(params->chunkToSave != NULL) { PIXBeginNamedEvent(0,"Saving entities"); //app.DebugPrintf("Save thread has started processing a chunk\n"); diff --git a/Minecraft.Client/ServerConnection.cpp b/Minecraft.Client/ServerConnection.cpp index cca4c619..07616aa4 100644 --- a/Minecraft.Client/ServerConnection.cpp +++ b/Minecraft.Client/ServerConnection.cpp @@ -78,7 +78,7 @@ void ServerConnection::tick() // uc.disconnect("Internal server error"); // logger.log(Level.WARNING, "Failed to handle packet: " + e, e); // } - if(uc->connection != nullptr) uc->connection->flush(); + if(uc->connection != NULL) uc->connection->flush(); } } @@ -167,7 +167,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptrlevels.length; ++i) { - if( pMinecraft->levels[i] != nullptr ) + if( pMinecraft->levels[i] != NULL ) { app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data); pMinecraft->levels[i]->difficulty = packet->data; diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index f158a1d9..242a0df9 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -42,7 +42,7 @@ WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS; -C4JThread* ServerLevel::m_updateThread = nullptr; +C4JThread* ServerLevel::m_updateThread = NULL; C4JThread::EventArray* ServerLevel::m_updateTrigger; CRITICAL_SECTION ServerLevel::m_updateCS[3]; @@ -63,7 +63,7 @@ void ServerLevel::staticCtor() InitializeCriticalSection(&m_updateCS[1]); InitializeCriticalSection(&m_updateCS[2]); - m_updateThread = new C4JThread(runUpdate, nullptr, "Tile update"); + m_updateThread = new C4JThread(runUpdate, NULL, "Tile update"); m_updateThread->SetProcessor(CPU_CORE_TILE_UPDATE); #ifdef __ORBIS__ m_updateThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also used for Matching 2, and that priority of that seems to be always at default no matter what we set it to. Prioritise this below Matching 2. @@ -123,7 +123,7 @@ ServerLevel::ServerLevel(MinecraftServer *server, shared_ptrlevelS scoreboard = new ServerScoreboard(server); //shared_ptr scoreboardSaveData = dynamic_pointer_cast( savedDataStorage->get(typeid(ScoreboardSaveData), ScoreboardSaveData::FILE_ID) ); - //if (scoreboardSaveData == nullptr) + //if (scoreboardSaveData == NULL) //{ // scoreboardSaveData = shared_ptr( new ScoreboardSaveData() ); // savedDataStorage->set(ScoreboardSaveData::FILE_ID, scoreboardSaveData); @@ -258,7 +258,7 @@ void ServerLevel::tick() { //app.DebugPrintf("Incremental save\n"); PIXBeginNamedEvent(0,"Incremental save"); - save(false, nullptr); + save(false, NULL); PIXEndNamedEvent(); } @@ -313,9 +313,9 @@ void ServerLevel::tick() Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z) { vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); - if (mobList == nullptr || mobList->empty()) return nullptr; + if (mobList == NULL || mobList->empty()) return NULL; - return static_cast(WeighedRandom::getRandomItem(random, (vector *)mobList)); + return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (vector *)mobList); } void ServerLevel::updateSleepingPlayerList() @@ -433,7 +433,7 @@ void ServerLevel::tickTiles() if( hasChunkAt(x,y,z) ) { int id = getTile(x,y,z); - if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking()) + if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking()) { /*if(id == 2) ++grassTicks; else if(id == 11) ++lavaTicks; @@ -497,7 +497,7 @@ void ServerLevel::tickTiles() if (isRainingAt(x, y, z)) { - addGlobalEntity(std::make_shared(this, x, y, z)); + addGlobalEntity( shared_ptr( new LightningBolt(this, x, y, z) ) ); } } @@ -640,8 +640,8 @@ void ServerLevel::resetEmptyTime() bool ServerLevel::tickPendingTicks(bool force) { EnterCriticalSection(&m_tickNextTickCS); - int count = static_cast(tickNextTickList.size()); - int count2 = static_cast(tickNextTickSet.size()); + int count = (int)tickNextTickList.size(); + int count2 = (int)tickNextTickSet.size(); if (count != tickNextTickSet.size()) { // TODO 4J Stu - Add new exception types @@ -685,8 +685,8 @@ bool ServerLevel::tickPendingTicks(bool force) toBeTicked.clear(); - int count3 = static_cast(tickNextTickList.size()); - int count4 = static_cast(tickNextTickSet.size()); + int count3 = (int)tickNextTickList.size(); + int count4 = (int)tickNextTickSet.size(); bool retval = tickNextTickList.size() != 0; LeaveCriticalSection(&m_tickNextTickCS); @@ -776,7 +776,7 @@ void ServerLevel::tick(shared_ptr e, bool actual) { e->remove(); } - if (!server->isNpcsEnabled() && (dynamic_pointer_cast(e) != nullptr)) + if (!server->isNpcsEnabled() && (dynamic_pointer_cast(e) != NULL)) { e->remove(); } @@ -860,7 +860,7 @@ void ServerLevel::setInitialSpawn(LevelSettings *levelSettings) int minXZ = - (dimension->getXZSize() * 16 ) / 2; int maxXZ = (dimension->getXZSize() * 16 ) / 2 - 1; - if (findBiome != nullptr) + if (findBiome != NULL) { xSpawn = findBiome->x; zSpawn = findBiome->z; @@ -914,7 +914,7 @@ void ServerLevel::generateBonusItemsNearSpawn() if( getTile( x, y, z ) == Tile::chest_Id ) { shared_ptr chest = dynamic_pointer_cast(getTileEntity(x, y, z)); - if (chest != nullptr) + if (chest != NULL) { if( chest->isBonusChest ) { @@ -960,7 +960,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut if(StorageManager.GetSaveDisabled()) return; - if (progressListener != nullptr) + if (progressListener != NULL) { if(bAutosave) { @@ -976,7 +976,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut saveLevelData(); PIXEndNamedEvent(); - if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS); + if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS); #if defined(_XBOX_ONE) || defined(__ORBIS__) // Our autosave is a minimal save. All the chunks are saves by the constant save process @@ -1009,7 +1009,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut //if( force && !isClientSide ) //{ - // if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + // if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); // levelStorage->flushSaveFile(); //} } @@ -1024,7 +1024,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave) if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=static_cast(tPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; DLCPack * pDLCPack=pDLCTexPack->getDLCInfoParentPack(); @@ -1034,7 +1034,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave) } } - if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); levelStorage->flushSaveFile(autosave); } @@ -1085,7 +1085,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr e) { if (Level::addGlobalEntity(e)) { - server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, std::make_shared(e)); + server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, shared_ptr( new AddGlobalEntityPacket(e) ) ); return true; } return false; @@ -1093,7 +1093,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr e) void ServerLevel::broadcastEntityEvent(shared_ptr e, byte event) { - shared_ptr p = std::make_shared(e->entityId, event); + shared_ptr p = shared_ptr( new EntityEventPacket(e->entityId, event) ); server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p); } @@ -1101,7 +1101,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, { // instead of calling super, we run the same explosion code here except // we don't generate any particles - shared_ptr explosion = std::make_shared(this, source, x, y, z, r); + shared_ptr explosion = shared_ptr( new Explosion(this, source, x, y, z, r) ); explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); @@ -1122,7 +1122,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, if( sentTo.size() ) { INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == nullptr ) + if( thisPlayer == NULL ) { continue; } @@ -1131,7 +1131,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, for(auto& player2 : sentTo) { INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { knockbackOnly = true; } @@ -1144,7 +1144,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player); //app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z); // If the player is not the primary on the system, then we only want to send info for the knockback - player->connection->send(std::make_shared(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly)); + player->connection->send( shared_ptr( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly))); sentTo.push_back( player ); } } @@ -1182,7 +1182,7 @@ void ServerLevel::runTileEvents() if (doTileEvent(&it)) { TileEventData te = it; - server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, std::make_shared(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB())); + server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, shared_ptr( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()))); } } tileEvents[runList].clear(); @@ -1212,11 +1212,11 @@ void ServerLevel::tickWeather() { if (wasRaining) { - server->getPlayers()->broadcastAll(std::make_shared(GameEventPacket::STOP_RAINING, 0)); + server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) ); } else { - server->getPlayers()->broadcastAll(std::make_shared(GameEventPacket::START_RAINING, 0)); + server->getPlayers()->broadcastAll( shared_ptr( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) ); } } @@ -1268,7 +1268,7 @@ void ServerLevel::sendParticles(const wstring &name, double x, double y, double void ServerLevel::sendParticles(const wstring &name, double x, double y, double z, int count, double xDist, double yDist, double zDist, double speed) { - shared_ptr packet = std::make_shared( name, static_cast(x), static_cast(y), static_cast(z), static_cast(xDist), static_cast(yDist), static_cast(zDist), static_cast(speed), count ); + shared_ptr packet = std::make_shared( name, (float) x, (float) y, (float) z, (float) xDist, (float) yDist, (float) zDist, (float) speed, count ); for(auto& it : players) { @@ -1578,7 +1578,7 @@ int ServerLevel::runUpdate(void* lpParam) if( (id == Tile::grass_Id && grassTicks >= MAX_GRASS_TICKS) || (id == Tile::calmLava_Id && lavaTicks >= MAX_LAVA_TICKS) ) continue; // 4J Stu - Added shouldTileTick as some tiles won't even do anything if they are set to tick and use up one of our updates - if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) ) + if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) ) { if(id == Tile::grass_Id) ++grassTicks; else if(id == Tile::calmLava_Id) ++lavaTicks; diff --git a/Minecraft.Client/ServerLevelListener.cpp b/Minecraft.Client/ServerLevelListener.cpp index 3884b469..c191b1a9 100644 --- a/Minecraft.Client/ServerLevelListener.cpp +++ b/Minecraft.Client/ServerLevelListener.cpp @@ -117,9 +117,9 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int p for(auto& p : server->getPlayers()->players) { if (p == nullptr || p->level != level || p->entityId == id) continue; - double xd = static_cast(x) - p->x; - double yd = static_cast(y) - p->y; - double zd = static_cast(z) - p->z; + double xd = (double) x - p->x; + double yd = (double) y - p->y; + double zd = (double) z - p->z; if (xd * xd + yd * yd + zd * zd < 32 * 32) { diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 10486de1..789b3176 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -101,7 +101,7 @@ ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring& waterDepth++; } attemptCount++; - playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != nullptr ); + playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != NULL ); } while ( ( waterDepth > 1 ) && (!playerNear) && ( attemptCount < 20 ) ); xx = xx2; yy = yy2; @@ -180,7 +180,7 @@ void ServerPlayer::readAdditionalSaveData(CompoundTag *entityTag) } GameRulesInstance *grs = gameMode->getGameRules(); - if (entityTag->contains(L"GameRules") && grs != nullptr) + if (entityTag->contains(L"GameRules") && grs != NULL) { byteArray ba = entityTag->getByteArray(L"GameRules"); ByteArrayInputStream bais(ba); @@ -197,13 +197,13 @@ void ServerPlayer::addAdditonalSaveData(CompoundTag *entityTag) Player::addAdditonalSaveData(entityTag); GameRulesInstance *grs = gameMode->getGameRules(); - if (grs != nullptr) + if (grs != NULL) { ByteArrayOutputStream baos; DataOutputStream dos(&baos); grs->write(&dos); entityTag->putByteArray(L"GameRules", baos.buf); - baos.buf.data = nullptr; + baos.buf.data = NULL; dos.close(); baos.close(); } @@ -280,7 +280,7 @@ void ServerPlayer::flushEntitiesToRemove() it = entitiesToRemove.erase(it); } - connection->send(std::make_shared(ids)); + connection->send(shared_ptr(new RemoveEntitiesPacket(ids))); } } @@ -308,14 +308,14 @@ void ServerPlayer::doTickA() for (unsigned int i = 0; i < inventory->getContainerSize(); i++) { shared_ptr ie = inventory->getItem(i); - if (ie != nullptr) + if (ie != NULL) { // 4J - removed condition. These were getting lower priority than tile update packets etc. on the slow outbound queue, and so were extremely slow to send sometimes, // particularly at the start of a game. They don't typically seem to be massive and shouldn't be send when there isn't actually any updating to do. if (Item::items[ie->id]->isComplex() ) // && connection->countDelayedPackets() <= 2) { shared_ptr packet = (dynamic_cast(Item::items[ie->id])->getUpdatePacket(ie, level, dynamic_pointer_cast( shared_from_this() ) ) ); - if (packet != nullptr) + if (packet != NULL) { connection->send(packet); } @@ -352,7 +352,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) } } - // if (nearest != nullptr) // 4J - removed as we don't have references here + // if (nearest != NULL) // 4J - removed as we don't have references here if( nearestValid ) { bool okToSend = false; @@ -372,7 +372,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // app.DebugPrintf("%d: canSendToPlayer %d, countDelayedPackets %d GetSendQueueSizeBytes %d done: %d\n", // connection->getNetworkPlayer()->GetSmallId(), // canSendToPlayer, connection->countDelayedPackets(), -// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ), +// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ), // connection->done); // } @@ -381,12 +381,12 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) #ifdef _XBOX_ONE // The network manager on xbox one doesn't currently split data into slow & fast queues - since we can only measure // both together then bytes provides a better metric than count of data items to determine if we should avoid queueing too much up - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( nullptr, true ) < 8192 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( NULL, true ) < 8192 )&& #elif defined _XBOX - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&& #else (connection->countDelayedPackets() < 4 )&& - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&& #endif //(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) && !connection->done) ) @@ -429,7 +429,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z); PIXBeginNamedEvent(0,"Creation BRUP for sending\n"); int64_t before = System::currentTimeMillis(); - const auto packet = std::make_shared(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level); + shared_ptr packet = shared_ptr( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) ); int64_t after = System::currentTimeMillis(); // app.DebugPrintf(">>><<< %d ms\n",after-before); PIXEndNamedEvent(); @@ -523,7 +523,7 @@ void ServerPlayer::doTickB() if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero)) { // 4J Stu - Added m_lastDamageSource for telemetry - connection->send(std::make_shared(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource)); + connection->send( shared_ptr( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) ); lastSentHealth = getHealth(); lastSentFood = foodData.getFoodLevel(); lastFoodSaturationZero = foodData.getSaturationLevel() == 0; @@ -550,7 +550,7 @@ void ServerPlayer::doTickB() if (totalExperience != lastSentExp) { lastSentExp = totalExperience; - connection->send(std::make_shared(experienceProgress, totalExperience, experienceLevel)); + connection->send( shared_ptr( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) ); } } @@ -584,7 +584,7 @@ void ServerPlayer::die(DamageSource *source) } shared_ptr killer = getKillCredit(); - if (killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore); + if (killer != NULL) killer->awardKillScore(shared_from_this(), deathScore); //awardStat(Stats::deaths, 1); } @@ -597,10 +597,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) //bool allowFallDamage = server->isPvpAllowed() && server->isDedicatedServer() && server->isPvpAllowed() && (dmgSource->msgId.compare(L"fall") == 0); if (!server->isPvpAllowed() && invulnerableTime > 0 && dmgSource != DamageSource::outOfWorld) return false; - if (dynamic_cast(dmgSource) != nullptr) + if (dynamic_cast(dmgSource) != NULL) { // 4J Stu - Fix for #46422 - TU5: Crash: Gameplay: Crash when being hit by a trap using a dispenser - // getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes nullptr. + // getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes NULL. shared_ptr source = dmgSource->getDirectEntity(); if (source->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(source)->canHarmPlayer(dynamic_pointer_cast(shared_from_this()))) @@ -608,10 +608,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) return false; } - if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) ) + if ( (source != NULL) && source->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = dynamic_pointer_cast(source); - if ( (arrow->owner != nullptr) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast(arrow->owner)) ) + if ( (arrow->owner != NULL) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast(arrow->owner)) ) { return false; } @@ -634,7 +634,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) else { shared_ptr source = dmgSource->getEntity(); - if( source != nullptr ) + if( source != NULL ) { switch(source->GetType()) { @@ -670,10 +670,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) m_lastDamageSource = eTelemetryPlayerDeathSource_Explosion_Tnt; break; case eTYPE_ARROW: - if ((dynamic_pointer_cast(source))->owner != nullptr) + if ((dynamic_pointer_cast(source))->owner != NULL) { shared_ptr attacker = (dynamic_pointer_cast(source))->owner; - if (attacker != nullptr) + if (attacker != NULL) { switch(attacker->GetType()) { @@ -712,7 +712,7 @@ bool ServerPlayer::canHarmPlayer(wstring targetName) bool canHarm = true; shared_ptr owner = server->getPlayers()->getPlayer(targetName); - if (owner != nullptr) + if (owner != NULL) { if ((shared_from_this() != owner) && canHarmPlayer(owner)) canHarm = false; } @@ -741,7 +741,7 @@ void ServerPlayer::changeDimension(int i) level->removeEntity(shared_from_this()); wonGame = true; m_enteredEndExitPortal = true; // We only flag this for the player in the portal - connection->send(std::make_shared(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); + connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if(thisPlayer) @@ -749,10 +749,10 @@ void ServerPlayer::changeDimension(int i) for(auto& servPlayer : MinecraftServer::getInstance()->getPlayers()->players) { INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); - if(thisPlayer != checkPlayer && checkPlayer != nullptr && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) + if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) { servPlayer->wonGame = true; - servPlayer->connection->send(std::make_shared(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); + servPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex()); } } @@ -766,7 +766,7 @@ void ServerPlayer::changeDimension(int i) awardStat(GenericStats::theEnd(), GenericStats::param_theEnd()); Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn(); - if (pos != nullptr) + if (pos != NULL) { connection->teleport(pos->x, pos->y, pos->z, 0, 0); delete pos; @@ -789,10 +789,10 @@ void ServerPlayer::changeDimension(int i) // 4J Added delay param void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) { - if (te != nullptr) + if (te != NULL) { shared_ptr p = te->getUpdatePacket(); - if (p != nullptr) + if (p != NULL) { p->shouldDelay = delay; if(delay) connection->queueSend(p); @@ -812,7 +812,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse); if (result == OK) { - shared_ptr p = std::make_shared(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z); + shared_ptr p = shared_ptr( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) ); getLevel()->getTracker()->broadcast(shared_from_this(), p); connection->teleport(this->x, this->y, this->z, yRot, xRot); connection->send(p); @@ -824,16 +824,16 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo { if (isSleeping()) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared(shared_from_this(), AnimatePacket::WAKE_UP)); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) ); } Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint); - if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot); + if (connection != NULL) connection->teleport(x, y, z, yRot, xRot); } void ServerPlayer::ride(shared_ptr e) { Player::ride(e); - connection->send(std::make_shared(SetEntityLinkPacket::RIDING, shared_from_this(), riding)); + connection->send( shared_ptr( new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, shared_from_this(), riding) ) ); // 4J Removed this - The act of riding will be handled on the client and will change the position // of the player. If we also teleport it then we can end up with a repeating movements, e.g. bouncing @@ -853,10 +853,10 @@ void ServerPlayer::doCheckFallDamage(double ya, bool onGround) void ServerPlayer::openTextEdit(shared_ptr sign) { shared_ptr signTE = dynamic_pointer_cast(sign); - if (signTE != nullptr) + if (signTE != NULL) { signTE->setAllowedPlayerEditor(dynamic_pointer_cast(shared_from_this())); - connection->send(std::make_shared(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)); + connection->send( shared_ptr( new TileEditorOpenPacket(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)) ); } } @@ -870,7 +870,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false)); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false) ) ); containerMenu = new CraftingMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -888,17 +888,17 @@ bool ServerPlayer::openFireworks(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false)); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) ); containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } - else if(dynamic_cast(containerMenu) != nullptr) + else if(dynamic_cast(containerMenu) != NULL) { closeContainer(); nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false)); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) ); containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -916,7 +916,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9, !name.empty())); + connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty()? L"" : name, 9, !name.empty() ) )); containerMenu = new EnchantmentMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -934,7 +934,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false)); + connection->send(shared_ptr ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false)) ); containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast(shared_from_this())); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -957,7 +957,7 @@ bool ServerPlayer::openContainer(shared_ptr container) int containerType = container->getContainerType(); assert(containerType >= 0); - connection->send(std::make_shared(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName())); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()) ) ); containerMenu = new ContainerMenu(inventory, container); containerMenu->containerId = containerCounter; @@ -976,7 +976,7 @@ bool ServerPlayer::openHopper(shared_ptr container) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) ); containerMenu = new HopperMenu(inventory, container); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -994,7 +994,7 @@ bool ServerPlayer::openHopper(shared_ptr container) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) ); containerMenu = new HopperMenu(inventory, container); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1012,7 +1012,7 @@ bool ServerPlayer::openFurnace(shared_ptr furnace) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName())); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()) ) ); containerMenu = new FurnaceMenu(inventory, furnace); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1030,7 +1030,7 @@ bool ServerPlayer::openTrap(shared_ptr trap) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName())); + connection->send( shared_ptr( new ContainerOpenPacket(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName() ) ) ); containerMenu = new TrapMenu(inventory, trap); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1048,7 +1048,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr brewingSt if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName())); + connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName() ))); containerMenu = new BrewingStandMenu(inventory, brewingStand); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1066,7 +1066,7 @@ bool ServerPlayer::openBeacon(shared_ptr beacon) if(containerMenu == inventoryMenu) { nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName())); + connection->send(shared_ptr( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName() ))); containerMenu = new BeaconMenu(inventory, beacon); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1087,12 +1087,12 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget, const wstring containerMenu = new MerchantMenu(inventory, traderTarget, level); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); - shared_ptr container = static_cast(containerMenu)->getTradeContainer(); + shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize(), !name.empty())); + connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty()?L"":name, container->getContainerSize(), !name.empty()))); MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast(shared_from_this())); - if (offers != nullptr) + if (offers != NULL) { ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); @@ -1101,7 +1101,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget, const wstring output.writeInt(containerCounter); offers->writeToStream(&output); - connection->send(std::make_shared(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray())); + connection->send(shared_ptr( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()))); } } else @@ -1119,7 +1119,7 @@ bool ServerPlayer::openHorseInventory(shared_ptr horse, shared_ptr< closeContainer(); } nextContainerCounter(); - connection->send(std::make_shared(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId)); + connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId ))); containerMenu = new HorseInventoryMenu(inventory, container, horse); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); @@ -1144,7 +1144,7 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex, return; } - connection->send(std::make_shared(container->containerId, slotIndex, item)); + connection->send( shared_ptr( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) ); } @@ -1157,8 +1157,8 @@ void ServerPlayer::refreshContainer(AbstractContainerMenu *menu) void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector > *items) { - connection->send(std::make_shared(container->containerId, items)); - connection->send(std::make_shared(-1, -1, inventory->getCarried())); + connection->send( shared_ptr( new ContainerSetContentPacket(container->containerId, items) ) ); + connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value) @@ -1173,12 +1173,12 @@ void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, in // client again. return; } - connection->send(std::make_shared(container->containerId, id, value)); + connection->send( shared_ptr( new ContainerSetDataPacket(container->containerId, id, value) ) ); } void ServerPlayer::closeContainer() { - connection->send(std::make_shared(containerMenu->containerId)); + connection->send( shared_ptr( new ContainerClosePacket(containerMenu->containerId) ) ); doCloseContainer(); } @@ -1192,7 +1192,7 @@ void ServerPlayer::broadcastCarriedItem() // client again. return; } - connection->send(std::make_shared(-1, -1, inventory->getCarried())); + connection->send( shared_ptr( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) ); } void ServerPlayer::doCloseContainer() @@ -1203,7 +1203,7 @@ void ServerPlayer::doCloseContainer() void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneaking) { - if(riding != nullptr) + if(riding != NULL) { if (xxa >= -1 && xxa <= 1) this->xxa = xxa; if (yya >= -1 && yya <= 1) this->yya = yya; @@ -1214,7 +1214,7 @@ void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneak void ServerPlayer::awardStat(Stat *stat, byteArray param) { - if (stat == nullptr) + if (stat == NULL) { delete [] param.data; return; @@ -1226,7 +1226,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param) int count = *((int*)param.data); delete [] param.data; - connection->send(std::make_shared(stat->id, count)); + connection->send( shared_ptr( new AwardStatPacket(stat->id, count) ) ); #else connection->send( shared_ptr( new AwardStatPacket(stat->id, param) ) ); // byteArray deleted in AwardStatPacket destructor. @@ -1237,7 +1237,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param) void ServerPlayer::disconnect() { - if (rider.lock() != nullptr) rider.lock()->ride(shared_from_this() ); + if (rider.lock() != NULL) rider.lock()->ride(shared_from_this() ); if (m_isSleeping) { stopSleepInBed(true, false, false); @@ -1257,19 +1257,19 @@ void ServerPlayer::displayClientMessage(int messageId) { case IDS_TILE_BED_OCCUPIED: messageType = ChatPacket::e_ChatBedOccupied; - connection->send(std::make_shared(L"", messageType)); + connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NO_SLEEP: messageType = ChatPacket::e_ChatBedNoSleep; - connection->send(std::make_shared(L"", messageType)); + connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOT_VALID: messageType = ChatPacket::e_ChatBedNotValid; - connection->send(std::make_shared(L"", messageType)); + connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_NOTSAFE: messageType = ChatPacket::e_ChatBedNotSafe; - connection->send(std::make_shared(L"", messageType)); + connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_TILE_BED_PLAYERSLEEP: messageType = ChatPacket::e_ChatBedPlayerSleep; @@ -1279,11 +1279,11 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatBedPlayerSleep)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep))); } else { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatBedMeSleep)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep))); } } return; @@ -1294,7 +1294,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerEnteredEnd)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd))); } } break; @@ -1304,13 +1304,13 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()!=player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerLeftEnd)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd))); } } break; case IDS_TILE_BED_MESLEEP: messageType = ChatPacket::e_ChatBedMeSleep; - connection->send(std::make_shared(L"", messageType)); + connection->send( shared_ptr( new ChatPacket(L"", messageType) ) ); break; case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED: @@ -1319,7 +1319,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows))); } } break; @@ -1329,7 +1329,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxChickens)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens))); } } break; @@ -1339,7 +1339,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxSquid)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid))); } } break; @@ -1349,7 +1349,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBats)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBats))); } } break; @@ -1359,7 +1359,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxWolves)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves))); } } break; @@ -1369,7 +1369,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxMooshrooms)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms))); } } break; @@ -1379,7 +1379,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxEnemies)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies))); } } break; @@ -1390,7 +1390,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxVillagers)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers))); } } break; @@ -1400,7 +1400,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows))); } } break; @@ -1410,7 +1410,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBredChickens)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens))); } } break; @@ -1420,7 +1420,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms))); } } break; @@ -1431,7 +1431,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBredWolves)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves))); } } break; @@ -1442,7 +1442,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerCantShearMooshroom)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom))); } } break; @@ -1454,7 +1454,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxHangingEntities)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities))); } } break; @@ -1464,7 +1464,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful))); } } break; @@ -1475,7 +1475,7 @@ void ServerPlayer::displayClientMessage(int messageId) shared_ptr player = server->getPlayers()->players[i]; if(shared_from_this()==player) { - player->connection->send(std::make_shared(name, ChatPacket::e_ChatPlayerMaxBoats)); + player->connection->send(shared_ptr( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats))); } } break; @@ -1493,7 +1493,7 @@ void ServerPlayer::displayClientMessage(int messageId) void ServerPlayer::completeUsingItem() { - connection->send(std::make_shared(entityId, EntityEvent::USE_ITEM_COMPLETE)); + connection->send(shared_ptr( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) ); Player::completeUsingItem(); } @@ -1501,9 +1501,9 @@ void ServerPlayer::startUsingItem(shared_ptr instance, int duratio { Player::startUsingItem(instance, duration); - if (instance != nullptr && instance->getItem() != nullptr && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) + if (instance != NULL && instance->getItem() != NULL && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared(shared_from_this(), AnimatePacket::EAT)); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); } } @@ -1519,21 +1519,21 @@ void ServerPlayer::restoreFrom(shared_ptr oldPlayer, bool restoreAll) void ServerPlayer::onEffectAdded(MobEffectInstance *effect) { Player::onEffectAdded(effect); - connection->send(std::make_shared(entityId, effect)); + connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes) { Player::onEffectUpdated(effect, doRefreshAttributes); - connection->send(std::make_shared(entityId, effect)); + connection->send(shared_ptr( new UpdateMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::onEffectRemoved(MobEffectInstance *effect) { Player::onEffectRemoved(effect); - connection->send(std::make_shared(entityId, effect)); + connection->send(shared_ptr( new RemoveMobEffectPacket(entityId, effect) ) ); } void ServerPlayer::teleportTo(double x, double y, double z) @@ -1543,34 +1543,34 @@ void ServerPlayer::teleportTo(double x, double y, double z) void ServerPlayer::crit(shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared(entity, AnimatePacket::CRITICAL_HIT)); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) )); } void ServerPlayer::magicCrit(shared_ptr entity) { - getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared(entity, AnimatePacket::MAGIC_CRITICAL_HIT)); + getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) )); } void ServerPlayer::onUpdateAbilities() { - if (connection == nullptr) return; - connection->send(std::make_shared(&abilities)); + if (connection == NULL) return; + connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); } ServerLevel *ServerPlayer::getLevel() { - return static_cast(level); + return (ServerLevel *) level; } void ServerPlayer::setGameMode(GameType *mode) { gameMode->setGameModeForPlayer(mode); - connection->send(std::make_shared(GameEventPacket::CHANGE_GAME_MODE, mode->getId())); + connection->send(shared_ptr(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId()))); } void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/) { - connection->send(std::make_shared(message, type, customData, additionalMessage)); + connection->send(shared_ptr(new ChatPacket(message,type,customData,additionalMessage))); } bool ServerPlayer::hasPermission(EGameCommand command) @@ -1651,7 +1651,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() { INetworkPlayer *player = connection->getNetworkPlayer(); - if( player != nullptr ) + if( player != NULL ) { DWORD rtt = player->GetCurrentRtt(); @@ -1666,7 +1666,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() void ServerPlayer::handleCollectItem(shared_ptr item) { - if(gameMode->getGameRules() != nullptr) gameMode->getGameRules()->onCollectItem(item); + if(gameMode->getGameRules() != NULL) gameMode->getGameRules()->onCollectItem(item); } #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.Client/ServerPlayerGameMode.cpp b/Minecraft.Client/ServerPlayerGameMode.cpp index d2dcaaf6..2e6bca35 100644 --- a/Minecraft.Client/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/ServerPlayerGameMode.cpp @@ -29,12 +29,12 @@ ServerPlayerGameMode::ServerPlayerGameMode(Level *level) this->level = level; // 4J Added - m_gameRules = nullptr; + m_gameRules = NULL; } ServerPlayerGameMode::~ServerPlayerGameMode() { - if(m_gameRules!=nullptr) delete m_gameRules; + if(m_gameRules!=NULL) delete m_gameRules; } void ServerPlayerGameMode::setGameModeForPlayer(GameType *gameModeForPlayer) @@ -86,7 +86,7 @@ void ServerPlayerGameMode::tick() { Tile *tile = Tile::tiles[t]; float destroyProgress = tile->getDestroyProgress(player, player->level, delayedDestroyX, delayedDestroyY, delayedDestroyZ) * (ticksSpentDestroying + 1); - int state = static_cast(destroyProgress * 10); + int state = (int) (destroyProgress * 10); if (state != lastSentState) { @@ -105,7 +105,7 @@ void ServerPlayerGameMode::tick() int t = level->getTile(xDestroyBlock, yDestroyBlock, zDestroyBlock); Tile *tile = Tile::tiles[t]; - if (tile == nullptr) + if (tile == NULL) { level->destroyTileProgress(player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1); lastSentState = -1; @@ -115,7 +115,7 @@ void ServerPlayerGameMode::tick() { int ticksSpentDestroying = gameTicks - destroyProgressStart; float destroyProgress = tile->getDestroyProgress(player, player->level, xDestroyBlock, yDestroyBlock, zDestroyBlock) * (ticksSpentDestroying + 1); - int state = static_cast(destroyProgress * 10); + int state = (int) (destroyProgress * 10); if (state != lastSentState) { @@ -166,7 +166,7 @@ void ServerPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) xDestroyBlock = x; yDestroyBlock = y; zDestroyBlock = z; - int state = static_cast(progress * 10); + int state = (int) (progress * 10); level->destroyTileProgress(player->entityId, x, y, z, state); lastSentState = state; } @@ -216,13 +216,13 @@ bool ServerPlayerGameMode::superDestroyBlock(int x, int y, int z) Tile *oldTile = Tile::tiles[level->getTile(x, y, z)]; int data = level->getData(x, y, z); - if (oldTile != nullptr) + if (oldTile != NULL) { oldTile->playerWillDestroy(level, x, y, z, data, player); } bool changed = level->removeTile(x, y, z); - if (oldTile != nullptr && changed) + if (oldTile != NULL && changed) { oldTile->destroy(level, x, y, z, data); } @@ -241,7 +241,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if (gameModeForPlayer->isCreative()) { - if (player->getCarriedItem() != nullptr && dynamic_cast(player->getCarriedItem()->getItem()) != nullptr) + if (player->getCarriedItem() != NULL && dynamic_cast(player->getCarriedItem()->getItem()) != NULL) { return false; } @@ -286,7 +286,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if (isCreative()) { - shared_ptr tup = std::make_shared(x, y, z, level); + shared_ptr tup = shared_ptr( new TileUpdatePacket(x, y, z, level) ); // 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate if( tup->block == 0 ) { @@ -298,7 +298,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) { shared_ptr item = player->getSelectedItem(); bool canDestroy = player->canDestroy(Tile::tiles[t]); - if (item != nullptr) + if (item != NULL) { item->mineBlock(level, t, x, y, z, player); if (item->count == 0) @@ -322,7 +322,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shar int oldCount = item->count; int oldAux = item->getAuxValue(); shared_ptr itemInstance = item->use(level, player); - if (itemInstance != item || (itemInstance != nullptr && (itemInstance->count != oldCount || itemInstance->getUseDuration() > 0 || itemInstance->getAuxValue() != oldAux))) + if (itemInstance != item || (itemInstance != NULL && (itemInstance->count != oldCount || itemInstance->getUseDuration() > 0 || itemInstance->getAuxValue() != oldAux))) { player->inventory->items[player->inventory->selected] = itemInstance; if (isCreative()) @@ -348,7 +348,7 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr player, Level *level, sh { // 4J-PB - Adding a test only version to allow tooltips to be displayed int t = level->getTile(x, y, z); - if (!player->isSneaking() || player->getCarriedItem() == nullptr) + if (!player->isSneaking() || player->getCarriedItem() == NULL) { if (t > 0 && player->isAllowedToUse(Tile::tiles[t])) { @@ -360,14 +360,14 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr player, Level *level, sh { if (Tile::tiles[t]->use(level, x, y, z, player, face, clickX, clickY, clickZ)) { - if(m_gameRules != nullptr) m_gameRules->onUseTile(t,x,y,z); + if(m_gameRules != NULL) m_gameRules->onUseTile(t,x,y,z); return true; } } } } - if (item == nullptr || !player->isAllowedToUse(item)) return false; + if (item == NULL || !player->isAllowedToUse(item)) return false; if (isCreative()) { int aux = item->getAuxValue(); @@ -391,6 +391,6 @@ void ServerPlayerGameMode::setLevel(ServerLevel *newLevel) // 4J Added void ServerPlayerGameMode::setGameRules(GameRulesInstance *rules) { - if(m_gameRules != nullptr) delete m_gameRules; + if(m_gameRules != NULL) delete m_gameRules; m_gameRules = rules; } \ No newline at end of file diff --git a/Minecraft.Client/ServerPlayerGameMode.h b/Minecraft.Client/ServerPlayerGameMode.h index 509e1676..89b9e9b4 100644 --- a/Minecraft.Client/ServerPlayerGameMode.h +++ b/Minecraft.Client/ServerPlayerGameMode.h @@ -54,7 +54,7 @@ private: public: bool destroyBlock(int x, int y, int z); bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=nullptr); + bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); void setLevel(ServerLevel *newLevel); }; \ No newline at end of file diff --git a/Minecraft.Client/ServerScoreboard.cpp b/Minecraft.Client/ServerScoreboard.cpp index 9a044324..738a29c9 100644 --- a/Minecraft.Client/ServerScoreboard.cpp +++ b/Minecraft.Client/ServerScoreboard.cpp @@ -37,7 +37,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective *objective) //Scoreboard::setDisplayObjective(slot, objective); - //if (old != objective && old != nullptr) + //if (old != objective && old != NULL) //{ // if (getObjectiveDisplaySlotCount(old) > 0) // { @@ -49,7 +49,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective *objective) // } //} - //if (objective != nullptr) + //if (objective != NULL) //{ // if (trackedObjectives.contains(objective)) // { @@ -146,7 +146,7 @@ void ServerScoreboard::setSaveData(ScoreboardSaveData *data) void ServerScoreboard::setDirty() { - //if (saveData != nullptr) + //if (saveData != NULL) //{ // saveData->setDirty(); //} @@ -154,7 +154,7 @@ void ServerScoreboard::setDirty() vector > *ServerScoreboard::getStartTrackingPackets(Objective *objective) { - return nullptr; + return NULL; //vector > *packets = new vector >(); //packets.push_back( shared_ptr( new SetObjectivePacket(objective, SetObjectivePacket::METHOD_ADD))); @@ -189,7 +189,7 @@ void ServerScoreboard::startTrackingObjective(Objective *objective) vector > *ServerScoreboard::getStopTrackingPackets(Objective *objective) { - return nullptr; + return NULL; //vector > *packets = new ArrayList(); //packets->push_back( shared_ptrgetPath(); } @@ -40,9 +40,9 @@ Settings::Settings(File *file) line.erase(line.size() - 1); if (line.size() >= 3 && - static_cast(line[0]) == 0xEF && - static_cast(line[1]) == 0xBB && - static_cast(line[2]) == 0xBF) + (unsigned char)line[0] == 0xEF && + (unsigned char)line[1] == 0xBB && + (unsigned char)line[2] == 0xBF) { line.erase(0, 3); } diff --git a/Minecraft.Client/SheepRenderer.cpp b/Minecraft.Client/SheepRenderer.cpp index 43450578..5a3580bc 100644 --- a/Minecraft.Client/SheepRenderer.cpp +++ b/Minecraft.Client/SheepRenderer.cpp @@ -30,7 +30,7 @@ int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, floa int value = (sheep->tickCount / colorDuration) + sheep->entityId; int c1 = value % Sheep::COLOR_LENGTH; int c2 = (value + 1) % Sheep::COLOR_LENGTH; - float subStep = ((sheep->tickCount % colorDuration) + a) / static_cast(colorDuration); + float subStep = ((sheep->tickCount % colorDuration) + a) / (float) colorDuration; glColor3f(Sheep::COLOR[c1][0] * (1.0f - subStep) + Sheep::COLOR[c2][0] * subStep, Sheep::COLOR[c1][1] * (1.0f - subStep) + Sheep::COLOR[c2][1] * subStep, Sheep::COLOR[c1][2] * (1.0f - subStep) + Sheep::COLOR[c2][2] * subStep); diff --git a/Minecraft.Client/SignRenderer.cpp b/Minecraft.Client/SignRenderer.cpp index 3f0b2175..5f764a92 100644 --- a/Minecraft.Client/SignRenderer.cpp +++ b/Minecraft.Client/SignRenderer.cpp @@ -25,7 +25,7 @@ void SignRenderer::render(shared_ptr _sign, double x, double y, doub float size = 16 / 24.0f; if (tile == Tile::sign) { - glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 0.75f * size, static_cast(z) + 0.5f); + glTranslatef((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f); float rot = sign->getData() * 360 / 16.0f; glRotatef(-rot, 0, 1, 0); signModel->cube2->visible = true; @@ -39,7 +39,7 @@ void SignRenderer::render(shared_ptr _sign, double x, double y, doub if (face == 4) rot = 90; if (face == 5) rot = -90; - glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 0.75f * size, static_cast(z) + 0.5f); + glTranslatef((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f); glRotatef(-rot, 0, 1, 0); glTranslatef(0, -5 / 16.0f, -7 / 16.0f); diff --git a/Minecraft.Client/SilverfishModel.cpp b/Minecraft.Client/SilverfishModel.cpp index 7058d187..ce8b8254 100644 --- a/Minecraft.Client/SilverfishModel.cpp +++ b/Minecraft.Client/SilverfishModel.cpp @@ -48,7 +48,7 @@ SilverfishModel::SilverfishModel() { bodyParts[i] = new ModelPart(this, BODY_TEXS[i][0], BODY_TEXS[i][1]); bodyParts[i]->addBox(BODY_SIZES[i][0] * -0.5f, 0, BODY_SIZES[i][2] * -0.5f, BODY_SIZES[i][0], BODY_SIZES[i][1], BODY_SIZES[i][2]); - bodyParts[i]->setPos(0.0f, 24.0f - static_cast(BODY_SIZES[i][1]), placement); + bodyParts[i]->setPos(0.0f, 24.0f - (float)BODY_SIZES[i][1], placement); zPlacement[i] = placement; if (i < bodyParts.length - 1) { @@ -100,8 +100,8 @@ void SilverfishModel::setupAnim(float time, float r, float bob, float yRot, floa { for (unsigned int i = 0; i < bodyParts.length; i++) { - bodyParts[i]->yRot = Mth::cos(bob * .9f + i * .15f * PI) * PI * .05f * (1 + abs(static_cast(i) - 2)); - bodyParts[i]->x = Mth::sin(bob * .9f + i * .15f * PI) * PI * .2f * abs(static_cast(i) - 2); + bodyParts[i]->yRot = Mth::cos(bob * .9f + i * .15f * PI) * PI * .05f * (1 + abs((int)i - 2)); + bodyParts[i]->x = Mth::sin(bob * .9f + i * .15f * PI) * PI * .2f * abs((int)i - 2); } bodyLayers[0]->yRot = bodyParts[2]->yRot; diff --git a/Minecraft.Client/SkullTileRenderer.cpp b/Minecraft.Client/SkullTileRenderer.cpp index 7862043b..32d216cd 100644 --- a/Minecraft.Client/SkullTileRenderer.cpp +++ b/Minecraft.Client/SkullTileRenderer.cpp @@ -6,7 +6,7 @@ #include "..\Minecraft.World\net.minecraft.h" #include "..\Minecraft.World\net.minecraft.world.level.tile.h" -SkullTileRenderer *SkullTileRenderer::instance = nullptr; +SkullTileRenderer *SkullTileRenderer::instance = NULL; ResourceLocation SkullTileRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON); ResourceLocation SkullTileRenderer::WITHER_SKELETON_LOCATION = ResourceLocation(TN_MOB_WITHER_SKELETON); @@ -28,7 +28,7 @@ SkullTileRenderer::~SkullTileRenderer() void SkullTileRenderer::render(shared_ptr _skull, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) { shared_ptr skull = dynamic_pointer_cast(_skull); - renderSkull(static_cast(x), static_cast(y), static_cast(z), skull->getData() & SkullTile::PLACEMENT_MASK, skull->getRotation() * 360 / 16.0f, skull->getSkullType(), skull->getExtraType()); + renderSkull((float) x, (float) y, (float) z, skull->getData() & SkullTile::PLACEMENT_MASK, skull->getRotation() * 360 / 16.0f, skull->getSkullType(), skull->getExtraType()); } void SkullTileRenderer::init(TileEntityRenderDispatcher *tileEntityRenderDispatcher) diff --git a/Minecraft.Client/SlideButton.cpp b/Minecraft.Client/SlideButton.cpp index 0c7735af..0da24515 100644 --- a/Minecraft.Client/SlideButton.cpp +++ b/Minecraft.Client/SlideButton.cpp @@ -18,22 +18,22 @@ void SlideButton::renderBg(Minecraft *minecraft, int xm, int ym) if (!visible) return; if (sliding) { - value = (xm - (x + 4)) / static_cast(w - 8); + value = (xm - (x + 4)) / (float) (w - 8); if (value < 0) value = 0; if (value > 1) value = 1; minecraft->options->set(option, value); msg = minecraft->options->getMessage(option); } glColor4f(1, 1, 1, 1); - blit(x + static_cast(value * (w - 8)), y, 0, 46 + 1 * 20, 4, 20); - blit(x + static_cast(value * (w - 8)) + 4, y, 196, 46 + 1 * 20, 4, 20); + blit(x + (int) (value * (w - 8)), y, 0, 46 + 1 * 20, 4, 20); + blit(x + (int) (value * (w - 8)) + 4, y, 196, 46 + 1 * 20, 4, 20); } bool SlideButton::clicked(Minecraft *minecraft, int mx, int my) { if (Button::clicked(minecraft, mx, my)) { - value = (mx - (x + 4)) / static_cast(w - 8); + value = (mx - (x + 4)) / (float) (w - 8); if (value < 0) value = 0; if (value > 1) value = 1; minecraft->options->set(option, value); diff --git a/Minecraft.Client/SlimeModel.cpp b/Minecraft.Client/SlimeModel.cpp index 7d30ce66..834847f8 100644 --- a/Minecraft.Client/SlimeModel.cpp +++ b/Minecraft.Client/SlimeModel.cpp @@ -27,9 +27,9 @@ SlimeModel::SlimeModel(int vOffs) } else { - eye0 = nullptr; - eye1 = nullptr; - mouth = nullptr; + eye0 = NULL; + eye1 = NULL; + mouth = NULL; } cube->compile(1.0f/16.0f); } @@ -39,7 +39,7 @@ void SlimeModel::render(shared_ptr entity, float time, float r, float bo setupAnim(time, r, bob, yRot, xRot, scale, entity); cube->render(scale,usecompiled); - if (eye0!=nullptr) + if (eye0!=NULL) { eye0->render(scale,usecompiled); eye1->render(scale,usecompiled); diff --git a/Minecraft.Client/SlimeRenderer.cpp b/Minecraft.Client/SlimeRenderer.cpp index ca5e5191..f3f64aed 100644 --- a/Minecraft.Client/SlimeRenderer.cpp +++ b/Minecraft.Client/SlimeRenderer.cpp @@ -41,7 +41,7 @@ void SlimeRenderer::scale(shared_ptr _slime, float a) // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr slime = dynamic_pointer_cast(_slime); - float size = static_cast(slime->getSize()); + float size = (float) slime->getSize(); float ss = (slime->oSquish + (slime->squish - slime->oSquish) * a) / (size * 0.5f + 1); float w = 1 / (ss + 1); glScalef(w * size, 1 / w * size, w * size); diff --git a/Minecraft.Client/SmallButton.cpp b/Minecraft.Client/SmallButton.cpp index 731f5f14..6bb3cd1f 100644 --- a/Minecraft.Client/SmallButton.cpp +++ b/Minecraft.Client/SmallButton.cpp @@ -3,12 +3,12 @@ SmallButton::SmallButton(int id, int x, int y, const wstring& msg) : Button(id, x, y, 150, 20, msg) { - this->option = nullptr; + this->option = NULL; } SmallButton::SmallButton(int id, int x, int y, int width, int height, const wstring& msg) : Button(id, x, y, width, height, msg) { - this->option = nullptr; + this->option = NULL; } SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg) : Button(id, x, y, 150, 20, msg) diff --git a/Minecraft.Client/SmokeParticle.cpp b/Minecraft.Client/SmokeParticle.cpp index b48978f0..a8855885 100644 --- a/Minecraft.Client/SmokeParticle.cpp +++ b/Minecraft.Client/SmokeParticle.cpp @@ -26,8 +26,8 @@ void SmokeParticle::init(Level *level, double x, double y, double z, double xa, size *= scale; oSize = size; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); - lifetime = static_cast(lifetime * scale); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (lifetime * scale); noPhysics = false; } diff --git a/Minecraft.Client/SnowManRenderer.cpp b/Minecraft.Client/SnowManRenderer.cpp index 1ab1d402..1e258f3c 100644 --- a/Minecraft.Client/SnowManRenderer.cpp +++ b/Minecraft.Client/SnowManRenderer.cpp @@ -11,7 +11,7 @@ ResourceLocation SnowManRenderer::SNOWMAN_LOCATION = ResourceLocation(TN_MOB_SNO SnowManRenderer::SnowManRenderer() : MobRenderer(new SnowManModel(), 0.5f) { - model = static_cast(MobRenderer::model); + model = (SnowManModel *) MobRenderer::model; this->setArmor(model); } @@ -22,8 +22,8 @@ void SnowManRenderer::additionalRendering(shared_ptr _mob, float a shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); - shared_ptr headGear = std::make_shared(Tile::pumpkin, 1); - if (headGear != nullptr && headGear->getItem()->id < 256) + shared_ptr headGear = shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); + if (headGear != NULL && headGear->getItem()->id < 256) { glPushMatrix(); model->head->translateTo(1 / 16.0f); diff --git a/Minecraft.Client/SnowShovelParticle.cpp b/Minecraft.Client/SnowShovelParticle.cpp index cf63a730..4417cb5d 100644 --- a/Minecraft.Client/SnowShovelParticle.cpp +++ b/Minecraft.Client/SnowShovelParticle.cpp @@ -11,13 +11,13 @@ void SnowShovelParticle::init(Level *level, double x, double y, double z, double yd += ya; zd += za; - rCol = gCol = bCol = 1 - static_cast(Math::random() * 0.3f); + rCol = gCol = bCol = 1 - (float) (Math::random() * 0.3f); size *= 0.75f; size *= scale; oSize = size; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); - lifetime = static_cast(lifetime * scale); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) ( lifetime * scale ); noPhysics = false; } diff --git a/Minecraft.Client/SpellParticle.cpp b/Minecraft.Client/SpellParticle.cpp index cd0797ac..ce8b975f 100644 --- a/Minecraft.Client/SpellParticle.cpp +++ b/Minecraft.Client/SpellParticle.cpp @@ -13,7 +13,7 @@ SpellParticle::SpellParticle(Level *level, double x, double y, double z, double size *= 0.75f; - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); noPhysics = false; baseTex = 8 * 16; diff --git a/Minecraft.Client/SpiderModel.cpp b/Minecraft.Client/SpiderModel.cpp index 0cdc14ca..739677e4 100644 --- a/Minecraft.Client/SpiderModel.cpp +++ b/Minecraft.Client/SpiderModel.cpp @@ -11,48 +11,48 @@ SpiderModel::SpiderModel() : Model() head = new ModelPart(this, 32, 4); head->addBox(-4, -4, -8, 8, 8, 8, g); // Head - head->setPos(0, static_cast(0 + yo), -3); + head->setPos(0, (float)(0+yo), -3); body0 = new ModelPart(this, 0, 0); body0->addBox(-3, -3, -3, 6, 6, 6, g); // Body - body0->setPos(0,static_cast(yo), 0); + body0->setPos(0,(float)(yo), 0); body1 = new ModelPart(this, 0, 12); body1->addBox(-5, -4, -6, 10, 8, 12, g); // Body - body1->setPos(0, static_cast(0 + yo), 3 + 6); + body1->setPos(0, (float)(0+yo), 3 + 6); leg0 = new ModelPart(this, 18, 0); leg0->addBox(-15, -1, -1, 16, 2, 2, g); // Leg0 - leg0->setPos(-4, static_cast(0 + yo), 2); + leg0->setPos(-4, (float)(0+yo), 2); leg1 = new ModelPart(this, 18, 0); leg1->addBox(-1, -1, -1, 16, 2, 2, g); // Leg1 - leg1->setPos(4, static_cast(0 + yo), 2); + leg1->setPos(4, (float)(0+yo), 2); leg2 = new ModelPart(this, 18, 0); leg2->addBox(-15, -1, -1, 16, 2, 2, g); // Leg2 - leg2->setPos(-4, static_cast(0 + yo), 1); + leg2->setPos(-4, (float)(0+yo), 1); leg3 = new ModelPart(this, 18, 0); leg3->addBox(-1, -1, -1, 16, 2, 2, g); // Leg3 - leg3->setPos(4, static_cast(0 + yo), 1); + leg3->setPos(4, (float)(0+yo), 1); leg4 = new ModelPart(this, 18, 0); leg4->addBox(-15, -1, -1, 16, 2, 2, g); // Leg0 - leg4->setPos(-4, static_cast(0 + yo), 0); + leg4->setPos(-4, (float)(0+yo), 0); leg5 = new ModelPart(this, 18, 0); leg5->addBox(-1, -1, -1, 16, 2, 2, g); // Leg1 - leg5->setPos(4, static_cast(0 + yo), 0); + leg5->setPos(4, (float)(0+yo), 0); leg6 = new ModelPart(this, 18, 0); leg6->addBox(-15, -1, -1, 16, 2, 2, g); // Leg2 - leg6->setPos(-4, static_cast(0 + yo), -1); + leg6->setPos(-4, (float)(0+yo), -1); leg7 = new ModelPart(this, 18, 0); leg7->addBox(-1, -1, -1, 16, 2, 2, g); // Leg3 - leg7->setPos(4, static_cast(0 + yo), -1); + leg7->setPos(4, (float)(0+yo), -1); // 4J added - compile now to avoid random performance hit first time cubes are rendered head->compile(1.0f/16.0f); diff --git a/Minecraft.Client/SquidModel.cpp b/Minecraft.Client/SquidModel.cpp index 0ee2501d..0152418f 100644 --- a/Minecraft.Client/SquidModel.cpp +++ b/Minecraft.Client/SquidModel.cpp @@ -14,17 +14,17 @@ SquidModel::SquidModel() : Model() { tentacles[i] = new ModelPart(this, 48, 0); - double angle = i * PI * 2.0 / static_cast(TENTACLES_LENGTH); // 4J - 8 was tentacles.length - float xo = Mth::cos(static_cast(angle)) * 5; - float yo = Mth::sin(static_cast(angle)) * 5; + double angle = i * PI * 2.0 / (double) TENTACLES_LENGTH; // 4J - 8 was tentacles.length + float xo = Mth::cos((float)angle) * 5; + float yo = Mth::sin((float)angle) * 5; tentacles[i]->addBox(-1, 0, -1, 2, 18, 2); tentacles[i]->x = xo; tentacles[i]->z = yo; - tentacles[i]->y = static_cast(31 + yoffs); + tentacles[i]->y = (float)(31 + yoffs); - angle = i * PI * -2.0 / static_cast(TENTACLES_LENGTH) + PI * .5; // 4J - 8 was tentacles.length - tentacles[i]->yRot = static_cast(angle); + angle = i * PI * -2.0 / (double) TENTACLES_LENGTH + PI * .5; // 4J - 8 was tentacles.length + tentacles[i]->yRot = (float) angle; // 4J added - compile now to avoid random performance hit first time cubes are rendered tentacles[i]->compile(1.0f/16.0f); diff --git a/Minecraft.Client/StatsCounter.cpp b/Minecraft.Client/StatsCounter.cpp index e92c43c0..b75625e9 100644 --- a/Minecraft.Client/StatsCounter.cpp +++ b/Minecraft.Client/StatsCounter.cpp @@ -142,7 +142,7 @@ void StatsCounter::parse(void* data) assert( stats.size() == 0 ); //Pointer to current position in stat array - PBYTE pbData=static_cast(data); + PBYTE pbData=(PBYTE)data; pbData+=sizeof(GAME_SETTINGS); unsigned short* statData = (unsigned short*)pbData;//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); @@ -217,7 +217,7 @@ void StatsCounter::save(int player, bool force) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) PBYTE pbData = (PBYTE)StorageManager.GetGameDefinedProfileData(player); #else - PBYTE pbData = static_cast(ProfileManager.GetGameDefinedProfileData(player)); + PBYTE pbData = (PBYTE)ProfileManager.GetGameDefinedProfileData(player); #endif pbData+=sizeof(GAME_SETTINGS); @@ -1314,30 +1314,30 @@ void StatsCounter::WipeLeaderboards() #if defined DEBUG_ENABLE_CLEAR_LEADERBOARDS && defined _XBOX - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_EASY, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_NORMAL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_HARD, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_PEACEFUL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_EASY, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_NORMAL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_HARD, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_EASY, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_HARD, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_PEACEFUL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_EASY, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_NORMAL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_HARD, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_PEACEFUL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_EASY, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_NORMAL, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_HARD, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_PEACEFUL, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_EASY, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_NORMAL, nullptr); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_HARD, nullptr); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_TOTAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_TOTAL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_EASY, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_NORMAL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_HARD, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_PEACEFUL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_EASY, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_NORMAL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_HARD, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_EASY, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_HARD, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_PEACEFUL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_EASY, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_NORMAL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_HARD, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_PEACEFUL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_EASY, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_NORMAL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_HARD, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_PEACEFUL, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_EASY, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_NORMAL, NULL); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_HARD, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_TOTAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_TOTAL, NULL); if( LeaderboardManager::Instance()->OpenSession() ) { writeStats(); diff --git a/Minecraft.Client/StatsScreen.cpp b/Minecraft.Client/StatsScreen.cpp index c618a30f..01d041f0 100644 --- a/Minecraft.Client/StatsScreen.cpp +++ b/Minecraft.Client/StatsScreen.cpp @@ -10,15 +10,15 @@ #include "..\Minecraft.World\net.minecraft.world.item.h" const float StatsScreen::SLOT_TEX_SIZE = 128.0f; -ItemRenderer *StatsScreen::itemRenderer = nullptr; +ItemRenderer *StatsScreen::itemRenderer = NULL; StatsScreen::StatsScreen(Screen *lastScreen, StatsCounter *stats) { // 4J - added initialisers itemRenderer = new ItemRenderer(); - statsList = nullptr; - itemStatsList = nullptr; - blockStatsList = nullptr; + statsList = NULL; + itemStatsList = NULL; + blockStatsList = NULL; this->lastScreen = lastScreen; this->stats = stats; } @@ -107,7 +107,7 @@ StatsScreen::GeneralStatisticsList::GeneralStatisticsList(StatsScreen *ss) : Scr int StatsScreen::GeneralStatisticsList::getNumberOfItems() { - return static_cast(Stats::generalStats->size()); + return (int)Stats::generalStats->size(); } void StatsScreen::GeneralStatisticsList::selectItem(int item, bool doubleClick) @@ -293,7 +293,7 @@ void StatsScreen::StatisticsList::clickedHeader(int headerMouseX, int headerMous int StatsScreen::StatisticsList::getNumberOfItems() { - return static_cast(statItemList.size()); + return (int)statItemList.size(); } ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot) @@ -303,7 +303,7 @@ ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot) void StatsScreen::StatisticsList::renderStat(ItemStat *stat, int x, int y, bool shaded) { - if (stat != nullptr) + if (stat != NULL) { wstring msg = stat->format(parent->stats->getTotalValue(stat)); parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090); @@ -373,7 +373,7 @@ void StatsScreen::StatisticsList::renderMousehoverTooltip(ItemStat *stat, int x, { // 4J Stu - Unused #if 0 - if (stat == nullptr) + if (stat == NULL) { return; } @@ -429,11 +429,11 @@ StatsScreen::ItemStatisticsList::ItemStatisticsList(StatsScreen *ss) : StatsScre { addToList = true; } - else if (Stats::itemBroke[id] != nullptr && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0) + else if (Stats::itemBroke[id] != NULL && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0) { addToList = true; } - else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) + else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) { addToList = true; } @@ -556,11 +556,11 @@ StatsScreen::BlockStatisticsList::BlockStatisticsList(StatsScreen *ss) : Statist { addToList = true; } - else if (Stats::itemUsed[id] != nullptr && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0) + else if (Stats::itemUsed[id] != NULL && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0) { addToList = true; } - else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) + else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) { addToList = true; } diff --git a/Minecraft.Client/StitchSlot.cpp b/Minecraft.Client/StitchSlot.cpp index 8de443ed..cdce6128 100644 --- a/Minecraft.Client/StitchSlot.cpp +++ b/Minecraft.Client/StitchSlot.cpp @@ -5,8 +5,8 @@ StitchSlot::StitchSlot(int originX, int originY, int width, int height) : originX(originX), originY(originY), width(width), height(height) { - subSlots = nullptr; - textureHolder = nullptr; + subSlots = NULL; + textureHolder = NULL; } TextureHolder *StitchSlot::getHolder() @@ -27,7 +27,7 @@ int StitchSlot::getY() bool StitchSlot::add(TextureHolder *textureHolder) { // Already holding a texture -- doesn't account for subslots. - if (this->textureHolder != nullptr) + if (this->textureHolder != NULL) { return false; } @@ -42,7 +42,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) } // Exact fit! best-case-solution - if (textureWidth == width && textureHeight == height && subSlots == nullptr) + if (textureWidth == width && textureHeight == height && subSlots == NULL) { // Store somehow this->textureHolder = textureHolder; @@ -50,7 +50,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) } // See if we're already divided before, if not, setup subSlots - if (subSlots == nullptr) + if (subSlots == NULL) { subSlots = new vector(); diff --git a/Minecraft.Client/StitchedTexture.cpp b/Minecraft.Client/StitchedTexture.cpp index b9693f3d..64ab2f36 100644 --- a/Minecraft.Client/StitchedTexture.cpp +++ b/Minecraft.Client/StitchedTexture.cpp @@ -26,7 +26,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name) StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) : name(name) { // 4J Initialisers - source = nullptr; + source = NULL; rotated = false; x = 0; y = 0; @@ -40,9 +40,9 @@ StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) : heightTranslation = 0.0f; frame = 0; subFrame = 0; - frameOverride = nullptr; + frameOverride = NULL; flags = 0; - frames = nullptr; + frames = NULL; m_fileName = filename; } @@ -94,10 +94,10 @@ void StitchedTexture::init(Texture *source, vector *frames, int x, in float marginX = 0.0f; //0.01f / source->getWidth(); float marginY = 0.0f; //0.01f / source->getHeight(); - this->u0 = x / static_cast(source->getWidth()) + marginX; - this->u1 = (x + width) / static_cast(source->getWidth()) - marginX; - this->v0 = y / static_cast(source->getHeight()) + marginY; - this->v1 = (y + height) / static_cast(source->getHeight()) - marginY; + this->u0 = x / (float) source->getWidth() + marginX; + this->u1 = (x + width) / (float) source->getWidth() - marginX; + this->v0 = y / (float) source->getHeight() + marginY; + this->v1 = (y + height) / (float) source->getHeight() - marginY; #ifndef _CONTENT_PACKAGE bool addBreakpoint = false; @@ -112,8 +112,8 @@ void StitchedTexture::init(Texture *source, vector *frames, int x, in } #endif - this->widthTranslation = width / static_cast(SharedConstants::WORLD_RESOLUTION); - this->heightTranslation = height / static_cast(SharedConstants::WORLD_RESOLUTION); + this->widthTranslation = width / (float) SharedConstants::WORLD_RESOLUTION; + this->heightTranslation = height / (float) SharedConstants::WORLD_RESOLUTION; } void StitchedTexture::replaceWith(StitchedTexture *texture) @@ -156,7 +156,7 @@ float StitchedTexture::getU1(bool adjust/*=false*/) const float StitchedTexture::getU(double offset, bool adjust/*=false*/) const { float diff = getU1(adjust) - getU0(adjust); - return getU0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); + return getU0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } float StitchedTexture::getV0(bool adjust/*=false*/) const @@ -172,7 +172,7 @@ float StitchedTexture::getV1(bool adjust/*=false*/) const float StitchedTexture::getV(double offset, bool adjust/*=false*/) const { float diff = getV1(adjust) - getV0(adjust); - return getV0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); + return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } wstring StitchedTexture::getName() const @@ -192,7 +192,7 @@ int StitchedTexture::getSourceHeight() const void StitchedTexture::cycleFrames() { - if (frameOverride != nullptr) + if (frameOverride != NULL) { pair current = frameOverride->at(frame); subFrame++; @@ -250,10 +250,10 @@ int StitchedTexture::getFrames() */ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) { - if(frameOverride != nullptr) + if(frameOverride != NULL) { delete frameOverride; - frameOverride = nullptr; + frameOverride = NULL; } frame = 0; subFrame = 0; @@ -303,10 +303,10 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) void StitchedTexture::loadAnimationFrames(const wstring &string) { - if(frameOverride != nullptr) + if(frameOverride != NULL) { delete frameOverride; - frameOverride = nullptr; + frameOverride = NULL; } frame = 0; subFrame = 0; diff --git a/Minecraft.Client/Stitcher.cpp b/Minecraft.Client/Stitcher.cpp index 450c8026..d52954c4 100644 --- a/Minecraft.Client/Stitcher.cpp +++ b/Minecraft.Client/Stitcher.cpp @@ -17,7 +17,7 @@ void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forc // 4J init storageX = 0; storageY = 0; - stitchedTexture = nullptr; + stitchedTexture = NULL; } Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) @@ -78,7 +78,7 @@ void Stitcher::stitch() //TextureHolder[] textureHolders = texturesToBeStitched.toArray(new TextureHolder[texturesToBeStitched.size()]); //Arrays.sort(textureHolders); - stitchedTexture = nullptr; + stitchedTexture = NULL; //for (int i = 0; i < textureHolders.length; i++) for( TextureHolder *textureHolder : texturesToBeStitched ) @@ -122,7 +122,7 @@ int Stitcher::smallestEncompassingPowerOfTwo(int input) bool Stitcher::addToStorage(TextureHolder *textureHolder) { - for (size_t i = 0; i < storage.size(); i++) + for (int i = 0; i < storage.size(); i++) { if (storage.at(i)->add(textureHolder)) { diff --git a/Minecraft.Client/SuspendedParticle.cpp b/Minecraft.Client/SuspendedParticle.cpp index b7305207..70702de0 100644 --- a/Minecraft.Client/SuspendedParticle.cpp +++ b/Minecraft.Client/SuspendedParticle.cpp @@ -25,7 +25,7 @@ SuspendedParticle::SuspendedParticle(Level *level, double x, double y, double z, yd = ya * 0.0f; zd = za * 0.0f; - lifetime = static_cast(16 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (16 / (Math::random() * 0.8 + 0.2)); } void SuspendedParticle::tick() diff --git a/Minecraft.Client/SuspendedTownParticle.cpp b/Minecraft.Client/SuspendedTownParticle.cpp index 4c31b0c0..a24bbc42 100644 --- a/Minecraft.Client/SuspendedTownParticle.cpp +++ b/Minecraft.Client/SuspendedTownParticle.cpp @@ -18,7 +18,7 @@ SuspendedTownParticle::SuspendedTownParticle(Level *level, double x, double y, d yd *= 0.02f; zd *= 0.02f; - lifetime = static_cast(20 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (20 / (Math::random() * 0.8 + 0.2)); this->noPhysics = true; } diff --git a/Minecraft.Client/TakeAnimationParticle.cpp b/Minecraft.Client/TakeAnimationParticle.cpp index f629363e..c9530b0a 100644 --- a/Minecraft.Client/TakeAnimationParticle.cpp +++ b/Minecraft.Client/TakeAnimationParticle.cpp @@ -64,7 +64,7 @@ void TakeAnimationParticle::render(Tesselator *t, float a, float xa, float ya, f zz-=zOff; - EntityRenderDispatcher::instance->render(item, static_cast(xx), static_cast(yy), static_cast(zz), item->yRot, a); + EntityRenderDispatcher::instance->render(item, (float)xx, (float)yy, (float)zz, item->yRot, a); } diff --git a/Minecraft.Client/TeleportCommand.cpp b/Minecraft.Client/TeleportCommand.cpp index 9dd29ff0..2132cfd4 100644 --- a/Minecraft.Client/TeleportCommand.cpp +++ b/Minecraft.Client/TeleportCommand.cpp @@ -29,7 +29,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman shared_ptr subject = players->getPlayer(subjectID); shared_ptr destination = players->getPlayer(destinationID); - if(subject != nullptr && destination != nullptr && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) + if(subject != NULL && destination != NULL && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) { subject->ride(nullptr); subject->connection->teleport(destination->x, destination->y, destination->z, destination->yRot, destination->xRot); @@ -86,5 +86,5 @@ shared_ptr TeleportCommand::preparePacket(PlayerUID subject, dos.writePlayerUID(subject); dos.writePlayerUID(destination); - return std::make_shared(eGameCommand_Teleport, baos.toByteArray()); + return shared_ptr( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.Client/TerrainParticle.cpp b/Minecraft.Client/TerrainParticle.cpp index fb29118b..811ba840 100644 --- a/Minecraft.Client/TerrainParticle.cpp +++ b/Minecraft.Client/TerrainParticle.cpp @@ -47,7 +47,7 @@ void TerrainParticle::render(Tesselator *t, float a, float xa, float ya, float z float v1 = v0 + 0.999f / 16.0f / 4; float r = 0.1f * size; - if (tex != nullptr) + if (tex != NULL) { u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION); u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); @@ -55,9 +55,9 @@ void TerrainParticle::render(Tesselator *t, float a, float xa, float ya, float z v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); } - float x = static_cast(xo + (this->x - xo) * a - xOff); - float y = static_cast(yo + (this->y - yo) * a - yOff); - float z = static_cast(zo + (this->z - zo) * a - zOff); + float x = (float) (xo + (this->x - xo) * a - xOff); + float y = (float) (yo + (this->y - yo) * a - yOff); + float z = (float) (zo + (this->z - zo) * a - zOff); // 4J - don't render terrain particles that are less than a metre away, to try and avoid large particles that are causing us problems with // photosensitivity testing diff --git a/Minecraft.Client/Tesselator.cpp b/Minecraft.Client/Tesselator.cpp index b70ec983..7bae7aca 100644 --- a/Minecraft.Client/Tesselator.cpp +++ b/Minecraft.Client/Tesselator.cpp @@ -28,7 +28,7 @@ DWORD Tesselator::tlsIdx = TlsAlloc(); Tesselator *Tesselator::getInstance() { - return static_cast(TlsGetValue(tlsIdx)); + return (Tesselator *)TlsGetValue(tlsIdx); } void Tesselator::CreateNewThreadStorage(int bytes) @@ -179,18 +179,18 @@ void Tesselator::end() } #else - RenderManager.DrawVertices(static_cast(mode),vertexCount,_array->data,C4JRender::VERTEX_TYPE_COMPRESSED, C4JRender::PIXEL_SHADER_TYPE_STANDARD); + RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_COMPRESSED, C4JRender::PIXEL_SHADER_TYPE_STANDARD); #endif } else { if( useProjectedTexturePixelShader ) { - RenderManager.DrawVertices(static_cast(mode),vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION); + RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION); } else { - RenderManager.DrawVertices(static_cast(mode),vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, C4JRender::PIXEL_SHADER_TYPE_STANDARD); + RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, C4JRender::PIXEL_SHADER_TYPE_STANDARD); } } #endif @@ -295,12 +295,12 @@ void Tesselator::tex2(int tex2) void Tesselator::color(float r, float g, float b) { - color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255)); + color((int) (r * 255), (int) (g * 255), (int) (b * 255)); } void Tesselator::color(float r, float g, float b, float a) { - color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), static_cast(a * 255)); + color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); } void Tesselator::color(int r, int g, int b) @@ -749,7 +749,7 @@ void Tesselator::vertex(float x, float y, float z) // see comments in packCompactQuad() for exact format if( useCompactFormat360 ) { - unsigned int ucol = static_cast(col); + unsigned int ucol = (unsigned int)col; #ifdef _XBOX // Pack as 4:4:4 RGB_ @@ -774,7 +774,7 @@ void Tesselator::vertex(float x, float y, float z) unsigned short packedcol = ((col & 0xf8000000 ) >> 16 ) | ((col & 0x00fc0000 ) >> 13 ) | ((col & 0x0000f800 ) >> 11 ); - int ipackedcol = static_cast(packedcol) & 0xffff; // 0 to 65535 range + int ipackedcol = ((int)packedcol) & 0xffff; // 0 to 65535 range ipackedcol -= 32768; // -32768 to 32767 range ipackedcol &= 0xffff; @@ -824,12 +824,12 @@ void Tesselator::vertex(float x, float y, float z) p += 4; #else - pShortData[0] = (static_cast((x + xo) * 1024.0f)&0xffff); - pShortData[1] = (static_cast((y + yo) * 1024.0f)&0xffff); - pShortData[2] = (static_cast((z + zo) * 1024.0f)&0xffff); + pShortData[0] = (((int)((x + xo ) * 1024.0f))&0xffff); + pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff); + pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff); pShortData[3] = ipackedcol; - pShortData[4] = (static_cast(uu * 8192.0f)&0xffff); - pShortData[5] = (static_cast(v * 8192.0f)&0xffff); + pShortData[4] = (((int)(uu * 8192.0f))&0xffff); + pShortData[5] = (((int)(v * 8192.0f))&0xffff); int16_t u2 = ((int16_t*)&_tex2)[0]; int16_t v2 = ((int16_t*)&_tex2)[1]; #if defined _XBOX_ONE || defined __ORBIS__ @@ -1040,9 +1040,9 @@ void Tesselator::normal(float x, float y, float z) int8_t zz = (int8_t) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #else - byte xx = static_cast(x * 127); - byte yy = static_cast(y * 127); - byte zz = static_cast(z * 127); + byte xx = (byte) (x * 127); + byte yy = (byte) (y * 127); + byte zz = (byte) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #endif } diff --git a/Minecraft.Client/TextEditScreen.cpp b/Minecraft.Client/TextEditScreen.cpp index 4b32d139..9537b969 100644 --- a/Minecraft.Client/TextEditScreen.cpp +++ b/Minecraft.Client/TextEditScreen.cpp @@ -35,7 +35,7 @@ void TextEditScreen::removed() Keyboard::enableRepeatEvents(false); if (minecraft->level->isClientSide) { - minecraft->getConnection(0)->send(std::make_shared(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages())); + minecraft->getConnection(0)->send( shared_ptr( new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()) ) ); } } @@ -52,7 +52,7 @@ void TextEditScreen::buttonClicked(Button *button) if (button->id == 0) { sign->setChanged(); - minecraft->setScreen(nullptr); + minecraft->setScreen(NULL); } } @@ -82,7 +82,7 @@ void TextEditScreen::render(int xm, int ym, float a) drawCenteredString(font, title, width / 2, 40, 0xffffff); glPushMatrix(); - glTranslatef(static_cast(width) / 2, static_cast(height) / 2, 50); + glTranslatef((float)width / 2, (float)height / 2, 50); float ss = 60 / (16 / 25.0f); glScalef(-ss, -ss, -ss); glRotatef(180, 0, 1, 0); diff --git a/Minecraft.Client/Texture.cpp b/Minecraft.Client/Texture.cpp index b7e58d5f..809f606a 100644 --- a/Minecraft.Client/Texture.cpp +++ b/Minecraft.Client/Texture.cpp @@ -24,7 +24,7 @@ Texture::Texture(const wstring &name, int mode, int width, int height, int depth void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) { #ifdef __PS3__ - if(g_texBlitJobQueuePort == nullptr) + if(g_texBlitJobQueuePort == NULL) g_texBlitJobQueuePort = new C4JSpursJobQueue::Port("C4JSpursJob_Texture_blit"); #endif this->name = name; @@ -40,7 +40,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de m_bInitialised = false; for( int i = 0 ; i < 10; i++ ) { - data[i] = nullptr; + data[i] = NULL; } rect = new Rect2i(0, 0, width, height); @@ -105,7 +105,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap); - if (image == nullptr) + if (image == NULL) { if (width == -1 || height == -1) { @@ -195,7 +195,7 @@ Texture::~Texture() for(int i = 0; i < 10; i++ ) { - if(data[i] != nullptr) delete data[i]; + if(data[i] != NULL) delete data[i]; } if(glId >= 0) @@ -225,10 +225,10 @@ void Texture::fill(const Rect2i *rect, int color) int line = y * width * 4; for (int x = myRect->getX(); x < (myRect->getX() + myRect->getWidth()); x++) { - data[0]->put(line + x * 4 + 0, static_cast((color >> 24) & 0x000000ff)); - data[0]->put(line + x * 4 + 1, static_cast((color >> 16) & 0x000000ff)); - data[0]->put(line + x * 4 + 2, static_cast((color >> 8) & 0x000000ff)); - data[0]->put(line + x * 4 + 3, static_cast((color >> 0) & 0x000000ff)); + data[0]->put(line + x * 4 + 0, (BYTE)((color >> 24) & 0x000000ff)); + data[0]->put(line + x * 4 + 1, (BYTE)((color >> 16) & 0x000000ff)); + data[0]->put(line + x * 4 + 2, (BYTE)((color >> 8) & 0x000000ff)); + data[0]->put(line + x * 4 + 3, (BYTE)((color >> 0) & 0x000000ff)); } } delete myRect; @@ -258,7 +258,7 @@ void Texture::writeAsBMP(const wstring &name) outFile.delete(); } - DataOutputStream *outStream = nullptr; + DataOutputStream *outStream = NULL; //try { outStream = new DataOutputStream(new FileOutputStream(outFile)); //} catch (IOException e) { @@ -384,7 +384,7 @@ void Texture::blit(int x, int y, Texture *source, bool rotated) { ByteBuffer *srcBuffer = source->getData(level); - if(srcBuffer == nullptr) break; + if(srcBuffer == NULL) break; int yy = y >> level; int xx = x >> level; @@ -530,10 +530,10 @@ void Texture::transferFromBuffer(intArray buffer) { int texel = column + x * 4; data[0]->position(0); - data[0]->put(texel + byteRemap[0], static_cast((buffer[texel >> 2] >> 24) & 0xff)); - data[0]->put(texel + byteRemap[1], static_cast((buffer[texel >> 2] >> 16) & 0xff)); - data[0]->put(texel + byteRemap[2], static_cast((buffer[texel >> 2] >> 8) & 0xff)); - data[0]->put(texel + byteRemap[3], static_cast((buffer[texel >> 2] >> 0) & 0xff)); + data[0]->put(texel + byteRemap[0], (byte)((buffer[texel >> 2] >> 24) & 0xff)); + data[0]->put(texel + byteRemap[1], (byte)((buffer[texel >> 2] >> 16) & 0xff)); + data[0]->put(texel + byteRemap[2], (byte)((buffer[texel >> 2] >> 8) & 0xff)); + data[0]->put(texel + byteRemap[3], (byte)((buffer[texel >> 2] >> 0) & 0xff)); } } } @@ -589,19 +589,19 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((tempPixels[intIndex] >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((tempPixels[intIndex] >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((tempPixels[intIndex] >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((tempPixels[intIndex] >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = (byte)((tempPixels[intIndex] >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = (byte)((tempPixels[intIndex] >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = (byte)((tempPixels[intIndex] >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = (byte)((tempPixels[intIndex] >> 0) & 0xff); } } for(int i = 0; i < 10; i++ ) { - if(data[i] != nullptr) + if(data[i] != NULL) { delete data[i]; - data[i] = nullptr; + data[i] = NULL; } } @@ -618,7 +618,7 @@ void Texture::transferFromImage(BufferedImage *image) delete [] tempBytes.data; - if(mipmapped || image->getData(1) != nullptr) + if(mipmapped || image->getData(1) != NULL) { mipmapped = true; for(unsigned int level = 1; level < MAX_MIP_LEVELS; ++level) @@ -641,10 +641,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((tempData[intIndex] >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((tempData[intIndex] >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((tempData[intIndex] >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((tempData[intIndex] >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = (byte)((tempData[intIndex] >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = (byte)((tempData[intIndex] >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = (byte)((tempData[intIndex] >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = (byte)((tempData[intIndex] >> 0) & 0xff); } } } @@ -676,10 +676,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((col >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((col >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((col >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((col >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = (byte)((col >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = (byte)((col >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = (byte)((col >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = (byte)((col >> 0) & 0xff); } } @@ -713,8 +713,8 @@ void Texture::transferFromImage(BufferedImage *image) // 4J Kept from older versions for where we create mip-maps for levels that do not have pre-made graphics int Texture::crispBlend(int c0, int c1) { - int a0 = static_cast(((c0 & 0xff000000) >> 24)) & 0xff; - int a1 = static_cast(((c1 & 0xff000000) >> 24)) & 0xff; + int a0 = (int) (((c0 & 0xff000000) >> 24)) & 0xff; + int a1 = (int) (((c1 & 0xff000000) >> 24)) & 0xff; int a = 255; if (a0 + a1 < 255) @@ -807,7 +807,7 @@ void Texture::updateOnGPU() { for (int level = 1; level < m_iMipLevels; level++) { - if(data[level] == nullptr) break; + if(data[level] == NULL) break; data[level]->flip(); } diff --git a/Minecraft.Client/Texture.h b/Minecraft.Client/Texture.h index 5dcf2b48..09b7495e 100644 --- a/Minecraft.Client/Texture.h +++ b/Minecraft.Client/Texture.h @@ -59,7 +59,7 @@ private: #ifdef __PS3__ ByteBuffer_IO *data[10]; #else - ByteBuffer *data[10]; // Arrays for mipmaps - nullptr if not used + ByteBuffer *data[10]; // Arrays for mipmaps - NULL if not used #endif public: diff --git a/Minecraft.Client/TextureHolder.cpp b/Minecraft.Client/TextureHolder.cpp index 11c8fb96..0f10272c 100644 --- a/Minecraft.Client/TextureHolder.cpp +++ b/Minecraft.Client/TextureHolder.cpp @@ -22,12 +22,12 @@ Texture *TextureHolder::getTexture() int TextureHolder::getWidth() const { - return rotated ? smallestFittingMinTexel(static_cast(height * scale)) : smallestFittingMinTexel(static_cast(width * scale)); + return rotated ? smallestFittingMinTexel((int) (height * scale)) : smallestFittingMinTexel((int) (width * scale)); } int TextureHolder::getHeight() const { - return rotated ? smallestFittingMinTexel(static_cast(width * scale)) : smallestFittingMinTexel(static_cast(height * scale)); + return rotated ? smallestFittingMinTexel((int) (width * scale)) : smallestFittingMinTexel((int) (height * scale)); } void TextureHolder::rotate() @@ -52,7 +52,7 @@ void TextureHolder::setForcedScale(int targetSize) return; } - scale = static_cast(targetSize) / min(width, height); + scale = (float) targetSize / min(width, height); } //@Override diff --git a/Minecraft.Client/TextureManager.cpp b/Minecraft.Client/TextureManager.cpp index d6cbe2c3..542b9499 100644 --- a/Minecraft.Client/TextureManager.cpp +++ b/Minecraft.Client/TextureManager.cpp @@ -7,7 +7,7 @@ #include "TextureManager.h" #include "..\Minecraft.World\StringHelpers.h" -TextureManager *TextureManager::instance = nullptr; +TextureManager *TextureManager::instance = NULL; void TextureManager::createInstance() { @@ -36,7 +36,7 @@ Texture *TextureManager::getTexture(const wstring &name) return idToTextureMap.find(stringToIDMap.find(name)->second)->second; } - return nullptr; + return NULL; } void TextureManager::registerName(const wstring &name, Texture *texture) @@ -136,7 +136,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool for (int i = 0; i < frameCount; i++) { BufferedImage *subImage = image->getSubimage(0, frameHeight * i, frameWidth, frameHeight); - Texture *texture = createTexture(texName, mode, frameWidth, frameHeight, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != nullptr, subImage); + Texture *texture = createTexture(texName, mode, frameWidth, frameHeight, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != NULL, subImage); delete subImage; result->push_back(texture); } @@ -146,7 +146,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool // TODO: Remove this hack -- fix proper rotation support (needed for 'off-aspect textures') if (width == height) { - result->push_back(createTexture(texName, mode, width, height, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != nullptr, image)); + result->push_back(createTexture(texName, mode, width, height, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != NULL, image)); } else { @@ -191,6 +191,6 @@ Texture *TextureManager::createTexture(const wstring &name, int mode, int width, Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap) { // 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader - //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, nullptr); - return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, nullptr); + //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); + return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); } \ No newline at end of file diff --git a/Minecraft.Client/TextureMap.cpp b/Minecraft.Client/TextureMap.cpp index 902dc9d6..9aefbb63 100644 --- a/Minecraft.Client/TextureMap.cpp +++ b/Minecraft.Client/TextureMap.cpp @@ -22,8 +22,8 @@ TextureMap::TextureMap(int type, const wstring &name, const wstring &path, Buffe this->missingTexture = missingTexture; // 4J Initialisers - missingPosition = nullptr; - stitchResult = nullptr; + missingPosition = NULL; + stitchResult = NULL; m_mipMap = mipmap; } @@ -37,7 +37,7 @@ void TextureMap::stitch() //for (Tile tile : Tile.tiles) for(unsigned int i = 0; i < Tile::TILE_NUM_COUNT; ++i) { - if (Tile::tiles[i] != nullptr) + if (Tile::tiles[i] != NULL) { Tile::tiles[i]->registerIcons(this); } @@ -51,7 +51,7 @@ void TextureMap::stitch() for(unsigned int i = 0; i < Item::ITEM_NUM_COUNT; ++i) { Item *item = Item::items[i]; - if (item != nullptr && item->getIconType() == iconType) + if (item != NULL && item->getIconType() == iconType) { item->registerIcons(this); } @@ -89,7 +89,7 @@ void TextureMap::stitch() // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); - if (frames == nullptr || frames->empty()) + if (frames == NULL || frames->empty()) { continue; // Couldn't load a texture, skip it } @@ -124,7 +124,7 @@ void TextureMap::stitch() vector *frames = textures.find(textureHolder)->second; - StitchedTexture *stored = nullptr; + StitchedTexture *stored = NULL; auto itTex = texturesToRegister.find(textureName); if(itTex != texturesToRegister.end() ) stored = itTex->second; @@ -188,7 +188,7 @@ void TextureMap::stitch() StitchedTexture *TextureMap::getTexture(const wstring &name) { StitchedTexture *result = texturesByName.find(name)->second; - if (result == nullptr) result = missingPosition; + if (result == NULL) result = missingPosition; return result; } @@ -212,7 +212,7 @@ Icon *TextureMap::registerIcon(const wstring &name) { if (name.empty()) { - app.DebugPrintf("Don't register nullptr\n"); + app.DebugPrintf("Don't register NULL\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif @@ -220,11 +220,11 @@ Icon *TextureMap::registerIcon(const wstring &name) } // TODO: [EB]: Why do we allow multiple registrations? - StitchedTexture *result = nullptr; + StitchedTexture *result = NULL; auto it = texturesToRegister.find(name); if(it != texturesToRegister.end()) result = it->second; - if (result == nullptr) + if (result == NULL) { result = StitchedTexture::create(name); texturesToRegister.insert( stringStitchedTextureMap::value_type(name, result) ); diff --git a/Minecraft.Client/TexturePack.cpp b/Minecraft.Client/TexturePack.cpp index bacb2951..7ed208ae 100644 --- a/Minecraft.Client/TexturePack.cpp +++ b/Minecraft.Client/TexturePack.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "TexturePack.h" -wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pchBDPatchFileName /*= nullptr*/) +wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pchBDPatchFileName /*= NULL*/) { wstring wDrive; #ifdef _XBOX @@ -24,8 +24,8 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pc #ifdef __PS3__ // 4J-PB - we need to check for a BD patch - this is going to be an issue for full DLC texture packs (Halloween) - char *pchUsrDir=nullptr; - if(app.GetBootedFromDiscPatch() && pchBDPatchFileName!=nullptr) + char *pchUsrDir=NULL; + if(app.GetBootedFromDiscPatch() && pchBDPatchFileName!=NULL) { pchUsrDir = app.GetBDUsrDirPath(pchBDPatchFileName); wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); diff --git a/Minecraft.Client/TexturePack.h b/Minecraft.Client/TexturePack.h index 8e613423..23cb4f62 100644 --- a/Minecraft.Client/TexturePack.h +++ b/Minecraft.Client/TexturePack.h @@ -35,11 +35,11 @@ public: */ return name; } - virtual DLCPack * getDLCPack() { return nullptr;} + virtual DLCPack * getDLCPack() { return NULL;} // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) = 0; virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"") = 0; virtual void loadColourTable() = 0; diff --git a/Minecraft.Client/TexturePackRepository.cpp b/Minecraft.Client/TexturePackRepository.cpp index ef926d78..6bb3cccc 100644 --- a/Minecraft.Client/TexturePackRepository.cpp +++ b/Minecraft.Client/TexturePackRepository.cpp @@ -8,9 +8,8 @@ #include "..\Minecraft.World\File.h" #include "..\Minecraft.World\StringHelpers.h" #include "Minimap.h" -#include "Common/UI/UI.h" -TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr; +TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = NULL; TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *minecraft) { @@ -18,7 +17,7 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m // 4J - added usingWeb = false; - selected = nullptr; + selected = NULL; texturePacks = new vector; this->minecraft = minecraft; @@ -29,9 +28,9 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m DEFAULT_TEXTURE_PACK->loadColourTable(); - m_dummyTexturePack = nullptr; - m_dummyDLCTexturePack = nullptr; - lastSelected = nullptr; + m_dummyTexturePack = NULL; + m_dummyDLCTexturePack = NULL; + lastSelected = NULL; updateList(); } @@ -50,13 +49,13 @@ void TexturePackRepository::addDebugPacks() { DLCPack *pack = app.m_dlcManager.getPack(L"DLCTestPack"); - if( pack != nullptr && pack->IsCorrupt() ) + if( pack != NULL && pack->IsCorrupt() ) { app.m_dlcManager.removePack(pack); - pack = nullptr; + pack = NULL; } - if(pack == nullptr) + if(pack == NULL) { wprintf(L"Pack \"%ls\" is not installed, so adding it\n", L"DLCTestPack"); pack = new DLCPack(L"DLCTestPack",0xffffffff); @@ -165,7 +164,7 @@ void TexturePackRepository::updateList() currentPacks->push_back(m_dummyTexturePack); cacheById[m_dummyTexturePack->getId()] = m_dummyTexturePack; - if(m_dummyDLCTexturePack != nullptr) + if(m_dummyDLCTexturePack != NULL) { currentPacks->push_back(m_dummyDLCTexturePack); cacheById[m_dummyDLCTexturePack->getId()] = m_dummyDLCTexturePack; @@ -228,7 +227,7 @@ wstring TexturePackRepository::getIdOrNull(File file) return file.getName() + ":folder:" + file.lastModified(); } - return nullptr; + return NULL; #endif return L""; } @@ -358,17 +357,17 @@ TexturePack *TexturePackRepository::getTexturePackById(DWORD id) return it->second; } - return nullptr; + return NULL; } TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, DWORD id) { - TexturePack *newPack = nullptr; + TexturePack *newPack = NULL; // 4J-PB - The City texture pack went out with a child id for the texture pack of 1 instead of zero // we need to mask off the child id here to deal with this DWORD dwParentID=id&0xFFFFFF; // child id is <<24 and Or'd with parent - if(dlcPack != nullptr) + if(dlcPack != NULL) { newPack = new DLCTexturePack(dwParentID, dlcPack, DEFAULT_TEXTURE_PACK); texturePacks->push_back(newPack); @@ -409,7 +408,7 @@ void TexturePackRepository::removeTexturePackById(DWORD id) texturePacks->erase(it2); if(lastSelected == oldPack) { - lastSelected = nullptr; + lastSelected = NULL; } } m_texturePacksToDelete.push_back(oldPack); @@ -418,19 +417,19 @@ void TexturePackRepository::removeTexturePackById(DWORD id) void TexturePackRepository::updateUI() { - if(lastSelected != nullptr && lastSelected != selected) + if(lastSelected != NULL && lastSelected != selected) { lastSelected->unloadUI(); selected->loadUI(); Minimap::reloadColours(); ui.StartReloadSkinThread(); - lastSelected = nullptr; + lastSelected = NULL; } } bool TexturePackRepository::needsUIUpdate() { - return lastSelected != nullptr && lastSelected != selected; + return lastSelected != NULL && lastSelected != selected; } unsigned int TexturePackRepository::getTexturePackCount() @@ -440,7 +439,7 @@ unsigned int TexturePackRepository::getTexturePackCount() TexturePack *TexturePackRepository::getTexturePackByIndex(unsigned int index) { - TexturePack *pack = nullptr; + TexturePack *pack = NULL; if(index < texturePacks->size()) { pack = texturePacks->at(index); diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index f433dc5e..9a2e98a6 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -288,7 +288,7 @@ void Textures::loadIndexedTextures() // 4J - added - preload a set of commonly used textures that can then be referenced directly be an enumerated type rather by string for( int i = 0; i < TN_COUNT - 2; i++ ) { - preLoadedIdx[i] = loadTexture(static_cast(i), wstring(preLoaded[i]) + L".png"); + preLoadedIdx[i] = loadTexture((TEXTURE_NAME)i, wstring(preLoaded[i]) + L".png"); } } @@ -299,15 +299,15 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resource { intArray id = pixelsMap[resourceName]; // 4J - if resourceName isn't in the map, it should add an element and as that will use the default constructor, its - // internal data pointer will be nullptr - if (id.data != nullptr) return id; + // internal data pointer will be NULL + if (id.data != NULL) return id; } // 4J - removed try/catch // try { intArray res; //wstring in = skin->getResource(resourceName); - if (false)// 4J - removed - was ( in == nullptr) + if (false)// 4J - removed - was ( in == NULL) { res = loadTexturePixels(missingNo); } @@ -451,14 +451,14 @@ void Textures::bindTextureLayers(ResourceLocation *resource) for( int i = 0; i < layers; i++ ) { TEXTURE_NAME textureName = resource->getTexture(i); - if( textureName == static_cast<_TEXTURE_NAME>(-1) ) + if( textureName == (_TEXTURE_NAME)-1 ) { continue; } wstring resourceName = wstring(preLoaded[textureName]) + L".png"; BufferedImage *image = readImage(textureName, resourceName); - if( image == nullptr ) + if( image == NULL ) { continue; } @@ -500,10 +500,10 @@ void Textures::bindTextureLayers(ResourceLocation *resource) float srcFactor = srcAlpha / outAlpha; float dstFactor = (dstAlpha * (1.0f - srcAlpha)) / outAlpha; - int outA = static_cast(outAlpha * 255.0f + 0.5f); - int outR = static_cast((((src >> 16) & 0xff) * srcFactor) + (((dst >> 16) & 0xff) * dstFactor) + 0.5f); - int outG = static_cast((((src >> 8) & 0xff) * srcFactor) + (((dst >> 8) & 0xff) * dstFactor) + 0.5f); - int outB = static_cast(((src & 0xff) * srcFactor) + ((dst & 0xff) * dstFactor) + 0.5f); + int outA = (int)(outAlpha * 255.0f + 0.5f); + int outR = (int)((((src >> 16) & 0xff) * srcFactor) + (((dst >> 16) & 0xff) * dstFactor) + 0.5f); + int outG = (int)((((src >> 8) & 0xff) * srcFactor) + (((dst >> 8) & 0xff) * dstFactor) + 0.5f); + int outB = (int)(((src & 0xff) * srcFactor) + ((dst & 0xff) * dstFactor) + 0.5f); mergedPixels[p] = (outA << 24) | (outR << 16) | (outG << 8) | outB; } } @@ -618,7 +618,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) if (clamp) pathName = resourceName.substr(7); //wstring in = skins->getSelected()->getResource(pathName); - if (false ) // 4J - removed was ( in == nullptr) + if (false ) // 4J - removed was ( in == NULL) { loadTexture(missingNo, id, blur, clamp); } @@ -711,7 +711,7 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp) intArray rawPixels(w*h); img->getRGB(0, 0, w, h, rawPixels, 0, w); - if (options != nullptr && options->anaglyph3d) + if (options != NULL && options->anaglyph3d) { rawPixels = anaglyph(rawPixels); } @@ -730,10 +730,10 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp) newPixels[i * 4 + 2] = (byte) g; newPixels[i * 4 + 3] = (byte) b; #else - newPixels[i * 4 + 0] = static_cast(r); - newPixels[i * 4 + 1] = static_cast(g); - newPixels[i * 4 + 2] = static_cast(b); - newPixels[i * 4 + 3] = static_cast(a); + newPixels[i * 4 + 0] = (byte) r; + newPixels[i * 4 + 1] = (byte) g; + newPixels[i * 4 + 2] = (byte) b; + newPixels[i * 4 + 3] = (byte) a; #endif } // 4J - now creating a buffer of the size we require dynamically @@ -877,7 +877,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - if (options != nullptr && options->anaglyph3d) + if (options != NULL && options->anaglyph3d) { rawPixels = anaglyph(rawPixels); } @@ -890,7 +890,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) int g = (rawPixels[i] >> 8) & 0xff; int b = (rawPixels[i]) & 0xff; - if (options != nullptr && options->anaglyph3d) + if (options != NULL && options->anaglyph3d) { int rr = (r * 30 + g * 59 + b * 11) / 100; int gg = (r * 30 + g * 70) / (100); @@ -901,10 +901,10 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) b = bb; } - newPixels[i * 4 + 0] = static_cast(r); - newPixels[i * 4 + 1] = static_cast(g); - newPixels[i * 4 + 2] = static_cast(b); - newPixels[i * 4 + 3] = static_cast(a); + newPixels[i * 4 + 0] = (byte) r; + newPixels[i * 4 + 1] = (byte) g; + newPixels[i * 4 + 2] = (byte) b; + newPixels[i * 4 + 3] = (byte) a; } ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically pixels->put(newPixels); @@ -1004,9 +1004,9 @@ void Textures::releaseTexture(int id) int Textures::loadHttpTexture(const wstring& url, const wstring& backup) { HttpTexture *texture = httpTextures[url]; - if (texture != nullptr) + if (texture != NULL) { - if (texture->loadedImage != nullptr && !texture->isLoaded) + if (texture->loadedImage != NULL && !texture->isLoaded) { if (texture->id < 0) { @@ -1019,7 +1019,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) texture->isLoaded = true; } } - if (texture == nullptr || texture->id < 0) + if (texture == NULL || texture->id < 0) { if (backup.empty() ) return -1; return loadTexture(TN_COUNT, backup); @@ -1030,9 +1030,9 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) int Textures::loadHttpTexture(const wstring& url, int backup) { HttpTexture *texture = httpTextures[url]; - if (texture != nullptr) + if (texture != NULL) { - if (texture->loadedImage != nullptr && !texture->isLoaded) + if (texture->loadedImage != NULL && !texture->isLoaded) { if (texture->id < 0) { @@ -1045,7 +1045,7 @@ int Textures::loadHttpTexture(const wstring& url, int backup) texture->isLoaded = true; } } - if (texture == nullptr || texture->id < 0) + if (texture == NULL || texture->id < 0) { return loadTexture(backup); } @@ -1060,7 +1060,7 @@ bool Textures::hasHttpTexture(const wstring &url) HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *processor) { HttpTexture *texture = httpTextures[url]; - if (texture == nullptr) + if (texture == NULL) { httpTextures[url] = new HttpTexture(url, processor); } @@ -1074,7 +1074,7 @@ HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor * void Textures::removeHttpTexture(const wstring& url) { HttpTexture *texture = httpTextures[url]; - if (texture != nullptr) + if (texture != NULL) { texture->count--; if (texture->count == 0) @@ -1088,20 +1088,20 @@ void Textures::removeHttpTexture(const wstring& url) // 4J-PB - adding for texture in memory (from global title storage) int Textures::loadMemTexture(const wstring& url, const wstring& backup) { - MemTexture *texture = nullptr; + MemTexture *texture = NULL; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == nullptr && app.IsFileInMemoryTextures(url)) + if(texture == NULL && app.IsFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor() ); } - if(texture != nullptr) + if(texture != NULL) { - if (texture->loadedImage != nullptr && !texture->isLoaded) + if (texture->loadedImage != NULL && !texture->isLoaded) { // 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo if( ( url.substr(0,7) == L"dlcskin" ) || @@ -1122,7 +1122,7 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) MIPMAP = true; } } - if (texture == nullptr || texture->id < 0) + if (texture == NULL || texture->id < 0) { if (backup.empty() ) return -1; return loadTexture(TN_COUNT,backup); @@ -1132,21 +1132,21 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) int Textures::loadMemTexture(const wstring& url, int backup) { - MemTexture *texture = nullptr; + MemTexture *texture = NULL; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == nullptr && app.IsFileInMemoryTextures(url)) + if(texture == NULL && app.IsFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor() ); } - if(texture != nullptr) + if(texture != NULL) { texture->ticksSinceLastUse = 0; - if (texture->loadedImage != nullptr && !texture->isLoaded) + if (texture->loadedImage != NULL && !texture->isLoaded) { // 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo if( ( url.substr(0,7) == L"dlcskin" ) || @@ -1166,7 +1166,7 @@ int Textures::loadMemTexture(const wstring& url, int backup) MIPMAP = true; } } - if (texture == nullptr || texture->id < 0) + if (texture == NULL || texture->id < 0) { return loadTexture(backup); } @@ -1175,16 +1175,16 @@ int Textures::loadMemTexture(const wstring& url, int backup) MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor) { - MemTexture *texture = nullptr; + MemTexture *texture = NULL; auto it = memTextures.find(name); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == nullptr) + if(texture == NULL) { // can we find it in the app mem files? - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwBytes=0; app.GetMemFileDetails(name,&pbData,&dwBytes); @@ -1196,7 +1196,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro else { // 4J Stu - Make an entry for this anyway and we can populate it later - memTextures[name] = nullptr; + memTextures[name] = NULL; } } else @@ -1212,7 +1212,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro // MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor *processor) // { // MemTexture *texture = memTextures[url]; -// if (texture != nullptr) +// if (texture != NULL) // { // texture->count++; // } @@ -1221,16 +1221,16 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro void Textures::removeMemTexture(const wstring& url) { - MemTexture *texture = nullptr; + MemTexture *texture = NULL; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; - // If it's nullptr then we should just remove the entry - if( texture == nullptr ) memTextures.erase(url); + // If it's NULL then we should just remove the entry + if( texture == NULL ) memTextures.erase(url); } - if(texture != nullptr) + if(texture != NULL) { texture->count--; if (texture->count == 0) @@ -1380,7 +1380,7 @@ Icon *Textures::getMissingIcon(int type) BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in { - BufferedImage *img=nullptr; + BufferedImage *img=NULL; MemSect(32); // is this image one of the Title Update ones? bool isTu = IsTUImage(texId, name); @@ -1534,7 +1534,7 @@ const wchar_t *TUImagePaths[] = // - nullptr + NULL }; bool Textures::IsTUImage(TEXTURE_NAME texId, const wstring& name) @@ -1583,7 +1583,7 @@ const wchar_t *OriginalImagesPaths[] = { L"misc/watercolor.png", - nullptr + NULL }; bool Textures::IsOriginalImage(TEXTURE_NAME texId, const wstring& name) diff --git a/Minecraft.Client/TheEndPortalRenderer.cpp b/Minecraft.Client/TheEndPortalRenderer.cpp index c709cfd1..98c7e7cc 100644 --- a/Minecraft.Client/TheEndPortalRenderer.cpp +++ b/Minecraft.Client/TheEndPortalRenderer.cpp @@ -16,9 +16,9 @@ void TheEndPortalRenderer::render(shared_ptr _table, double x, doubl { // 4J Convert as we aren't using a templated class shared_ptr table = dynamic_pointer_cast(_table); - float xx = static_cast(tileEntityRenderDispatcher->xPlayer); - float yy = static_cast(tileEntityRenderDispatcher->yPlayer); - float zz = static_cast(tileEntityRenderDispatcher->zPlayer); + float xx = (float) tileEntityRenderDispatcher->xPlayer; + float yy = (float) tileEntityRenderDispatcher->yPlayer; + float zz = (float) tileEntityRenderDispatcher->zPlayer; glDisable(GL_LIGHTING); @@ -50,12 +50,12 @@ void TheEndPortalRenderer::render(shared_ptr _table, double x, doubl sscale = 1 / 2.0f; } - float dd = static_cast(-(y + hoff)); + float dd = (float) -(y + hoff); { float ss1 = (float) (dd + Camera::yPlayerOffs); float ss2 = (float) (dd + dist + Camera::yPlayerOffs); float s = ss1 / ss2; - s = static_cast(y + hoff) + s; + s = (float) (y + hoff) + s; glTranslatef(xx, s, zz); } diff --git a/Minecraft.Client/TileEntityRenderDispatcher.cpp b/Minecraft.Client/TileEntityRenderDispatcher.cpp index 5a1519c7..887663fe 100644 --- a/Minecraft.Client/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/TileEntityRenderDispatcher.cpp @@ -15,7 +15,7 @@ #include "EnderChestRenderer.h" #include "BeaconRenderer.h" -TileEntityRenderDispatcher *TileEntityRenderDispatcher::instance = nullptr; +TileEntityRenderDispatcher *TileEntityRenderDispatcher::instance = NULL; double TileEntityRenderDispatcher::xOff = 0; double TileEntityRenderDispatcher::yOff = 0; double TileEntityRenderDispatcher::zOff = 0; @@ -28,9 +28,9 @@ void TileEntityRenderDispatcher::staticCtor() TileEntityRenderDispatcher::TileEntityRenderDispatcher() { // 4J -a dded - font = nullptr; - textures = nullptr; - level = nullptr; + font = NULL; + textures = NULL; + level = NULL; cameraEntity = nullptr; playerRotY = 0.0f; playerRotX = 0.0f;; @@ -45,7 +45,7 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() renderers[eTYPE_ENCHANTMENTTABLEENTITY] = new EnchantTableRenderer(); renderers[eTYPE_THEENDPORTALTILEENTITY] = new TheEndPortalRenderer(); renderers[eTYPE_SKULLTILEENTITY] = new SkullTileRenderer(); - renderers[eTYPE_FURNACETILEENTITY] = nullptr; + renderers[eTYPE_FURNACETILEENTITY] = NULL; renderers[eTYPE_BEACONTILEENTITY] = new BeaconRenderer(); glDisable(GL_LIGHTING); @@ -57,13 +57,13 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) { - TileEntityRenderer *r = nullptr; + TileEntityRenderer *r = NULL; //TileEntityRenderer *r = renderers[e]; auto it = renderers.find(e); // 4J Stu - The .at and [] accessors insert elements if they don't exist if( it == renderers.end() ) { - return nullptr; + return NULL; } /* 4J - not doing this hierarchical search anymore. We need to explicitly add renderers for any eINSTANCEOF type that we want to be able to render @@ -83,12 +83,12 @@ TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) bool TileEntityRenderDispatcher::hasRenderer(shared_ptr e) { - return getRenderer(e) != nullptr; + return getRenderer(e) != NULL; } TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(shared_ptr e) { - if (e == nullptr) return nullptr; + if (e == NULL) return NULL; return getRenderer(e->GetType()); } @@ -135,7 +135,7 @@ void TileEntityRenderDispatcher::render(shared_ptr e, float a, bool void TileEntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float a, bool setColor/*=true*/, float alpha, bool useCompiled) { TileEntityRenderer *renderer = getRenderer(entity); - if (renderer != nullptr) + if (renderer != NULL) { renderer->render(entity, x, y, z, a, setColor, alpha, useCompiled); } diff --git a/Minecraft.Client/TileEntityRenderer.cpp b/Minecraft.Client/TileEntityRenderer.cpp index 86bfee7b..94bdd39c 100644 --- a/Minecraft.Client/TileEntityRenderer.cpp +++ b/Minecraft.Client/TileEntityRenderer.cpp @@ -5,13 +5,13 @@ void TileEntityRenderer::bindTexture(ResourceLocation *location) { Textures *t = tileEntityRenderDispatcher->textures; - if(t != nullptr) t->bind(t->loadTexture(location->getTexture())); + if(t != NULL) t->bind(t->loadTexture(location->getTexture())); } void TileEntityRenderer::bindTexture(const wstring& urlTexture, ResourceLocation *location) { Textures *t = tileEntityRenderDispatcher->textures; - if(t != nullptr) t->bind(t->loadHttpTexture(urlTexture, location->getTexture())); + if(t != NULL) t->bind(t->loadHttpTexture(urlTexture, location->getTexture())); } Level *TileEntityRenderer::getLevel() diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index b77729ab..4735b941 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -19,7 +19,7 @@ const float smallUV = ( 1.0f / 16.0f ); void TileRenderer::_init() { - fixedTexture = nullptr; + fixedTexture = NULL; xFlipTexture = false; noCulling = false; applyAmbienceOcclusion = false; @@ -44,7 +44,7 @@ void TileRenderer::_init() xMin = 0; yMin = 0; zMin = 0; - cache = nullptr; + cache = NULL; } bool TileRenderer::isTranslucentAt(LevelSource *level, int x, int y, int z) @@ -131,7 +131,7 @@ int TileRenderer::getLightColor( Tile *tt, LevelSource *level, int x, int y, int // Tiles that were determined to be invisible (by being surrounded by solid stuff) will be set to 255 rather than their actual ID if( ucTileId != 255 ) { - tileId = static_cast(ucTileId); + tileId = (int)ucTileId; } } int ret = tt->getLightColor(level, x, y, z, tileId); @@ -170,7 +170,7 @@ TileRenderer::TileRenderer( LevelSource* level ) TileRenderer::TileRenderer() { - this->level = nullptr; + this->level = NULL; _init(); } @@ -181,7 +181,7 @@ void TileRenderer::setFixedTexture( Icon *fixedTexture ) void TileRenderer::clearFixedTexture() { - this->fixedTexture = nullptr; + this->fixedTexture = NULL; } bool TileRenderer::hasFixedTexture() @@ -195,7 +195,7 @@ bool TileRenderer::hasFixedTexture() } #endif - return fixedTexture != nullptr; + return fixedTexture != NULL; } void TileRenderer::setShape(float x0, float y0, float z0, float x1, float y1, float z1) @@ -347,7 +347,7 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceDat retVal = tesselateTorchInWorld( tt, x, y, z ); break; case Tile::SHAPE_FIRE: - retVal = tesselateFireInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFireInWorld( (FireTile *)tt, x, y, z ); break; case Tile::SHAPE_RED_DUST: retVal = tesselateDustInWorld( tt, x, y, z ); @@ -359,19 +359,19 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceDat retVal = tesselateDoorInWorld( tt, x, y, z ); break; case Tile::SHAPE_RAIL: - retVal = tesselateRailInWorld( static_cast(tt), x, y, z ); + retVal = tesselateRailInWorld( ( RailTile* )tt, x, y, z ); break; case Tile::SHAPE_STAIRS: - retVal = tesselateStairsInWorld( static_cast(tt), x, y, z ); + retVal = tesselateStairsInWorld( (StairTile *)tt, x, y, z ); break; case Tile::SHAPE_EGG: - retVal = tesselateEggInWorld(static_cast(tt), x, y, z); + retVal = tesselateEggInWorld((EggTile*) tt, x, y, z); break; case Tile::SHAPE_FENCE: - retVal = tesselateFenceInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFenceInWorld( ( FenceTile* )tt, x, y, z ); break; case Tile::SHAPE_WALL: - retVal = tesselateWallInWorld( static_cast(tt), x, y, z); + retVal = tesselateWallInWorld( (WallTile *) tt, x, y, z); break; case Tile::SHAPE_LEVER: retVal = tesselateLeverInWorld( tt, x, y, z ); @@ -386,13 +386,13 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceDat retVal = tesselateBedInWorld( tt, x, y, z ); break; case Tile::SHAPE_REPEATER: - retVal = tesselateRepeaterInWorld(static_cast(tt), x, y, z); + retVal = tesselateRepeaterInWorld((RepeaterTile *)tt, x, y, z); break; case Tile::SHAPE_DIODE: - retVal = tesselateDiodeInWorld( static_cast(tt), x, y, z ); + retVal = tesselateDiodeInWorld( (DiodeTile *)tt, x, y, z ); break; case Tile::SHAPE_COMPARATOR: - retVal = tesselateComparatorInWorld(static_cast(tt), x, y, z); + retVal = tesselateComparatorInWorld((ComparatorTile *)tt, x, y, z); break; case Tile::SHAPE_PISTON_BASE: retVal = tesselatePistonBaseInWorld( tt, x, y, z, false, forceData ); @@ -401,7 +401,7 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceDat retVal = tesselatePistonExtensionInWorld( tt, x, y, z, true, forceData ); break; case Tile::SHAPE_IRON_FENCE: - retVal = tesselateThinFenceInWorld( static_cast(tt), x, y, z ); + retVal = tesselateThinFenceInWorld( ( ThinFenceTile* )tt, x, y, z ); break; case Tile::SHAPE_THIN_PANE: retVal = tesselateThinPaneInWorld(tt, x, y, z); @@ -410,25 +410,25 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z, int forceDat retVal = tesselateVineInWorld( tt, x, y, z ); break; case Tile::SHAPE_FENCE_GATE: - retVal = tesselateFenceGateInWorld( static_cast(tt), x, y, z ); + retVal = tesselateFenceGateInWorld( ( FenceGateTile* )tt, x, y, z ); break; case Tile::SHAPE_CAULDRON: - retVal = tesselateCauldronInWorld(static_cast(tt), x, y, z); + retVal = tesselateCauldronInWorld((CauldronTile* ) tt, x, y, z); break; case Tile::SHAPE_FLOWER_POT: - retVal = tesselateFlowerPotInWorld(static_cast(tt), x, y, z); + retVal = tesselateFlowerPotInWorld((FlowerPotTile *) tt, x, y, z); break; case Tile::SHAPE_ANVIL: - retVal = tesselateAnvilInWorld(static_cast(tt), x, y, z); + retVal = tesselateAnvilInWorld((AnvilTile *) tt, x, y, z); break; case Tile::SHAPE_BREWING_STAND: - retVal = tesselateBrewingStandInWorld(static_cast(tt), x, y, z); + retVal = tesselateBrewingStandInWorld((BrewingStandTile* ) tt, x, y, z); break; case Tile::SHAPE_PORTAL_FRAME: - retVal = tesselateAirPortalFrameInWorld(static_cast(tt), x, y, z); + retVal = tesselateAirPortalFrameInWorld((TheEndPortalFrameTile *)tt, x, y, z); break; case Tile::SHAPE_COCOA: - retVal = tesselateCocoaInWorld(static_cast(tt), x, y, z); + retVal = tesselateCocoaInWorld((CocoaTile *)tt, x, y, z); break; case Tile::SHAPE_BEACON: retVal = tesselateBeaconInWorld(tt, x, y, z); @@ -907,7 +907,7 @@ bool TileRenderer::tesselateFlowerPotInWorld(FlowerPotTile *tt, int x, int y, in float xOff = 0; float yOff = 4; float zOff = 0; - Tile *plant = nullptr; + Tile *plant = NULL; switch (type) { @@ -927,7 +927,7 @@ bool TileRenderer::tesselateFlowerPotInWorld(FlowerPotTile *tt, int x, int y, in t->addOffset(xOff / 16.0f, yOff / 16.0f, zOff / 16.0f); - if (plant != nullptr) + if (plant != NULL) { tesselateInWorld(plant, x, y, z); } @@ -1160,23 +1160,23 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z ) float h = 0.20f; if ( dir == 1 ) { - tesselateTorch( tt, static_cast(x) - r2, static_cast(y) + h, static_cast(z), -r, 0.0f, 0 ); + tesselateTorch( tt, (float)x - r2, (float)y + h, (float)z, -r, 0.0f, 0 ); } else if ( dir == 2 ) { - tesselateTorch( tt, static_cast(x) + r2, static_cast(y) + h, static_cast(z), +r, 0.0f, 0 ); + tesselateTorch( tt, (float)x + r2, (float)y + h, (float)z, +r, 0.0f, 0 ); } else if ( dir == 3 ) { - tesselateTorch( tt, static_cast(x), static_cast(y) + h, z - r2, 0.0f, -r, 0 ); + tesselateTorch( tt, (float)x, (float)y + h, z - r2, 0.0f, -r, 0 ); } else if ( dir == 4 ) { - tesselateTorch( tt, static_cast(x), static_cast(y) + h, static_cast(z) + r2, 0.0f, +r, 0 ); + tesselateTorch( tt, (float)x, (float)y + h, (float)z + r2, 0.0f, +r, 0 ); } else { - tesselateTorch( tt, static_cast(x), static_cast(y), static_cast(z), 0.0f, 0.0f, 0 ); + tesselateTorch( tt, (float)x, (float)y, (float)z, 0.0f, 0.0f, 0 ); } return true; @@ -1257,7 +1257,7 @@ bool TileRenderer::tesselateRepeaterInWorld(RepeaterTile *tt, int x, int y, int south = 14.f; break; } - setShape(west / 16.0f + static_cast(transmitterX), 2.f / 16.0f, north / 16.0f + static_cast(transmitterZ), east / 16.0f + static_cast(transmitterX), 4.f / 16.0f, south / 16.0f + static_cast(transmitterZ)); + setShape(west / 16.0f + (float) transmitterX, 2.f / 16.0f, north / 16.0f + (float) transmitterZ, east / 16.0f + (float) transmitterX, 4.f / 16.0f, south / 16.0f + (float) transmitterZ); double u0 = lockTex->getU(west); double v0 = lockTex->getV(north); double u1 = lockTex->getU(east); @@ -1503,7 +1503,7 @@ bool TileRenderer::tesselatePistonBaseInWorld( Tile* tt, int x, int y, int z, bo } // weird way of telling the piston to use the // "inside" texture for the forward-facing edge - static_cast(tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); + ((PistonBaseTile *) tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); tesselateBlockInWorld( tt, x, y, z ); northFlip = FLIP_NONE; southFlip = FLIP_NONE; @@ -1511,7 +1511,7 @@ bool TileRenderer::tesselatePistonBaseInWorld( Tile* tt, int x, int y, int z, bo westFlip = FLIP_NONE; upFlip = FLIP_NONE; downFlip = FLIP_NONE; - static_cast(tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); + ((PistonBaseTile *) tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); } else { @@ -1902,7 +1902,7 @@ bool TileRenderer::tesselateLeverInWorld( Tile* tt, int x, int y, int z ) } } - Vec3* c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; + Vec3* c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; for ( int i = 0; i < 6; i++ ) { if ( i == 0 ) @@ -1961,10 +1961,10 @@ bool TileRenderer::tesselateLeverInWorld( Tile* tt, int x, int y, int z ) c2 = corners[7]; c3 = corners[4]; } - t->vertexUV( static_cast(c0->x), static_cast(c0->y), static_cast(c0->z), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(c1->x), static_cast(c1->y), static_cast(c1->z), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(c2->x), static_cast(c2->y), static_cast(c2->z), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(c3->x), static_cast(c3->y), static_cast(c3->z), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( c0->x ), ( float )( c0->y ), ( float )( c0->z ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( c1->x ), ( float )( c1->y ), ( float )( c1->z ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( c2->x ), ( float )( c2->y ), ( float )( c2->z ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( c3->x ), ( float )( c3->y ), ( float )( c3->z ), ( float )( u0 ), ( float )( v0 ) ); } return true; @@ -2073,7 +2073,7 @@ bool TileRenderer::tesselateTripwireSourceInWorld(Tile *tt, int x, int y, int z) corners[i]->z += z + 0.5; } - Vec3 *c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; + Vec3 *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; int stickX0 = 7; int stickX1 = 9; int stickY0 = 9; @@ -2491,15 +2491,15 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) float z0_ = z + 0.5f - 0.3f; float z1_ = z + 0.5f + 0.3f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(true); @@ -2507,15 +2507,15 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) u1 = tex->getU1(true); v1 = tex->getV1(true); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); x0 = x + 0.5f - 0.5f; x1 = x + 0.5f + 0.5f; @@ -2527,15 +2527,15 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) z0_ = z + 0.5f - 0.4f; z1_ = z + 0.5f + 0.4f; - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), static_cast(z + 1), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 1), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), static_cast(z + 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), static_cast(z + 0), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) ); tex = firstTex; u0 = tex->getU0(true); @@ -2543,15 +2543,15 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) u1 = tex->getU1(true); v1 = tex->getV1(true); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 0), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); } else { @@ -2595,10 +2595,10 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) { t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 0.0f ), ( float )( u0 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + - 0.0f ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x + 1 - 0), ( float )( y + 0 + yo ), ( float )( z + - 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 0.0f ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); @@ -2674,14 +2674,14 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) if ( ( ( x + y + z ) & 1 ) == 0 ) { - t->vertexUV( static_cast(x0_), ( float )( y + h ), static_cast(z + - 0), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x0), static_cast(y + 0), static_cast(z + - 0), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x0), static_cast(y + 0), static_cast(z + - 1), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x0_), ( float )( y + h ), static_cast(z + - 1), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 0 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + + 1 ), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(true); @@ -2689,25 +2689,25 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) u1 = tex->getU1(true); v1 = tex->getV1(true); - t->vertexUV( static_cast(x1_), ( float )( y + h ), ( float )( z + - 1.0f ), ( float )( u1 ), ( float )( v0 ) ); - t->vertexUV( static_cast(x1), ( float )( y + 0.0f ), ( float )( z + - 1.0f ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x1), ( float )( y + 0.0f ), static_cast(z + - 0), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( static_cast(x1_), ( float )( y + h ), static_cast(z + - 0), ( float )( u0 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v0 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + + 1.0f ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + + 0 ), ( float )( u0 ), ( float )( v0 ) ); } else { t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - h ), static_cast(z1_), ( float )( u1 ), ( float )( v0 ) ); + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - 0.0f ), static_cast(z1), ( float )( u1 ), ( float )( v1 ) ); + 0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - 0.0f ), static_cast(z1), ( float )( u0 ), ( float )( v1 ) ); + 0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - h ), static_cast(z1_), ( float )( u0 ), ( float )( v0 ) ); + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); tex = secondTex; u0 = tex->getU0(true); @@ -2716,13 +2716,13 @@ bool TileRenderer::tesselateFireInWorld( FireTile* tt, int x, int y, int z ) v1 = tex->getV1(true); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - h ), static_cast(z0_), ( float )( u1 ), ( float )( v0 ) ); + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - 0.0f ), static_cast(z0), ( float )( u1 ), ( float )( v1 ) ); + 0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - 0.0f ), static_cast(z0), ( float )( u0 ), ( float )( v1 ) ); + 0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - h ), static_cast(z0_), ( float )( u0 ), ( float )( v0 ) ); + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); } } } @@ -2838,13 +2838,13 @@ bool TileRenderer::tesselateDustInWorld( Tile* tt, int x, int y, int z ) int v1 = SharedConstants::WORLD_RESOLUTION; int cutDistance = 5; - if (!w) x0 += cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); + if (!w) x0 += cutDistance / (float) SharedConstants::WORLD_RESOLUTION; if (!w) u0 += cutDistance; - if (!e) x1 -= cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); + if (!e) x1 -= cutDistance / (float) SharedConstants::WORLD_RESOLUTION; if (!e) u1 -= cutDistance; - if (!n) z0 += cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); + if (!n) z0 += cutDistance / (float) SharedConstants::WORLD_RESOLUTION; if (!n) v0 += cutDistance; - if (!s) z1 -= cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); + if (!s) z1 -= cutDistance / (float) SharedConstants::WORLD_RESOLUTION; if (!s) v1 -= cutDistance; t->vertexUV( ( float )( x1 ), ( float )( y + dustOffset ), ( float )( z1 ), crossTexture->getU(u1, true), crossTexture->getV(v1) ); t->vertexUV( ( float )( x1 ), ( float )( y + dustOffset ), ( float )( z0 ), crossTexture->getU(u1, true), crossTexture->getV(v0) ); @@ -2891,58 +2891,58 @@ bool TileRenderer::tesselateDustInWorld( Tile* tt, int x, int y, int z ) if ( level->isSolidBlockingTile( x - 1, y, z ) && level->getTile( x - 1, y + 1, z ) == Tile::redStoneDust_Id ) { t->color( br * red, br * green, br * blue ); - t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 1), lineTexture->getU1(true), lineTexture->getV0(true) ); - t->vertexUV( ( float )( x + dustOffset ), static_cast(y + 0), static_cast(z + 1), lineTexture->getU0(true), lineTexture->getV0(true) ); - t->vertexUV( ( float )( x + dustOffset ), static_cast(y + 0), static_cast(z + 0), lineTexture->getU0(true), lineTexture->getV1(true) ); - t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 0), lineTexture->getU1(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 1 ), lineTexture->getU1(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 0 ), ( float )( z + 1 ), lineTexture->getU0(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 0 ), ( float )( z + 0 ), lineTexture->getU0(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + dustOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 0 ), lineTexture->getU1(true), lineTexture->getV1(true) ); t->color( br, br, br ); - t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 1), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( ( float )( x + overlayOffset ), static_cast(y + 0), static_cast(z + 1), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( ( float )( x + overlayOffset ), static_cast(y + 0), static_cast(z + 0), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 0), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 1 ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 0 ), ( float )( z + 1 ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 0 ), ( float )( z + 0 ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + overlayOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 0 ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); } if ( level->isSolidBlockingTile( x + 1, y, z ) && level->getTile( x + 1, y + 1, z ) == Tile::redStoneDust_Id ) { t->color( br * red, br * green, br * blue ); - t->vertexUV( ( float )( x + 1 - dustOffset ), static_cast(y + 0), static_cast(z + 1), lineTexture->getU0(true), lineTexture->getV1(true) ); - t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 1), lineTexture->getU1(true), lineTexture->getV1(true) ); - t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 0), lineTexture->getU1(true), lineTexture->getV0(true) ); - t->vertexUV( ( float )( x + 1 - dustOffset ), static_cast(y + 0), static_cast(z + 0), lineTexture->getU0(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 0 ), ( float )( z + 1 ), lineTexture->getU0(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 1 ), lineTexture->getU1(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 0 ), lineTexture->getU1(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 1 - dustOffset ), ( float )( y + 0 ), ( float )( z + 0 ), lineTexture->getU0(true), lineTexture->getV0(true) ); t->color( br, br, br ); - t->vertexUV( ( float )( x + 1 - overlayOffset ), static_cast(y + 0), static_cast(z + 1), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 1), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 1 + yStretch ), static_cast(z + 0), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( ( float )( x + 1 - overlayOffset ), static_cast(y + 0), static_cast(z + 0), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 0 ), ( float )( z + 1 ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 1 ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 1 + yStretch ), ( float )( z + 0 ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 1 - overlayOffset ), ( float )( y + 0 ), ( float )( z + 0 ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); } if ( level->isSolidBlockingTile( x, y, z - 1 ) && level->getTile( x, y + 1, z - 1 ) == Tile::redStoneDust_Id ) { t->color( br * red, br * green, br * blue ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z + dustOffset ), lineTexture->getU0(true), lineTexture->getV1(true) ); - t->vertexUV( static_cast(x + 1), ( float )( y + 1 + yStretch ), ( float )( z + dustOffset ), lineTexture->getU1(true), lineTexture->getV1(true) ); - t->vertexUV( static_cast(x + 0), ( float )( y + 1 + yStretch ), ( float )( z + dustOffset ), lineTexture->getU1(true), lineTexture->getV0(true) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z + dustOffset ), lineTexture->getU0(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z + dustOffset ), lineTexture->getU0(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 1 + yStretch ), ( float )( z + dustOffset ), lineTexture->getU1(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 1 + yStretch ), ( float )( z + dustOffset ), lineTexture->getU1(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z + dustOffset ), lineTexture->getU0(true), lineTexture->getV0(true) ); t->color( br, br, br ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z + overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( static_cast(x + 1), ( float )( y + 1 + yStretch ), ( float )( z + overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( static_cast(x + 0), ( float )( y + 1 + yStretch ), ( float )( z + overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z + overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z + overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 1 + yStretch ), ( float )( z + overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 1 + yStretch ), ( float )( z + overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z + overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); } if ( level->isSolidBlockingTile( x, y, z + 1 ) && level->getTile( x, y + 1, z + 1 ) == Tile::redStoneDust_Id ) { t->color( br * red, br * green, br * blue ); - t->vertexUV( static_cast(x + 1), ( float )( y + 1 + yStretch ), ( float )( z + 1 - dustOffset ), lineTexture->getU1(true), lineTexture->getV0(true) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z + 1 - dustOffset ), lineTexture->getU0(true), lineTexture->getV0(true) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z + 1 - dustOffset ), lineTexture->getU0(true), lineTexture->getV1(true) ); - t->vertexUV( static_cast(x + 0), ( float )( y + 1 + yStretch ), ( float )( z + 1 - dustOffset ), lineTexture->getU1(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 1 + yStretch ), ( float )( z + 1 - dustOffset ), lineTexture->getU1(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z + 1 - dustOffset ), lineTexture->getU0(true), lineTexture->getV0(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z + 1 - dustOffset ), lineTexture->getU0(true), lineTexture->getV1(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 1 + yStretch ), ( float )( z + 1 - dustOffset ), lineTexture->getU1(true), lineTexture->getV1(true) ); t->color( br, br, br ); - t->vertexUV( static_cast(x + 1), ( float )( y + 1 + yStretch ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( static_cast(x + 1), static_cast(y + 0), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); - t->vertexUV( static_cast(x + 0), static_cast(y + 0), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); - t->vertexUV( static_cast(x + 0), ( float )( y + 1 + yStretch ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 1 + yStretch ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV0(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU0(true), lineTextureOverlay->getV1(true) ); + t->vertexUV( ( float )( x + 0 ), ( float )( y + 1 + yStretch ), ( float )( z + 1 - overlayOffset ), lineTextureOverlay->getU1(true), lineTextureOverlay->getV1(true) ); } } @@ -2982,15 +2982,15 @@ bool TileRenderer::tesselateRailInWorld( RailTile* tt, int x, int y, int z ) float r = 1 / 16.0f; - float x0 = static_cast(x + 1); - float x1 = static_cast(x + 1); - float x2 = static_cast(x + 0); - float x3 = static_cast(x + 0); + float x0 = ( float )( x + 1 ); + float x1 = ( float )( x + 1 ); + float x2 = ( float )( x + 0 ); + float x3 = ( float )( x + 0 ); - float z0 = static_cast(z + 0); - float z1 = static_cast(z + 1); - float z2 = static_cast(z + 1); - float z3 = static_cast(z + 0); + float z0 = ( float )( z + 0 ); + float z1 = ( float )( z + 1 ); + float z2 = ( float )( z + 1 ); + float z3 = ( float )( z + 0 ); float y0 = ( float )( y + r ); float y1 = ( float )( y + r ); @@ -2999,24 +2999,24 @@ bool TileRenderer::tesselateRailInWorld( RailTile* tt, int x, int y, int z ) if ( data == 1 || data == 2 || data == 3 || data == 7 ) { - x0 = x3 = static_cast(x + 1); - x1 = x2 = static_cast(x + 0); - z0 = z1 = static_cast(z + 1); - z2 = z3 = static_cast(z + 0); + x0 = x3 = ( float )( x + 1 ); + x1 = x2 = ( float )( x + 0 ); + z0 = z1 = ( float )( z + 1 ); + z2 = z3 = ( float )( z + 0 ); } else if ( data == 8 ) { - x0 = x1 = static_cast(x + 0); - x2 = x3 = static_cast(x + 1); - z0 = z3 = static_cast(z + 1); - z1 = z2 = static_cast(z + 0); + x0 = x1 = ( float )( x + 0 ); + x2 = x3 = ( float )( x + 1 ); + z0 = z3 = ( float )( z + 1 ); + z1 = z2 = ( float )( z + 0 ); } else if ( data == 9 ) { - x0 = x3 = static_cast(x + 0); - x1 = x2 = static_cast(x + 1); - z0 = z1 = static_cast(z + 0); - z2 = z3 = static_cast(z + 1); + x0 = x3 = ( float )( x + 0 ); + x1 = x2 = ( float )( x + 1 ); + z0 = z1 = ( float )( z + 0 ); + z2 = z3 = ( float )( z + 1 ); } if ( data == 2 || data == 4 ) @@ -3241,7 +3241,7 @@ bool TileRenderer::tesselateThinPaneInWorld(Tile *tt, int x, int y, int z) Icon *tex; Icon *edgeTex; - bool stained = dynamic_cast(tt) != nullptr; + bool stained = dynamic_cast(tt) != NULL; if (hasFixedTexture()) { tex = fixedTexture; @@ -3251,7 +3251,7 @@ bool TileRenderer::tesselateThinPaneInWorld(Tile *tt, int x, int y, int z) { int data = level->getData(x, y, z); tex = getTexture(tt, 0, data); - edgeTex = (stained) ? static_cast(tt)->getEdgeTexture(data) : static_cast(tt)->getEdgeTexture(); + edgeTex = (stained) ? ((StainedGlassPaneBlock *) tt)->getEdgeTexture(data) : ((ThinFenceTile *) tt)->getEdgeTexture(); } double u0 = tex->getU0(); @@ -3277,10 +3277,10 @@ bool TileRenderer::tesselateThinPaneInWorld(Tile *tt, int x, int y, int z) double iz0 = z + .5 - 1.0 / 16.0; double iz1 = z + .5 + 1.0 / 16.0; - bool n = (stained) ? static_cast(tt)->attachsTo(level->getTile(x, y, z - 1)) : static_cast(tt)->attachsTo(level->getTile(x, y, z - 1)); - bool s = (stained) ? static_cast(tt)->attachsTo(level->getTile(x, y, z + 1)) : static_cast(tt)->attachsTo(level->getTile(x, y, z + 1)); - bool w = (stained) ? static_cast(tt)->attachsTo(level->getTile(x - 1, y, z)) : static_cast(tt)->attachsTo(level->getTile(x - 1, y, z)); - bool e = (stained) ? static_cast(tt)->attachsTo(level->getTile(x + 1, y, z)) : static_cast(tt)->attachsTo(level->getTile(x + 1, y, z)); + bool n = (stained) ? ((StainedGlassPaneBlock *)tt)->attachsTo(level->getTile(x, y, z - 1)) : ((ThinFenceTile *)tt)->attachsTo(level->getTile(x, y, z - 1)); + bool s = (stained) ? ((StainedGlassPaneBlock *)tt)->attachsTo(level->getTile(x, y, z + 1)) : ((ThinFenceTile *)tt)->attachsTo(level->getTile(x, y, z + 1)); + bool w = (stained) ? ((StainedGlassPaneBlock *)tt)->attachsTo(level->getTile(x - 1, y, z)) : ((ThinFenceTile *)tt)->attachsTo(level->getTile(x - 1, y, z)); + bool e = (stained) ? ((StainedGlassPaneBlock *)tt)->attachsTo(level->getTile(x + 1, y, z)) : ((ThinFenceTile *)tt)->attachsTo(level->getTile(x + 1, y, z)); double noZFightingOffset = 0.001; double yt = 1.0 - noZFightingOffset; @@ -3691,10 +3691,10 @@ bool TileRenderer::tesselateThinFenceInWorld( ThinFenceTile* tt, int x, int y, i float iv1 = edgeTex->getV(8, true); float iv2 = edgeTex->getV1(true); - float x0 = static_cast(x); + float x0 = (float)x; float x1 = x + 0.5f; float x2 = x + 1.0f; - float z0 = static_cast(z); + float z0 = (float)z; float z1 = z + 0.5f; float z2 = z + 1.0f; float ix0 = x + 0.5f - 1.0f / 16.0f; @@ -4161,9 +4161,9 @@ bool TileRenderer::tesselateCrossInWorld( Tile* tt, int x, int y, int z ) } t->color( br * r, br * g, br * b ); - float xt = static_cast(x); - float yt = static_cast(y); - float zt = static_cast(z); + float xt = (float)x; + float yt = (float)y; + float zt = (float)z; if (tt == Tile::tallgrass) { @@ -4181,7 +4181,7 @@ bool TileRenderer::tesselateCrossInWorld( Tile* tt, int x, int y, int z ) bool TileRenderer::tesselateStemInWorld( Tile* _tt, int x, int y, int z ) { - StemTile* tt = static_cast(_tt); + StemTile* tt = ( StemTile* )_tt; Tesselator* t = Tesselator::getInstance(); float br; @@ -4409,7 +4409,7 @@ bool TileRenderer::tesselateLilypadInWorld(Tile *tt, int x, int y, int z) int64_t seed = (x * 3129871) ^ (z * 116129781l) ^ (y); seed = seed * seed * 42317861 + seed * 11; - int dir = static_cast((seed >> 16) & 0x3); + int dir = (int) ((seed >> 16) & 0x3); @@ -4622,7 +4622,7 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) { changed = true; Icon *tex = getTexture( tt, 1, data ); - float angle = static_cast(LiquidTile::getSlopeAngle(level, x, y, z, m)); + float angle = ( float )LiquidTile::getSlopeAngle( level, x, y, z, m ); if ( angle > -999 ) { tex = getTexture( tt, 2, data ); @@ -4717,8 +4717,8 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) { hh0 = ( float )( h0 ); hh1 = ( float )( h3 ); - x0 = static_cast(x); - x1 = static_cast(x + 1); + x0 = ( float )( x ); + x1 = ( float )( x + 1 ); z0 = ( float )( z + offs); z1 = ( float )( z + offs); } @@ -4726,8 +4726,8 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) { hh0 = ( float )( h2 ); hh1 = ( float )( h1 ); - x0 = static_cast(x + 1); - x1 = static_cast(x); + x0 = ( float )( x + 1 ); + x1 = ( float )( x ); z0 = ( float )( z + 1 - offs); z1 = ( float )( z + 1 - offs); } @@ -4737,8 +4737,8 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) hh1 = ( float )( h0 ); x0 = ( float )( x + offs); x1 = ( float )( x + offs); - z0 = static_cast(z + 1); - z1 = static_cast(z); + z0 = ( float )( z + 1 ); + z1 = ( float )( z ); } else { @@ -4746,8 +4746,8 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) hh1 = ( float )( h2 ); x0 = ( float )( x + 1 - offs); x1 = ( float )( x + 1 - offs); - z0 = static_cast(z); - z1 = static_cast(z + 1); + z0 = ( float )( z ); + z1 = ( float )( z + 1 ); } @@ -4777,8 +4777,8 @@ bool TileRenderer::tesselateWaterInWorld( Tile* tt, int x, int y, int z ) t->color( c11 * br * r, c11 * br * g, c11 * br * b ); t->vertexUV( ( float )( x0 ), ( float )( y + hh0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v01 ) ); t->vertexUV( ( float )( x1 ), ( float )( y + hh1 ), ( float )( z1 ), ( float )( u1 ), ( float )( v02 ) ); - t->vertexUV( ( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); } @@ -5207,7 +5207,7 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* // but they also happen to draw a lot of faces, and the code for determining which texture to use is more complex than in most // cases. Optimisation here then to store a uniform texture where appropriate (could be extended beyond leaves) that will stop // any other faces being evaluated. - Icon *uniformTex = nullptr; + Icon *uniformTex = NULL; int id = tt->id; if( id == Tile::leaves_Id ) { @@ -5257,7 +5257,7 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* Tesselator* t = Tesselator::getInstance(); t->tex2( 0xf000f ); - if( uniformTex == nullptr ) + if( uniformTex == NULL ) { if ( getTexture(tt)->getFlags() == Icon::IS_GRASS_TOP ) tintSides = false; } @@ -5534,14 +5534,14 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* float _ll2 = (ll00z + ll0Yz + llX0z + llXYz) / 4.0f; float _ll3 = (ll0yz + ll00z + llXyz + llX0z) / 4.0f; float _ll4 = (llxyz + llx0z + ll0yz + ll00z) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); - ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); + ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll2 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll4 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); + ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll2 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll2 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll4 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); int _tc1 = blend(ccx0z, ccxYz, cc0Yz, cc00z); int _tc2 = blend(cc0Yz, ccX0z, ccXYz, cc00z); @@ -5689,14 +5689,14 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* float _ll4 = (ll00Z + ll0YZ + llX0Z + llXYZ) / 4.0f; float _ll3 = (ll0yZ + ll00Z + llXyZ + llX0Z) / 4.0f; float _ll2 = (llxyZ + llx0Z + ll0yZ + ll00Z) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX0)); - ll2 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX0)); - ll3 = static_cast(_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) - * (1.0 - tileShapeX1)); - ll4 = static_cast(_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) - * (1.0 - tileShapeX1)); + ll1 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX0) + _ll4 * tileShapeY1 * tileShapeX0 + _ll3 * (1.0 - tileShapeY1) * tileShapeX0 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX0)); + ll2 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX0) + _ll4 * tileShapeY0 * tileShapeX0 + _ll3 * (1.0 - tileShapeY0) * tileShapeX0 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX0)); + ll3 = (float) (_ll1 * tileShapeY0 * (1.0 - tileShapeX1) + _ll4 * tileShapeY0 * tileShapeX1 + _ll3 * (1.0 - tileShapeY0) * tileShapeX1 + _ll2 * (1.0 - tileShapeY0) + * (1.0 - tileShapeX1)); + ll4 = (float) (_ll1 * tileShapeY1 * (1.0 - tileShapeX1) + _ll4 * tileShapeY1 * tileShapeX1 + _ll3 * (1.0 - tileShapeY1) * tileShapeX1 + _ll2 * (1.0 - tileShapeY1) + * (1.0 - tileShapeX1)); int _tc1 = blend(ccx0Z, ccxYZ, cc0YZ, cc00Z); int _tc4 = blend(cc0YZ, ccX0Z, ccXYZ, cc00Z); @@ -5840,14 +5840,14 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* float _ll1 = (llx00 + llx0Z + llxY0 + llxYZ) / 4.0f; float _ll2 = (llx0z + llx00 + llxYz + llxY0) / 4.0f; float _ll3 = (llxyz + llxy0 + llx0z + llx00) / 4.0f; - ll1 = static_cast(_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ1); - ll2 = static_cast(_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) - * tileShapeZ0); - ll3 = static_cast(_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ0); - ll4 = static_cast(_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) - * tileShapeZ1); + ll1 = (float) (_ll1 * tileShapeY1 * tileShapeZ1 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ1); + ll2 = (float) (_ll1 * tileShapeY1 * tileShapeZ0 + _ll2 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY1) + * tileShapeZ0); + ll3 = (float) (_ll1 * tileShapeY0 * tileShapeZ0 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ0); + ll4 = (float) (_ll1 * tileShapeY0 * tileShapeZ1 + _ll2 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll3 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll4 * (1.0 - tileShapeY0) + * tileShapeZ1); int _tc4 = blend(ccxy0, ccxyZ, ccx0Z, ccx00); int _tc1 = blend(ccx0Z, ccxY0, ccxYZ, ccx00); @@ -5991,14 +5991,14 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* float _ll2 = (llXyz + llXy0 + llX0z + llX00) / 4.0f; float _ll3 = (llX0z + llX00 + llXYz + llXY0) / 4.0f; float _ll4 = (llX00 + llX0Z + llXY0 + llXYZ) / 4.0f; - ll1 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 - * tileShapeZ1); - ll2 = static_cast(_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 - * tileShapeZ0); - ll3 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 - * tileShapeZ0); - ll4 = static_cast(_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 - * tileShapeZ1); + ll1 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY0 + * tileShapeZ1); + ll2 = (float) (_ll1 * (1.0 - tileShapeY0) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY0) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY0 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY0 + * tileShapeZ0); + ll3 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ0 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ0) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ0) + _ll4 * tileShapeY1 + * tileShapeZ0); + ll4 = (float) (_ll1 * (1.0 - tileShapeY1) * tileShapeZ1 + _ll2 * (1.0 - tileShapeY1) * (1.0 - tileShapeZ1) + _ll3 * tileShapeY1 * (1.0 - tileShapeZ1) + _ll4 * tileShapeY1 + * tileShapeZ1); int _tc1 = blend(ccXy0, ccXyZ, ccX0Z, ccX00); int _tc4 = blend(ccX0Z, ccXY0, ccXYZ, ccX00); @@ -6085,8 +6085,8 @@ int TileRenderer::blend( int a, int b, int c, int def ) int TileRenderer::blend(int a, int b, int c, int d, double fa, double fb, double fc, double fd) { - int top = static_cast((double)((a >> 16) & 0xff) * fa + (double)((b >> 16) & 0xff) * fb + (double)((c >> 16) & 0xff) * fc + (double)((d >> 16) & 0xff) * fd) & 0xff; - int bottom = static_cast((double)(a & 0xff) * fa + (double)(b & 0xff) * fb + (double)(c & 0xff) * fc + (double)(d & 0xff) * fd) & 0xff; + int top = (int) ((double) ((a >> 16) & 0xff) * fa + (double) ((b >> 16) & 0xff) * fb + (double) ((c >> 16) & 0xff) * fc + (double) ((d >> 16) & 0xff) * fd) & 0xff; + int bottom = (int) ((double) (a & 0xff) * fa + (double) (b & 0xff) * fb + (double) (c & 0xff) * fc + (double) (d & 0xff) * fd) & 0xff; return (top << 16) | bottom; } @@ -7282,23 +7282,23 @@ void TileRenderer::renderFaceDown( Tile* tt, double x, double y, double z, Icon t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); } else { - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u01), static_cast(v01) ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); } } @@ -7394,23 +7394,23 @@ void TileRenderer::renderFaceUp( Tile* tt, double x, double y, double z, Icon *t t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); } else { - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), ( float )( u01 ), ( float )( v01 ) ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); } } @@ -7513,23 +7513,23 @@ void TileRenderer::renderNorth( Tile* tt, double x, double y, double z, Icon *te t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); } else { - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); } } @@ -7632,23 +7632,23 @@ void TileRenderer::renderSouth( Tile* tt, double x, double y, double z, Icon *te t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); } else { - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); } } @@ -7750,23 +7750,23 @@ void TileRenderer::renderWest( Tile* tt, double x, double y, double z, Icon *tex t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); } else { - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); - t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); - t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); } } @@ -7868,23 +7868,23 @@ void TileRenderer::renderEast( Tile* tt, double x, double y, double z, Icon *tex t->color( c1r, c1g, c1b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc1 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); } else { - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); - t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); - t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); } } @@ -8399,7 +8399,7 @@ void TileRenderer::renderTile( Tile* tile, int data, float brightness, float fAl else if (shape == Tile::SHAPE_ANVIL) { glTranslatef(-0.5f, -0.5f, -0.5f); - tesselateAnvilInWorld(static_cast(tile), 0, 0, 0, data << 2, true); + tesselateAnvilInWorld((AnvilTile *) tile, 0, 0, 0, data << 2, true); glTranslatef(0.5f, 0.5f, 0.5f); } else if ( shape == Tile::SHAPE_PORTAL_FRAME ) @@ -8550,7 +8550,7 @@ Icon *TileRenderer::getTexture(Tile *tile) Icon *TileRenderer::getTextureOrMissing(Icon *icon) { - if (icon == nullptr) return minecraft->textures->getMissingIcon(Icon::TYPE_TERRAIN); + if (icon == NULL) return minecraft->textures->getMissingIcon(Icon::TYPE_TERRAIN); #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita. Pass on the Alpha Cut out flag to the tesselator diff --git a/Minecraft.Client/Timer.cpp b/Minecraft.Client/Timer.cpp index 3ef51eb7..636904b7 100644 --- a/Minecraft.Client/Timer.cpp +++ b/Minecraft.Client/Timer.cpp @@ -40,10 +40,10 @@ void Timer::advanceTime() accumMs += passedMs; if (accumMs > 1000) { - const int64_t msSysTime = static_cast(now * 1000.0); - const int64_t passedMsSysTime = msSysTime - lastMsSysTime; + int64_t msSysTime = (int64_t)(now * 1000.0); + int64_t passedMsSysTime = msSysTime - lastMsSysTime; - const double adjustTimeT = accumMs / static_cast(passedMsSysTime); + double adjustTimeT = accumMs / (double) passedMsSysTime; adjustTime += (adjustTimeT - adjustTime) * 0.2f; lastMsSysTime = msSysTime; @@ -51,7 +51,7 @@ void Timer::advanceTime() } if (accumMs < 0) { - lastMsSysTime = static_cast(now * 1000.0); + lastMsSysTime = (int64_t)(now * 1000.0); } } lastMs = nowMs; @@ -62,9 +62,9 @@ void Timer::advanceTime() if (passedSeconds < 0) passedSeconds = 0; if (passedSeconds > 1) passedSeconds = 1; - passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); + passedTime = (float)( passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = static_cast(passedTime); + ticks = (int) passedTime; passedTime -= ticks; if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE; @@ -75,10 +75,10 @@ void Timer::advanceTime() void Timer::advanceTimeQuickly() { - double passedSeconds = static_cast(MAX_TICKS_PER_UPDATE) / static_cast(ticksPerSecond); + double passedSeconds = (double) MAX_TICKS_PER_UPDATE / (double) ticksPerSecond; - passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = static_cast(passedTime); + passedTime = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond)); + ticks = (int) passedTime; passedTime -= ticks; a = passedTime; @@ -110,7 +110,7 @@ void Timer::skipTime() { int64_t passedMsSysTime = msSysTime - lastMsSysTime; - double adjustTimeT = accumMs / static_cast(passedMsSysTime); + double adjustTimeT = accumMs / (double) passedMsSysTime; adjustTime += (adjustTimeT - adjustTime) * 0.2f; lastMsSysTime = msSysTime; @@ -130,9 +130,9 @@ void Timer::skipTime() if (passedSeconds < 0) passedSeconds = 0; if (passedSeconds > 1) passedSeconds = 1; - passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); + passedTime = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = static_cast(0); + ticks = (int) 0; if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE; passedTime -= ticks; diff --git a/Minecraft.Client/TitleScreen.cpp b/Minecraft.Client/TitleScreen.cpp index d522963c..1c7d5125 100644 --- a/Minecraft.Client/TitleScreen.cpp +++ b/Minecraft.Client/TitleScreen.cpp @@ -18,7 +18,7 @@ TitleScreen::TitleScreen() { // 4J - added initialisers vo = 0; - multiplayerButton = nullptr; + multiplayerButton = NULL; splash = L"missingno"; // try { // 4J - removed try/catch @@ -93,7 +93,7 @@ void TitleScreen::init() buttons.push_back(new Button(4, width / 2 + 2, topPos + spacing * 3 + 12, 98, 20, language->getElement(L"menu.quit"))); } - if (minecraft->user == nullptr) + if (minecraft->user == NULL) { multiplayerButton->active = false; } diff --git a/Minecraft.Client/TntRenderer.cpp b/Minecraft.Client/TntRenderer.cpp index 848a456c..52e2877d 100644 --- a/Minecraft.Client/TntRenderer.cpp +++ b/Minecraft.Client/TntRenderer.cpp @@ -17,7 +17,7 @@ void TntRenderer::render(shared_ptr _tnt, double x, double y, double z, shared_ptr tnt = dynamic_pointer_cast(_tnt); glPushMatrix(); - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); if (tnt->life - a + 1 < 10) { float g = 1 - ((tnt->life - a + 1) / 10.0f); diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index 3aa33248..0a5a02bf 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -63,10 +63,10 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl updatePlayers(tracker, players); } - if (lastRidingEntity != e->riding || (e->riding != nullptr && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) + if (lastRidingEntity != e->riding || (e->riding != NULL && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) { lastRidingEntity = e->riding; - broadcast(std::make_shared(SetEntityLinkPacket::RIDING, e, e->riding)); + broadcast(shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding))); } // Moving forward special case for item frames @@ -75,7 +75,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl shared_ptr frame = dynamic_pointer_cast (e); shared_ptr item = frame->getItem(); - if (item != nullptr && item->getItem()->id == Item::map_Id && !e->removed) + if (item != NULL && item->getItem()->id == Item::map_Id && !e->removed) { shared_ptr data = Item::map->getSavedData(item, e->level); for (auto& it : *players) @@ -86,7 +86,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (!player->removed && player->connection && player->connection->countDelayedPackets() <= 5) { shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); - if (packet != nullptr) player->connection->send(packet); + if (packet != NULL) player->connection->send(packet); } } } @@ -94,7 +94,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend(std::make_shared(e->entityId, entityData, false)); + broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false) ) ); } } else if (tickCount % updateInterval == 0 || e->hasImpulse || e->getEntityData()->isDirty()) @@ -107,7 +107,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int yRota = yRotn - yRotp; int xRota = xRotn - xRotp; - if(e->riding == nullptr) + if(e->riding == NULL) { teleportDelay++; @@ -152,7 +152,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ) { teleportDelay = 0; - packet = std::make_shared(e->entityId, xn, yn, zn, static_cast(yRotn), static_cast(xRotn)); + packet = shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (byte) yRotn, (byte) xRotn) ); // printf("%d: New teleport rot %d\n",e->entityId,yRotn); yRotp = yRotn; xRotp = xRotn; @@ -179,12 +179,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRotn = yRotp + yRota; } // 5 bits each for x & z, and 6 for y - packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), static_cast(yRota), 0); + packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); c0a++; } else { - packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), static_cast(yRota), static_cast(xRota)); + packet = shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); // printf("%d: New posrot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); c0b++; } @@ -197,7 +197,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -16 ) && ( ya <= 15 ) ) { // 4 bits each for x & z, and 5 for y - packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za)); + packet = shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1a++; } @@ -206,12 +206,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( ya >= -32 ) && ( ya <= 31 ) ) { // use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative - packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), 0, 0); + packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); c1b++; } else { - packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za)); + packet = shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); c1c++; } } @@ -231,13 +231,13 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRota = 15; yRotn = yRotp + yRota; } - packet = std::make_shared(e->entityId, static_cast(yRota), 0); + packet = shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); c2a++; } else { // printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); - packet = std::make_shared(e->entityId, static_cast(yRota), static_cast(xRota)); + packet = shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); c2b++; } } @@ -259,12 +259,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl xap = e->xd; yap = e->yd; zap = e->zd; - broadcast(std::make_shared(e->entityId, xap, yap, zap)); + broadcast( shared_ptr( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) ); } } - if (packet != nullptr) + if (packet != NULL) { broadcast(packet); } @@ -291,7 +291,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (rot) { // 4J: Changed this to use deltas - broadcast(std::make_shared(e->entityId, static_cast(yRota), static_cast(xRota))); + broadcast( shared_ptr( new MoveEntityPacket::Rot(e->entityId, (byte) yRota, (byte) xRota)) ); yRotp = yRotn; xRotp = xRotn; } @@ -308,7 +308,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) { - broadcast(std::make_shared(e->entityId, static_cast(yHeadRot))); + broadcast(shared_ptr( new RotateHeadPacket(e->entityId, (byte) yHeadRot))); yHeadRotp = yHeadRot; } @@ -320,7 +320,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (e->hurtMarked) { // broadcast(new AnimatePacket(e, AnimatePacket.HURT)); - broadcastAndSend(std::make_shared(e)); + broadcastAndSend( shared_ptr( new SetEntityMotionPacket(e) ) ); e->hurtMarked = false; } @@ -331,18 +331,18 @@ void TrackedEntity::sendDirtyEntityData() shared_ptr entityData = e->getEntityData(); if (entityData->isDirty()) { - broadcastAndSend(std::make_shared(e->entityId, entityData, false)); + broadcastAndSend( shared_ptr( new SetEntityDataPacket(e->entityId, entityData, false)) ); } if ( e->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(e); - ServersideAttributeMap *attributeMap = static_cast(living->getAttributes()); + ServersideAttributeMap *attributeMap = (ServersideAttributeMap *) living->getAttributes(); unordered_set *attributes = attributeMap->getDirtyAttributes(); if (!attributes->empty()) { - broadcastAndSend(std::make_shared(e->entityId, attributes)); + broadcastAndSend(shared_ptr( new UpdateAttributesPacket(e->entityId, attributes)) ); } attributes->clear(); @@ -368,7 +368,7 @@ void TrackedEntity::broadcast(shared_ptr packet) if( sentTo.size() ) { INetworkPlayer *thisPlayer =player->connection->getNetworkPlayer(); - if( thisPlayer == nullptr ) + if( thisPlayer == NULL ) { dontSend = true; } @@ -377,7 +377,7 @@ void TrackedEntity::broadcast(shared_ptr packet) for(auto& player2 : sentTo) { INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -410,7 +410,7 @@ void TrackedEntity::broadcastAndSend(shared_ptr packet) vector< shared_ptr > sentTo; broadcast(packet); shared_ptr sp = e->instanceof(eTYPE_SERVERPLAYER) ? dynamic_pointer_cast(e) : nullptr; - if (sp != nullptr && sp->connection) + if (sp != NULL && sp->connection) { sp->connection->send(packet); } @@ -477,7 +477,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar if( ep->dimension != sp->dimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) { // 4J Stu - We call update players when the entity has moved more than a certain amount at the start of it's tick // Before this call we set xpu, ypu and zpu to the entities new position, but xp,yp and zp are the old position until later in the tick. @@ -499,7 +499,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar // 4J-JEV: ADDED! An entities mount has to be visible before the entity visible, // this is to ensure that the mount is already in the client's game when the rider is added. - if (canBeSeenBy && bVisible && e->riding != nullptr) + if (canBeSeenBy && bVisible && e->riding != NULL) { return tracker->getTracker(e->riding)->isVisible(tracker, sp, true); } @@ -530,43 +530,43 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr plr = dynamic_pointer_cast(e); app.DebugPrintf( "TrackedEntity:: Player '%ls' is now visible to player '%ls', %s.\n", plr->name.c_str(), sp->name.c_str(), - (e->riding==nullptr?"not riding minecart":"in minecart") + (e->riding==NULL?"not riding minecart":"in minecart") ); } - bool isAddMobPacket = dynamic_pointer_cast(packet) != nullptr; + bool isAddMobPacket = dynamic_pointer_cast(packet) != NULL; // 4J Stu brought forward to fix when Item Frames if (!e->getEntityData()->isEmpty() && !isAddMobPacket) { - sp->connection->send(std::make_shared(e->entityId, e->getEntityData(), true)); + sp->connection->send(shared_ptr( new SetEntityDataPacket(e->entityId, e->getEntityData(), true))); } if ( e->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(e); - ServersideAttributeMap *attributeMap = static_cast(living->getAttributes()); + ServersideAttributeMap *attributeMap = (ServersideAttributeMap *) living->getAttributes(); unordered_set *attributes = attributeMap->getSyncableAttributes(); if (!attributes->empty()) { - sp->connection->send(std::make_shared(e->entityId, attributes)); + sp->connection->send(shared_ptr( new UpdateAttributesPacket(e->entityId, attributes)) ); } delete attributes; } if (trackDelta && !isAddMobPacket) { - sp->connection->send(std::make_shared(e->entityId, e->xd, e->yd, e->zd)); + sp->connection->send( shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); } - if (e->riding != nullptr) + if (e->riding != NULL) { - sp->connection->send(std::make_shared(SetEntityLinkPacket::RIDING, e, e->riding)); + sp->connection->send(shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding))); } - if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast(e)->getLeashHolder() != nullptr) + if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast(e)->getLeashHolder() != NULL) { - sp->connection->send(std::make_shared(SetEntityLinkPacket::LEASH, e, dynamic_pointer_cast(e)->getLeashHolder())); + sp->connection->send( shared_ptr( new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, e, dynamic_pointer_cast(e)->getLeashHolder())) ); } if ( e->instanceof(eTYPE_LIVINGENTITY) ) @@ -574,7 +574,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr item = dynamic_pointer_cast(e)->getCarried(i); - if(item != nullptr) sp->connection->send(std::make_shared(e->entityId, i, item)); + if(item != NULL) sp->connection->send( shared_ptr( new SetEquippedItemPacket(e->entityId, i, item) ) ); } } @@ -583,7 +583,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr spe = dynamic_pointer_cast(e); if (spe->isSleeping()) { - sp->connection->send(std::make_shared(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z))); + sp->connection->send( shared_ptr( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) ); } } @@ -636,15 +636,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() } // 4J-PB - replacing with a switch, rather than tons of ifs - if (dynamic_pointer_cast(e) != nullptr) + if (dynamic_pointer_cast(e) != NULL) { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return std::make_shared(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp); + return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); } if (e->instanceof(eTYPE_ITEMENTITY)) { - shared_ptr packet = std::make_shared(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp); + shared_ptr packet = shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) ); return packet; } else if (e->instanceof(eTYPE_SERVERPLAYER)) @@ -653,61 +653,61 @@ shared_ptr TrackedEntity::getAddEntityPacket() PlayerUID xuid = INVALID_XUID; PlayerUID OnlineXuid = INVALID_XUID; - if( player != nullptr ) + if( player != NULL ) { xuid = player->getXuid(); OnlineXuid = player->getOnlineXuid(); } // 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees. - return std::make_shared(player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp); + return shared_ptr( new AddPlayerPacket( player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) ); } else if (e->instanceof(eTYPE_MINECART)) { shared_ptr minecart = dynamic_pointer_cast(e); - return std::make_shared(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_BOAT)) { - return std::make_shared(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_ENDERDRAGON)) { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); - return std::make_shared(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp); + return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) ); } else if (e->instanceof(eTYPE_FISHINGHOOK)) { shared_ptr owner = dynamic_pointer_cast(e)->owner; - return std::make_shared(e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_ARROW)) { shared_ptr owner = (dynamic_pointer_cast(e))->owner; - return std::make_shared(e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_SNOWBALL)) { - return std::make_shared(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_THROWNPOTION)) { - return std::make_shared(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp)); } else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) { - return std::make_shared(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_THROWNENDERPEARL)) { - return std::make_shared(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) { - return std::make_shared(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) { - return std::make_shared(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_FIREBALL)) { @@ -728,39 +728,39 @@ shared_ptr TrackedEntity::getAddEntityPacket() shared_ptr fb = dynamic_pointer_cast(e); shared_ptr aep = nullptr; - if (fb->owner != nullptr) + if (fb->owner != NULL) { - aep = std::make_shared(e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp); + aep = shared_ptr( new AddEntityPacket(e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } else { - aep = std::make_shared(e, type, 0, yRotp, xRotp, xp, yp, zp); + aep = shared_ptr( new AddEntityPacket(e, type, 0, yRotp, xRotp, xp, yp, zp) ); } - aep->xa = static_cast(fb->xPower * 8000); - aep->ya = static_cast(fb->yPower * 8000); - aep->za = static_cast(fb->zPower * 8000); + aep->xa = (int) (fb->xPower * 8000); + aep->ya = (int) (fb->yPower * 8000); + aep->za = (int) (fb->zPower * 8000); return aep; } else if (e->instanceof(eTYPE_THROWNEGG)) { - return std::make_shared(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_PRIMEDTNT)) { - return std::make_shared(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) { - return std::make_shared(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_FALLINGTILE)) { shared_ptr ft = dynamic_pointer_cast(e); - return std::make_shared(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_PAINTING)) { - return std::make_shared(dynamic_pointer_cast(e)); + return shared_ptr( new AddPaintingPacket(dynamic_pointer_cast(e)) ); } else if (e->instanceof(eTYPE_ITEM_FRAME)) { @@ -774,7 +774,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - shared_ptr packet = std::make_shared(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp); + shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); packet->x = Mth::floor(frame->xTile * 32.0f); packet->y = Mth::floor(frame->yTile * 32.0f); packet->z = Mth::floor(frame->zTile * 32.0f); @@ -783,15 +783,15 @@ shared_ptr TrackedEntity::getAddEntityPacket() else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) { shared_ptr knot = dynamic_pointer_cast(e); - shared_ptr packet = std::make_shared(e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp); - packet->x = Mth::floor(static_cast(knot->xTile) * 32); - packet->y = Mth::floor(static_cast(knot->yTile) * 32); - packet->z = Mth::floor(static_cast(knot->zTile) * 32); + shared_ptr packet = shared_ptr(new AddEntityPacket(e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp) ); + packet->x = Mth::floor((float)knot->xTile * 32); + packet->y = Mth::floor((float)knot->yTile * 32); + packet->z = Mth::floor((float)knot->zTile * 32); return packet; } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { - return std::make_shared(dynamic_pointer_cast(e)); + return shared_ptr( new AddExperienceOrbPacket(dynamic_pointer_cast(e)) ); } else { diff --git a/Minecraft.Client/VideoSettingsScreen.cpp b/Minecraft.Client/VideoSettingsScreen.cpp index cc13eab2..5c948cdd 100644 --- a/Minecraft.Client/VideoSettingsScreen.cpp +++ b/Minecraft.Client/VideoSettingsScreen.cpp @@ -46,9 +46,9 @@ void VideoSettingsScreen::init() void VideoSettingsScreen::buttonClicked(Button *button) { if (!button->active) return; - if (button->id < 100 && (dynamic_cast(button) != nullptr)) + if (button->id < 100 && (dynamic_cast(button) != NULL)) { - options->toggle(static_cast(button)->getOption(), 1); + options->toggle(((SmallButton *) button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); } if (button->id == 200) diff --git a/Minecraft.Client/VillagerGolemRenderer.cpp b/Minecraft.Client/VillagerGolemRenderer.cpp index 0b62435b..5d680978 100644 --- a/Minecraft.Client/VillagerGolemRenderer.cpp +++ b/Minecraft.Client/VillagerGolemRenderer.cpp @@ -10,7 +10,7 @@ ResourceLocation VillagerGolemRenderer::GOLEM_LOCATION = ResourceLocation(TN_MOB VillagerGolemRenderer::VillagerGolemRenderer() : MobRenderer(new VillagerGolemModel(), 0.5f) { - golemModel = static_cast(model); + golemModel = (VillagerGolemModel *) model; } void VillagerGolemRenderer::render(shared_ptr mob, double x, double y, double z, float rot, float a) diff --git a/Minecraft.Client/VillagerRenderer.cpp b/Minecraft.Client/VillagerRenderer.cpp index 0b54a70b..ac885747 100644 --- a/Minecraft.Client/VillagerRenderer.cpp +++ b/Minecraft.Client/VillagerRenderer.cpp @@ -12,7 +12,7 @@ ResourceLocation VillagerRenderer::VILLAGER_BUTCHER_LOCATION = ResourceLocation( VillagerRenderer::VillagerRenderer() : MobRenderer(new VillagerModel(0), 0.5f) { - villagerModel = static_cast(model); + villagerModel = (VillagerModel *) model; } int VillagerRenderer::prepareArmor(shared_ptr villager, int layer, float a) diff --git a/Minecraft.Client/WaterDropParticle.cpp b/Minecraft.Client/WaterDropParticle.cpp index 065738af..90035243 100644 --- a/Minecraft.Client/WaterDropParticle.cpp +++ b/Minecraft.Client/WaterDropParticle.cpp @@ -8,7 +8,7 @@ WaterDropParticle::WaterDropParticle(Level *level, double x, double y, double z) : Particle(level, x, y, z, 0, 0, 0) { xd *= 0.3f; - yd = static_cast(Math::random()) * 0.2f + 0.1f; + yd = (float) Math::random() * 0.2f + 0.1f; zd *= 0.3f; rCol = 1.0f; @@ -19,7 +19,7 @@ WaterDropParticle::WaterDropParticle(Level *level, double x, double y, double z) gravity = 0.06f; noPhysics = true; // 4J - optimisation - do we really need collision on these? its really slow... - lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); } void WaterDropParticle::tick() diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h index 26e88e06..9ac5c55d 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h @@ -107,8 +107,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h index 6b9cc289..f1bd85bb 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h @@ -100,7 +100,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h index fb16ccb3..737caa98 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h @@ -16,8 +16,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = nullptr; } - bool Allocated() { return m_pBuffer != nullptr; } + void Release() { free(m_pBuffer); m_pBuffer = NULL; } + bool Allocated() { return m_pBuffer != NULL; } }; typedef struct @@ -60,7 +60,7 @@ public: void StartFrame(); void DoScreenGrabOnNextPresent(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = nullptr); + void Clear(int flags, D3D11_RECT *pRect = NULL); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h index 006c3c88..45bfb31a 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h @@ -239,7 +239,7 @@ public: // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, C4JStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -296,17 +296,17 @@ public: C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=nullptr); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); // Global title storage C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=nullptr,LPVOID lpParam=nullptr, int iAction=0); + WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0); bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); - void StoreTMSPathName(WCHAR *pwchName=nullptr); + void StoreTMSPathName(WCHAR *pwchName=NULL); // TMS++ #ifdef _XBOX @@ -314,11 +314,11 @@ public: HRESULT GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam); #endif - // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); - // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); - // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=nullptr, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl index 6ea0d142..d4d2bb22 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl @@ -1364,7 +1364,7 @@ static DWORD pshader_exceptional_blend_12[276] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { nullptr, 0, }, + { NULL, 0, }, { pshader_exceptional_blend_1, 1340, }, { pshader_exceptional_blend_2, 1444, }, { pshader_exceptional_blend_3, 1424, }, @@ -2672,10 +2672,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_9, 708, }, { pshader_filter_10, 1644, }, { pshader_filter_11, 1372, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, { pshader_filter_16, 1740, }, { pshader_filter_17, 1732, }, { pshader_filter_18, 1820, }, @@ -2688,10 +2688,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_25, 1468, }, { pshader_filter_26, 1820, }, { pshader_filter_27, 1548, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, + { NULL, 0, }, }; static DWORD pshader_blur_2[320] = { @@ -3193,8 +3193,8 @@ static DWORD pshader_blur_9[621] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { nullptr, 0, }, - { nullptr, 0, }, + { NULL, 0, }, + { NULL, 0, }, { pshader_blur_2, 1280, }, { pshader_blur_3, 1452, }, { pshader_blur_4, 1624, }, diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp index b9fb627b..9ebf6c5d 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp @@ -64,7 +64,7 @@ static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard) HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr); if (FAILED(hr)) { report_d3d_error(hr, "Map", "of buffer"); - return nullptr; + return NULL; } else return msr.pData; } @@ -76,12 +76,12 @@ static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf) static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader) { - ctx->PSSetShader(shader, nullptr, 0); + ctx->PSSetShader(shader, NULL, 0); } static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader) { - ctx->VSSetShader(shader, nullptr, 0); + ctx->VSSetShader(shader, NULL, 0); } static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst) @@ -100,7 +100,7 @@ static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11 HRESULT hr = dev->CreateBlendState(&desc, &res); if (FAILED(hr)) { report_d3d_error(hr, "CreateBlendState", ""); - res = nullptr; + res = NULL; } return res; @@ -113,10 +113,10 @@ static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWi { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader); + HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, NULL, &p->pshader); if (FAILED(hr)) { report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = nullptr; + p->pshader = NULL; return; } } @@ -126,10 +126,10 @@ static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramW { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader); + HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, NULL, &p->vshader); if (FAILED(hr)) { report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = nullptr; + p->vshader = NULL; return; } } diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h index 47fe3c29..7fd7012f 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h @@ -42,7 +42,7 @@ IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11 There can only be one D3D GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_D3D11_DestroyContext(void); /* Destroys the current GDraw context, if any. */ @@ -70,7 +70,7 @@ IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D If your rendertarget uses multisampling, you also need to specify a shader resource view for a non-MSAA rendertarget texture (identically sized to main_rt) in non_msaa_rt. This is only used if the Flash content includes non-standard - blend modes which have to use a special blend shader, so you can leave it nullptr + blend modes which have to use a special blend shader, so you can leave it NULL if you forbid such content. You need to call this before Iggy calls any rendering functions. */ diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl index 7719ca71..7e4db038 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -196,16 +196,16 @@ static void safe_release(T *&p) { if (p) { p->Release(); - p = nullptr; + p = NULL; } } static void report_d3d_error(HRESULT hr, const char *call, const char *context) { if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context); + IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context); else - IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); + IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); } static void unbind_resources(void) @@ -214,13 +214,13 @@ static void unbind_resources(void) // unset active textures and vertex/index buffers, // to make sure there are no dangling refs - static ID3D1X(ShaderResourceView) *no_views[3] = { nullptr }; - ID3D1X(Buffer) *no_vb = nullptr; + static ID3D1X(ShaderResourceView) *no_views[3] = { 0 }; + ID3D1X(Buffer) *no_vb = NULL; UINT no_offs = 0; d3d->PSSetShaderResources(0, 3, no_views); d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); + d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); } static void api_free_resource(GDrawHandle *r) @@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) static void *start_write_dyn(DynBuffer *buf, U32 size) { - U8 *ptr = nullptr; + U8 *ptr = NULL; if (size > buf->size) { - IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); - return nullptr; + IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); + return NULL; } // update statistics @@ -270,7 +270,7 @@ static void *start_write_dyn(DynBuffer *buf, U32 size) // discard buffer whenever the current write position is 0; // done this way so that if a DISCARD Map() were to fail, we would // just keep retrying the next time around. - ptr = static_cast(map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0)); + ptr = (U8 *) map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0); if (ptr) { ptr += buf->write_pos; // we return pointer to write position in buffer buf->alloc_pos = buf->write_pos + size; // bump alloc position @@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie { GDrawStats stats={0}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = nullptr; + p->handle.tex.d3d = NULL; p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = nullptr; + p->handle.tex.d3d_rtview = NULL; p->handle.tex.w = 1; p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view) { GDrawHandle *p = (GDrawHandle *) tex; - p->handle.tex.d3d = nullptr; + p->handle.tex.d3d = NULL; p->handle.tex.d3d_view = tex_view; } @@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; DXGI_FORMAT dxgi_fmt; S32 bpp, size = 0, nmips = 0; if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); + IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); return false; } @@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, // try to allocate memory for the client to write to p->texture_data = (U8 *) IggyGDrawMalloc(size); if (!p->texture_data) { - IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); return false; } @@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, t->handle.tex.w = width; t->handle.tex.h = height; - t->handle.tex.d3d = nullptr; - t->handle.tex.d3d_view = nullptr; - t->handle.tex.d3d_rtview = nullptr; + t->handle.tex.d3d = NULL; + t->handle.tex.d3d_view = NULL; + t->handle.tex.d3d_rtview = NULL; p->texture_type = GDRAW_TEXTURE_TYPE_rgba; p->p0 = t; @@ -474,7 +474,7 @@ static rrbool RADLINK gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo * / static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { - GDrawHandle *t = static_cast(p->p0); + GDrawHandle *t = (GDrawHandle *) p->p0; D3D1X_(SUBRESOURCE_DATA) mipdata[24]; S32 i, w, h, nmips, bpp; HRESULT hr = S_OK; @@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI // and create a corresponding shader resource view failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); done: if (!FAILED(hr)) { @@ -525,7 +525,7 @@ done: safe_release(t->handle.tex.d3d_view); gdraw_HandleCacheAllocateFail(t); - t = nullptr; + t = NULL; report_d3d_error(hr, failed_call, " while creating texture"); } @@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/ static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == NULL) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) return; } - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view); + hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view); if (FAILED(hr)) { report_d3d_error(hr, "CreateShaderResourceView", " while creating texture"); safe_release(gdraw->aa_tex); @@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (p->vertex_data && p->index_data) { GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); if (vb) { - vb->handle.vbuf.verts = nullptr; - vb->handle.vbuf.inds = nullptr; + vb->handle.vbuf.verts = NULL; + vb->handle.vbuf.inds = NULL; p->vertex_data_length = vbuf_size; p->index_data_length = ibuf_size; @@ -643,7 +643,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_Processi static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuffer_ProcessingInfo *p, GDrawStats * /*stats*/) { - GDrawHandle *vb = static_cast(p->p0); + GDrawHandle *vb = (GDrawHandle *) p->p0; HRESULT hr; D3D1X_(BUFFER_DESC) vbdesc = { static_cast(p->vertex_data_length), D3D1X_(USAGE_IMMUTABLE), D3D1X_(BIND_VERTEX_BUFFER), 0U, 0U }; @@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf safe_release(vb->handle.vbuf.inds); gdraw_HandleCacheAllocateFail(vb); - vb = nullptr; + vb = NULL; report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); } else { @@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); // @GDRAW_ASSERT + assert(h != NULL); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) // ran out of RTs, allocate a new one S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); - return nullptr; + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); + return NULL; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); return t; } D3D1X_(TEXTURE2D_DESC) desc = { static_cast(gdraw->frametex_width), static_cast(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0U, 0U }; - t->handle.tex.d3d = nullptr; - t->handle.tex.d3d_view = nullptr; - t->handle.tex.d3d_rtview = nullptr; + t->handle.tex.d3d = NULL; + t->handle.tex.d3d_view = NULL; + t->handle.tex.d3d_rtview = NULL; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); failed_call = "CreateTexture2D"; } if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview); + hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); failed_call = "CreateRenderTargetView"; } @@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) report_d3d_error(hr, failed_call, " creating rendertarget"); - return nullptr; + return NULL; } gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked); @@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats) D3D1X_(TEXTURE2D_DESC) desc = { static_cast(gdraw->frametex_width), static_cast(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0U, 0U }; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]); + hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); failed_call = "CreateDepthStencilView while creating rendertarget"; } @@ -861,7 +861,7 @@ static void disable_scissor(int force) static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h) { - D3D1X_(VIEWPORT) vp = { static_cast(x), static_cast(y), static_cast(w), static_cast(h), 0.0f, 1.0f }; + D3D1X_(VIEWPORT) vp = { (ViewCoord) x, (ViewCoord) y, (ViewCoord) w, (ViewCoord) h, 0.0f, 1.0f }; gdraw->d3d_context->RSSetViewports(1, &vp); gdraw->cview.x = x; gdraw->cview.y = y; @@ -891,8 +891,8 @@ static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1) { gdraw->projection[0] = 2.0f / (x1-x0); gdraw->projection[1] = 2.0f / (y1-y0); - gdraw->projection[2] = (x1+x0)/static_cast(x0 - x1); - gdraw->projection[3] = (y1+y0)/static_cast(y0 - y1); + gdraw->projection[2] = (x1+x0)/(F32)(x0-x1); + gdraw->projection[3] = (y1+y0)/(F32)(y0-y1); set_projection_base(); } @@ -1113,7 +1113,7 @@ static void set_render_target(GDrawStats *stats) gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]); gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); } else { - ID3D1X(DepthStencilView) *depth = nullptr; + ID3D1X(DepthStencilView) *depth = NULL; if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) depth = get_rendertarget_depthbuffer(stats); @@ -1128,15 +1128,15 @@ static void set_render_target(GDrawStats *stats) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats) { GDrawFramebufferState *n = gdraw->cur+1; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } @@ -1150,10 +1150,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->flags = flags; n->color_buffer = t; - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT ++gdraw->cur; - gdraw->cur->cached = owner != nullptr; + gdraw->cur->cached = owner != NULL; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1164,7 +1164,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex set_render_target(stats); assert(gdraw->frametex_width >= gdraw->tw && gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT - S32 k = static_cast(t - gdraw->rendertargets.handle); + S32 k = (S32) (t - gdraw->rendertargets.handle); if (region) { gswf_recti r; @@ -1190,7 +1190,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex if (r.x1 <= r.x0 || r.y1 <= r.y0) { // region doesn't intersect with current tile --gdraw->cur; - gdraw_FreeTexture((GDrawTexture *) t, nullptr, stats); + gdraw_FreeTexture((GDrawTexture *) t, 0, stats); // note: don't send a warning since this will happen during regular tiled rendering return false; } @@ -1224,17 +1224,17 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) { GDrawFramebufferState *n = gdraw->cur; GDrawFramebufferState *m = --gdraw->cur; - if (gdraw->tw == 0 || gdraw->th == 0) return nullptr; + if (gdraw->tw == 0 || gdraw->th == 0) return 0; if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) - return nullptr; // already returned a warning in Begin + return 0; // already returned a warning in Begin assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != nullptr); // @GDRAW_ASSERT + assert(m->color_buffer != NULL); // @GDRAW_ASSERT } - assert(n->color_buffer != nullptr); // @GDRAW_ASSERT + assert(n->color_buffer != NULL); // @GDRAW_ASSERT // switch back to old render target set_render_target(stats); @@ -1284,15 +1284,15 @@ static void RADLINK gdraw_ClearID(void) // assuming the depth buffer has been mappped to 0..1 static F32 depth_from_id(S32 id) { - return 1.0f - (static_cast(id) + 1.0f) / MAX_DEPTH_VALUE; + return 1.0f - ((F32) id + 1.0f) / MAX_DEPTH_VALUE; } static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap) { ID3D1XContext *d3d = gdraw->d3d_context; - if (tex == nullptr) { - ID3D1X(ShaderResourceView) *notex = nullptr; + if (tex == NULL) { + ID3D1X(ShaderResourceView) *notex = NULL; d3d->PSSetShaderResources(texunit, 1, ¬ex); } else { GDrawHandle *h = (GDrawHandle *) tex; @@ -1303,7 +1303,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == nullptr) + if (mat == NULL) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -1319,7 +1319,7 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta set_vertex_shader(d3d, gdraw->vert[vertex_format].vshader); // set vertex shader constants - if (VertexVars *vvars = static_cast(map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true))) { + if (VertexVars *vvars = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) { F32 depth = depth_from_id(r->id); if (!r->use_world_space) gdraw_ObjectSpace(vvars->world[0], r->o2w, depth, 0.0f); @@ -1366,9 +1366,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta // in stencil set mode, prefer not doing any shading at all // but if alpha test is on, we need to make an exception -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems +#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems if (which != GDRAW_TEXTURE_alpha_test) - program = nullptr; + program = NULL; else #endif { @@ -1384,7 +1384,7 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta set_texture(0, r->tex[0], r->nearest0, r->wrap0); // pixel shader constants - if (PixelCommonVars *pvars = static_cast(map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true))) { + if (PixelCommonVars *pvars = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) { memcpy(pvars->color_mul, r->color, 4*sizeof(float)); if (r->cxf_add) { @@ -1478,13 +1478,13 @@ static int vertsize[GDRAW_vformat__basic_count] = { // Draw triangles with a given renderstate // -static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) +static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) { U64 now = gdraw->frame_counter; - if (r1) static_cast(r1)->fence.value = now; - if (r2) static_cast(r2)->fence.value = now; - if (r3) static_cast(r3)->fence.value = now; - if (r4) static_cast(r4)->fence.value = now; + if (r1) ((GDrawHandle *) r1)->fence.value = now; + if (r2) ((GDrawHandle *) r2)->fence.value = now; + if (r3) ((GDrawHandle *) r3)->fence.value = now; + if (r4) ((GDrawHandle *) r4)->fence.value = now; } static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimitive *p, GDrawVertexBuffer *buf, GDrawStats *stats) @@ -1501,10 +1501,10 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti d3d->IASetInputLayout(gdraw->inlayout[vfmt]); if (vb) { - UINT offs = static_cast((UINTa)p->vertices); + UINT offs = (UINT) (UINTa) p->vertices; d3d->IASetVertexBuffers(0, 1, &vb->handle.vbuf.verts, &stride, &offs); - d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, static_cast((UINTa)p->indices)); + d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, (UINT) (UINTa) p->indices); d3d->DrawIndexed(p->num_indices, 0, 0); } else if (p->indices) { U32 vbytes = p->num_vertices * stride; @@ -1581,10 +1581,10 @@ static void set_pixel_constant(F32 *constant, F32 x, F32 y, F32 z, F32 w) static void do_screen_quad(gswf_recti *s, const F32 *tc, GDrawStats *stats) { ID3D1XContext *d3d = gdraw->d3d_context; - F32 px0 = static_cast(s->x0), py0 = static_cast(s->y0), px1 = static_cast(s->x1), py1 = static_cast(s->y1); + F32 px0 = (F32) s->x0, py0 = (F32) s->y0, px1 = (F32) s->x1, py1 = (F32) s->y1; // generate vertex data - gswf_vertex_xyst *vert = static_cast(start_write_dyn(&gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst))); + gswf_vertex_xyst *vert = (gswf_vertex_xyst *) start_write_dyn(&gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst)); if (!vert) return; @@ -1595,7 +1595,7 @@ static void do_screen_quad(gswf_recti *s, const F32 *tc, GDrawStats *stats) UINT offs = end_write_dyn(&gdraw->dyn_vb); UINT stride = sizeof(gswf_vertex_xyst); - if (VertexVars *vvars = static_cast(map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true))) { + if (VertexVars *vvars = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) { gdraw_PixelSpace(vvars->world[0]); memcpy(vvars->x3d, gdraw->projmat, 12*sizeof(F32)); unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex); @@ -1629,7 +1629,7 @@ static void manual_clear(gswf_recti *r, GDrawStats *stats) set_projection_raw(0, gdraw->frametex_width, gdraw->frametex_height, 0); set_pixel_shader(d3d, gdraw->clear_ps.pshader); - if (PixelCommonVars *pvars = static_cast(map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true))) { + if (PixelCommonVars *pvars = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) { memset(pvars, 0, sizeof(*pvars)); unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common); d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common); @@ -1643,7 +1643,7 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, float *data, gs set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); set_pixel_shader(gdraw->d3d_context, gdraw->blur_prog[taps].pshader); - PixelParaBlur *para = static_cast(start_ps_constants(gdraw->cb_blur)); + PixelParaBlur *para = (PixelParaBlur *) start_ps_constants(gdraw->cb_blur); memcpy(para->clamp, clamp, 4 * sizeof(float)); memcpy(para->tap, data, taps * 4 * sizeof(float)); end_ps_constants(gdraw->cb_blur); @@ -1654,13 +1654,13 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, float *data, gs static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, stats)) return; set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); set_pixel_shader(gdraw->d3d_context, gdraw->colormatrix.pshader); - PixelParaColorMatrix *para = static_cast(start_ps_constants(gdraw->cb_colormatrix)); + PixelParaColorMatrix *para = (PixelParaColorMatrix *) start_ps_constants(gdraw->cb_colormatrix); memcpy(para->data, r->shader_data, 5 * 4 * sizeof(float)); end_ps_constants(gdraw->cb_colormatrix); @@ -1672,7 +1672,7 @@ static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDr static gswf_recti *get_valid_rect(GDrawTexture *tex) { GDrawHandle *h = (GDrawHandle *) tex; - S32 n = static_cast(h - gdraw->rendertargets.handle); + S32 n = (S32) (h - gdraw->rendertargets.handle); assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH+1); return &gdraw->rt_valid[n]; } @@ -1690,7 +1690,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) return; set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); @@ -1698,12 +1698,12 @@ static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbe set_texture(2, r->tex[2], false, GDRAW_WRAP_clamp); set_pixel_shader(gdraw->d3d_context, gdraw->filter_prog[isbevel][r->filter_mode].pshader); - PixelParaFilter *para = static_cast(start_ps_constants(gdraw->cb_filter)); + PixelParaFilter *para = (PixelParaFilter *) start_ps_constants(gdraw->cb_filter); set_clamp_constant(para->clamp0, r->tex[0]); set_clamp_constant(para->clamp1, r->tex[1]); set_pixel_constant(para->color, r->shader_data[0], r->shader_data[1], r->shader_data[2], r->shader_data[3]); set_pixel_constant(para->color2, r->shader_data[8], r->shader_data[9], r->shader_data[10], r->shader_data[11]); - set_pixel_constant(para->tc_off, -r->shader_data[4] / static_cast(gdraw->frametex_width), -r->shader_data[5] / static_cast(gdraw->frametex_height), r->shader_data[6], 0); + set_pixel_constant(para->tc_off, -r->shader_data[4] / (F32)gdraw->frametex_width, -r->shader_data[5] / (F32)gdraw->frametex_height, r->shader_data[6], 0); end_ps_constants(gdraw->cb_filter); do_screen_quad(s, tc, stats); @@ -1725,10 +1725,10 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 if (s.x1 < s.x0 || s.y1 < s.y0) return; - tc[0] = (s.x0 - gdraw->tx0p) / static_cast(gdraw->frametex_width); - tc[1] = (s.y0 - gdraw->ty0p) / static_cast(gdraw->frametex_height); - tc[2] = (s.x1 - gdraw->tx0p) / static_cast(gdraw->frametex_width); - tc[3] = (s.y1 - gdraw->ty0p) / static_cast(gdraw->frametex_height); + tc[0] = (s.x0 - gdraw->tx0p) / (F32) gdraw->frametex_width; + tc[1] = (s.y0 - gdraw->ty0p) / (F32) gdraw->frametex_height; + tc[2] = (s.x1 - gdraw->tx0p) / (F32) gdraw->frametex_width; + tc[3] = (s.y1 - gdraw->ty0p) / (F32) gdraw->frametex_height; // clear to known render state d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); @@ -1778,7 +1778,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = nullptr; + GDrawHandle *blend_tex = NULL; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. we do this with copies @@ -1811,10 +1811,10 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 d3d->PSSetSamplers(1, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); // calculate texture coordinate remapping - rescale1[0] = gdraw->frametex_width / static_cast(texdesc.Width); - rescale1[1] = gdraw->frametex_height / static_cast(texdesc.Height); - rescale1[2] = (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / static_cast(texdesc.Width); - rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / static_cast(texdesc.Height); + rescale1[0] = gdraw->frametex_width / (F32) texdesc.Width; + rescale1[1] = gdraw->frametex_height / (F32) texdesc.Height; + rescale1[2] = (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / (F32) texdesc.Width; + rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / (F32) texdesc.Height; } else { D3D1X_(BOX) box = { 0,0,0,0,0,1 }; S32 dx = 0, dy = 0; @@ -1847,7 +1847,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 do_screen_quad(&s, tc, stats); tag_resources(r->tex[0], r->tex[1]); if (blend_tex) - gdraw_FreeTexture((GDrawTexture *) blend_tex, nullptr, stats); + gdraw_FreeTexture((GDrawTexture *) blend_tex, 0, stats); } } @@ -1862,18 +1862,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p) { if (p->pshader) { p->pshader->Release(); - p->pshader = nullptr; + p->pshader = NULL; } } static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind) { D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 }; - ID3D1X(Buffer) *buf = nullptr; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf); + ID3D1X(Buffer) *buf = NULL; + HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = nullptr; + buf = NULL; } return buf; } @@ -1910,7 +1910,7 @@ static void create_all_shaders_and_state(void) HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]); if (FAILED(hr)) { report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = nullptr; + gdraw->inlayout[i] = NULL; } } @@ -2029,11 +2029,11 @@ static void create_all_shaders_and_state(void) hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = nullptr; + gdraw->quad_ib = NULL; } IggyGDrawFree(inds); } else - gdraw->quad_ib = nullptr; + gdraw->quad_ib = NULL; } static void destroy_all_shaders_and_state() @@ -2106,7 +2106,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } static bool alloc_dynbuffer(U32 size) @@ -2142,7 +2142,7 @@ static bool alloc_dynbuffer(U32 size) gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); gdraw->max_quad_vert_count &= ~3; // must be multiple of four - return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr; + return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; } int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2181,7 +2181,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2189,7 +2189,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; case GDRAW_D3D1X_(RESOURCE_dynbuffer): unbind_resources(); @@ -2205,7 +2205,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h) { gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -2220,7 +2220,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { free_gdraw(); - return nullptr; + return NULL; } create_all_shaders_and_state(); @@ -2291,7 +2291,7 @@ void gdraw_D3D1X_(DestroyContext)(void) if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - gdraw->d3d_device = nullptr; + gdraw->d3d_device = NULL; } free_gdraw(); @@ -2354,7 +2354,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break; case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return; - default: cache = nullptr; break; + default: cache = NULL; break; } *handles_used = *bytes_used = 0; @@ -2385,14 +2385,14 @@ static S32 num_pixels(S32 w, S32 h, S32 mipmaps) GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, S32 /*len*/, IggyFileTextureRaw *texture) { const char *failed_call=""; - U8 *free_data = nullptr; - GDrawTexture *t=nullptr; + U8 *free_data = 0; + GDrawTexture *t=0; S32 width, height, mipmaps, size, blk; - ID3D1X(Texture2D) *tex=nullptr; - ID3D1X(ShaderResourceView) *view=nullptr; + ID3D1X(Texture2D) *tex=0; + ID3D1X(ShaderResourceView) *view=0; DXGI_FORMAT d3dfmt; - D3D1X_(SUBRESOURCE_DATA) mipdata[24] = { nullptr }; + D3D1X_(SUBRESOURCE_DATA) mipdata[24] = { 0 }; S32 k; HRESULT hr = S_OK; @@ -2413,7 +2413,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break; case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break; default: { - IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); + IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); done = true; } } @@ -2430,7 +2430,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, free_data = (U8 *) IggyGDrawMalloc(total_size); if (!free_data) { - IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); done = true; } else { U8 *cur = free_data; @@ -2463,7 +2463,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex); if (!FAILED(hr)) { failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view); + hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); if (!FAILED(hr)) t = gdraw_D3D1X_(WrappedTextureCreate)(view); } @@ -2483,14 +2483,14 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, if (tex) tex->Release(); } else { - reinterpret_cast(t)->handle.tex.d3d = tex; + ((GDrawHandle *) t)->handle.tex.d3d = tex; } return t; } void RADLINK gdraw_D3D1X_(DestroyTextureFromResource)(GDrawTexture *tex) { - GDrawHandle *h = reinterpret_cast(tex); + GDrawHandle *h = (GDrawHandle *) tex; safe_release(h->handle.tex.d3d_view); safe_release(h->handle.tex.d3d); gdraw_D3D1X_(WrappedTextureDestroy)(tex); diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl index 74a29221..dc8a0484 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl @@ -181,7 +181,7 @@ static char *pshader_basic_vars[] = { "color_mul", "color_add", "focal", - nullptr + NULL }; static char pshader_general2_frag0[] = @@ -293,7 +293,7 @@ static char **pshader_general2(void) static char *pshader_general2_vars[] = { "tex0", - nullptr + NULL }; static char pshader_exceptional_blend_frag0[] = @@ -414,7 +414,7 @@ static char pshader_exceptional_blend_frag13[] = #define NUMFRAGMENTS_pshader_exceptional_blend 3 static char *pshader_exceptional_blend_arr[13][NUMFRAGMENTS_pshader_exceptional_blend] = { - { nullptr, nullptr, nullptr, }, + { NULL, NULL, NULL, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag1, pshader_exceptional_blend_frag2, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag3, pshader_exceptional_blend_frag2, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag4, pshader_exceptional_blend_frag2, }, @@ -439,7 +439,7 @@ static char *pshader_exceptional_blend_vars[] = { "tex1", "color_mul", "color_add", - nullptr + NULL }; static char pshader_filter_frag0[] = @@ -593,10 +593,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, @@ -609,10 +609,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, }; static char **pshader_filter(int bevel, int ontop, int inner, int gradient, int knockout) @@ -629,7 +629,7 @@ static char *pshader_filter_vars[] = { "clamp0", "clamp1", "color2", - nullptr + NULL }; static char pshader_blur_frag0[] = @@ -701,8 +701,8 @@ static char pshader_blur_frag9[] = #define NUMFRAGMENTS_pshader_blur 3 static char *pshader_blur_arr[10][NUMFRAGMENTS_pshader_blur] = { - { nullptr, nullptr, nullptr, }, - { nullptr, nullptr, nullptr, }, + { NULL, NULL, NULL, }, + { NULL, NULL, NULL, }, { pshader_blur_frag0, pshader_blur_frag1, pshader_blur_frag2, }, { pshader_blur_frag0, pshader_blur_frag3, pshader_blur_frag2, }, { pshader_blur_frag0, pshader_blur_frag4, pshader_blur_frag2, }, @@ -722,7 +722,7 @@ static char *pshader_blur_vars[] = { "tex0", "tap", "clampv", - nullptr + NULL }; static char pshader_color_matrix_frag0[] = @@ -804,7 +804,7 @@ static char **pshader_color_matrix(void) static char *pshader_color_matrix_vars[] = { "tex0", "data", - nullptr + NULL }; static char pshader_manual_clear_frag0[] = @@ -855,7 +855,7 @@ static char **pshader_manual_clear(void) static char *pshader_manual_clear_vars[] = { "color_mul", - nullptr + NULL }; static char vshader_vsgl_frag0[] = @@ -966,7 +966,7 @@ static char *vshader_vsgl_vars[] = { "texgen_s", "texgen_t", "viewproj", - nullptr + NULL }; static char vshader_vsglihud_frag0[] = @@ -1079,6 +1079,6 @@ static char *vshader_vsglihud_vars[] = { "worldview", "material", "textmode", - nullptr + NULL }; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl index f134b740..9916096a 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl @@ -60,7 +60,7 @@ static RADINLINE void break_on_err(GLint e) static void report_err(GLint e) { break_on_err(e); - IggyGDrawSendWarning(nullptr, "OpenGL glGetError error"); + IggyGDrawSendWarning(NULL, "OpenGL glGetError error"); } static void compilation_err(const char *msg) @@ -256,7 +256,7 @@ static void make_texture(GLuint tex) static void make_rendertarget(GDrawHandle *t, GLuint tex, GLenum int_type, GLenum ext_type, GLenum data_type, S32 w, S32 h, S32 size) { glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, nullptr); + glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, NULL); make_texture(tex); glBindTexture(GL_TEXTURE_2D, 0); } @@ -309,7 +309,7 @@ extern GDrawTexture *gdraw_GLx_(WrappedTextureCreate)(S32 gl_texture_handle, S32 p->handle.tex.w = width; p->handle.tex.h = height; p->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); - gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } @@ -350,7 +350,7 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *gstats) { S32 size=0, asize, stride; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; opengl_check(); stride = width; @@ -369,7 +369,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, p->texture_data = IggyGDrawMalloc(size); if (!p->texture_data) { gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, "GDraw malloc for texture data failed"); + IggyGDrawSendWarning(NULL, "GDraw malloc for texture data failed"); return false; } @@ -419,9 +419,9 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI if (e != 0) { gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, "GDraw OpenGL error creating texture"); + IggyGDrawSendWarning(NULL, "GDraw OpenGL error creating texture"); eat_gl_err(); - return nullptr; + return NULL; } else { gdraw_HandleCacheAllocateEnd(t, p->i4, p->p1, (flags & GDRAW_MAKETEXTURE_FLAGS_never_flush) ? GDRAW_HANDLE_STATE_pinned : GDRAW_HANDLE_STATE_locked); stats->nonzero_flags |= GDRAW_STATS_alloc_tex; @@ -467,8 +467,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *tex, void *unique_id, G static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *gstats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != nullptr); - if (t->owner == unique_id || unique_id == nullptr) { + assert(t != NULL); + if (t->owner == unique_id || unique_id == NULL) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -516,7 +516,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat opengl_check(); vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, gstats); if (!vb) { - IggyGDrawSendWarning(nullptr, "GDraw out of vertex buffer memory"); + IggyGDrawSendWarning(NULL, "GDraw out of vertex buffer memory"); return false; } @@ -526,9 +526,9 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat glGenBuffers(1, &vb->handle.vbuf.base); glGenBuffers(1, &vb->handle.vbuf.indices); glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); - glBufferData(GL_ARRAY_BUFFER, vbuf_size, nullptr, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, vbuf_size, NULL, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, nullptr, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, NULL, GL_STATIC_DRAW); if (!e) e = glGetError(); if (e != GL_NO_ERROR) { glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -537,7 +537,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat glDeleteBuffers(1, &vb->handle.vbuf.indices); gdraw_HandleCacheAllocateFail(vb); eat_gl_err(); - IggyGDrawSendWarning(nullptr, "GDraw OpenGL vertex buffer creation failed"); + IggyGDrawSendWarning(NULL, "GDraw OpenGL vertex buffer creation failed"); return false; } @@ -556,7 +556,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (!p->vertex_data || !p->index_data) { if (p->vertex_data) IggyGDrawFree(p->vertex_data); if (p->index_data) IggyGDrawFree(p->index_data); - IggyGDrawSendWarning(nullptr, "GDraw malloc for vertex buffer temporary memory failed"); + IggyGDrawSendWarning(NULL, "GDraw malloc for vertex buffer temporary memory failed"); return false; } } else { @@ -602,7 +602,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf glDeleteBuffers(1, &vb->handle.vbuf.indices); gdraw_HandleCacheAllocateFail(vb); eat_gl_err(); - return nullptr; + return NULL; } else gdraw_HandleCacheAllocateEnd(vb, p->i0 + p->i1, p->p1, GDRAW_HANDLE_STATE_locked); @@ -619,7 +619,7 @@ static rrbool RADLINK gdraw_TryToLockVertexBuffer(GDrawVertexBuffer *vb, void *u static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != nullptr); + assert(h != NULL); if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -678,13 +678,13 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *gstats) // ran out of RTs, allocate a new one size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget memory"); - return nullptr; + IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget memory"); + return NULL; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget handles"); + IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget handles"); return t; } @@ -873,7 +873,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == nullptr) + if (mat == NULL) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -992,30 +992,30 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawHandle *t; int k; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(nullptr, "GDraw got a request for an empty rendertarget"); + IggyGDrawSendWarning(NULL, "GDraw got a request for an empty rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { t = get_rendertarget_texture(region->x1 - region->x0, region->y1 - region->y0, owner, gstats); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets for cacheAsBItmap"); + IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets for cacheAsBItmap"); return false; } } else { t = get_color_rendertarget(gstats); if (!t) { - IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets"); + IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets"); return false; } } n->color_buffer = t; - assert(n->color_buffer != nullptr); + assert(n->color_buffer != NULL); if (n == gdraw->frame+1) n->stencil_depth = get_depthstencil_renderbuffer(gstats); @@ -1023,7 +1023,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->stencil_depth = (n-1)->stencil_depth; ++gdraw->cur; - gdraw->cur->cached = owner != nullptr; + gdraw->cur->cached = owner != NULL; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1161,8 +1161,8 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *gstats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) - assert(m->color_buffer != nullptr); - assert(n->color_buffer != nullptr); + assert(m->color_buffer != NULL); + assert(n->color_buffer != NULL); // remove color and stencil buffers glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_RENDERBUFFER, 0); @@ -1274,7 +1274,7 @@ static float depth_from_id(S32 id) static void set_texture(U32 texunit, GDrawTexture *tex) { glActiveTexture(GL_TEXTURE0 + texunit); - if (tex == nullptr) + if (tex == NULL) glBindTexture(GL_TEXTURE_2D, 0); else glBindTexture(GL_TEXTURE_2D, ((GDrawHandle *) tex)->handle.tex.gl); @@ -1575,7 +1575,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } - if (!set_render_state(r,p->vertex_format, nullptr, p, gstats)) return; + if (!set_render_state(r,p->vertex_format, NULL, p, gstats)) return; gstats->nonzero_flags |= GDRAW_STATS_batches; gstats->num_batches += 1; gstats->drawn_indices += p->num_indices; @@ -1593,7 +1593,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti while (pos < p->num_vertices) { S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); set_vertex_format(p->vertex_format, p->vertices + pos*stride); - glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, nullptr); + glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, NULL); pos += vert_count; } @@ -1719,7 +1719,7 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, F32 *data, gswf_ static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDrawStats *gstats) { ProgramWithCachedVariableLocations *prg = &gdraw->colormatrix; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats)) return; use_lazy_shader(prg); set_texture(0, r->tex[0]); @@ -1752,7 +1752,7 @@ static void set_clamp_constant(GLint constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *gstats) { ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode]; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats)) return; use_lazy_shader(prg); set_texture(0, r->tex[0]); @@ -1845,7 +1845,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawTexture *blend_tex = nullptr; + GDrawTexture *blend_tex = NULL; const int *vvars; // for crazy blend modes, we need to read back from the framebuffer @@ -1864,7 +1864,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 set_texture(1, blend_tex); } - if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, nullptr, gstats)) + if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, NULL, gstats)) return; do_screen_quad(&s, tc, vvars, gstats, 0); tag_resources(r->tex[0],r->tex[1],0); @@ -1932,7 +1932,7 @@ static void make_fragment_program(ProgramWithCachedVariableLocations *p, int num } shad = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr); + glShaderSource(shad, num_strings, (const GLchar **)strings, NULL); glCompileShader(shad); glGetShaderiv(shad, GL_COMPILE_STATUS, &res); if (!res) { @@ -1994,7 +1994,7 @@ static void make_vertex_program(GLuint *vprog, int num_strings, char **strings) if(strings[0]) { shad = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr); + glShaderSource(shad, num_strings, (const GLchar **)strings, NULL); glCompileShader(shad); glGetShaderiv(shad, GL_COMPILE_STATUS, &res); if (!res) { @@ -2154,7 +2154,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = nullptr; + gdraw = NULL; } int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2193,7 +2193,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); - return gdraw->texturecache != nullptr; + return gdraw->texturecache != NULL; case GDRAW_GLx_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2201,7 +2201,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != nullptr; + return gdraw->vbufcache != NULL; default: return 0; @@ -2220,12 +2220,12 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3 while (fmt->iggyfmt != texture->format && fmt->blkbytes) fmt++; if (!fmt->blkbytes) // end of list - i.e. format not supported - return nullptr; + return NULL; // prepare texture glGenTextures(1, &gl_texture_handle); if (gl_texture_handle == 0) - return nullptr; + return NULL; opengl_check(); make_texture(gl_texture_handle); @@ -2283,7 +2283,7 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mips-1); tex = gdraw_GLx_(WrappedTextureCreate)(gl_texture_handle, texture->w, texture->h, mips > 1); - if (tex == nullptr) + if (tex == NULL) glDeleteTextures(1, &gl_texture_handle); opengl_check(); return tex; @@ -2301,7 +2301,7 @@ static rrbool hasext(const char *exts, const char *which) size_t len; #ifdef GDRAW_USE_glGetStringi - if (exts == nullptr) { + if (exts == NULL) { GLint i, num_exts; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts); for (i=0; i < num_exts; ++i) @@ -2316,7 +2316,7 @@ static rrbool hasext(const char *exts, const char *which) for(;;) { where = strstr(where, which); - if (where == nullptr) + if (where == NULL) return false; if ( (where == exts || *(where - 1) == ' ') // starts with terminator @@ -2329,7 +2329,7 @@ static rrbool hasext(const char *exts, const char *which) static GDrawFunctions *create_context(S32 w, S32 h) { gdraw = IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return nullptr; + if (!gdraw) return NULL; memset(gdraw, 0, sizeof(*gdraw)); @@ -2339,7 +2339,7 @@ static GDrawFunctions *create_context(S32 w, S32 h) if (!gdraw->texturecache || !gdraw->vbufcache || !make_quad_indices()) { free_gdraw(); - return nullptr; + return NULL; } opengl_check(); @@ -2380,7 +2380,7 @@ static GDrawFunctions *create_context(S32 w, S32 h) gdraw_funcs.ClearID = gdraw_ClearID; gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; - gdraw_funcs.MakeTextureMore = nullptr; + gdraw_funcs.MakeTextureMore = NULL; gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl index 1790de77..a60fa520 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != nullptr) { + while (s != NULL) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -368,7 +368,7 @@ static void gdraw_HandleTransitionInsertBefore(GDrawHandle *t, GDrawHandleState { check_lists(t->cache); assert(t->state != GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != static_cast(new_state)); // code should never call "transition" if it's not transitioning! + assert(t->state != (U32) new_state); // code should never call "transition" if it's not transitioning! // unlink from prev state t->prev->next = t->next; t->next->prev = t->prev; @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, nullptr); + return gdraw_HandleCacheLockStats(t, owner, NULL); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = nullptr; - c->state[i].cache = nullptr; // should never follow cache link from sentinels! + c->state[i].owner = NULL; + c->state[i].cache = NULL; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = nullptr; + c->state[i].raw_ptr = NULL; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = nullptr; + c->handle[i].raw_ptr = NULL; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = nullptr; + c->alloc = NULL; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = nullptr; + c->alloc_other = NULL; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = nullptr; + GDrawHandle *t = NULL; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = nullptr; + t->raw_ptr = NULL; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -558,7 +558,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : nullptr; + return (sentinel->next != sentinel) ? sentinel->next : NULL; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -773,7 +773,7 @@ static GDrawTexture *gdraw_BlurPass(GDrawFunctions *g, GDrawBlurInfo *c, GDrawRe if (!g->TextureDrawBufferBegin(draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, 0, gstats)) return r->tex[0]; - c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -825,7 +825,7 @@ static GDrawTexture *gdraw_BlurPassDownsample(GDrawFunctions *g, GDrawBlurInfo * assert(clamp[0] <= clamp[2]); assert(clamp[1] <= clamp[3]); - c->BlurPass(r, taps, data, &z, tc, static_cast(c->h) / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, (F32) c->h / c->frametex_height, clamp, gstats); return g->TextureDrawBufferEnd(gstats); } @@ -837,7 +837,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR GDrawTexture *t; F32 data[MAX_TAPS][4]; S32 off_axis = 1-axis; - S32 w = static_cast(ceil((blur_width - 1) / 2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 F32 edge_weight = 1 - (w - blur_width)/2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 F32 inverse_weight = 1.0f / blur_width; @@ -944,7 +944,7 @@ static void gdraw_BlurAxis(S32 axis, GDrawFunctions *g, GDrawBlurInfo *c, GDrawR // max coverage is 25 samples, or a filter width of 13. with 7 taps, we sample // 13 samples in one pass, max coverage is 13*13 samples or (13*13-1)/2 width, // which is ((2T-1)*(2T-1)-1)/2 or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = static_cast(ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS))); + S32 w_mip = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); S32 downsample = w_mip; F32 sample_spacing = texel; if (downsample < 2) downsample = 2; @@ -1090,7 +1090,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = nullptr; + *start = NULL; *num_bytes = 0; return; } else { @@ -1127,7 +1127,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return nullptr; + return NULL; arena->current = ptr + size; return ptr; @@ -1152,7 +1152,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, nullptr-terminated list of elements in each hash +// There's a single-linked, NULL-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1161,7 +1161,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, nullptr-terminated list of unused blocks. Every block is either +// single-linked, NULL-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1379,7 +1379,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != nullptr); + GFXALLOC_ASSERT(alloc->unused_list != NULL); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1452,7 +1452,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return nullptr; + return NULL; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1460,7 +1460,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return nullptr; + return NULL; memset(a, 0, size); @@ -1501,16 +1501,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, nullptr, 0,0); + debug_complete_check(a, NULL, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = nullptr; + gfx_block_info *cur, *best = NULL; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, nullptr, 0,0); +debug_complete_check(alloc, NULL, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1560,7 +1560,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return nullptr; // not enough space! + return NULL; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1730,7 +1730,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = nullptr; + b->prev = NULL; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1743,7 +1743,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1905,7 +1905,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = nullptr; + void *ptr = NULL; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2295,7 +2295,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = nullptr; + ring->cur = NULL; ring->seg_size = 0; } @@ -2305,7 +2305,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return nullptr; // nope, won't fit + return NULL; // nope, won't fit assert(align <= ring->align); @@ -2410,7 +2410,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2430,8 +2430,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return nullptr; + IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return NULL; } #ifndef GDRAW_MANAGE_MEM @@ -2440,7 +2440,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2448,7 +2448,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, nullptr, "memory"); + gdraw_res_alloc_outofmem(c, NULL, "memory"); break; } } @@ -2463,8 +2463,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == nullptr) { - gdraw_res_alloc_outofmem(c, nullptr, "handles"); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); } } } @@ -2508,7 +2508,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = nullptr; + r->owner = NULL; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2516,11 +2516,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = nullptr; + void *ptr = NULL; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2532,7 +2532,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, nullptr, "handles"); + return gdraw_res_alloc_outofmem(c, NULL, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Windows64/Iggy/include/gdraw.h b/Minecraft.Client/Windows64/Iggy/include/gdraw.h index 7cc4ddd0..404a2642 100644 --- a/Minecraft.Client/Windows64/Iggy/include/gdraw.h +++ b/Minecraft.Client/Windows64/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is nullptr, then the pointers in 'prim' are machine pointers, and + If buf is NULL, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-nullptr, then use the appropriate vertex buffer, and the + If buf is non-NULL, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or nullptr if an error occured + $:return Handle for the newly created texture, or NULL if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h index a42ccbff..1f1a90a1 100644 --- a/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP +Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index 54191ebc..3a98a098 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -288,7 +288,7 @@ void KeyboardMouseInput::SetMouseGrabbed(bool grabbed) else if (!grabbed && !m_cursorHiddenForUI && g_hWnd) { while (ShowCursor(TRUE) < 0) {} - ClipCursor(nullptr); + ClipCursor(NULL); } } @@ -317,7 +317,7 @@ void KeyboardMouseInput::SetCursorHiddenForUI(bool hidden) else if (!hidden && !m_mouseGrabbed && g_hWnd) { while (ShowCursor(TRUE) < 0) {} - ClipCursor(nullptr); + ClipCursor(NULL); } } @@ -347,13 +347,13 @@ void KeyboardMouseInput::SetWindowFocused(bool focused) else { while (ShowCursor(TRUE) < 0) {} - ClipCursor(nullptr); + ClipCursor(NULL); } } else { while (ShowCursor(TRUE) < 0) {} - ClipCursor(nullptr); + ClipCursor(NULL); } } diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 27638953..c76bc2fe 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -16,8 +16,8 @@ static bool RecvExact(SOCKET sock, BYTE* buf, int len); SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_acceptThread = nullptr; -HANDLE WinsockNetLayer::s_clientRecvThread = nullptr; +HANDLE WinsockNetLayer::s_acceptThread = NULL; +HANDLE WinsockNetLayer::s_clientRecvThread = NULL; bool WinsockNetLayer::s_isHost = false; bool WinsockNetLayer::s_connected = false; @@ -34,14 +34,14 @@ CRITICAL_SECTION WinsockNetLayer::s_connectionsLock; std::vector WinsockNetLayer::s_connections; SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_advertiseThread = nullptr; +HANDLE WinsockNetLayer::s_advertiseThread = NULL; volatile bool WinsockNetLayer::s_advertising = false; Win64LANBroadcast WinsockNetLayer::s_advertiseData = {}; CRITICAL_SECTION WinsockNetLayer::s_advertiseLock; int WinsockNetLayer::s_hostGamePort = WIN64_NET_DEFAULT_PORT; SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_discoveryThread = nullptr; +HANDLE WinsockNetLayer::s_discoveryThread = NULL; volatile bool WinsockNetLayer::s_discovering = false; CRITICAL_SECTION WinsockNetLayer::s_discoveryLock; std::vector WinsockNetLayer::s_discoveredSessions; @@ -123,18 +123,18 @@ void WinsockNetLayer::Shutdown() s_connections.clear(); LeaveCriticalSection(&s_connectionsLock); - if (s_acceptThread != nullptr) + if (s_acceptThread != NULL) { WaitForSingleObject(s_acceptThread, 2000); CloseHandle(s_acceptThread); - s_acceptThread = nullptr; + s_acceptThread = NULL; } - if (s_clientRecvThread != nullptr) + if (s_clientRecvThread != NULL) { WaitForSingleObject(s_clientRecvThread, 2000); CloseHandle(s_clientRecvThread); - s_clientRecvThread = nullptr; + s_clientRecvThread = NULL; } if (s_initialized) @@ -172,22 +172,22 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp) LeaveCriticalSection(&s_smallIdToSocketLock); struct addrinfo hints = {}; - struct addrinfo* result = nullptr; + struct addrinfo* result = NULL; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - hints.ai_flags = (bindIp == nullptr || bindIp[0] == 0) ? AI_PASSIVE : 0; + hints.ai_flags = (bindIp == NULL || bindIp[0] == 0) ? AI_PASSIVE : 0; char portStr[16]; sprintf_s(portStr, "%d", port); - const char* resolvedBindIp = (bindIp != nullptr && bindIp[0] != 0) ? bindIp : nullptr; + const char* resolvedBindIp = (bindIp != NULL && bindIp[0] != 0) ? bindIp : NULL; int iResult = getaddrinfo(resolvedBindIp, portStr, &hints, &result); if (iResult != 0) { app.DebugPrintf("getaddrinfo failed for %s:%d - %d\n", - resolvedBindIp != nullptr ? resolvedBindIp : "*", + resolvedBindIp != NULL ? resolvedBindIp : "*", port, iResult); return false; @@ -204,7 +204,7 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp) int opt = 1; setsockopt(s_listenSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt)); - iResult = ::bind(s_listenSocket, result->ai_addr, static_cast(result->ai_addrlen)); + iResult = ::bind(s_listenSocket, result->ai_addr, (int)result->ai_addrlen); freeaddrinfo(result); if (iResult == SOCKET_ERROR) { @@ -226,10 +226,10 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp) s_active = true; s_connected = true; - s_acceptThread = CreateThread(nullptr, 0, AcceptThreadProc, nullptr, 0, nullptr); + s_acceptThread = CreateThread(NULL, 0, AcceptThreadProc, NULL, 0, NULL); app.DebugPrintf("Win64 LAN: Hosting on %s:%d\n", - resolvedBindIp != nullptr ? resolvedBindIp : "*", + resolvedBindIp != NULL ? resolvedBindIp : "*", port); return true; } @@ -250,7 +250,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) } struct addrinfo hints = {}; - struct addrinfo* result = nullptr; + struct addrinfo* result = NULL; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; @@ -282,7 +282,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) int noDelay = 1; setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char*)&noDelay, sizeof(noDelay)); - iResult = connect(s_hostConnectionSocket, result->ai_addr, static_cast(result->ai_addrlen)); + iResult = connect(s_hostConnectionSocket, result->ai_addr, (int)result->ai_addrlen); if (iResult == SOCKET_ERROR) { int err = WSAGetLastError(); @@ -342,7 +342,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) s_active = true; s_connected = true; - s_clientRecvThread = CreateThread(nullptr, 0, ClientRecvThreadProc, nullptr, 0, nullptr); + s_clientRecvThread = CreateThread(NULL, 0, ClientRecvThreadProc, NULL, 0, NULL); return true; } @@ -354,10 +354,10 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize) EnterCriticalSection(&s_sendLock); BYTE header[4]; - header[0] = static_cast((dataSize >> 24) & 0xFF); - header[1] = static_cast((dataSize >> 16) & 0xFF); - header[2] = static_cast((dataSize >> 8) & 0xFF); - header[3] = static_cast(dataSize & 0xFF); + header[0] = (BYTE)((dataSize >> 24) & 0xFF); + header[1] = (BYTE)((dataSize >> 16) & 0xFF); + header[2] = (BYTE)((dataSize >> 8) & 0xFF); + header[3] = (BYTE)(dataSize & 0xFF); int totalSent = 0; int toSend = 4; @@ -375,7 +375,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize) totalSent = 0; while (totalSent < dataSize) { - int sent = send(sock, static_cast(data) + totalSent, dataSize - totalSent, 0); + int sent = send(sock, (const char*)data + totalSent, dataSize - totalSent, 0); if (sent == SOCKET_ERROR || sent == 0) { LeaveCriticalSection(&s_sendLock); @@ -450,18 +450,18 @@ void WinsockNetLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsig INetworkPlayer* pPlayerFrom = g_NetworkManager.GetPlayerBySmallId(fromSmallId); INetworkPlayer* pPlayerTo = g_NetworkManager.GetPlayerBySmallId(toSmallId); - if (pPlayerFrom == nullptr || pPlayerTo == nullptr) return; + if (pPlayerFrom == NULL || pPlayerTo == NULL) return; if (s_isHost) { ::Socket* pSocket = pPlayerFrom->GetSocket(); - if (pSocket != nullptr) + if (pSocket != NULL) pSocket->pushDataToQueue(data, dataSize, false); } else { ::Socket* pSocket = pPlayerTo->GetSocket(); - if (pSocket != nullptr) + if (pSocket != NULL) pSocket->pushDataToQueue(data, dataSize, true); } } @@ -470,7 +470,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) { while (s_active) { - SOCKET clientSocket = accept(s_listenSocket, nullptr, nullptr); + SOCKET clientSocket = accept(s_listenSocket, NULL, NULL); if (clientSocket == INVALID_SOCKET) { if (s_active) @@ -532,11 +532,11 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) conn.tcpSocket = clientSocket; conn.smallId = assignedSmallId; conn.active = true; - conn.recvThread = nullptr; + conn.recvThread = NULL; EnterCriticalSection(&s_connectionsLock); s_connections.push_back(conn); - int connIdx = static_cast(s_connections.size()) - 1; + int connIdx = (int)s_connections.size() - 1; LeaveCriticalSection(&s_connectionsLock); app.DebugPrintf("Win64 LAN: Client connected, assigned smallId=%d\n", assignedSmallId); @@ -555,10 +555,10 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) DWORD* threadParam = new DWORD; *threadParam = connIdx; - HANDLE hThread = CreateThread(nullptr, 0, RecvThreadProc, threadParam, 0, nullptr); + HANDLE hThread = CreateThread(NULL, 0, RecvThreadProc, threadParam, 0, NULL); EnterCriticalSection(&s_connectionsLock); - if (connIdx < static_cast(s_connections.size())) + if (connIdx < (int)s_connections.size()) s_connections[connIdx].recvThread = hThread; LeaveCriticalSection(&s_connectionsLock); } @@ -567,11 +567,11 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) { - DWORD connIdx = *static_cast(param); - delete static_cast(param); + DWORD connIdx = *(DWORD*)param; + delete (DWORD*)param; EnterCriticalSection(&s_connectionsLock); - if (connIdx >= static_cast(s_connections.size())) + if (connIdx >= (DWORD)s_connections.size()) { LeaveCriticalSection(&s_connectionsLock); return 0; @@ -593,10 +593,10 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) } int packetSize = - (static_cast(header[0]) << 24) | - (static_cast(header[1]) << 16) | - (static_cast(header[2]) << 8) | - static_cast(header[3]); + ((uint32_t)header[0] << 24) | + ((uint32_t)header[1] << 16) | + ((uint32_t)header[2] << 8) | + ((uint32_t)header[3]); if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE) { @@ -607,7 +607,7 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) break; } - if (static_cast(recvBuf.size()) < packetSize) + if ((int)recvBuf.size() < packetSize) { recvBuf.resize(packetSize); app.DebugPrintf("Win64 LAN: Resized host recv buffer to %d bytes for client smallId=%d\n", packetSize, clientSmallId); @@ -706,7 +706,7 @@ DWORD WINAPI WinsockNetLayer::ClientRecvThreadProc(LPVOID param) break; } - if (static_cast(recvBuf.size()) < packetSize) + if ((int)recvBuf.size() < packetSize) { recvBuf.resize(packetSize); app.DebugPrintf("Win64 LAN: Resized client recv buffer to %d bytes\n", packetSize); @@ -734,7 +734,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t* hostName, un memset(&s_advertiseData, 0, sizeof(s_advertiseData)); s_advertiseData.magic = WIN64_LAN_BROADCAST_MAGIC; s_advertiseData.netVersion = netVer; - s_advertiseData.gamePort = static_cast(gamePort); + s_advertiseData.gamePort = (WORD)gamePort; wcsncpy_s(s_advertiseData.hostName, 32, hostName, _TRUNCATE); s_advertiseData.playerCount = 1; s_advertiseData.maxPlayers = MINECRAFT_NET_MAX_PLAYERS; @@ -756,7 +756,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t* hostName, un setsockopt(s_advertiseSock, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); s_advertising = true; - s_advertiseThread = CreateThread(nullptr, 0, AdvertiseThreadProc, nullptr, 0, nullptr); + s_advertiseThread = CreateThread(NULL, 0, AdvertiseThreadProc, NULL, 0, NULL); app.DebugPrintf("Win64 LAN: Started advertising on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT); return true; @@ -772,11 +772,11 @@ void WinsockNetLayer::StopAdvertising() s_advertiseSock = INVALID_SOCKET; } - if (s_advertiseThread != nullptr) + if (s_advertiseThread != NULL) { WaitForSingleObject(s_advertiseThread, 2000); CloseHandle(s_advertiseThread); - s_advertiseThread = nullptr; + s_advertiseThread = NULL; } } @@ -862,7 +862,7 @@ bool WinsockNetLayer::StartDiscovery() setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout)); s_discovering = true; - s_discoveryThread = CreateThread(nullptr, 0, DiscoveryThreadProc, nullptr, 0, nullptr); + s_discoveryThread = CreateThread(NULL, 0, DiscoveryThreadProc, NULL, 0, NULL); app.DebugPrintf("Win64 LAN: Listening for LAN games on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT); return true; @@ -878,11 +878,11 @@ void WinsockNetLayer::StopDiscovery() s_discoverySock = INVALID_SOCKET; } - if (s_discoveryThread != nullptr) + if (s_discoveryThread != NULL) { WaitForSingleObject(s_discoveryThread, 2000); CloseHandle(s_discoveryThread); - s_discoveryThread = nullptr; + s_discoveryThread = NULL; } EnterCriticalSection(&s_discoveryLock); @@ -916,7 +916,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) continue; } - if (recvLen < static_cast(sizeof(Win64LANBroadcast))) + if (recvLen < (int)sizeof(Win64LANBroadcast)) continue; Win64LANBroadcast* broadcast = (Win64LANBroadcast*)recvBuf; @@ -934,7 +934,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) for (size_t i = 0; i < s_discoveredSessions.size(); i++) { if (strcmp(s_discoveredSessions[i].hostIP, senderIP) == 0 && - s_discoveredSessions[i].hostPort == static_cast(broadcast->gamePort)) + s_discoveredSessions[i].hostPort == (int)broadcast->gamePort) { s_discoveredSessions[i].netVersion = broadcast->netVersion; wcsncpy_s(s_discoveredSessions[i].hostName, 32, broadcast->hostName, _TRUNCATE); @@ -955,7 +955,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) Win64LANSession session; memset(&session, 0, sizeof(session)); strncpy_s(session.hostIP, sizeof(session.hostIP), senderIP, _TRUNCATE); - session.hostPort = static_cast(broadcast->gamePort); + session.hostPort = (int)broadcast->gamePort; session.netVersion = broadcast->netVersion; wcsncpy_s(session.hostName, 32, broadcast->hostName, _TRUNCATE); session.playerCount = broadcast->playerCount; diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h index 59dda29a..f30240d3 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h @@ -66,7 +66,7 @@ public: static bool Initialize(); static void Shutdown(); - static bool HostGame(int port, const char* bindIp = nullptr); + static bool HostGame(int port, const char* bindIp = NULL); static bool JoinGame(const char* ip, int port); static bool SendToSmallId(BYTE targetSmallId, const void* data, int dataSize); diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index 369e2909..497808e1 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -52,8 +52,8 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) } else { - // No capture happened (e.g. first save on world creation) leave thumbnail as nullptr - if (pbData) *pbData = nullptr; + // No capture happened (e.g. first save on world creation) leave thumbnail as NULL + if (pbData) *pbData = NULL; if (pdwSize) *pdwSize = 0; } } @@ -69,7 +69,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(nullptr); + app.setLevelGenerationOptions(NULL); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -99,7 +99,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = nullptr; + param->saveData = NULL; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -125,7 +125,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); + loadingParams->lpParam = (LPVOID)param; // Reset the autosave time app.SetAutosaveTimerTime(); diff --git a/Minecraft.Client/Windows64/Windows64_App.h b/Minecraft.Client/Windows64/Windows64_App.h index 639cec73..bff916ec 100644 --- a/Minecraft.Client/Windows64/Windows64_App.h +++ b/Minecraft.Client/Windows64/Windows64_App.h @@ -25,9 +25,9 @@ public: virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG); // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false) {} + virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} - C4JStringTable *GetStringTable() { return nullptr;} + C4JStringTable *GetStringTable() { return NULL;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 69c1a12b..35afc694 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -47,7 +47,6 @@ #include "..\GameRenderer.h" #include "Network\WinsockNetLayer.h" #include "Windows64_Xuid.h" -#include "Common/UI/UI.h" #include "Xbox/resource.h" @@ -83,6 +82,7 @@ DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]= 0,0,0,0,0 #endif }; + //------------------------------------------------------------------------------------- // Time Since fAppTime is a float, we need to keep the quadword app time // as a LARGE_INTEGER so that we don't lose precision after running @@ -124,17 +124,17 @@ static void CopyWideArgToAnsi(LPCWSTR source, char* dest, size_t destSize) return; dest[0] = 0; - if (source == nullptr) + if (source == NULL) return; - WideCharToMultiByte(CP_ACP, 0, source, -1, dest, static_cast(destSize), nullptr, nullptr); + WideCharToMultiByte(CP_ACP, 0, source, -1, dest, (int)destSize, NULL, NULL); dest[destSize - 1] = 0; } // ---------- Persistent options (options.txt next to exe) ---------- static void GetOptionsFilePath(char *out, size_t outSize) { - GetModuleFileNameA(nullptr, out, static_cast(outSize)); + GetModuleFileNameA(NULL, out, (DWORD)outSize); char *p = strrchr(out, '\\'); if (p) *(p + 1) = '\0'; strncat_s(out, outSize, "options.txt", _TRUNCATE); @@ -210,7 +210,7 @@ static Win64LaunchOptions ParseLaunchOptions() int argc = 0; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); - if (argv == nullptr) + if (argv == NULL) return options; if (argc > 1 && lstrlenW(argv[1]) == 1) @@ -252,14 +252,14 @@ static Win64LaunchOptions ParseLaunchOptions() } else if (_wcsicmp(argv[i], L"-port") == 0 && (i + 1) < argc) { - wchar_t* endPtr = nullptr; - const long port = wcstol(argv[++i], &endPtr, 10); + wchar_t* endPtr = NULL; + long port = wcstol(argv[++i], &endPtr, 10); if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535) { if (options.serverMode) - g_Win64DedicatedServerPort = static_cast(port); + g_Win64DedicatedServerPort = (int)port; else - g_Win64MultiplayerPort = static_cast(port); + g_Win64MultiplayerPort = (int)port; } } else if (_wcsicmp(argv[i], L"-fullscreen") == 0) @@ -290,7 +290,7 @@ static void SetupHeadlessServerConsole() { if (AllocConsole()) { - FILE* stream = nullptr; + FILE* stream = NULL; freopen_s(&stream, "CONIN$", "r", stdin); freopen_s(&stream, "CONOUT$", "w", stdout); freopen_s(&stream, "CONOUT$", "w", stderr); @@ -491,7 +491,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - nullptr, + NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -509,16 +509,16 @@ void MemSect(int sect) } #endif -HINSTANCE g_hInst = nullptr; -HWND g_hWnd = nullptr; +HINSTANCE g_hInst = NULL; +HWND g_hWnd = NULL; D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = nullptr; -ID3D11DeviceContext* g_pImmediateContext = nullptr; -IDXGISwapChain* g_pSwapChain = nullptr; -ID3D11RenderTargetView* g_pRenderTargetView = nullptr; -ID3D11DepthStencilView* g_pDepthStencilView = nullptr; -ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; +ID3D11Device* g_pd3dDevice = NULL; +ID3D11DeviceContext* g_pImmediateContext = NULL; +IDXGISwapChain* g_pSwapChain = NULL; +ID3D11RenderTargetView* g_pRenderTargetView = NULL; +ID3D11DepthStencilView* g_pDepthStencilView = NULL; +ID3D11Texture2D* g_pDepthStencilBuffer = NULL; // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) @@ -586,7 +586,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if ((lParam & 0x40000000) && vk != VK_LEFT && vk != VK_RIGHT && vk != VK_BACK) break; #ifdef _WINDOWS64 - const Minecraft* pm = Minecraft::GetInstance(); + Minecraft* pm = Minecraft::GetInstance(); ChatScreen* chat = pm && pm->screen ? dynamic_cast(pm->screen) : nullptr; if (chat) { @@ -653,13 +653,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_INPUT: { UINT dwSize = 0; - GetRawInputData((HRAWINPUT)lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER)); + GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)); if (dwSize > 0 && dwSize <= 256) { BYTE rawBuffer[256]; if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) == dwSize) { - const RAWINPUT* raw = (RAWINPUT*)rawBuffer; + RAWINPUT* raw = (RAWINPUT*)rawBuffer; if (raw->header.dwType == RIM_TYPEMOUSE) { g_KBMInput.OnRawMouseDelta(raw->data.mouse.lLastX, raw->data.mouse.lLastY); @@ -696,7 +696,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = "Minecraft"; wcex.lpszClassName = "MinecraftClass"; @@ -729,10 +729,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) 0, wr.right - wr.left, // width of the window wr.bottom - wr.top, // height of the window - nullptr, - nullptr, + NULL, + NULL, hInstance, - nullptr); + NULL); if (!g_hWnd) { @@ -847,7 +847,7 @@ HRESULT InitDevice() for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, + hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); if( HRESULT_SUCCEEDED( hr ) ) break; @@ -856,7 +856,7 @@ HRESULT InitDevice() return hr; // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; + ID3D11Texture2D* pBackBuffer = NULL; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) return hr; @@ -876,7 +876,7 @@ HRESULT InitDevice() descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; ZeroMemory(&descDSView, sizeof(descDSView)); @@ -886,7 +886,7 @@ HRESULT InitDevice() hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView ); + hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) return hr; @@ -895,8 +895,8 @@ HRESULT InitDevice() // Setup the viewport D3D11_VIEWPORT vp; - vp.Width = static_cast(width); - vp.Height = static_cast(height); + vp.Width = (FLOAT)width; + vp.Height = (FLOAT)height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; @@ -916,7 +916,7 @@ HRESULT InitDevice() void Render() { // Just clear the backbuffer - const float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha + float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, ClearColor ); g_pSwapChain->Present( 0, 0 ); @@ -927,7 +927,7 @@ void Render() //-------------------------------------------------------------------------------------- void ToggleFullscreen() { - const DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE); + DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE); if (!g_isFullscreen) { MONITORINFO mi = { sizeof(mi) }; @@ -946,7 +946,7 @@ void ToggleFullscreen() { SetWindowLong(g_hWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); SetWindowPlacement(g_hWnd, &g_wpPrev); - SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, + SetWindowPos(g_hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); } g_isFullscreen = !g_isFullscreen; @@ -999,7 +999,7 @@ static Minecraft* InitialiseMinecraftRuntime() for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - IQNet::m_player[i].m_smallId = static_cast(i); + IQNet::m_player[i].m_smallId = (BYTE)i; IQNet::m_player[i].m_isRemote = false; IQNet::m_player[i].m_isHostPlayer = (i == 0); swprintf_s(IQNet::m_player[i].m_gamertag, 32, L"Player%d", i); @@ -1021,8 +1021,8 @@ static Minecraft* InitialiseMinecraftRuntime() Minecraft::main(); Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft == nullptr) - return nullptr; + if (pMinecraft == NULL) + return NULL; app.InitGameSettings(); app.InitialiseTips(); @@ -1054,7 +1054,7 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter) continue; MinecraftServer* server = MinecraftServer::getInstance(); - if (server != nullptr) + if (server != NULL) { server->handleConsoleInput(command, server); } @@ -1068,7 +1068,7 @@ static int RunHeadlessServer() SetupHeadlessServerConsole(); Settings serverSettings(new File(L"server.properties")); - const wstring configuredBindIp = serverSettings.getString(L"server-ip", L""); + wstring configuredBindIp = serverSettings.getString(L"server-ip", L""); const char* bindIp = "*"; if (g_Win64DedicatedServerBindIP[0] != 0) @@ -1085,8 +1085,8 @@ static int RunHeadlessServer() printf("Starting headless server on %s:%d\n", bindIp, port); fflush(stdout); - const Minecraft* pMinecraft = InitialiseMinecraftRuntime(); - if (pMinecraft == nullptr) + Minecraft* pMinecraft = InitialiseMinecraftRuntime(); + if (pMinecraft == NULL) { fprintf(stderr, "Failed to initialise the Minecraft runtime.\n"); return 1; @@ -1152,13 +1152,13 @@ static int RunHeadlessServer() printf("Type 'help' for server commands.\n"); fflush(stdout); - C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, nullptr, "Server console", 128 * 1024); + C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, NULL, "Server console", 128 * 1024); consoleThread->Run(); MSG msg = { 0 }; while (WM_QUIT != msg.message && !app.m_bShutdown && !MinecraftServer::serverHalted()) { - if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -1196,7 +1196,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // 4J-Win64: set CWD to exe dir so asset paths resolve correctly { char szExeDir[MAX_PATH] = {}; - GetModuleFileNameA(nullptr, szExeDir, MAX_PATH); + GetModuleFileNameA(NULL, szExeDir, MAX_PATH); char *pSlash = strrchr(szExeDir, '\\'); if (pSlash) { *(pSlash + 1) = '\0'; SetCurrentDirectoryA(szExeDir); } } @@ -1208,7 +1208,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Load username from username.txt char exePath[MAX_PATH] = {}; - GetModuleFileNameA(nullptr, exePath, MAX_PATH); + GetModuleFileNameA(NULL, exePath, MAX_PATH); char *lastSlash = strrchr(exePath, '\\'); if (lastSlash) { @@ -1224,7 +1224,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, char buf[128] = {}; if (fgets(buf, sizeof(buf), f)) { - int len = static_cast(strlen(buf)); + int len = (int)strlen(buf); while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r' || buf[len - 1] == ' ')) { buf[--len] = '\0'; @@ -1239,7 +1239,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } // Load stuff from launch options, including username - const Win64LaunchOptions launchOptions = ParseLaunchOptions(); + Win64LaunchOptions launchOptions = ParseLaunchOptions(); ApplyScreenMode(launchOptions.screenMode); // Ensure uid.dat exists from startup in client mode (before any multiplayer/login path). @@ -1282,7 +1282,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, if (launchOptions.serverMode) { - const int serverResult = RunHeadlessServer(); + int serverResult = RunHeadlessServer(); CleanupDevice(); return serverResult; } @@ -1292,7 +1292,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -1340,7 +1340,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #endif Minecraft *pMinecraft = InitialiseMinecraftRuntime(); - if (pMinecraft == nullptr) + if (pMinecraft == NULL) { CleanupDevice(); return 1; @@ -1376,7 +1376,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, { g_KBMInput.Tick(); - while( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) + while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -1409,7 +1409,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Detect KBM vs controller input mode if (InputManager.IsPadConnected(0)) { - const bool controllerUsed = InputManager.ButtonPressed(0) || + bool controllerUsed = InputManager.ButtonPressed(0) || InputManager.GetJoypadStick_LX(0, false) != 0.0f || InputManager.GetJoypadStick_LY(0, false) != 0.0f || InputManager.GetJoypadStick_RX(0, false) != 0.0f || @@ -1471,7 +1471,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1568,7 +1568,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Update mouse grab: grab when in-game and no menu is open { static bool altToggleSuppressCapture = false; - const bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == nullptr; + bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL; // Left Alt key toggles capture on/off for debugging if (g_KBMInput.IsKeyPressed(VK_LMENU) || g_KBMInput.IsKeyPressed(VK_RMENU)) { @@ -1589,8 +1589,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // F1 toggles the HUD if (g_KBMInput.IsKeyPressed(VK_F1)) { - const int primaryPad = ProfileManager.GetPrimaryPad(); - const unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD); + int primaryPad = ProfileManager.GetPrimaryPad(); + unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD); app.SetGameSettings(primaryPad, eGameSetting_DisplayHUD, displayHud ? 0 : 1); app.SetGameSettings(primaryPad, eGameSetting_DisplayHand, displayHud ? 0 : 1); } @@ -1598,7 +1598,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // F3 toggles onscreen debug info if (g_KBMInput.IsKeyPressed(VK_F3)) { - if (const Minecraft* pMinecraft = Minecraft::GetInstance()) + if (Minecraft* pMinecraft = Minecraft::GetInstance()) { if (pMinecraft->options) { diff --git a/Minecraft.Client/Windows64/Windows64_UIController.cpp b/Minecraft.Client/Windows64/Windows64_UIController.cpp index e251793b..10ae20af 100644 --- a/Minecraft.Client/Windows64/Windows64_UIController.cpp +++ b/Minecraft.Client/Windows64/Windows64_UIController.cpp @@ -82,7 +82,7 @@ void ConsoleUIController::render() example, no resolve targets are required. */ gdraw_D3D11_SetTileOrigin( m_pRenderTargetView, m_pDepthStencilView, - nullptr, + NULL, 0, 0 ); @@ -147,7 +147,7 @@ void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { gdraw_D3D11_SetTileOrigin( m_pRenderTargetView, m_pDepthStencilView, - nullptr, + NULL, xPos, yPos ); } @@ -163,7 +163,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId) ID3D11ShaderResourceView *tex = RenderManager.TextureGetTexture(textureId); ID3D11Resource *resource; tex->GetResource(&resource); - ID3D11Texture2D *tex2d = static_cast(resource); + ID3D11Texture2D *tex2d = (ID3D11Texture2D *)resource; D3D11_TEXTURE2D_DESC desc; tex2d->GetDesc(&desc); GDrawTexture *gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); diff --git a/Minecraft.Client/Windows64/Windows64_UIController.h b/Minecraft.Client/Windows64/Windows64_UIController.h index 066d279f..2b2ccdba 100644 --- a/Minecraft.Client/Windows64/Windows64_UIController.h +++ b/Minecraft.Client/Windows64/Windows64_UIController.h @@ -26,3 +26,5 @@ public: public: void shutdown(); }; + +extern ConsoleUIController ui; \ No newline at end of file diff --git a/Minecraft.Client/Windows64/XML/ATGXmlParser.h b/Minecraft.Client/Windows64/XML/ATGXmlParser.h index 12f59737..75142e3e 100644 --- a/Minecraft.Client/Windows64/XML/ATGXmlParser.h +++ b/Minecraft.Client/Windows64/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/WitchRenderer.cpp b/Minecraft.Client/WitchRenderer.cpp index ec2b8a76..5e0f2b10 100644 --- a/Minecraft.Client/WitchRenderer.cpp +++ b/Minecraft.Client/WitchRenderer.cpp @@ -18,7 +18,7 @@ void WitchRenderer::render(shared_ptr entity, double x, double y, double shared_ptr item = mob->getCarriedItem(); - witchModel->holdingItem = item != nullptr; + witchModel->holdingItem = item != NULL; MobRenderer::render(mob, x, y, z, rot, a); } @@ -38,7 +38,7 @@ void WitchRenderer::additionalRendering(shared_ptr entity, float a shared_ptr item = mob->getCarriedItem(); - if (item != nullptr) + if (item != NULL) { glPushMatrix(); diff --git a/Minecraft.Client/WitherBossRenderer.cpp b/Minecraft.Client/WitherBossRenderer.cpp index e358c6da..254a00bc 100644 --- a/Minecraft.Client/WitherBossRenderer.cpp +++ b/Minecraft.Client/WitherBossRenderer.cpp @@ -48,7 +48,7 @@ void WitherBossRenderer::scale(shared_ptr _mob, float a) int inTicks = mob->getInvulnerableTicks(); if (inTicks > 0) { - float scale = 2.0f - ((static_cast(inTicks) - a) / (SharedConstants::TICKS_PER_SECOND * 11)) * .5f; + float scale = 2.0f - (((float) inTicks - a) / (SharedConstants::TICKS_PER_SECOND * 11)) * .5f; glScalef(scale, scale, scale); } else diff --git a/Minecraft.Client/WitherSkullRenderer.cpp b/Minecraft.Client/WitherSkullRenderer.cpp index 5f08b5b6..87873574 100644 --- a/Minecraft.Client/WitherSkullRenderer.cpp +++ b/Minecraft.Client/WitherSkullRenderer.cpp @@ -19,7 +19,7 @@ void WitherSkullRenderer::render(shared_ptr entity, double x, double y, float headRot = rotlerp(entity->yRotO, entity->yRot, a); float headRotx = entity->xRotO + (entity->xRot - entity->xRotO) * a; - glTranslatef(static_cast(x), static_cast(y), static_cast(z)); + glTranslatef((float) x, (float) y, (float) z); float scale = 1 / 16.0f; glEnable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h index 6d504b63..120e9c7b 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h @@ -98,8 +98,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); - EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,CXuiStringTable *pStringTable=nullptr); - EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,CXuiStringTable *pStringTable=nullptr); + EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,CXuiStringTable *pStringTable=NULL); + EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,CXuiStringTable *pStringTable=NULL); // Online check strings against offensive list - TCR 92 // TCR # 092 CMTV Player Text String Verification diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h index 524d9417..28e717e8 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h @@ -96,7 +96,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h index 613486f0..5f113d5d 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h @@ -116,7 +116,7 @@ public: void Initialise(IDirect3DDevice9 *pDevice); void InitialiseContext(); void Present(); - void Clear(int flags, D3DRECT *pRect = nullptr); + void Clear(int flags, D3DRECT *pRect = NULL); void SetClearColour(D3DCOLOR colour); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h index 7ae05193..2ba90566 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h @@ -217,7 +217,7 @@ public: // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, CXuiStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, CXuiStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); void CancelMessageBoxRequest(); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -239,7 +239,7 @@ public: unsigned int GetSaveSize(); void GetSaveData(void *pvData,unsigned int *puiBytes); PVOID AllocateSaveData(unsigned int uiBytes); - void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=nullptr,DWORD cbThumbnail=0,PBYTE pbTextData=nullptr, DWORD dwTextLen=0); + void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=NULL,DWORD cbThumbnail=0,PBYTE pbTextData=NULL, DWORD dwTextLen=0); void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); bool GetSaveDeviceSelected(unsigned int iPad); @@ -271,27 +271,27 @@ public: C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=nullptr); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive=nullptr); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive=NULL); // Global title storage C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=nullptr,LPVOID lpParam=nullptr, int iAction=0); + WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0); bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); - void StoreTMSPathName(WCHAR *pwchName=nullptr); + void StoreTMSPathName(WCHAR *pwchName=NULL); // TMS++ - C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=nullptr, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); unsigned int CRC(unsigned char *buf, int len); - C4JStorage::ETMSStatus TMSPP_WriteFileWithProgress(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0, - int( *CompletionFunc)(LPVOID,float fComplete)=nullptr,LPVOID lpCompletionParam=nullptr); + C4JStorage::ETMSStatus TMSPP_WriteFileWithProgress(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0, + int( *CompletionFunc)(LPVOID,float fComplete)=NULL,LPVOID lpCompletionParam=NULL); void TMSPP_CancelWriteFileWithProgress(int iPad); HRESULT TMSPP_SetTitleGroupID(LPCSTR szGroupID); diff --git a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp index 9ba0e4dd..b088150c 100644 --- a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp @@ -12,16 +12,16 @@ #include "..\..\DLCTexturePack.h" -IXAudio2* g_pXAudio2 = nullptr; // pointer to XAudio2 instance used by QNet and XACT -IXAudio2MasteringVoice* g_pXAudio2MasteringVoice = nullptr; // pointer to XAudio2 mastering voice +IXAudio2* g_pXAudio2 = NULL; // pointer to XAudio2 instance used by QNet and XACT +IXAudio2MasteringVoice* g_pXAudio2MasteringVoice = NULL; // pointer to XAudio2 mastering voice -IXACT3Engine *SoundEngine::m_pXACT3Engine = nullptr; -IXACT3WaveBank *SoundEngine::m_pWaveBank = nullptr; -IXACT3WaveBank *SoundEngine::m_pWaveBank2 = nullptr; -IXACT3WaveBank *SoundEngine::m_pStreamedWaveBank = nullptr; -IXACT3WaveBank *SoundEngine::m_pStreamedWaveBankAdditional = nullptr; -IXACT3SoundBank *SoundEngine::m_pSoundBank = nullptr; -IXACT3SoundBank *SoundEngine::m_pSoundBank2 = nullptr; +IXACT3Engine *SoundEngine::m_pXACT3Engine = NULL; +IXACT3WaveBank *SoundEngine::m_pWaveBank = NULL; +IXACT3WaveBank *SoundEngine::m_pWaveBank2 = NULL; +IXACT3WaveBank *SoundEngine::m_pStreamedWaveBank = NULL; +IXACT3WaveBank *SoundEngine::m_pStreamedWaveBankAdditional = NULL; +IXACT3SoundBank *SoundEngine::m_pSoundBank = NULL; +IXACT3SoundBank *SoundEngine::m_pSoundBank2 = NULL; CRITICAL_SECTION SoundEngine::m_CS; X3DAUDIO_HANDLE SoundEngine::m_xact3dInstance; @@ -97,9 +97,9 @@ void SoundEngine::init(Options *pOptions) // 4J-PB - move this to the title update, since we've corrected it to allow sounds to be pitch varied when they weren't before HANDLE file; #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\Minecraft.xgs", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("UPDATE:\\res\\audio\\Minecraft.xgs", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\Minecraft.xgs", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\Minecraft.xgs", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -107,11 +107,11 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - DWORD dwFileSize = GetFileSize(file,nullptr); + DWORD dwFileSize = GetFileSize(file,NULL); DWORD bytesRead = 0; DWORD memFlags = MAKE_XALLOC_ATTRIBUTES(0,FALSE,TRUE,FALSE,0,XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,XALLOC_MEMPROTECT_READWRITE,FALSE,XALLOC_MEMTYPE_PHYSICAL); void *pvGlobalSettings = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvGlobalSettings,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvGlobalSettings,dwFileSize,&bytesRead,NULL); CloseHandle(file); XACT_RUNTIME_PARAMETERS EngineParameters = {0}; @@ -161,7 +161,7 @@ void SoundEngine::init(Options *pOptions) // Create resident wave bank - leave memory for this managed by xact so it can free it - file = CreateFile("GAME:\\res\\audio\\resident.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\audio\\resident.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { app.FatalLoadError(); @@ -169,9 +169,9 @@ void SoundEngine::init(Options *pOptions) return; } - dwFileSize = GetFileSize(file,nullptr); + dwFileSize = GetFileSize(file,NULL); void *pvWaveBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvWaveBank,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvWaveBank,dwFileSize,&bytesRead,NULL); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateInMemoryWaveBank( pvWaveBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pWaveBank ) ) ) @@ -183,9 +183,9 @@ void SoundEngine::init(Options *pOptions) // 4J-PB - add new sounds wavebank #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\additional.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("UPDATE:\\res\\audio\\additional.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -194,9 +194,9 @@ void SoundEngine::init(Options *pOptions) return; } - dwFileSize = GetFileSize(file,nullptr); + dwFileSize = GetFileSize(file,NULL); void *pvWaveBank2 = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvWaveBank2,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvWaveBank2,dwFileSize,&bytesRead,NULL); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateInMemoryWaveBank( pvWaveBank2, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pWaveBank2 ) ) ) @@ -208,7 +208,7 @@ void SoundEngine::init(Options *pOptions) // Create streamed sound bank - file = CreateFile("GAME:\\res\\audio\\streamed.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); + file = CreateFile("GAME:\\res\\audio\\streamed.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); if( file == INVALID_HANDLE_VALUE ) { @@ -232,11 +232,11 @@ void SoundEngine::init(Options *pOptions) // Create streamed sound bank - //file = CreateFile("GAME:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); + //file = CreateFile("GAME:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("UPDATE:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -259,11 +259,11 @@ void SoundEngine::init(Options *pOptions) // Create sound bank - leave memory for this managed by xact so it can free it // 4J-PB - updated for the TU - //file = CreateFile("GAME:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + //file = CreateFile("GAME:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("UPDATE:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -271,9 +271,9 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - dwFileSize = GetFileSize(file,nullptr); + dwFileSize = GetFileSize(file,NULL); void *pvSoundBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,NULL); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pSoundBank ) ) ) @@ -286,9 +286,9 @@ void SoundEngine::init(Options *pOptions) // Create sound bank2 - leave memory for this managed by xact so it can free it #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\additional.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("UPDATE:\\res\\audio\\additional.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -296,9 +296,9 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - dwFileSize = GetFileSize(file,nullptr); + dwFileSize = GetFileSize(file,NULL); void *pvSoundBank2 = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank2,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvSoundBank2,dwFileSize,&bytesRead,NULL); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank2, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pSoundBank2 ) ) ) @@ -324,7 +324,7 @@ void SoundEngine::CreateStreamingWavebank(const char *pchName, IXACT3WaveBank ** // Create streamed sound bank HRESULT hr; - HANDLE file = CreateFile(pchName, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); + HANDLE file = CreateFile(pchName, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); if( file == INVALID_HANDLE_VALUE ) { @@ -350,7 +350,7 @@ void SoundEngine::CreateStreamingWavebank(const char *pchName, IXACT3WaveBank ** void SoundEngine::CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSoundBank) { HRESULT hr; - HANDLE file = CreateFile(pchName, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(pchName, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { @@ -358,11 +358,11 @@ void SoundEngine::CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSound assert(false); return; } - DWORD dwFileSize = GetFileSize(file,nullptr); + DWORD dwFileSize = GetFileSize(file,NULL); DWORD bytesRead = 0; DWORD memFlags = MAKE_XALLOC_ATTRIBUTES(0,FALSE,TRUE,FALSE,0,XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,XALLOC_MEMPROTECT_READWRITE,FALSE,XALLOC_MEMTYPE_PHYSICAL); void *pvSoundBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,nullptr); + ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,NULL); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, ppSoundBank ) ) ) @@ -416,11 +416,11 @@ bool SoundEngine::isStreamingWavebankReady(IXACT3WaveBank *pWaveBank) void SoundEngine::XACTNotificationCallback( const XACT_NOTIFICATION* pNotification ) { - if(pNotification->pvContext!= nullptr) + if(pNotification->pvContext!= NULL) { if(pNotification->type==XACTNOTIFICATIONTYPE_WAVEBANKPREPARED) { - SoundEngine *pSoundEngine=static_cast(pNotification->pvContext); + SoundEngine *pSoundEngine=(SoundEngine *)pNotification->pvContext; if(pNotification->waveBank.pWaveBank==pSoundEngine->m_pStreamedWaveBank) { pSoundEngine->m_bStreamingWaveBank1Ready=true; @@ -446,7 +446,7 @@ char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpac { wchar_t c = name[i]; if(c=='.') c='_'; - buf[i] = static_cast(c); + buf[i] = (char)c; } buf[name.length()] = 0; return buf; @@ -462,7 +462,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa bool bSoundbank1=(iSound<=eSoundType_STEP_SAND); - if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr))return; + if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL))return; if( currentSounds.size() > MAX_POLYPHONY ) { @@ -541,7 +541,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa soundInfo *info = new soundInfo(); info->idx = idx; - info->eSoundID = static_cast(iSound); + info->eSoundID = (eSOUND_TYPE)iSound; info->iSoundBank = bSoundbank1?0:1; info->x = x; info->y = y; @@ -570,7 +570,7 @@ void SoundEngine::playUI(int iSound, float, float) { bool bSoundBank1=(iSound<=eSoundType_STEP_SAND); - if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr)) return; + if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL)) return; if( currentSounds.size() > MAX_POLYPHONY ) { @@ -578,7 +578,7 @@ void SoundEngine::playUI(int iSound, float, float) } wstring name = wchSoundNames[iSound]; - char *xboxName = static_cast(ConvertSoundPathToName(name)); + char *xboxName = (char *)ConvertSoundPathToName(name); XACTINDEX idx = m_pSoundBank->GetCueIndex(xboxName); @@ -618,7 +618,7 @@ void SoundEngine::playUI(int iSound, float, float) // Add sound info just so we can detect end of this sound soundInfo *info = new soundInfo(); - info->eSoundID = static_cast(0); + info->eSoundID = (eSOUND_TYPE)0; info->iSoundBank = bSoundBank1?0:1; info->idx =idx; info->x = 0.0f; @@ -637,15 +637,15 @@ void SoundEngine::playUI(int iSound, float, float) void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) { - IXACT3SoundBank *pSoundBank=nullptr; + IXACT3SoundBank *pSoundBank=NULL; bool bSoundBank2=false; MemSect(34); - if(m_MusicInfo.pCue!=nullptr) + if(m_MusicInfo.pCue!=NULL) { m_MusicInfo.pCue->Stop(0); m_MusicInfo.pCue->Destroy(); - m_MusicInfo.pCue = nullptr; + m_MusicInfo.pCue = NULL; } m_MusicInfo.volume = 1.0f;//m_fMusicVolume; @@ -673,7 +673,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, for(unsigned int i=0;ilocalplayers[i]!=nullptr) + if(pMinecraft->localplayers[i]!=NULL) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -701,7 +701,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, else { // get the dlc texture pack - DLCTexturePack *pDLCTexPack=static_cast(pTexPack); + DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; pSoundBank=pDLCTexPack->m_pSoundBank; // check we can play the sound @@ -743,7 +743,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, { // printf("Sound prep failed\n"); m_musicIDX = XACTINDEX_INVALID; // don't do anything in the tick - m_MusicInfo.pCue=nullptr; + m_MusicInfo.pCue=NULL; MemSect(0); return; } @@ -774,7 +774,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, } void SoundEngine::playMusicTick() { - if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr)) return; + if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL)) return; if( m_musicIDX == XACTINDEX_INVALID ) { @@ -785,7 +785,7 @@ void SoundEngine::playMusicTick() // check to see if the sound has stopped playing DWORD state; HRESULT hr; - if(m_MusicInfo.pCue!=nullptr) + if(m_MusicInfo.pCue!=NULL) { if( FAILED( hr = m_MusicInfo.pCue->GetState(&state) ) ) { @@ -804,14 +804,14 @@ void SoundEngine::playMusicTick() if(GetIsPlayingStreamingGameMusic()) { - if(m_MusicInfo.pCue!=nullptr) + if(m_MusicInfo.pCue!=NULL) { bool playerInEnd = false; bool playerInNether=false; Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(pMinecraft->localplayers[i]!=nullptr) + if(pMinecraft->localplayers[i]!=NULL) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -852,7 +852,7 @@ void SoundEngine::playMusicTick() return; } - if(m_MusicInfo.pCue!=nullptr) + if(m_MusicInfo.pCue!=NULL) { update3DPosition(&m_MusicInfo, true); SetIsPlayingStreamingGameMusic(true); @@ -986,7 +986,7 @@ void SoundEngine::update3DPosition(SoundEngine::soundInfo *pInfo, bool bPlaceEmi void SoundEngine::tick(shared_ptr *players, float a) { - if( m_pXACT3Engine == nullptr ) return; + if( m_pXACT3Engine == NULL ) return; // Creater listener array from the local players int listenerCount = 0; @@ -995,13 +995,13 @@ void SoundEngine::tick(shared_ptr *players, float a) { for( int i = 0; i < 4; i++ ) { - if( players[i] != nullptr ) + if( players[i] != NULL ) { float yRot = players[i]->yRotO + (players[i]->yRot - players[i]->yRotO) * a; - m_listeners[listenerCount].Position.x = static_cast(players[i]->xo + (players[i]->x - players[i]->xo) * a); - m_listeners[listenerCount].Position.y = static_cast(players[i]->yo + (players[i]->y - players[i]->yo) * a); - m_listeners[listenerCount].Position.z = -static_cast(players[i]->zo + (players[i]->z - players[i]->zo) * a); // Flipped sign of z as x3daudio is expecting left handed coord system + m_listeners[listenerCount].Position.x = (float) (players[i]->xo + (players[i]->x - players[i]->xo) * a); + m_listeners[listenerCount].Position.y = (float) (players[i]->yo + (players[i]->y - players[i]->yo) * a); + m_listeners[listenerCount].Position.z = -(float) (players[i]->zo + (players[i]->z - players[i]->zo) * a); // Flipped sign of z as x3daudio is expecting left handed coord system float yCos = (float)cos(-yRot * Mth::RAD_TO_GRAD - PI); float ySin = (float)sin(-yRot * Mth::RAD_TO_GRAD - PI); diff --git a/Minecraft.Client/Xbox/Audio/SoundEngine.h b/Minecraft.Client/Xbox/Audio/SoundEngine.h index 77998d20..e2f22869 100644 --- a/Minecraft.Client/Xbox/Audio/SoundEngine.h +++ b/Minecraft.Client/Xbox/Audio/SoundEngine.h @@ -77,32 +77,31 @@ class SoundEngine : public ConsoleSoundEngine #endif public: SoundEngine(); - void destroy() override; - void play(int iSound, float x, float y, float z, float volume, float pitch) override; - void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override; - void playUI(int iSound, float volume, float pitch) override; - void playMusicTick() override; - void updateMusicVolume(float fVal) override; - void updateSystemMusicPlaying(bool isPlaying) override; - void updateSoundEffectVolume(float fVal) override; - void init(Options *) override; - void tick(shared_ptr *players, float a) override; // 4J - updated to take array of local players rather than single one - void add(const wstring& name, File *file) override; - void addMusic(const wstring& name, File *file) override; - void addStreaming(const wstring& name, File *file) override; + virtual void destroy(); + virtual void play(int iSound, float x, float y, float z, float volume, float pitch); + virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true); + virtual void playUI(int iSound, float volume, float pitch); + virtual void playMusicTick(); + virtual void updateMusicVolume(float fVal); + virtual void updateSystemMusicPlaying(bool isPlaying); + virtual void updateSoundEffectVolume(float fVal); + virtual void init(Options *); + virtual void tick(shared_ptr *players, float a); // 4J - updated to take array of local players rather than single one + virtual void add(const wstring& name, File *file); + virtual void addMusic(const wstring& name, File *file); + virtual void addStreaming(const wstring& name, File *file); #ifndef __PS3__ static void setXACTEngine( IXACT3Engine *pXACT3Engine); void CreateStreamingWavebank(const char *pchName, IXACT3WaveBank **ppStreamedWaveBank); void CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSoundBank); #endif // __PS3__ - char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false) override; + virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false); bool isStreamingWavebankReady(); // 4J Added #ifdef _XBOX bool isStreamingWavebankReady(IXACT3WaveBank *pWaveBank); #endif - int initAudioHardware(int iMinSpeakers) override - { return iMinSpeakers;} + int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;} private: #ifndef __PS3__ diff --git a/Minecraft.Client/Xbox/Font/XUI_Font.cpp b/Minecraft.Client/Xbox/Font/XUI_Font.cpp index 2262f345..8b1a624b 100644 --- a/Minecraft.Client/Xbox/Font/XUI_Font.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_Font.cpp @@ -53,8 +53,8 @@ XUI_Font::~XUI_Font() VOID XUI_Font::GetTextExtent( const WCHAR* strText, FLOAT* pWidth, FLOAT* pHeight, BOOL bFirstLineOnly ) const { - assert( pWidth != nullptr ); - assert( pHeight != nullptr ); + assert( pWidth != NULL ); + assert( pHeight != NULL ); // Set default text extent in output parameters int iWidth = 0; @@ -146,8 +146,8 @@ VOID XUI_Font::Begin() //m_pFontTexture->GetLevelDesc( 0, &TextureDesc ); // Get the description // Set render state - assert(m_fontData->m_pFontTexture != nullptr || m_fontData->m_iFontTexture > 0); - if(m_fontData->m_pFontTexture != nullptr) + assert(m_fontData->m_pFontTexture != NULL || m_fontData->m_iFontTexture > 0); + if(m_fontData->m_pFontTexture != NULL) { pD3dDevice->SetTexture( 0, m_fontData->m_pFontTexture ); } @@ -236,7 +236,7 @@ VOID XUI_Font::DrawShadowText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, DW VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, const WCHAR* strText, DWORD dwFlags, FLOAT fMaxPixelWidth, bool darken /*= false*/ ) { - if( nullptr == strText ) return; + if( NULL == strText ) return; if( L'\0' == strText[0] ) return; // 4J-PB - if we're in 480 widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple @@ -244,21 +244,21 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, { if(RenderManager.IsWidescreen()) { - int iScaleX=static_cast(m_fXScaleFactor); + int iScaleX=(int)m_fXScaleFactor; int iOriginX; if(iScaleX%2==0) { - iOriginX=static_cast(fOriginX); + iOriginX=(int)fOriginX; if(iOriginX%2==1) { fOriginX+=1.0f; } } - int iScaleY=static_cast(m_fYScaleFactor); + int iScaleY=(int)m_fYScaleFactor; int iOriginY; if(iScaleY%2==0) { - iOriginY=static_cast(fOriginY); + iOriginY=(int)fOriginY; if(iOriginY%2==1) { fOriginY+=1.0f; @@ -268,7 +268,7 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, else { // 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it - int iOriginY=static_cast(fOriginY); + int iOriginY=(int)fOriginY; if(iOriginY%2==1) { fOriginY-=1.0f/3.0f; @@ -415,8 +415,8 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, // Translate unprintable characters XUI_FontData::SChar sChar = m_fontData->getChar( letter ); - FLOAT fOffset = m_fXScaleFactor * static_cast(sChar.getOffset()); - FLOAT fAdvance = m_fXScaleFactor * static_cast(sChar.getWAdvance()); + FLOAT fOffset = m_fXScaleFactor * ( FLOAT )sChar.getOffset(); + FLOAT fAdvance = m_fXScaleFactor * ( FLOAT )sChar.getWAdvance(); // 4J Use the font max width otherwise scaling doesnt look right FLOAT fWidth = m_fXScaleFactor * (sChar.tu2() - sChar.tu1());//( FLOAT )pGlyph->wWidth; FLOAT fHeight = m_fYScaleFactor * m_fontData->getFontHeight(); @@ -450,10 +450,10 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, // Add the vertices to draw this glyph - FLOAT tu1 = sChar.tu1() / static_cast(m_fontData->getImageWidth()); - FLOAT tv1 = sChar.tv1() / static_cast(m_fontData->getImageHeight()); - FLOAT tu2 = sChar.tu2() / static_cast(m_fontData->getImageWidth()); - FLOAT tv2 = sChar.tv2() / static_cast(m_fontData->getImageHeight()); + FLOAT tu1 = sChar.tu1() / (float)m_fontData->getImageWidth(); + FLOAT tv1 = sChar.tv1() / (float)m_fontData->getImageHeight(); + FLOAT tu2 = sChar.tu2() / (float)m_fontData->getImageWidth(); + FLOAT tv2 = sChar.tv2() / (float)m_fontData->getImageHeight(); Tesselator *t = Tesselator::getInstance(); t->begin(); diff --git a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp index 88d77d09..7a70cdfb 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp @@ -68,7 +68,7 @@ float XUI_FontData::SChar::getMinX() float XUI_FontData::SChar::getMaxX() { - return static_cast(m_parent->m_fontData->getFontData()->m_uiGlyphWidth); + return (float) m_parent->m_fontData->getFontData()->m_uiGlyphWidth; } float XUI_FontData::SChar::getMinY() @@ -83,7 +83,7 @@ float XUI_FontData::SChar::getMaxY() float XUI_FontData::SChar::getAdvance() { - return static_cast(m_parent->m_fontData->getWidth(m_glyphId)); + return (float) m_parent->m_fontData->getWidth(m_glyphId); } int XUI_FontData::SChar::getGlyphId() @@ -157,11 +157,11 @@ XUI_FontData::SChar XUI_FontData::getChar(const wchar_t strChar) //-------------------------------------------------------------------------------------- XUI_FontData::XUI_FontData() { - m_pFontTexture = nullptr; + m_pFontTexture = NULL; m_iFontTexture = -1; m_dwNumGlyphs = 0L; - m_Glyphs = nullptr; + m_Glyphs = NULL; m_cMaxGlyph = 0; @@ -201,12 +201,12 @@ HRESULT XUI_FontData::Create( SFontData &sfontdata ) m_fontData = new CFontData( sfontdata, rawPixels.data ); - if (rawPixels.data != nullptr) delete [] rawPixels.data; + if (rawPixels.data != NULL) delete [] rawPixels.data; #if 0 { // 4J-JEV: Load in FontData (ABC) file, and initialize member variables from it. - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); //wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/font/Mojangles_10.abc"); wsprintfW(szResourceLocator,L"section://%X,%s#%s%s%s",c_ModuleHandle,L"media", L"media/font/",strFontFileName.c_str(),L".abc"); @@ -349,7 +349,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData ) //-------------------------------------------------------------------------------------- VOID XUI_FontData::Destroy() { - if(m_pFontTexture!=nullptr) + if(m_pFontTexture!=NULL) { m_pFontTexture->Release(); delete m_pFontTexture; @@ -357,7 +357,7 @@ VOID XUI_FontData::Destroy() m_fontData->release(); - m_pFontTexture = nullptr; + m_pFontTexture = NULL; m_dwNumGlyphs = 0L; m_cMaxGlyph = 0; diff --git a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp index f6619fd5..d708af79 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp @@ -36,7 +36,7 @@ VOID XUI_FontRenderer::Term() HRESULT XUI_FontRenderer::GetCaps( DWORD * pdwCaps ) { - if( pdwCaps != nullptr ) + if( pdwCaps != NULL ) { // setting this means XUI calls the DrawCharsToDevice method *pdwCaps = XUI_FONT_RENDERER_CAP_INTERNAL_GLYPH_CACHE | XUI_FONT_RENDERER_CAP_POINT_SIZE_RESPECTED | XUI_FONT_RENDERER_STYLE_DROPSHADOW; @@ -50,7 +50,7 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri //float fXuiSize = fPointSize * ( 16.0f / 16.0f ); fXuiSize /= 4.0f; fXuiSize = floor( fXuiSize ); - int xuiSize = static_cast(fXuiSize * 4.0f); + int xuiSize = (int)(fXuiSize * 4.0f); if( xuiSize < 1 ) xuiSize = 8; // 4J Stu - We have fonts based on multiples of 8 or 12 @@ -60,8 +60,8 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri //app.DebugPrintf("point size is: %f, xuiSize is: %d\n", fPointSize, xuiSize); - XUI_Font *font = nullptr; - XUI_FontData *fontData = nullptr; + XUI_Font *font = NULL; + XUI_FontData *fontData = NULL; FLOAT scale = 1; eFontData efontdata; @@ -77,17 +77,17 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font = m_loadedFonts[efontdata][scale]; - if (font == nullptr) + if (font == NULL) { fontData = m_loadedFontData[efontdata]; - if (fontData == nullptr) + if (fontData == NULL) { SFontData *sfontdata; switch (efontdata) { case eFontData_Mojangles_7: sfontdata = &SFontData::Mojangles_7; break; case eFontData_Mojangles_11: sfontdata = &SFontData::Mojangles_11; break; - default: sfontdata = nullptr; break; + default: sfontdata = NULL; break; } fontData = new XUI_FontData(); @@ -101,14 +101,14 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font->IncRefCount(); - *phFont = static_cast(font); + *phFont = (HFONTOBJ)font; return S_OK; } VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont ) { - XUI_Font *xuiFont = static_cast(hFont); - if (xuiFont != nullptr) + XUI_Font *xuiFont = (XUI_Font*) hFont; + if (xuiFont != NULL) { xuiFont->DecRefCount(); if (xuiFont->refCount <= 0) @@ -125,7 +125,7 @@ HRESULT XUI_FontRenderer::GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontM { if( hFont == 0 || pFontMetrics == 0 ) return E_INVALIDARG; - XUI_Font *font = static_cast(hFont); + XUI_Font *font = (XUI_Font *)hFont; pFontMetrics->fLineHeight = (font->m_fontData->getFontYAdvance() + 1) * font->m_fYScaleFactor; pFontMetrics->fMaxAscent = font->m_fontData->getMaxAscent() * font->m_fYScaleFactor; @@ -142,7 +142,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr { if (hFont == 0 || pCharMetrics == 0) return E_INVALIDARG; - XUI_Font *font = static_cast(hFont); + XUI_Font *font = (XUI_Font *)hFont; XUI_FontData::SChar sChar = font->m_fontData->getChar(wch); pCharMetrics->fMinX = sChar.getMinX() * font->m_fYScaleFactor; @@ -156,7 +156,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr HRESULT XUI_FontRenderer::DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC, IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, UINT insetX, UINT insetY ) { - if( hFont==0 || pTexture==nullptr ) return E_INVALIDARG; + if( hFont==0 || pTexture==NULL ) return E_INVALIDARG; return( S_OK ); } @@ -169,7 +169,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat DWORD SamplerStateA[5]; XMVECTOR vconsts[20]; XMVECTOR pconsts[20]; - XUI_Font *font = static_cast(hFont); + XUI_Font *font = (XUI_Font *)hFont; // 4J-PB - if we're in 480 Widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple if(!RenderManager.IsHiDef()) @@ -184,19 +184,19 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat if(iScaleX%2==0) { int iWorldX=pWorldViewProj->_41; - pWorldViewProj->_41 = static_cast(iWorldX & -2); + pWorldViewProj->_41 = (float)(iWorldX & -2); } if(iScaleY%2==0) { int iWorldY=pWorldViewProj->_42; - pWorldViewProj->_42 = static_cast(iWorldY & -2); + pWorldViewProj->_42 = (float)(iWorldY & -2); } } else { // make x an even number for 480 4:3 int iWorldX=pWorldViewProj->_41; - pWorldViewProj->_41 = static_cast(iWorldX & -2); + pWorldViewProj->_41 = (float)(iWorldX & -2); // 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it int iWorldY=pWorldViewProj->_42; diff --git a/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp b/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp index 55967327..efa8a3da 100644 --- a/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp +++ b/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp @@ -10,25 +10,25 @@ LeaderboardManager *LeaderboardManager::m_instance = new XboxLeaderboardManager( const XboxLeaderboardManager::LeaderboardDescriptor XboxLeaderboardManager::LEADERBOARD_DESCRIPTORS[XboxLeaderboardManager::NUM_LEADERBOARDS][4] = { { - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, nullptr, nullptr, nullptr,nullptr), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, nullptr, nullptr, nullptr,nullptr), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, nullptr, nullptr, nullptr,nullptr), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, nullptr, nullptr, nullptr,nullptr), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, NULL, NULL, NULL,NULL), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, NULL, NULL, NULL,NULL), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, NULL, NULL, NULL,NULL), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, NULL, NULL, NULL,NULL), }, { - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN, nullptr ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN, NULL ), }, { - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS,STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE,STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, nullptr, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, nullptr, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, nullptr, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, nullptr, nullptr ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS,STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE,STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, NULL, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, NULL, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, NULL, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, NULL, NULL ), }, { - XboxLeaderboardManager::LeaderboardDescriptor( nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME, nullptr ), - XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME, nullptr ), + XboxLeaderboardManager::LeaderboardDescriptor( NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME, NULL ), + XboxLeaderboardManager::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME, NULL ), }, }; @@ -37,9 +37,9 @@ XboxLeaderboardManager::XboxLeaderboardManager() m_eStatsState = eStatsState_Idle; m_statsRead = false; - m_hSession = nullptr; - m_spec = nullptr; - m_stats = nullptr; + m_hSession = NULL; + m_spec = NULL; + m_stats = NULL; m_isQNetSession = false; m_endingSession = false; @@ -53,11 +53,11 @@ void XboxLeaderboardManager::Tick() { /*if( IsStatsReadComplete() ) - if( m_readCompleteCallback != nullptr ) + if( m_readCompleteCallback != NULL ) m_readCompleteCallback(m_readCompleteUserdata);*/ if ( IsStatsReadComplete() ) - if (m_readListener != nullptr) + if (m_readListener != NULL) { // 4J Stu - If the state is other than ready, then we don't have any stats to sort if(m_eFilterMode == LeaderboardManager::eFM_Friends && m_eStatsState == eStatsState_Ready) SortFriendStats(); @@ -83,12 +83,12 @@ bool XboxLeaderboardManager::OpenSession() if (m_endingSession) return false; //We've already got an open session - if (m_hSession != nullptr) return true; + if (m_hSession != NULL) return true; int lockedProfile = ProfileManager.GetLockedProfile(); if( lockedProfile == -1 ) { - m_hSession = nullptr; + m_hSession = NULL; return false; } @@ -112,26 +112,26 @@ bool XboxLeaderboardManager::OpenSession() XSESSION_INFO sessionInfo; ULONGLONG sessionNonce; - DWORD ret = XSessionCreate(XSESSION_CREATE_USES_STATS | XSESSION_CREATE_HOST, lockedProfile, 8, 8, &sessionNonce, &sessionInfo, nullptr, &m_hSession); + DWORD ret = XSessionCreate(XSESSION_CREATE_USES_STATS | XSESSION_CREATE_HOST, lockedProfile, 8, 8, &sessionNonce, &sessionInfo, NULL, &m_hSession); if( ret != ERROR_SUCCESS ) { - m_hSession = nullptr; + m_hSession = NULL; return false; } DWORD userIndices[1] = { lockedProfile }; BOOL privateSlots[1] = { FALSE }; - ret = XSessionJoinLocal(m_hSession, 1, userIndices, privateSlots, nullptr); + ret = XSessionJoinLocal(m_hSession, 1, userIndices, privateSlots, NULL); if( ret != ERROR_SUCCESS ) { - m_hSession = nullptr; + m_hSession = NULL; return false; } - ret = XSessionStart(m_hSession, 0, nullptr); + ret = XSessionStart(m_hSession, 0, NULL); if( ret != ERROR_SUCCESS ) { - m_hSession = nullptr; + m_hSession = NULL; return false; } @@ -151,7 +151,7 @@ void XboxLeaderboardManager::CloseSession() return; } - if (m_hSession == nullptr) return; + if (m_hSession == NULL) return; memset(&m_endSessionOverlapped, 0, sizeof(m_endSessionOverlapped)); @@ -166,15 +166,15 @@ void XboxLeaderboardManager::CloseSession() if (ret != ERROR_SUCCESS) DeleteSession(); } - m_readListener = nullptr; + m_readListener = NULL; } } void XboxLeaderboardManager::DeleteSession() { - XSessionDelete(m_hSession, nullptr); + XSessionDelete(m_hSession, NULL); CloseHandle(m_hSession); - m_hSession = nullptr; + m_hSession = NULL; } bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) @@ -190,9 +190,9 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) if(m_isQNetSession == true) { INetworkPlayer *player = g_NetworkManager.GetPlayerByXuid(m_myXUID); - if(player != nullptr) + if(player != NULL) { - ret = static_cast(player)->GetQNetPlayer()->WriteStats(viewCount,views); + ret = ((NetworkPlayerXbox *)player)->GetQNetPlayer()->WriteStats(viewCount,views); //printf("Wrote stats to QNet player\n"); } else @@ -204,7 +204,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) } else { - ret = XSessionWriteStats(m_hSession, m_myXUID, viewCount, views, nullptr); + ret = XSessionWriteStats(m_hSession, m_myXUID, viewCount, views, NULL); } if (ret != ERROR_SUCCESS) return false; return true; @@ -213,7 +213,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) void XboxLeaderboardManager::CancelOperation() { //Need to have a session open - if( m_hSession == nullptr ) + if( m_hSession == NULL ) if( !OpenSession() ) return; @@ -249,7 +249,7 @@ bool XboxLeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == nullptr) return false; + if (m_stats == NULL) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -258,7 +258,7 @@ bool XboxLeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *callback hEnumerator, // Enumeration handle m_stats, // Buffer m_numStats, // Size of buffer - nullptr, // Number of rows returned; not used for async + NULL, // Number of rows returned; not used for async &m_overlapped ); // Overlapped structure; not used for sync if ( (ret!=ERROR_SUCCESS) && (ret!=ERROR_IO_PENDING) ) return false; @@ -280,12 +280,12 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback getFriends(friendCount, &friends); - if(friendCount == 0 || friends == nullptr) + if(friendCount == 0 || friends == NULL) { app.DebugPrintf("XboxLeaderboardManager::ReadStats_Friends - No friends found. Possibly you are offline?\n"); return false; } - assert(friendCount > 0 && friends != nullptr); + assert(friendCount > 0 && friends != NULL); m_numStats = 0; ret = XUserReadStats( @@ -295,8 +295,8 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback 1, //specCount, m_spec, &m_numStats, - nullptr, - nullptr + NULL, + NULL ); //Annoyingly, this returns ERROR_INSUFFICIENT_BUFFER when it is being asked to calculate the size of the buffer by passing zero resultsSize @@ -304,7 +304,7 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == nullptr) return false; + if (m_stats == NULL) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -346,7 +346,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == nullptr) return false; + if (m_stats == NULL) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -355,7 +355,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback hEnumerator, // Enumeration handle m_stats, // Buffer m_numStats, // Size of buffer - nullptr, // Number of rows returned; not used for async + NULL, // Number of rows returned; not used for async &m_overlapped ); // Overlapped structure; not used for sync if( (ret!=ERROR_SUCCESS) && (ret!=ERROR_IO_PENDING) ) return false; @@ -367,7 +367,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback bool XboxLeaderboardManager::readStats(int difficulty, EStatsType type) { //Need to have a session open - if (m_hSession==nullptr) if(!OpenSession()) return false; + if (m_hSession==NULL) if(!OpenSession()) return false; m_eStatsState = eStatsState_Failed; m_statsRead = false; @@ -376,17 +376,17 @@ bool XboxLeaderboardManager::readStats(int difficulty, EStatsType type) //Setup the spec structure for the read request m_spec = new XUSER_STATS_SPEC[1]; - m_spec[0].dwViewId = LEADERBOARD_DESCRIPTORS[static_cast(type)][difficulty].m_viewId; - m_spec[0].dwNumColumnIds = LEADERBOARD_DESCRIPTORS[static_cast(type)][difficulty].m_columnCount; + m_spec[0].dwViewId = LEADERBOARD_DESCRIPTORS[(int)type][difficulty].m_viewId; + m_spec[0].dwNumColumnIds = LEADERBOARD_DESCRIPTORS[(int)type][difficulty].m_columnCount; for (unsigned int i=0; i(type)][difficulty].m_columnIds[i]; + m_spec[0].rgwColumnIds[i] = LEADERBOARD_DESCRIPTORS[(int)type][difficulty].m_columnIds[i]; return true; } void XboxLeaderboardManager::FlushStats() { - if( m_hSession == nullptr || m_isQNetSession ) return; + if( m_hSession == NULL || m_isQNetSession ) return; memset(&m_flushStatsOverlapped, 0, sizeof(m_flushStatsOverlapped)); XSessionFlushStats(m_hSession, &m_flushStatsOverlapped); } @@ -403,7 +403,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() if( m_stats ) { delete [] m_stats; - m_stats = nullptr; + m_stats = NULL; } } else @@ -415,7 +415,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() if( m_stats ) { delete [] m_stats; - m_stats = nullptr; + m_stats = NULL; } } else @@ -431,7 +431,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() int XboxLeaderboardManager::FriendSortFunction(const void* a, const void* b) { - return static_cast(((XUSER_STATS_ROW *)a)->dwRank) - static_cast(((XUSER_STATS_ROW *)b)->dwRank); + return ((int)((XUSER_STATS_ROW*)a)->dwRank) - ((int)((XUSER_STATS_ROW*)b)->dwRank); } void XboxLeaderboardManager::SortFriendStats() @@ -465,10 +465,10 @@ void XboxLeaderboardManager::SortFriendStats() #if 0 void XboxLeaderboardManager::SetStatsRetrieved(bool success) { - if( m_stats != nullptr ) + if( m_stats != NULL ) { delete [] m_stats; - m_stats = nullptr; + m_stats = NULL; } m_statsRead = success; @@ -496,7 +496,7 @@ bool XboxLeaderboardManager::getFriends(unsigned int &friendsCount, PlayerUID** xonlineFriends, resultsSize, &numFriends, - nullptr + NULL ); if (ret!=ERROR_SUCCESS) friendsCount = 0; diff --git a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp index edadfac4..5216d908 100644 --- a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp +++ b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp @@ -4,7 +4,7 @@ NetworkPlayerXbox::NetworkPlayerXbox(IQNetPlayer *qnetPlayer) { m_qnetPlayer = qnetPlayer; - m_pSocket = nullptr; + m_pSocket = NULL; } unsigned char NetworkPlayerXbox::GetSmallId() @@ -17,7 +17,7 @@ void NetworkPlayerXbox::SendData(INetworkPlayer *player, const void *pvData, int DWORD flags; flags = QNET_SENDDATA_RELIABLE | QNET_SENDDATA_SEQUENTIAL; if( lowPriority ) flags |= QNET_SENDDATA_LOW_PRIORITY | QNET_SENDDATA_SECONDARY; - m_qnetPlayer->SendData(static_cast(player)->m_qnetPlayer, pvData, dataSize, flags); + m_qnetPlayer->SendData(((NetworkPlayerXbox *)player)->m_qnetPlayer, pvData, dataSize, flags); } int NetworkPlayerXbox::GetOutstandingAckCount() @@ -27,21 +27,21 @@ int NetworkPlayerXbox::GetOutstandingAckCount() bool NetworkPlayerXbox::IsSameSystem(INetworkPlayer *player) { - return ( m_qnetPlayer->IsSameSystem(static_cast(player)->m_qnetPlayer) == TRUE ); + return ( m_qnetPlayer->IsSameSystem(((NetworkPlayerXbox *)player)->m_qnetPlayer) == TRUE ); } int NetworkPlayerXbox::GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ) { DWORD flags = QNET_GETSENDQUEUESIZE_BYTES; if( lowPriority ) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : nullptr , flags); + return m_qnetPlayer->GetSendQueueSize(player ? ((NetworkPlayerXbox *)player)->m_qnetPlayer : NULL , flags); } int NetworkPlayerXbox::GetSendQueueSizeMessages( INetworkPlayer *player, bool lowPriority ) { DWORD flags = QNET_GETSENDQUEUESIZE_MESSAGES; if( lowPriority ) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : nullptr , flags); + return m_qnetPlayer->GetSendQueueSize(player ? ((NetworkPlayerXbox *)player)->m_qnetPlayer : NULL , flags); } int NetworkPlayerXbox::GetCurrentRtt() @@ -137,6 +137,6 @@ int NetworkPlayerXbox::GetTimeSinceLastChunkPacket_ms() return INT_MAX; } - const int64_t currentTime = System::currentTimeMillis(); - return static_cast(currentTime - m_lastChunkPacketTime); + int64_t currentTime = System::currentTimeMillis(); + return (int)( currentTime - m_lastChunkPacketTime ); } \ No newline at end of file diff --git a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp index f586f447..47317146 100644 --- a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -109,7 +109,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerJoined( bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerXbox *networkPlayer = static_cast(addNetworkPlayer(pQNetPlayer)); + NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); if( pQNetPlayer->IsLocal() ) { @@ -187,7 +187,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerJoined( for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -196,7 +196,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerJoined( int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -221,7 +221,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -237,14 +237,14 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( nullptr ); + networkPlayer->SetSocket( NULL ); } if( m_pIQNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pQNetPlayer) ) { - IQNetPlayer *pNewQNetPrimaryPlayer = nullptr; + IQNetPlayer *pNewQNetPrimaryPlayer = NULL; for(unsigned int i = 0; i < m_pIQNet->GetPlayerCount(); ++i ) { IQNetPlayer *pQNetPlayer2 = m_pIQNet->GetPlayerByIndex( i ); @@ -261,7 +261,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( m_machineQNetPrimaryPlayers.erase( it ); } - if( pNewQNetPrimaryPlayer != nullptr ) + if( pNewQNetPrimaryPlayer != NULL ) m_machineQNetPrimaryPlayers.push_back( pNewQNetPrimaryPlayer ); } @@ -274,7 +274,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -283,7 +283,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -349,7 +349,7 @@ VOID CPlatformNetworkManagerXbox::NotifyDataReceived( INetworkPlayer *pPlayerFrom = getNetworkPlayer(pQNetPlayerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(pbData, dwDataSize, false); } else @@ -358,7 +358,7 @@ VOID CPlatformNetworkManagerXbox::NotifyDataReceived( INetworkPlayer *pPlayerTo = getNetworkPlayer(apQNetPlayersTo[dwPlayer]); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(pbData, dwDataSize); } } @@ -380,7 +380,7 @@ VOID CPlatformNetworkManagerXbox::NotifyReadinessChanged( __in BOOL bReady ) { - app.DebugPrintf( "Player 0x%p readiness is now %i.\n", pQNetPlayer, static_cast(bReady) ); + app.DebugPrintf( "Player 0x%p readiness is now %i.\n", pQNetPlayer, (int) bReady ); } @@ -432,7 +432,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } HRESULT hr; @@ -440,7 +440,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa DWORD dwResult; // Start up XNet with default settings. - iResult = XNetStartup( nullptr ); + iResult = XNetStartup( NULL ); if( iResult != 0 ) { app.DebugPrintf( "Starting up XNet failed (err = %i)!\n", iResult ); @@ -457,7 +457,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa } // Create the QNet object. - hr = QNetCreateUsingXAudio2( QNET_SESSIONTYPE_LIVE_STANDARD, this, nullptr, g_pXAudio2, &m_pIQNet ); + hr = QNetCreateUsingXAudio2( QNET_SESSIONTYPE_LIVE_STANDARD, this, NULL, g_pXAudio2, &m_pIQNet ); if( FAILED( hr ) ) { app.DebugPrintf( "Creating QNet object failed (err = 0x%08x)!\n", hr ); @@ -489,8 +489,8 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -498,10 +498,10 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; + m_pSearchResults[i] = NULL; + m_pQoSResult[i] = NULL; + m_pCurrentSearchResults[i] = NULL; + m_pCurrentQoSResult[i] = NULL; m_currentSearchResultsCount[i] = 0; } @@ -629,11 +629,11 @@ bool CPlatformNetworkManagerXbox::RemoveLocalPlayerByUserIndex( int userIndex ) IQNetPlayer *pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(userIndex); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // We can't remove the player from qnet until we have stopped using it to communicate C4JThread* thread = new C4JThread(&CPlatformNetworkManagerXbox::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); @@ -701,11 +701,11 @@ bool CPlatformNetworkManagerXbox::LeaveGame(bool bMigrateHost) IQNetPlayer *pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer != nullptr) + if(pNetworkPlayer != NULL) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE); @@ -717,13 +717,13 @@ bool CPlatformNetworkManagerXbox::LeaveGame(bool bMigrateHost) // 4J Stu - Clear our reference to this socket pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer) pNetworkPlayer->SetSocket( nullptr ); + if(pNetworkPlayer) pNetworkPlayer->SetSocket( NULL ); } delete socket; } else { - //printf("Socket is already nullptr\n"); + //printf("Socket is already NULL\n"); } } @@ -795,7 +795,7 @@ void CPlatformNetworkManagerXbox::_HostGame(int usersMask, unsigned char publicS publicSlots, // dwPublicSlots privateSlots, // dwPrivateSlots 0, // cProperties - nullptr, // pProperties + NULL, // pProperties ARRAYSIZE( aXUserContexts ), // cContexts aXUserContexts ); // pContexts @@ -899,8 +899,8 @@ void CPlatformNetworkManagerXbox::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -927,14 +927,14 @@ bool CPlatformNetworkManagerXbox::_RunNetworkGame() return true; } -void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { DWORD playerCount = m_pIQNet->GetPlayerCount(); if( this->m_bLeavingGame ) return; - if( GetHostPlayer() == nullptr ) + if( GetHostPlayer() == NULL ) return; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -946,7 +946,7 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN // We can call this from NotifyPlayerLeaving but at that point the player is still considered in the session if( pNetworkPlayer != pNetworkPlayerLeaving ) { - m_hostGameSessionData.players[i] = static_cast(pNetworkPlayer)->GetUID(); + m_hostGameSessionData.players[i] = ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID(); char *temp; temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() ); @@ -954,18 +954,18 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN } else { - m_hostGameSessionData.players[i] = nullptr; + m_hostGameSessionData.players[i] = NULL; memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); } } else { - m_hostGameSessionData.players[i] = nullptr; + m_hostGameSessionData.players[i] = NULL; memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); } } - m_hostGameSessionData.hostPlayerUID = static_cast(GetHostPlayer())->GetQNetPlayer()->GetXuid(); + m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); HRESULT hr = S_OK; @@ -978,18 +978,18 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerXbox::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast(lpParam); + INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -1066,7 +1066,7 @@ void CPlatformNetworkManagerXbox::SystemFlagReset() void CPlatformNetworkManagerXbox::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -1082,7 +1082,7 @@ void CPlatformNetworkManagerXbox::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -1099,8 +1099,8 @@ bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerXbox::GatherStats() { - return L"Queue messages: " + std::to_wstring(static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) ) - + L" Queue bytes: " + std::to_wstring( static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) ); + return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); } wstring CPlatformNetworkManagerXbox::GatherRTTStats() @@ -1111,7 +1111,7 @@ wstring CPlatformNetworkManagerXbox::GatherRTTStats() for(unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer *pQNetPlayer = static_cast(GetPlayerByIndex(i))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -1132,23 +1132,23 @@ void CPlatformNetworkManagerXbox::TickSearch() m_currentSearchResultsCount[m_lastSearchPad] = m_searchResultsCount[m_lastSearchPad]; // Store the current search results so that we don't delete them too early - if( m_pCurrentSearchResults[m_lastSearchPad] != nullptr ) + if( m_pCurrentSearchResults[m_lastSearchPad] != NULL ) { delete m_pCurrentSearchResults[m_lastSearchPad]; - m_pCurrentSearchResults[m_lastSearchPad] = nullptr; + m_pCurrentSearchResults[m_lastSearchPad] = NULL; } m_pCurrentSearchResults[m_lastSearchPad] = m_pSearchResults[m_lastSearchPad]; - m_pSearchResults[m_lastSearchPad] = nullptr; + m_pSearchResults[m_lastSearchPad] = NULL; - if( m_pCurrentQoSResult[m_lastSearchPad] != nullptr ) + if( m_pCurrentQoSResult[m_lastSearchPad] != NULL ) { XNetQosRelease(m_pCurrentQoSResult[m_lastSearchPad]); - m_pCurrentQoSResult[m_lastSearchPad] = nullptr; + m_pCurrentQoSResult[m_lastSearchPad] = NULL; } m_pCurrentQoSResult[m_lastSearchPad] = m_pQoSResult[m_lastSearchPad]; - m_pQoSResult[m_lastSearchPad] = nullptr; + m_pQoSResult[m_lastSearchPad] = NULL; - if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); m_bSearchResultsReady = false; m_bSearchPending = false; } @@ -1156,7 +1156,7 @@ void CPlatformNetworkManagerXbox::TickSearch() else { // Don't start searches unless we have registered a callback - if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime[g_NetworkManager.GetPrimaryPad()] + MINECRAFT_XSESSION_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) + if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime[g_NetworkManager.GetPrimaryPad()] + MINECRAFT_XSESSION_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) { SearchForGames(); } @@ -1180,15 +1180,15 @@ void CPlatformNetworkManagerXbox::SearchForGames() } friendsSessions[m_lastSearchPad].clear(); - if( m_pSearchResults[m_lastSearchPad] != nullptr ) + if( m_pSearchResults[m_lastSearchPad] != NULL ) { delete m_pSearchResults[m_lastSearchPad]; - m_pSearchResults[m_lastSearchPad] = nullptr; + m_pSearchResults[m_lastSearchPad] = NULL; } - if( m_pQoSResult[m_lastSearchPad] != nullptr ) + if( m_pQoSResult[m_lastSearchPad] != NULL ) { XNetQosRelease(m_pQoSResult[m_lastSearchPad]); - m_pQoSResult[m_lastSearchPad] = nullptr; + m_pQoSResult[m_lastSearchPad] = NULL; } bool bMultiplayerAllowed = g_NetworkManager.IsSignedInLive( g_NetworkManager.GetPrimaryPad() ) && g_NetworkManager.AllowedToPlayMultiplayer( g_NetworkManager.GetPrimaryPad() ); @@ -1250,7 +1250,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() buffer, bufferSize, &itemsReturned, - nullptr + NULL ); DWORD flagPlayingOnline = XONLINE_FRIENDSTATE_FLAG_ONLINE; // | XONLINE_FRIENDSTATE_FLAG_PLAYING; @@ -1317,8 +1317,8 @@ void CPlatformNetworkManagerXbox::SearchForGames() sessionIDList, g_NetworkManager.GetPrimaryPad(), &cbResults, // Pass in the address of the size variable - nullptr, - nullptr // This example uses the synchronous model + NULL, + NULL // This example uses the synchronous model ); XOVERLAPPED *pOverlapped = new XOVERLAPPED(); @@ -1386,7 +1386,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) { - SearchForGamesData *threadData = static_cast(lpParameter); + SearchForGamesData *threadData = (SearchForGamesData *)lpParameter; DWORD sessionIDCount = threadData->sessionIDCount; @@ -1423,7 +1423,7 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) } // Create an event object that is autoreset with an initial state of "not signaled". // Pass this event handle to the QoSLookup to receive notification of each QoS lookup. - HANDLE QoSLookupHandle = CreateEvent(nullptr, false, false, nullptr); + HANDLE QoSLookupHandle = CreateEvent(NULL, false, false, NULL); *threadData->ppQos = new XNQOS(); @@ -1433,8 +1433,8 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) QoSxnkid, // Array of pointers to XNKID structures that contain session IDs for the remote Xbox 360 consoles QoSxnkey, // Array of pointers to XNKEY structures that contain key-exchange keys for the remote Xbox 360 consoles 0, // Number of security gateways to probe - nullptr, // Pointer to an array of IN_ADDR structures that contain the IP addresses of the security gateways - nullptr, // Pointer to an array of service IDs for the security gateway + NULL, // Pointer to an array of IN_ADDR structures that contain the IP addresses of the security gateways + NULL, // Pointer to an array of service IDs for the security gateway 8, // Number of desired probe replies to receive 0, // Maximum upstream bandwidth that the outgoing QoS probe packets can consume 0, // Flags @@ -1489,11 +1489,11 @@ vector *CPlatformNetworkManagerXbox::GetSessionList(int iPa pSearchResult = &m_pCurrentSearchResults[iPad]->pResults[dwResult]; // No room for us, so ignore it - // 4J Stu - pSearchResult should never be nullptr, but just in case... - if(pSearchResult == nullptr || pSearchResult->dwOpenPublicSlots < localPlayers) continue; + // 4J Stu - pSearchResult should never be NULL, but just in case... + if(pSearchResult == NULL || pSearchResult->dwOpenPublicSlots < localPlayers) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = nullptr; + FriendSessionInfo *sessionInfo = NULL; auto itFriendSession = friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1595,7 +1595,7 @@ bool CPlatformNetworkManagerXbox::GetGameSessionInfo(int iPad, SessionID session if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = nullptr; + FriendSessionInfo *sessionInfo = NULL; auto = itFriendSession, friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1637,7 +1637,7 @@ bool CPlatformNetworkManagerXbox::GetGameSessionInfo(int iPad, SessionID session sessionInfo->data.isJoinable) { foundSessionInfo->data = sessionInfo->data; - if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel; + if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel; foundSessionInfo->displayLabel = new wchar_t[100]; memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) ); foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength; @@ -1672,7 +1672,7 @@ void CPlatformNetworkManagerXbox::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; + m_pSearchResults[i] = NULL; } } @@ -1699,7 +1699,7 @@ void CPlatformNetworkManagerXbox::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerXbox::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h index 2784726c..7c6112b4 100644 --- a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h @@ -88,7 +88,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp index 086b141e..5d2b9763 100644 --- a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp +++ b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp @@ -11,7 +11,7 @@ bool MinecraftDynamicConfigurations::s_bUpdatedConfigs[MinecraftDynamicConfigura MinecraftDynamicConfigurations::EDynamic_Configs MinecraftDynamicConfigurations::s_eCurrentConfig = MinecraftDynamicConfigurations::eDynamic_Config_Max; size_t MinecraftDynamicConfigurations::s_currentConfigSize = 0; size_t MinecraftDynamicConfigurations::s_dataWrittenSize = 0; -byte *MinecraftDynamicConfigurations::s_dataWritten = nullptr; +byte *MinecraftDynamicConfigurations::s_dataWritten = NULL; void MinecraftDynamicConfigurations::Tick() { @@ -43,7 +43,7 @@ void MinecraftDynamicConfigurations::UpdateNextConfiguration() { if(!s_bUpdatedConfigs[i]) { - update = static_cast(i); + update = (EDynamic_Configs)i; break; } } @@ -57,7 +57,7 @@ void MinecraftDynamicConfigurations::UpdateConfiguration(EDynamic_Configs id) { app.DebugPrintf("DynamicConfig: Attempting to update dynamic configuration %d\n", id); - HRESULT hr = Sentient::SenDynamicConfigGetSize( id, &s_currentConfigSize, &MinecraftDynamicConfigurations::GetSizeCompletedCallback, nullptr); + HRESULT hr = Sentient::SenDynamicConfigGetSize( id, &s_currentConfigSize, &MinecraftDynamicConfigurations::GetSizeCompletedCallback, NULL); switch(hr) { @@ -76,7 +76,7 @@ void MinecraftDynamicConfigurations::UpdateConfiguration(EDynamic_Configs id) break; case E_POINTER: app.DebugPrintf("DynamicConfig: Failed to get size for config as pointer is invalid\n"); - //The out_size pointer is nullptr. + //The out_size pointer is NULL. break; } if(FAILED(hr) ) @@ -97,7 +97,7 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult &s_dataWrittenSize, s_dataWritten, &MinecraftDynamicConfigurations::GetDataCompletedCallback, - nullptr + NULL ); switch(hr) @@ -115,8 +115,8 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult //Sentient is not initialized. You must call SentientInitialize before you call this function. break; case E_POINTER: - app.DebugPrintf("DynamicConfig: Failed to get bytes for config as pointer is nullptr\n"); - //The out_size pointer is nullptr. + app.DebugPrintf("DynamicConfig: Failed to get bytes for config as pointer is NULL\n"); + //The out_size pointer is NULL. break; } if(FAILED(hr) ) @@ -160,7 +160,7 @@ void MinecraftDynamicConfigurations::GetDataCompletedCallback(HRESULT taskResu } delete [] s_dataWritten; - s_dataWritten = nullptr; + s_dataWritten = NULL; s_bUpdatedConfigs[s_eCurrentConfig] = true; UpdateNextConfiguration(); diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h index 524c1bdc..dfccfd3b 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h @@ -108,7 +108,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_avatarInfoList is nullptr. + /// E_POINTER: out_avatarInfoList is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -149,7 +149,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_avatarInfo is nullptr. + /// E_POINTER: out_avatarInfo is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -192,7 +192,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.metadata is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -235,7 +235,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.assets is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -278,7 +278,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.icon is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -316,7 +316,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.xml is invalid. - /// E_POINTER: out_avatarExtraInfo is nullptr. + /// E_POINTER: out_avatarExtraInfo is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -352,14 +352,14 @@ namespace Sentient // First method, filling a fixed-size buffer: // // wchar_t buffer[1234]; - // SenAvatarXMLGetTitle( xml, loc, _countof(buffer), nullptr, buffer ); + // SenAvatarXMLGetTitle( xml, loc, _countof(buffer), NULL, buffer ); // // Second method, filling a dynamically-allocated buffer: // // size_t bufferLength; - // SenAvatarXMLGetTitle( xml, loc, 0, &bufferLength, nullptr ); + // SenAvatarXMLGetTitle( xml, loc, 0, &bufferLength, NULL ); // wchar_t buffer = new wchar_t[bufferLength]; - // SenAvatarXMLGetTitle( xml, loc, bufferLength, nullptr, buffer ); + // SenAvatarXMLGetTitle( xml, loc, bufferLength, NULL, buffer ); // // Note that bufferLength is in wchars, and includes the terminating nul. // The actual length of the _string_ is (*out_bufferLength - 1). diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h index 95a8c188..09662243 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h @@ -116,7 +116,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_boxArtInfoList is nullptr. + /// E_POINTER: out_boxArtInfoList is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -160,7 +160,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.image is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -198,7 +198,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.xml is invalid. - /// E_POINTER: out_boxArtExtraInfo is nullptr. + /// E_POINTER: out_boxArtExtraInfo is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -236,7 +236,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.xml is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -263,7 +263,7 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). + /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). /// /// @param[in] bufferLength /// Note that bufferLength is in wchars, and needs to _include_ space for the terminating nul. @@ -271,16 +271,16 @@ namespace Sentient /// @param[out] out_bufferLength /// Used to return the actual number of wchars written to the buffer, including the terminating nul. /// The actual length of the _string_ is (*out_bufferLength - 1). - /// Pass @a out_bufferLength = nullptr if you don't care about the actual size. + /// Pass @a out_bufferLength = NULL if you don't care about the actual size. /// /// @param[out] out_buffer /// The buffer to fill in with the string. /// It is assumed that this is preallocated to at least @a bufferLength wchars. - /// Pass @a out_buffer = nullptr if you are only interested in finding out the necessary buffer size. + /// Pass @a out_buffer = NULL if you are only interested in finding out the necessary buffer size. /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_UNEXPECTED: passed a nullptr culture without a default culture being set first. + /// E_UNEXPECTED: passed a NULL culture without a default culture being set first. /// E_INVALIDARG: senXML does not contain parsed XML data. /// E_FAIL: Failed to locate text. /// S_OK: Server call spawned successfully. @@ -291,14 +291,14 @@ namespace Sentient /// First method, filling a fixed-size buffer: /// /// wchar_t buffer[1234]; - /// SenBoxArtXMLGetTitle( xml, culture, _countof(buffer), nullptr, buffer ); + /// SenBoxArtXMLGetTitle( xml, culture, _countof(buffer), NULL, buffer ); /// /// Second method, filling a dynamically-allocated buffer: /// /// size_t bufferLength; - /// SenBoxArtXMLGetTitle( xml, culture, 0, &bufferLength, nullptr ); + /// SenBoxArtXMLGetTitle( xml, culture, 0, &bufferLength, NULL ); /// wchar_t buffer = new wchar_t[bufferLength]; - /// SenBoxArtXMLGetTitle( xml, culture, bufferLength, nullptr, buffer ); + /// SenBoxArtXMLGetTitle( xml, culture, bufferLength, NULL, buffer ); /// /// @related SenBoxArtDownloadXML() /// @related SenXMLParse() @@ -319,7 +319,7 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). + /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). /// /// @param[in] bufferLength /// Note that bufferLength is in wchars, and needs to _include_ space for the terminating nul. @@ -327,16 +327,16 @@ namespace Sentient /// @param[out] out_bufferLength /// Used to return the actual number of wchars written to the buffer, including the terminating nul. /// The actual length of the _string_ is (*out_bufferLength - 1). - /// Pass @a out_bufferLength = nullptr if you don't care about the actual size. + /// Pass @a out_bufferLength = NULL if you don't care about the actual size. /// /// @param[out] out_buffer /// The buffer to fill in with the string. /// It is assumed that this is preallocated to at least @a bufferLength wchars. - /// Pass @a out_buffer = nullptr if you are only interested in finding out the necessary buffer size. + /// Pass @a out_buffer = NULL if you are only interested in finding out the necessary buffer size. /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_UNEXPECTED: passed a nullptr culture without a default culture being set first. + /// E_UNEXPECTED: passed a NULL culture without a default culture being set first. /// E_INVALIDARG: senXML does not contain parsed XML data. /// E_FAIL: Failed to locate text. /// S_OK: Server call spawned successfully. @@ -347,14 +347,14 @@ namespace Sentient /// First method, filling a fixed-size buffer: /// /// wchar_t buffer[1234]; - /// SenBoxArtXMLGetDescription( xml, culture, _countof(buffer), nullptr, buffer ); + /// SenBoxArtXMLGetDescription( xml, culture, _countof(buffer), NULL, buffer ); /// /// Second method, filling a dynamically-allocated buffer: /// /// size_t bufferLength; - /// SenBoxArtXMLGetDescription( xml, culture, 0, &bufferLength, nullptr ); + /// SenBoxArtXMLGetDescription( xml, culture, 0, &bufferLength, NULL ); /// wchar_t buffer = new wchar_t[bufferLength]; - /// SenBoxArtXMLGetDescription( xml, culture, bufferLength, nullptr, buffer ); + /// SenBoxArtXMLGetDescription( xml, culture, bufferLength, NULL, buffer ); /// /// @related SenBoxArtDownloadXML() /// @related SenXMLParse() @@ -390,7 +390,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.image is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h index 0aca08ef..81c2f3cc 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h @@ -55,7 +55,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_configInfo is nullptr. + /// E_POINTER: out_configInfo is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -95,7 +95,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: configInfo.resourceID or configInfo.config is invalid. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h index 4d3815d2..f86eb92a 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h @@ -42,7 +42,7 @@ 3. Many functions are designed for asynchronous use, and will internally create a task that will only finish after feedback from the server. - a. These functions can be either blocking or asynchronous. If the callback pointer is nullptr + a. These functions can be either blocking or asynchronous. If the callback pointer is NULL then it is a blocking call. b. If the call is asynchronous, then it will always return instantly, and will return S_OK if a task has been created. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h index 02e255e8..b36fd6e5 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h @@ -25,8 +25,8 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). - /// May be nullptr for default culture. + /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). + /// May be NULL for default culture. /// /// @param[in] maxResults /// Used to indicate the number of items to be returned by @a out_feedInfo. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h index 7b652aae..d6c5cb64 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h @@ -34,7 +34,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: size is nullptr. + /// E_POINTER: size is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -66,7 +66,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: size is nullptr. + /// E_POINTER: size is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -109,7 +109,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -149,7 +149,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_data is nullptr. + /// E_POINTER: out_data is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h index 8f07b1ce..1e823075 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h @@ -215,7 +215,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_userFameVIPArray is nullptr. + /// E_POINTER: out_userFameVIPArray is NULL. /// SENTIENT_E_TOO_MANY_CALLS: This call has been rejected to avoid excessive server load. Try again later. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. @@ -243,7 +243,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_fameVIPData is nullptr. + /// E_POINTER: out_fameVIPData is NULL. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_fameVIPData has not been filled in. /// S_OK: The operation completed successfully. /// @@ -304,8 +304,8 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_entryArray or out_leaderboardResults is nullptr. - /// E_INVALIDARG: userCallback is nullptr and out_senHandle is non-nullptr. Task handles are not supported for synchronous requests. + /// E_POINTER: out_entryArray or out_leaderboardResults is NULL. + /// E_INVALIDARG: userCallback is NULL and out_senHandle is non-NULL. Task handles are not supported for synchronous requests. /// SENTIENT_E_TOO_MANY_CALLS: This call has been rejected to avoid excessive server load. Try again later. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. @@ -331,7 +331,7 @@ namespace Sentient /// /// @return SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_awardData is nullptr. + /// E_POINTER: out_awardData is NULL. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_awardData has not been filled in. /// S_FALSE: The operation completed successfully but there were no awards to report. out_awardData has not been filled in. /// S_OK: The operation completed successfully and there was a valid award to report. out_awardData contains information about the award. @@ -351,7 +351,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_timeRemaining is nullptr. + /// E_POINTER: out_timeRemaining is NULL. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_timeRemaining has not been filled in. /// E_FAIL: Internal failure. Check log for output. /// S_OK: Call completed successfully and out_timeRemaining has been filled in. @@ -373,7 +373,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_timeRemaining is nullptr. + /// E_POINTER: out_timeRemaining is NULL. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_timeRemaining has not been filled in. /// S_FALSE: The VIP level of the supplied user does not expire. out_timeRemaining has not been filled in. /// E_FAIL: Internal failure. Check log for output. @@ -400,7 +400,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_name is nullptr. + /// E_POINTER: out_name is NULL. /// E_INVALIDARG: vipLevel is outside the range of known VIP levels. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_name has not been filled in. /// S_OK: The operation completed successfully. @@ -423,7 +423,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_count is nullptr. + /// E_POINTER: out_count is NULL. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_count has not been filled in. /// E_FAIL: Internal failure. Check log for output. /// S_OK: The operation completed successfully. @@ -456,7 +456,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_dataCount or out_displayData is nullptr. + /// E_POINTER: out_dataCount or out_displayData is NULL. /// E_INVALIDARG: startIndex is greater than the total number of items available. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and output parameters have not been filled in. /// E_FAIL: Internal failure. Check log for output. @@ -553,8 +553,8 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_INVALIDARG: Either userCallback is nullptr and out_senHandle is non-nullptr, or participantCount is less than 2. - /// E_POINTER: participants is nullptr. + /// E_INVALIDARG: Either userCallback is NULL and out_senHandle is non-NULL, or participantCount is less than 2. + /// E_POINTER: participants is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h index b749a164..e8405d5e 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h @@ -45,10 +45,10 @@ namespace Sentient enum SenResourceID : INT32 { /// This is used to indicate a failed search, an invalid resource structure, or sometimes to substitute for a default. - SenResourceID_Invalid = static_cast(SenResourceType_Invalid) << 24, + SenResourceID_Invalid = (INT32)SenResourceType_Invalid << 24, /// This is the first VIP reward costume and there is one for each title. - SenResourceID_Superstar_0 = static_cast(SenResourceType_Avatar) << 24, + SenResourceID_Superstar_0 = (INT32)SenResourceType_Avatar << 24, /// This is the second VIP reward costume and there is one for each title. SenResourceID_Superstar_1, /// This is the third VIP reward costume and there is one for each title. @@ -59,15 +59,15 @@ namespace Sentient SenResourceID_Superstar_4, /// This is used for the cross-sell screen and contains things such as an image, offerID, strings, etc. - SenResourceID_BoxArt_0 = static_cast(SenResourceType_BoxArt) << 24, + SenResourceID_BoxArt_0 = (INT32)SenResourceType_BoxArt << 24, /// This is used for game-private config files, and is only the base of the range. /// Titles may use the entire 24-bit space for various custom config files. - SenResourceID_Config_0 = static_cast(SenResourceType_Config) << 24, + SenResourceID_Config_0 = (INT32)SenResourceType_Config << 24, /// This is used for server-supplied help files/text. /// At the moment, this is not supported. - SenResourceID_Help_0 = static_cast(SenResourceType_Help) << 24, + SenResourceID_Help_0 = (INT32)SenResourceType_Help << 24, }; diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h index b4024571..da1b1f65 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h @@ -97,7 +97,7 @@ namespace Sentient // metadata for a lot of UGCs at once. // Note: if a level has been uploaded with main data before, and the creator // wants to just modify the metadata, they can upload the metadata with the - // maindatablobs being nullptr. + // maindatablobs being NULL. // NOTE: for large items, use the SenUGCUploadMainData method with the SenUGCProgressInfo // signature so you can get the running progress and a cancellation token // to abort the upload (allowing UI for the user, etc) @@ -159,7 +159,7 @@ namespace Sentient // be used to abort the upload. This is useful for large uploads where // you may want to allow the user to cancel. // NOTE: This call is asynchronous ONLY and will error for synchronous - // attempts with a nullptr param for userCallback. + // attempts with a NULL param for userCallback. // There are multiple data blobs supported (the exact number is defined in // SenUGCMainData_NrBlobs) on subsequent calls. Slot zero is to be used by a // game to store a preview thumbnail, which can then be downloaded without @@ -172,7 +172,7 @@ namespace Sentient // metadata for a lot of UGCs at once. // NOTE: if a level has been uploaded with main data before, and the creator // wants to just modify the metadata, they can upload the metadata with the - // main data blob being nullptr. + // main data blob being NULL. // NOTE: If a creator uploads a data blob again, it will overwrite the previous // stored blob with the new one. //************************************ @@ -848,8 +848,8 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). - /// May be nullptr for default culture. + /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). + /// May be NULL for default culture. /// /// @param[in] maxResults /// Used to indicate the number of items to be returned by @a out_feedInfo. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h index 4c48ee50..cf3ef0b3 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h @@ -61,7 +61,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_isInRole is nullptr. + /// E_POINTER: out_isInRole is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -91,7 +91,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_isInRole is nullptr. + /// E_POINTER: out_isInRole is NULL. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp index 49b0c26a..aade06bc 100644 --- a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp +++ b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp @@ -20,7 +20,7 @@ CTelemetryManager *TelemetryManager = new CSentientManager(); HRESULT CSentientManager::Init() { Sentient::SenSysTitleID sentitleID; - sentitleID = static_cast(TITLEID_MINECRAFT); + sentitleID = (Sentient::SenSysTitleID)TITLEID_MINECRAFT; HRESULT hr = SentientInitialize( sentitleID ); @@ -52,7 +52,7 @@ HRESULT CSentientManager::Tick() m_lastHeartbeat = currentTime; for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i) { - if(Minecraft::GetInstance()->localplayers[i] != nullptr) + if(Minecraft::GetInstance()->localplayers[i] != NULL) { SenStatHeartBeat(i, m_lastHeartbeat - m_initialiseTime); } @@ -63,7 +63,7 @@ HRESULT CSentientManager::Tick() { for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i) { - if(Minecraft::GetInstance()->localplayers[i] != nullptr && m_fLevelStartTime[i] - currentTime > 60) + if(Minecraft::GetInstance()->localplayers[i] != NULL && m_fLevelStartTime[i] - currentTime > 60) { Flush(); } @@ -123,7 +123,7 @@ HRESULT CSentientManager::Flush() BOOL CSentientManager::RecordPlayerSessionStart(DWORD dwUserId) { - return SenStatPlayerSessionStart( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetTitleBuildId(), 0, 0, 0, static_cast(app.getDeploymentType()) ); + return SenStatPlayerSessionStart( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetTitleBuildId(), 0, 0, 0, (INT)app.getDeploymentType() ); } BOOL CSentientManager::RecordPlayerSessionExit(DWORD dwUserId, int _) @@ -149,13 +149,13 @@ BOOL CSentientManager::RecordLevelStart(DWORD dwUserId, ESen_FriendOrMatch frien BOOL CSentientManager::RecordLevelExit(DWORD dwUserId, ESen_LevelExitStatus levelExitStatus) { float levelDuration = app.getAppTime() - m_fLevelStartTime[dwUserId]; - return SenStatLevelExit( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), levelExitStatus, GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast(levelDuration) ); + return SenStatLevelExit( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), levelExitStatus, GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), (INT)levelDuration ); } BOOL CSentientManager::RecordLevelSaveOrCheckpoint(DWORD dwUserId, INT saveOrCheckPointID, INT saveSizeInBytes) { float levelDuration = app.getAppTime() - m_fLevelStartTime[dwUserId]; - return SenStatLevelSaveOrCheckpoint( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast(levelDuration), saveOrCheckPointID, saveSizeInBytes ); + return SenStatLevelSaveOrCheckpoint( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), (INT)levelDuration, saveOrCheckPointID, saveSizeInBytes ); } BOOL CSentientManager::RecordLevelResume(DWORD dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, DWORD numberOfLocalPlayers, DWORD numberOfOnlinePlayers, INT saveOrCheckPointID) @@ -240,7 +240,7 @@ This should be tracked independently of saved games (restoring a save should not */ INT CSentientManager::GetSecondsSinceInitialize() { - return static_cast(app.getAppTime() - m_initialiseTime); + return (INT)(app.getAppTime() - m_initialiseTime); } /* @@ -257,21 +257,21 @@ INT CSentientManager::GetMode(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr ) + if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL ) { GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType(); if (gameType->isSurvival()) { - mode = static_cast(eTelem_ModeId_Survival); + mode = (INT)eTelem_ModeId_Survival; } else if (gameType->isCreative()) { - mode = static_cast(eTelem_ModeId_Creative); + mode = (INT)eTelem_ModeId_Creative; } else { - mode = static_cast(eTelem_ModeId_Undefined); + mode = (INT)eTelem_ModeId_Undefined; } } return mode; @@ -290,11 +290,11 @@ INT CSentientManager::GetSubMode(DWORD dwUserId) if(Minecraft::GetInstance()->isTutorial()) { - subMode = static_cast(eTelem_SubModeId_Tutorial); + subMode = (INT)eTelem_SubModeId_Tutorial; } else { - subMode = static_cast(eTelem_SubModeId_Normal); + subMode = (INT)eTelem_SubModeId_Normal; } return subMode; @@ -312,7 +312,7 @@ INT CSentientManager::GetLevelId(DWORD dwUserId) { INT levelId = (INT)eTelem_LevelId_Undefined; - levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); + levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel; return levelId; } @@ -329,18 +329,18 @@ INT CSentientManager::GetSubLevelId(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[dwUserId] != nullptr) + if(pMinecraft->localplayers[dwUserId] != NULL) { switch(pMinecraft->localplayers[dwUserId]->dimension) { case 0: - subLevelId = static_cast(eTelem_SubLevelId_Overworld); + subLevelId = (INT)eTelem_SubLevelId_Overworld; break; case -1: - subLevelId = static_cast(eTelem_SubLevelId_Nether); + subLevelId = (INT)eTelem_SubLevelId_Nether; break; case 1: - subLevelId = static_cast(eTelem_SubLevelId_End); + subLevelId = (INT)eTelem_SubLevelId_End; break; }; } @@ -364,7 +364,7 @@ Helps differentiate level attempts when a play plays the same mode/level - espec */ INT CSentientManager::GetLevelInstanceID() { - return static_cast(m_levelInstanceID); + return (INT)m_levelInstanceID; } /* @@ -403,19 +403,19 @@ INT CSentientManager::GetSingleOrMultiplayer() if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Single_Player); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player; } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local; } else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live; } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); + singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live; } return singleOrMultiplayer; @@ -432,16 +432,16 @@ INT CSentientManager::GetDifficultyLevel(INT diff) switch(diff) { case 0: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); + difficultyLevel = (INT)eSen_DifficultyLevel_Easiest; break; case 1: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); + difficultyLevel = (INT)eSen_DifficultyLevel_Easier; break; case 2: - difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); + difficultyLevel = (INT)eSen_DifficultyLevel_Normal; break; case 3: - difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); + difficultyLevel = (INT)eSen_DifficultyLevel_Harder; break; } @@ -461,11 +461,11 @@ INT CSentientManager::GetLicense() if(ProfileManager.IsFullVersion()) { - license = static_cast(eSen_License_Full_Purchased_Title); + license = (INT)eSen_License_Full_Purchased_Title; } else { - license = static_cast(eSen_License_Trial_or_Demo); + license = (INT)eSen_License_Trial_or_Demo; } return license; } @@ -500,15 +500,15 @@ INT CSentientManager::GetAudioSettings(DWORD dwUserId) if(volume == 0) { - audioSettings = static_cast(eSen_AudioSettings_Off); + audioSettings = (INT)eSen_AudioSettings_Off; } else if(volume == DEFAULT_VOLUME_LEVEL) { - audioSettings = static_cast(eSen_AudioSettings_On_Default); + audioSettings = (INT)eSen_AudioSettings_On_Default; } else { - audioSettings = static_cast(eSen_AudioSettings_On_CustomSetting); + audioSettings = (INT)eSen_AudioSettings_On_CustomSetting; } } return audioSettings; diff --git a/Minecraft.Client/Xbox/Sentient/SentientStats.cpp b/Minecraft.Client/Xbox/Sentient/SentientStats.cpp index ffa9392d..361d18ee 100644 --- a/Minecraft.Client/Xbox/Sentient/SentientStats.cpp +++ b/Minecraft.Client/Xbox/Sentient/SentientStats.cpp @@ -37,8 +37,8 @@ BOOL SenStatPlayerSessionStart ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 10; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -67,8 +67,8 @@ BOOL SenStatPlayerSessionExit ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 5; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -93,8 +93,8 @@ BOOL SenStatHeartBeat ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 1; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -136,8 +136,8 @@ BOOL SenStatLevelStart ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 18; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -172,8 +172,8 @@ BOOL SenStatLevelExit ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 11; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -209,8 +209,8 @@ BOOL SenStatLevelSaveOrCheckpoint ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 12; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -253,8 +253,8 @@ BOOL SenStatLevelResume ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 19; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -285,8 +285,8 @@ BOOL SenStatPauseOrInactive ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -317,8 +317,8 @@ BOOL SenStatUnpauseOrActive ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -351,8 +351,8 @@ BOOL SenStatMenuShown ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -385,8 +385,8 @@ BOOL SenStatAchievementUnlocked ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -419,8 +419,8 @@ BOOL SenStatMediaShareUpload ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -453,8 +453,8 @@ BOOL SenStatUpsellPresented ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -488,8 +488,8 @@ BOOL SenStatUpsellResponded ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 10; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -607,8 +607,8 @@ BOOL SenStatSkinChanged ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 8; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -639,8 +639,8 @@ BOOL SenStatBanLevel ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -671,8 +671,8 @@ BOOL SenStatUnBanLevel ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -705,8 +705,8 @@ BOOL SenStatTexturePackChanged ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = nullptr; - st.arrValueFlags = nullptr; + st.arrValues = NULL; + st.arrValueFlags = NULL; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing diff --git a/Minecraft.Client/Xbox/Social/SocialManager.cpp b/Minecraft.Client/Xbox/Social/SocialManager.cpp index b89fda70..b7a108bc 100644 --- a/Minecraft.Client/Xbox/Social/SocialManager.cpp +++ b/Minecraft.Client/Xbox/Social/SocialManager.cpp @@ -67,14 +67,14 @@ CSocialManager::CSocialManager() // WESTY : Not sure if we even need to get social access key! /* - m_pAccessKeyText = nullptr; + m_pAccessKeyText = NULL; m_dwAccessKeyTextSize = 0; */ - m_pMainImageBuffer = nullptr; + m_pMainImageBuffer = NULL; m_dwMainImageBufferSize = 0; - m_PostPreviewImage.pBytes = nullptr; + m_PostPreviewImage.pBytes = NULL; m_dwCurrRequestUser = -1; ZeroMemory(m_wchTitleA,sizeof(WCHAR)*MAX_SOCIALPOST_CAPTION); @@ -304,14 +304,14 @@ bool CSocialManager::AreAllUsersAllowedToPostImages() void CSocialManager::DestroyMainPostImage() { delete [] m_PostImageParams.pFullImage; - m_PostImageParams.pFullImage=nullptr; + m_PostImageParams.pFullImage=NULL; m_dwMainImageBufferSize=0; } void CSocialManager::DestroyPreviewPostImage() { XPhysicalFree( (void *)m_PostPreviewImage.pBytes ); - m_PostPreviewImage.pBytes = nullptr; + m_PostPreviewImage.pBytes = NULL; } void CSocialManager::SetSocialPostText(LPCWSTR pwchTitle, LPCWSTR pwchCaption, LPCWSTR pwchDesc) @@ -459,7 +459,7 @@ bool CSocialManager::PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DW bool bResult = false; - PBYTE pbData=nullptr; + PBYTE pbData=NULL; DWORD dwDataSize; app.GetScreenshot(dwUserIndex,&pbData,&dwDataSize); @@ -536,10 +536,10 @@ bool CSocialManager::GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, D DWORD dwResult; // Ensure that we free any previously used access key buffer. - if ( m_pAccessKeyText != nullptr ) + if ( m_pAccessKeyText != NULL ) { delete [] m_pAccessKeyText; - m_pAccessKeyText = nullptr; + m_pAccessKeyText = NULL; } // Get social network ID and permissions. @@ -554,39 +554,39 @@ bool CSocialManager::GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, D { if ( bUsingKinect ) { - dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); } } else // using standard controller interface. { - dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); } } } else // we are trying to obtain cached user access key. { - dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); + dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); } } diff --git a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp index fd8781ea..cfa92064 100644 --- a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp @@ -27,7 +27,7 @@ XMLParser::XMLParser() { m_pWritePtr = m_pWriteBuf; m_pReadPtr = m_pReadBuf; - m_pISAXCallback = nullptr; + m_pISAXCallback = NULL; m_hFile = INVALID_HANDLE_VALUE; } @@ -49,7 +49,7 @@ VOID XMLParser::FillBuffer() m_pReadPtr = m_pReadBuf; - if( m_hFile == nullptr ) + if( m_hFile == NULL ) { if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) NChars = XML_READ_BUFFER_SIZE; @@ -62,15 +62,15 @@ VOID XMLParser::FillBuffer() } else { - if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, nullptr )) + if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, NULL )) { return; } } m_dwCharsConsumed += NChars; - int64_t iProgress = m_dwCharsTotal ? (( static_cast(m_dwCharsConsumed) * 1000 ) / static_cast(m_dwCharsTotal)) : 0; - m_pISAXCallback->SetParseProgress( static_cast(iProgress) ); + int64_t iProgress = m_dwCharsTotal ? (( (int64_t)m_dwCharsConsumed * 1000 ) / (int64_t)m_dwCharsTotal) : 0; + m_pISAXCallback->SetParseProgress( (DWORD)iProgress ); m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars + 1] = '\0'; @@ -192,29 +192,30 @@ HRESULT XMLParser::ConvertEscape() // must be an entity reference WCHAR *pEntityRefVal = m_pWritePtr; + UINT EntityRefLen; SkipNextAdvance(); if( FAILED( hr = AdvanceName() ) ) return hr; - const UINT entityRefLen = static_cast(m_pWritePtr - pEntityRefVal); + EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); m_pWritePtr = pEntityRefVal; - if ( entityRefLen == 0 ) + if ( EntityRefLen == 0 ) { Error( E_INVALID_XML_SYNTAX, "Expecting entity name after &" ); return E_INVALID_XML_SYNTAX; } - if( !wcsncmp( pEntityRefVal, L"lt", entityRefLen ) ) + if( !wcsncmp( pEntityRefVal, L"lt", EntityRefLen ) ) wVal = '<'; - else if( !wcsncmp( pEntityRefVal, L"gt", entityRefLen ) ) + else if( !wcsncmp( pEntityRefVal, L"gt", EntityRefLen ) ) wVal = '>'; - else if( !wcsncmp( pEntityRefVal, L"amp", entityRefLen ) ) + else if( !wcsncmp( pEntityRefVal, L"amp", EntityRefLen ) ) wVal = '&'; - else if( !wcsncmp( pEntityRefVal, L"apos", entityRefLen ) ) + else if( !wcsncmp( pEntityRefVal, L"apos", EntityRefLen ) ) wVal = '\''; - else if( !wcsncmp( pEntityRefVal, L"quot", entityRefLen ) ) + else if( !wcsncmp( pEntityRefVal, L"quot", EntityRefLen ) ) wVal = '"'; else { @@ -358,7 +359,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail ) // Read more from the file FillBuffer(); - // We are at EOF if it is still nullptr + // We are at EOF if it is still NULL if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) { if( !bOkToFail ) @@ -497,7 +498,7 @@ HRESULT XMLParser::AdvanceElement() return hr; if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, - static_cast(m_pWritePtr - pEntityRefVal) ) ) ) + (UINT) ( m_pWritePtr - pEntityRefVal ) ) ) ) return E_ABORT; if( FAILED( hr = ConsumeSpace() ) ) @@ -540,7 +541,7 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = static_cast(m_pWritePtr - pEntityRefVal); + EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); if( FAILED( hr = ConsumeSpace() ) ) return hr; @@ -564,7 +565,8 @@ HRESULT XMLParser::AdvanceElement() // Attribute name if( FAILED( hr = AdvanceName() ) ) return hr; - Attributes[ NumAttrs ].NameLen = static_cast(m_pWritePtr - Attributes[NumAttrs].strName); + + Attributes[ NumAttrs ].NameLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName ); if( FAILED( hr = ConsumeSpace() ) ) return hr; @@ -586,8 +588,9 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceAttrVal() ) ) return hr; - Attributes[ NumAttrs ].ValueLen = static_cast(m_pWritePtr - - Attributes[NumAttrs].strValue); + Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr - + Attributes[ NumAttrs ].strValue ); + ++NumAttrs; if( FAILED( hr = ConsumeSpace() ) ) @@ -660,13 +663,13 @@ HRESULT XMLParser::AdvanceCDATA() if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE ) { - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; } } - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; @@ -779,9 +782,9 @@ HRESULT XMLParser::MainParseLoop() { if( FAILED( AdvanceCharacter( TRUE ) ) ) { - if ( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) + if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -795,9 +798,9 @@ HRESULT XMLParser::MainParseLoop() if( m_Ch == '<' ) { - if( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) + if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -835,7 +838,7 @@ HRESULT XMLParser::MainParseLoop() if( !bWhiteSpaceOnly ) { if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, - static_cast(m_pWritePtr - m_pWriteBuf), + ( UINT ) ( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) { return E_ABORT; @@ -858,7 +861,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { HRESULT hr; - if( m_pISAXCallback == nullptr ) + if( m_pISAXCallback == NULL ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -869,12 +872,11 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_pReadPtr = m_pReadBuf; m_pReadBuf[ 0 ] = '\0'; - m_pReadBuf[ 1 ] = '\0'; - m_pInXMLBuffer = nullptr; + m_pInXMLBuffer = NULL; m_uInXMLBufferCharsLeft = 0; - m_hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + m_hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); if( m_hFile == INVALID_HANDLE_VALUE ) { @@ -886,7 +888,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { LARGE_INTEGER iFileSize; GetFileSizeEx( m_hFile, &iFileSize ); - m_dwCharsTotal = static_cast(iFileSize.QuadPart); + m_dwCharsTotal = (DWORD)iFileSize.QuadPart; m_dwCharsConsumed = 0; hr = MainParseLoop(); } @@ -897,7 +899,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_hFile = INVALID_HANDLE_VALUE; // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; + m_pISAXCallback->m_strFilename = NULL; return hr; } @@ -910,7 +912,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) { HRESULT hr; - if( m_pISAXCallback == nullptr) + if( m_pISAXCallback == NULL ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -923,7 +925,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_hFile = nullptr; + m_hFile = NULL; m_pInXMLBuffer = strBuffer; m_uInXMLBufferCharsLeft = uBufferSize; m_dwCharsTotal = uBufferSize; @@ -932,7 +934,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) hr = MainParseLoop(); // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; + m_pISAXCallback->m_strFilename = NULL; return hr; } diff --git a/Minecraft.Client/Xbox/XML/ATGXmlParser.h b/Minecraft.Client/Xbox/XML/ATGXmlParser.h index 12f59737..75142e3e 100644 --- a/Minecraft.Client/Xbox/XML/ATGXmlParser.h +++ b/Minecraft.Client/Xbox/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Xbox/XML/xmlFilesCallback.h b/Minecraft.Client/Xbox/XML/xmlFilesCallback.h index 7571706e..2ea670df 100644 --- a/Minecraft.Client/Xbox/XML/xmlFilesCallback.h +++ b/Minecraft.Client/Xbox/XML/xmlFilesCallback.h @@ -47,7 +47,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - xuid=_wcstoui64(wTemp,nullptr,10); + xuid=_wcstoui64(wTemp,NULL,10); } } else if (_wcsicmp(wAttName,L"cape")==0) @@ -138,7 +138,7 @@ public: #ifdef _XBOX iValue=_wtoi(wValue); #else - iValue=wcstol(wValue, nullptr, 10); + iValue=wcstol(wValue, NULL, 10); #endif } } @@ -220,7 +220,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - uiSortIndex=wcstoul(wTemp,nullptr,16); + uiSortIndex=wcstoul(wTemp,NULL,16); } } else if (_wcsicmp(wAttName,L"Banner")==0) @@ -236,7 +236,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullFull=_wcstoui64(wTemp,nullptr,16); + ullFull=_wcstoui64(wTemp,NULL,16); } } else if (_wcsicmp(wAttName,L"Trial")==0) @@ -245,7 +245,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullTrial=_wcstoui64(wTemp,nullptr,16); + ullTrial=_wcstoui64(wTemp,NULL,16); } } else if (_wcsicmp(wAttName,L"FirstSkin")==0) @@ -286,7 +286,7 @@ public: #ifdef _XBOX iConfig=_wtoi(wConfig); #else - iConfig=wcstol(wConfig, nullptr, 10); + iConfig=wcstol(wConfig, NULL, 10); #endif } } diff --git a/Minecraft.Client/Xbox/Xbox_App.cpp b/Minecraft.Client/Xbox/Xbox_App.cpp index a717540b..eebeb827 100644 --- a/Minecraft.Client/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Xbox/Xbox_App.cpp @@ -284,10 +284,10 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bRead_TMS_XUIDS_XML=false; m_bRead_TMS_Config_XML=false; m_bRead_TMS_DLCINFO_XML=false; - m_pXuidsFileBuffer=nullptr; + m_pXuidsFileBuffer=NULL; m_dwXuidsFileSize=0; ZeroMemory(m_ScreenshotBuffer,sizeof(LPD3DXBUFFER)*XUSER_MAX_COUNT); - m_ThumbnailBuffer=nullptr; + m_ThumbnailBuffer=NULL; #ifdef _DEBUG_MENUS_ENABLED debugOverlayCreated = false; #endif @@ -301,12 +301,12 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bContainerMenuDisplayed[i]=false; m_bIgnoreAutosaveMenuDisplayed[i]=false; m_bIgnorePlayerJoinMenuDisplayed[i]=false; - m_hCurrentScene[i]=nullptr; - m_hFirstScene[i]=nullptr; + m_hCurrentScene[i]=NULL; + m_hFirstScene[i]=NULL; } m_titleDeploymentType = XTITLE_DEPLOYMENT_DOWNLOAD; - DWORD dwResult = XTitleGetDeploymentType(&m_titleDeploymentType, nullptr); + DWORD dwResult = XTitleGetDeploymentType(&m_titleDeploymentType, NULL); if( dwResult == ERROR_SUCCESS ) { switch( m_titleDeploymentType ) @@ -658,7 +658,7 @@ void CConsoleMinecraftApp::GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *previe preview->pBytes = (BYTE *)XPhysicalAlloc(sizeBytes, MAXULONG_PTR, 0, PAGE_READWRITE | PAGE_WRITECOMBINE ); memcpy( (void *)preview->pBytes, (void *)m_PreviewBuffer[iPad].pBytes, sizeBytes ); XPhysicalFree((LPVOID)m_PreviewBuffer[iPad].pBytes); - m_PreviewBuffer[iPad].pBytes = nullptr; + m_PreviewBuffer[iPad].pBytes = NULL; } void CConsoleMinecraftApp::CaptureScreenshot(int iPad) @@ -678,7 +678,7 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() HRESULT hr; // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); //#ifdef _CONTENT_PACKAGE @@ -894,7 +894,7 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() // int iStringC=0; // LPCWSTR lpTempString; // - // while((lpTempString=StringTable.Lookup(iStringC))!=nullptr) + // while((lpTempString=StringTable.Lookup(iStringC))!=NULL) // { // DebugPrintf("STRING %d = ",iStringC); // OutputDebugStringW(lpTempString); @@ -914,17 +914,17 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); if(RenderManager.IsHiDef()) { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", nullptr, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", NULL, &mainBaseScene ); } else { if(RenderManager.IsWidescreen()) { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", nullptr, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", NULL, &mainBaseScene ); } else { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base_480.xur", nullptr, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base_480.xur", NULL, &mainBaseScene ); } } if( FAILED(hr) ) app.FatalLoadError(); @@ -989,7 +989,7 @@ HRESULT CConsoleMinecraftApp::RegisterFont(eFont eFontLanguage,eFont eFontFallba HRESULT hr=S_OK; const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", wchTypefaceLocatorA[eFontLanguage]); // 4J Stu - Check that the font file actually exists @@ -1003,7 +1003,7 @@ HRESULT CConsoleMinecraftApp::RegisterFont(eFont eFontLanguage,eFont eFontFallba { if(eFontFallback!=eFont_None) { - hr = RegisterDefaultTypeface( wchTypefaceA[eFontLanguage],szResourceLocator,nullptr,0.0f,wchTypefaceA[eFontFallback]); + hr = RegisterDefaultTypeface( wchTypefaceA[eFontLanguage],szResourceLocator,NULL,0.0f,wchTypefaceA[eFontFallback]); } else { @@ -1410,7 +1410,7 @@ void CConsoleMinecraftApp::OverrideFontRenderer(bool set, bool immediate) } else { - XuiFontSetRenderer( nullptr ); + XuiFontSetRenderer( NULL ); } m_bFontRendererOverridden = set; @@ -1451,7 +1451,7 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) { // on a save caused by a create world, the thumbnail capture won't have happened - if(m_ThumbnailBuffer!=nullptr) + if(m_ThumbnailBuffer!=NULL) { if( pbData ) { @@ -1460,28 +1460,28 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) memcpy(*pbData,m_ThumbnailBuffer->GetBufferPointer(),*pdwSize); } m_ThumbnailBuffer->Release(); - m_ThumbnailBuffer=nullptr; + m_ThumbnailBuffer=NULL; } } void CConsoleMinecraftApp::ReleaseSaveThumbnail() { - if(m_ThumbnailBuffer!=nullptr) + if(m_ThumbnailBuffer!=NULL) { m_ThumbnailBuffer->Release(); - m_ThumbnailBuffer=nullptr; + m_ThumbnailBuffer=NULL; } } void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) { // on a save caused by a create world, the thumbnail capture won't have happened - if(m_ScreenshotBuffer[iPad]!=nullptr) + if(m_ScreenshotBuffer[iPad]!=NULL) { *pbData= new BYTE [m_ScreenshotBuffer[iPad]->GetBufferSize()]; *pdwSize=m_ScreenshotBuffer[iPad]->GetBufferSize(); memcpy(*pbData,m_ScreenshotBuffer[iPad]->GetBufferPointer(),*pdwSize); m_ScreenshotBuffer[iPad]->Release(); - m_ScreenshotBuffer[iPad]=nullptr; + m_ScreenshotBuffer[iPad]=NULL; } } @@ -1492,13 +1492,13 @@ void CConsoleMinecraftApp::EnableDebugOverlay(bool enable,int iPad) if(enable && !debugOverlayCreated) { - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); - hr = XuiSceneCreate(szResourceLocator, L"xuiscene_debugoverlay.xur", nullptr, &m_hDebugOverlay); + hr = XuiSceneCreate(szResourceLocator, L"xuiscene_debugoverlay.xur", NULL, &m_hDebugOverlay); debugContainerScene.AddChild(m_hDebugOverlay); debugContainerScene.SetShow(false); @@ -1644,7 +1644,7 @@ WCHAR *CConsoleMinecraftApp::GetSceneName(EUIScene eScene,bool bAppendToName,boo return m_SceneName; } -HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *initData /* = nullptr */, bool forceUsePad /*= false*/, BOOL bStayVisible /* = FALSE */, HXUIOBJ *phResultingScene /*= nullptr*/ ) +HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *initData /* = NULL */, bool forceUsePad /*= false*/, BOOL bStayVisible /* = FALSE */, HXUIOBJ *phResultingScene /*= NULL*/ ) { ASSERT(m_bDefaultTypefaceRegistered); ASSERT(m_bSkinLoaded); @@ -1690,7 +1690,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in } // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); HXUIOBJ hScene; HRESULT hr; @@ -1701,7 +1701,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in // If the init data is null, put the player pad in there - if(initData==nullptr) + if(initData==NULL) { initData = &iPad; } @@ -1843,7 +1843,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in m_bPauseMenuDisplayed[iPad] = true; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; @@ -1883,7 +1883,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in break; } - if(phResultingScene!=nullptr) + if(phResultingScene!=NULL) { *phResultingScene=hScene; } @@ -1997,7 +1997,7 @@ HRESULT CConsoleMinecraftApp::CloseXuiScenes(int iPad, bool forceUsePad /*= fals } Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) + if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; @@ -2132,7 +2132,7 @@ HRESULT CConsoleMinecraftApp::RemoveBackScene(int iPad) } } - XuiSceneSetBackScene(hBack, nullptr); + XuiSceneSetBackScene(hBack, NULL); XuiDestroyObject( hBack ); } } @@ -2163,7 +2163,7 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() // unload any texture pack audio // if there is audio in use, clear out the audio, and unmount the pack TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=nullptr; + DLCTexturePack *pDLCTexPack=NULL; if(pTexPack->hasAudio()) { @@ -2179,11 +2179,11 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() // need to stop the streaming audio - by playing streaming audio from the default texture pack now pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); - if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) + if(pDLCTexPack->m_pStreamedWaveBank!=NULL) { pDLCTexPack->m_pStreamedWaveBank->Destroy(); } - if(pDLCTexPack->m_pSoundBank!=nullptr) + if(pDLCTexPack->m_pSoundBank!=NULL) { pDLCTexPack->m_pSoundBank->Destroy(); } @@ -2193,7 +2193,7 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() g_NetworkManager.ForceFriendsSessionRefresh(); - hr = NavigateToScene(XUSER_INDEX_ANY,eUIScene_MainMenu,nullptr); + hr = NavigateToScene(XUSER_INDEX_ANY,eUIScene_MainMenu,NULL); return hr; } @@ -2217,7 +2217,7 @@ void CConsoleMinecraftApp::SetChatTextDisplayed(int iPad, bool bVal) void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, bool bForce /*= false*/) { - if(m_hFirstChatScene[iPad] == nullptr || m_hCurrentChatScene[iPad] == nullptr) return; + if(m_hFirstChatScene[iPad] == NULL || m_hCurrentChatScene[iPad] == NULL) return; // Re-create the chat scene so it is the correct size. It starts without any visible lines. BOOL chatSceneVisible = FALSE; @@ -2236,7 +2236,7 @@ void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, { if( m_hFirstChatScene[iPad] != m_hCurrentChatScene[iPad] ) XuiSceneNavigateBack(m_hCurrentChatScene[iPad], m_hFirstChatScene[iPad],iPad); m_hCurrentChatScene[iPad] = m_hFirstChatScene[iPad]; - app.NavigateToScene(iPad,eUIComponent_Chat,nullptr,true); + app.NavigateToScene(iPad,eUIComponent_Chat,NULL,true); XuiElementSetShow( m_hCurrentChatScene[iPad], chatSceneVisible); } @@ -2298,7 +2298,7 @@ void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, void CConsoleMinecraftApp::ReloadHudScene(int iPad, bool bJoining /*= false*/, bool bForce /*= false*/) { - if(m_hFirstHudScene[iPad] == nullptr || m_hCurrentHudScene[iPad] == nullptr) return; + if(m_hFirstHudScene[iPad] == NULL || m_hCurrentHudScene[iPad] == NULL) return; // Re-create the hud scene so it is the correct size. It starts without any visible lines. BOOL hudSceneVisible = FALSE; @@ -2317,7 +2317,7 @@ void CConsoleMinecraftApp::ReloadHudScene(int iPad, bool bJoining /*= false*/, b { if( m_hFirstHudScene[iPad] != m_hCurrentHudScene[iPad] ) XuiSceneNavigateBack(m_hCurrentHudScene[iPad], m_hFirstHudScene[iPad],iPad); m_hCurrentHudScene[iPad] = m_hFirstHudScene[iPad]; - app.NavigateToScene(iPad,eUIScene_HUD,nullptr,true); + app.NavigateToScene(iPad,eUIScene_HUD,NULL,true); XuiElementSetShow( m_hCurrentHudScene[iPad], hudSceneVisible); } @@ -2333,7 +2333,7 @@ void CConsoleMinecraftApp::AdjustSplitscreenScene(HXUIOBJ hScene,D3DXVECTOR3 *pv XuiElementGetPosition(hScene,pvOriginalPosition); vec=*pvOriginalPosition; - if( pMinecraft->localplayers[iPad] != nullptr ) + if( pMinecraft->localplayers[iPad] != NULL ) { switch( pMinecraft->localplayers[iPad]->m_iScreenSection) { @@ -2382,7 +2382,7 @@ void CConsoleMinecraftApp::AdjustSplitscreenScene(HXUIOBJ hScene,D3DXVECTOR3 *pv vec=*pvOriginalPosition; - if( pMinecraft->localplayers[iPad] != nullptr ) + if( pMinecraft->localplayers[iPad] != NULL ) { switch( pMinecraft->localplayers[iPad]->m_iScreenSection) { @@ -2449,7 +2449,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen // 4J Stu - Return S_FALSE to inidicate that the scene has been closed return S_FALSE; } - else if ( pMinecraft->localplayers[iPad] != nullptr ) + else if ( pMinecraft->localplayers[iPad] != NULL ) { // we need to reposition the scenes since the players will have moved around @@ -2510,7 +2510,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen // 4J Stu - Return S_FALSE to inidicate that the scene has been closed return S_FALSE; } - else if ( pMinecraft->localplayers[iPad] != nullptr ) + else if ( pMinecraft->localplayers[iPad] != NULL ) { // we need to reposition the scenes since the players will have moved around @@ -2560,7 +2560,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen void CConsoleMinecraftApp::StoreLaunchData() { - LD_DEMO* pDemoData = nullptr; + LD_DEMO* pDemoData = NULL; DWORD dwStatus = XGetLaunchDataSize( &m_dwLaunchDataSize ); @@ -2578,7 +2578,7 @@ void CConsoleMinecraftApp::StoreLaunchData() void CConsoleMinecraftApp::ExitGame() { - if(m_pLaunchData!=nullptr) + if(m_pLaunchData!=NULL) { LD_DEMO* pDemoData = (LD_DEMO*)( m_pLaunchData ); XSetLaunchData( pDemoData, m_dwLaunchDataSize ); @@ -2605,7 +2605,7 @@ void CConsoleMinecraftApp::FatalLoadError(void) memset(&MessageBoxOverlap, 0, sizeof(MessageBoxOverlap)); - //HANDLE messageBoxThread = CreateThread(nullptr, 0, &CMinecraftApp::ShowFatalLoadMessageBoxThreadProc, &MessageBoxOverlap, 0, nullptr); + //HANDLE messageBoxThread = CreateThread(NULL, 0, &CMinecraftApp::ShowFatalLoadMessageBoxThreadProc, &MessageBoxOverlap, 0, NULL); // //WaitForSingleObjectEx(messageBoxThread, // handle to object // 20000, // time-out interval @@ -2775,7 +2775,7 @@ int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile) if(iTMSFileIndex!=-1) { // can we find the tms file in our xzp? - if(TMSFileA[iTMSFileIndex].pbData==nullptr) // if we haven't already loaded it + if(TMSFileA[iTMSFileIndex].pbData==NULL) // if we haven't already loaded it { swprintf(szResourceLocator, LOCATOR_SIZE, L"%ls#TMSFiles/%ls",m_wchTMSXZP, wchTMSFile); @@ -2793,10 +2793,10 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) { if((eType==eTMSFileType_All) ||(eType==TMSFileA[i].eTMSType)) { - if(TMSFileA[i].pbData!=nullptr) + if(TMSFileA[i].pbData!=NULL) { XuiFree(TMSFileA[i].pbData); - TMSFileA[i].pbData=nullptr; + TMSFileA[i].pbData=NULL; TMSFileA[i].uiSize=0; } } @@ -2807,148 +2807,148 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) TMS_FILE CConsoleMinecraftApp::TMSFileA[TMS_COUNT] = { // skin packs - { L"SP1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SP2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SP3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SP4", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SP5", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SP6", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPF", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPB", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPC", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPZ", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPM", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPI", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"SPG", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP4", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP5", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP6", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPF", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPB", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPC", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPZ", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPM", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPI", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SPG", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, //themes - { L"ThSt", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"ThIr", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"ThGo", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"ThDi", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, - { L"ThAw", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"ThSt", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"ThIr", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"ThGo", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"ThDi", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"ThAw", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, //gamerpics - { L"GPAn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPCo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPEn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPFo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPTo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPBA", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPFa", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPME", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPMF", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPMM", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPSE", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPAn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPCo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPEn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPFo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPTo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPBA", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPFa", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPME", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPMF", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPMM", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPSE", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPOr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPMi", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPMB", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPBr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPOr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPMi", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPMB", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPBr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPM1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPM2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPM3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPM1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPM2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPM3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, //avatar items - { L"AH_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AH_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0027", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0028", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0029", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0030", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0031", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0032", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0033", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0027", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0028", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0029", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0030", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0031", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0032", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0033", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AA_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0 }, + { L"AA_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0 }, // Mash-up Packs - { L"MPMA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"MPMA", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1024 }, - { L"MPSR", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"MPSR", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1025 }, - { L"MPHA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"MPHA", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1026 }, + { L"MPMA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"MPMA", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1024 }, + { L"MPSR", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"MPSR", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1025 }, + { L"MPHA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"MPHA", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1026 }, // Texture Packs - { L"TP01", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP01", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2049 }, - { L"TP02", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP02", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2053 }, - { L"TP04", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP04", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2051 }, - { L"TP05", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP05", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2054 }, - { L"TP06", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP06", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2050 }, - { L"TP07", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"TP07", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2055 }, + { L"TP01", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP01", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2049 }, + { L"TP02", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP02", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2053 }, + { L"TP04", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP04", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2051 }, + { L"TP05", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP05", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2054 }, + { L"TP06", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP06", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2050 }, + { L"TP07", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"TP07", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2055 }, }; diff --git a/Minecraft.Client/Xbox/Xbox_App.h b/Minecraft.Client/Xbox/Xbox_App.h index 86dbc287..f64e7142 100644 --- a/Minecraft.Client/Xbox/Xbox_App.h +++ b/Minecraft.Client/Xbox/Xbox_App.h @@ -121,7 +121,7 @@ private: public: - void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false); + void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false); // void ReadXuidsFileFromTMS(int iPad,eTMSAction NextAction,bool bCallback); // void ReadDLCFileFromTMS(int iPad,eTMSAction NextAction, bool bCallback); @@ -133,12 +133,12 @@ public: WCHAR *GetSceneName(EUIScene eScene, bool bAppendToName,bool bSplitscreenScene); - virtual HRESULT NavigateToScene(int iPad,EUIScene eScene, void *initData = nullptr, bool forceUsePad = false, BOOL bStayVisible=FALSE, HXUIOBJ *phResultingScene=nullptr); + virtual HRESULT NavigateToScene(int iPad,EUIScene eScene, void *initData = NULL, bool forceUsePad = false, BOOL bStayVisible=FALSE, HXUIOBJ *phResultingScene=NULL); virtual HRESULT NavigateBack(int iPad, bool forceUsePad = false,EUIScene eScene = eUIScene_COUNT); virtual HRESULT TutorialSceneNavigateBack(int iPad, bool forceUsePad = false); virtual HRESULT CloseXuiScenes(int iPad, bool forceUsePad = false); virtual HRESULT CloseAllPlayersXuiScenes(); - virtual HRESULT CloseXuiScenesAndNavigateToScene(int iPad,EUIScene eScene, void *initData=nullptr, bool forceUsePad = false); + virtual HRESULT CloseXuiScenesAndNavigateToScene(int iPad,EUIScene eScene, void *initData=NULL, bool forceUsePad = false); virtual HRESULT RemoveBackScene(int iPad); virtual HRESULT NavigateToHomeMenu(); D3DXVECTOR3 GetElementScreenPosition(HXUIOBJ hObj); diff --git a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp index 6606dacf..04e4a8d5 100644 --- a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp @@ -285,7 +285,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - nullptr, + NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -399,7 +399,7 @@ int __cdecl main() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -671,7 +671,7 @@ int __cdecl main() else { MemSect(28); - pMinecraft->soundEngine->tick(nullptr, 0.0f); + pMinecraft->soundEngine->tick(NULL, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); diff --git a/Minecraft.Client/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Xbox/Xbox_UIController.cpp index 669b037a..51d91ca4 100644 --- a/Minecraft.Client/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Xbox/Xbox_UIController.cpp @@ -170,7 +170,7 @@ void ConsoleUIController::HandleDLCInstalled(int iPad) CustomMessage_DLCInstalled( &xuiMsg ); // The DLC message should only happen in the main menus, so it should go to the default xui scenes - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { @@ -188,7 +188,7 @@ void ConsoleUIController::HandleTMSDLCFileRetrieved(int iPad) XUIMessage xuiMsg; CustomMessage_TMS_DLCFileRetrieved( &xuiMsg ); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { @@ -204,7 +204,7 @@ void ConsoleUIController::HandleTMSBanFileRetrieved(int iPad) { XUIMessage xuiMsg; CustomMessage_TMS_BanFileRetrieved( &xuiMsg ); - bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { @@ -319,7 +319,7 @@ C4JStorage::EMessageResult ConsoleUIController::RequestMessageBox(UINT uiTitle, return StorageManager.RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pStringTable, pwchFormatString, dwFocusButton); } -C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) +C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) { // Default title / messages if (title == -1) @@ -337,5 +337,5 @@ C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/ UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - return ui.RequestMessageBox(title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), nullptr, 0, false); + return ui.RequestMessageBox(title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); } \ No newline at end of file diff --git a/Minecraft.Client/Xbox/Xbox_UIController.h b/Minecraft.Client/Xbox/Xbox_UIController.h index cd460596..2b273ee5 100644 --- a/Minecraft.Client/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Xbox/Xbox_UIController.h @@ -11,7 +11,7 @@ public: virtual void StartReloadSkinThread(); virtual bool IsReloadingSkin(); virtual void CleanUpSkinReload(); - virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); + virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT); virtual void NavigateToHomeMenu(); virtual void CloseUIScenes(int iPad, bool forceIPad = false); @@ -71,9 +71,9 @@ public: virtual void SetWinUserIndex(unsigned int iPad); virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, CXuiStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0, bool bIsError = true); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, CXuiStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true); - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); + C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); }; extern ConsoleUIController ui; \ No newline at end of file diff --git a/Minecraft.Client/ZombieRenderer.cpp b/Minecraft.Client/ZombieRenderer.cpp index 10d13b26..7fd2d201 100644 --- a/Minecraft.Client/ZombieRenderer.cpp +++ b/Minecraft.Client/ZombieRenderer.cpp @@ -14,11 +14,11 @@ ZombieRenderer::ZombieRenderer() : HumanoidMobRenderer(new ZombieModel(), .5f, 1 defaultModel = humanoidModel; villagerModel = new VillagerZombieModel(); - defaultArmorParts1 = nullptr; - defaultArmorParts2 = nullptr; + defaultArmorParts1 = NULL; + defaultArmorParts2 = NULL; - villagerArmorParts1 = nullptr; - villagerArmorParts2 = nullptr; + villagerArmorParts1 = NULL; + villagerArmorParts2 = NULL; createArmorParts(); } @@ -98,7 +98,7 @@ void ZombieRenderer::swapArmor(shared_ptr mob) armorParts2 = defaultArmorParts2; } - humanoidModel = static_cast(model); + humanoidModel = (HumanoidModel *) model; } void ZombieRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) @@ -106,7 +106,7 @@ void ZombieRenderer::setupRotations(shared_ptr _mob, float bob, fl shared_ptr mob = dynamic_pointer_cast(_mob); if (mob->isConverting()) { - bodyRot += static_cast(cos(mob->tickCount * 3.25) * PI * .25f); + bodyRot += (float) (cos(mob->tickCount * 3.25) * PI * .25f); } HumanoidMobRenderer::setupRotations(mob, bob, bodyRot, a); } \ No newline at end of file diff --git a/Minecraft.Client/glWrapper.cpp b/Minecraft.Client/glWrapper.cpp index 9c3c8559..a356e674 100644 --- a/Minecraft.Client/glWrapper.cpp +++ b/Minecraft.Client/glWrapper.cpp @@ -62,7 +62,7 @@ void glOrtho(float left,float right,float bottom,float top,float zNear,float zFa void glScaled(double x,double y,double z) { - RenderManager.MatrixScale(static_cast(x),static_cast(y),static_cast(z)); + RenderManager.MatrixScale((float)x,(float)y,(float)z); } void glGetFloat(int type, FloatBuffer *buff) diff --git a/Minecraft.Client/stubs.h b/Minecraft.Client/stubs.h index 10ba2d05..f4ae056f 100644 --- a/Minecraft.Client/stubs.h +++ b/Minecraft.Client/stubs.h @@ -170,15 +170,15 @@ class ZipFile { public: ZipFile(File *file) {} - InputStream *getInputStream(ZipEntry *entry) { return nullptr; } - ZipEntry *getEntry(const wstring& name) {return nullptr;} + InputStream *getInputStream(ZipEntry *entry) { return NULL; } + ZipEntry *getEntry(const wstring& name) {return NULL;} void close() {} }; class ImageIO { public: - static BufferedImage *read(InputStream *in) { return nullptr; } + static BufferedImage *read(InputStream *in) { return NULL; } }; class Keyboard diff --git a/Minecraft.World/AABB.cpp b/Minecraft.World/AABB.cpp index af0501b4..f8e13497 100644 --- a/Minecraft.World/AABB.cpp +++ b/Minecraft.World/AABB.cpp @@ -8,7 +8,7 @@ #include "HitResult.h" DWORD AABB::tlsIdx = 0; -AABB::ThreadStorage *AABB::tlsDefault = nullptr; +AABB::ThreadStorage *AABB::tlsDefault = NULL; AABB::ThreadStorage::ThreadStorage() { @@ -25,7 +25,7 @@ AABB::ThreadStorage::~ThreadStorage() void AABB::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == nullptr ) + if(tlsDefault == NULL ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -41,7 +41,7 @@ void AABB::UseDefaultThreadStorage() void AABB::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if( tls == tlsDefault ) return; delete tls; @@ -62,7 +62,7 @@ void AABB::resetPool() AABB *AABB::newTemp(double x0, double y0, double z0, double x1, double y1, double z1) { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); AABB *thisAABB = &tls->pool[tls->poolPointer]; thisAABB->set(x0, y0, z0, x1, y1, z1); tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE; @@ -286,23 +286,23 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b) Vec3 *zh0 = a->clipZ(b, z0); Vec3 *zh1 = a->clipZ(b, z1); - if (!containsX(xh0)) xh0 = nullptr; - if (!containsX(xh1)) xh1 = nullptr; - if (!containsY(yh0)) yh0 = nullptr; - if (!containsY(yh1)) yh1 = nullptr; - if (!containsZ(zh0)) zh0 = nullptr; - if (!containsZ(zh1)) zh1 = nullptr; + if (!containsX(xh0)) xh0 = NULL; + if (!containsX(xh1)) xh1 = NULL; + if (!containsY(yh0)) yh0 = NULL; + if (!containsY(yh1)) yh1 = NULL; + if (!containsZ(zh0)) zh0 = NULL; + if (!containsZ(zh1)) zh1 = NULL; - Vec3 *closest = nullptr; + Vec3 *closest = NULL; - if (xh0 != nullptr && (closest == nullptr || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; - if (xh1 != nullptr && (closest == nullptr || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; - if (yh0 != nullptr && (closest == nullptr || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; - if (yh1 != nullptr && (closest == nullptr || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; - if (zh0 != nullptr && (closest == nullptr || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; - if (zh1 != nullptr && (closest == nullptr || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; + if (xh0 != NULL && (closest == NULL || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; + if (xh1 != NULL && (closest == NULL || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; + if (yh0 != NULL && (closest == NULL || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; + if (yh1 != NULL && (closest == NULL || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; + if (zh0 != NULL && (closest == NULL || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; + if (zh1 != NULL && (closest == NULL || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; - if (closest == nullptr) return nullptr; + if (closest == NULL) return NULL; int face = -1; @@ -319,19 +319,19 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b) bool AABB::containsX(Vec3 *v) { - if (v == nullptr) return false; + if (v == NULL) return false; return v->y >= y0 && v->y <= y1 && v->z >= z0 && v->z <= z1; } bool AABB::containsY(Vec3 *v) { - if (v == nullptr) return false; + if (v == NULL) return false; return v->x >= x0 && v->x <= x1 && v->z >= z0 && v->z <= z1; } bool AABB::containsZ(Vec3 *v) { - if (v == nullptr) return false; + if (v == NULL) return false; return v->x >= x0 && v->x <= x1 && v->y >= y0 && v->y <= y1; } diff --git a/Minecraft.World/AbstractContainerMenu.cpp b/Minecraft.World/AbstractContainerMenu.cpp index 1fd400e5..57b0b177 100644 --- a/Minecraft.World/AbstractContainerMenu.cpp +++ b/Minecraft.World/AbstractContainerMenu.cpp @@ -29,7 +29,7 @@ AbstractContainerMenu::~AbstractContainerMenu() Slot *AbstractContainerMenu::addSlot(Slot *slot) { - slot->index = static_cast(slots.size()); + slot->index = (int)slots.size(); slots.push_back(slot); lastSlots.push_back(nullptr); return slot; @@ -80,7 +80,7 @@ void AbstractContainerMenu::broadcastChanges() { // 4J Stu - Added 0 count check. There is a bug in the Java with anvils that means this broadcast // happens while we are in the middle of quickmoving, and before the slot properly gets set to null - expected = (current == nullptr || current->count == 0) ? nullptr : current->copy(); + expected = (current == NULL || current->count == 0) ? nullptr : current->copy(); lastSlots[i] = expected; m_bNeedsRendered = true; @@ -103,7 +103,7 @@ bool AbstractContainerMenu::needsRendered() shared_ptr expected = lastSlots.at(i); if (!ItemInstance::matches(expected, current)) { - expected = current == nullptr ? nullptr : current->copy(); + expected = current == NULL ? nullptr : current->copy(); lastSlots[i] = expected; needsRendered = true; } @@ -126,7 +126,7 @@ Slot *AbstractContainerMenu::getSlotFor(shared_ptr c, int index) return slot; } } - return nullptr; + return NULL; } Slot *AbstractContainerMenu::getSlot(int index) @@ -137,7 +137,7 @@ Slot *AbstractContainerMenu::getSlot(int index) shared_ptr AbstractContainerMenu::quickMoveStack(shared_ptr player, int slotIndex) { Slot *slot = slots.at(slotIndex); - if (slot != nullptr) + if (slot != NULL) { return slot->getItem(); } @@ -158,7 +158,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { resetQuickCraft(); } - else if (inventory->getCarried() == nullptr) + else if (inventory->getCarried() == NULL) { resetQuickCraft(); } @@ -180,7 +180,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { Slot *slot = slots.at(slotIndex); - if (slot != nullptr && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot)) + if (slot != NULL && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot)) { quickcraftSlots.insert(slot); } @@ -231,7 +231,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { if (slotIndex == SLOT_CLICKED_OUTSIDE) { - if (inventory->getCarried() != nullptr) + if (inventory->getCarried() != NULL) { if (slotIndex == SLOT_CLICKED_OUTSIDE) { @@ -253,10 +253,10 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { if (slotIndex < 0) return nullptr; Slot *slot = slots.at(slotIndex); - if(slot != nullptr && slot->mayPickup(player)) + if(slot != NULL && slot->mayPickup(player)) { shared_ptr piiClicked = quickMoveStack(player, slotIndex); - if (piiClicked != nullptr) + if (piiClicked != NULL) { int oldType = piiClicked->id; @@ -269,14 +269,14 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto // 4J Stu - Remove the reference to this before we start a recursive loop piiClicked = nullptr; - if (slot != nullptr) + if (slot != NULL) { - if (slot->getItem() != nullptr && slot->getItem()->id == oldType) + if (slot->getItem() != NULL && slot->getItem()->id == oldType) { if(looped) { // Return a non-null value to indicate that we want to loop more - clickedEntity = std::make_shared(0, 1, 0); + clickedEntity = shared_ptr(new ItemInstance(0,1,0)); } else { @@ -293,19 +293,19 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slotIndex < 0) return nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr) + if (slot != NULL) { shared_ptr clicked = slot->getItem(); shared_ptr carried = inventory->getCarried(); - if (clicked != nullptr) + if (clicked != NULL) { clickedEntity = clicked->copy(); } - if (clicked == nullptr) + if (clicked == NULL) { - if (carried != nullptr && slot->mayPlace(carried)) + if (carried != NULL && slot->mayPlace(carried)) { int c = buttonNum == 0 ? carried->count : 1; if (c > slot->getMaxStackSize()) @@ -326,7 +326,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto else if (buttonNum == 1 && mayCombine(slot, carried)) { shared_ptr combined = slot->combine(carried); - if(combined != nullptr) + if(combined != NULL) { slot->set(combined); if(!player->abilities.instabuild) carried->remove(1); @@ -338,7 +338,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto } else if (slot->mayPickup(player)) { - if (carried == nullptr) + if (carried == NULL) { // pick up to empty hand int c = buttonNum == 0 ? clicked->count : (clicked->count + 1) / 2; @@ -412,7 +412,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slot->mayPickup(player)) { shared_ptr current = inventory->getItem(buttonNum); - bool canMove = current == nullptr || (slot->container == inventory && slot->mayPlace(current)); + bool canMove = current == NULL || (slot->container == inventory && slot->mayPlace(current)); int freeSlot = -1; if (!canMove) @@ -426,7 +426,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto shared_ptr taking = slot->getItem(); inventory->setItem(buttonNum, taking); - if ((slot->container == inventory && slot->mayPlace(current)) || current == nullptr) + if ((slot->container == inventory && slot->mayPlace(current)) || current == NULL) { slot->remove(taking->count); slot->set(current); @@ -440,47 +440,47 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto slot->onTake(player, taking); } } - else if (!slot->hasItem() && current != nullptr && slot->mayPlace(current)) + else if (!slot->hasItem() && current != NULL && slot->mayPlace(current)) { inventory->setItem(buttonNum, nullptr); slot->set(current); } } } - else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == nullptr && slotIndex >= 0) + else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == NULL && slotIndex >= 0) { Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr copy = slot->getItem()->copy(); copy->count = copy->getMaxStackSize(); inventory->setCarried(copy); } } - else if (clickType == CLICK_THROW && inventory->getCarried() == nullptr && slotIndex >= 0) + else if (clickType == CLICK_THROW && inventory->getCarried() == NULL && slotIndex >= 0) { Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem() && slot->mayPickup(player)) + if (slot != NULL && slot->hasItem() && slot->mayPickup(player)) { shared_ptr item = slot->remove(buttonNum == 0 ? 1 : slot->getItem()->count); slot->onTake(player, item); player->drop(item); } } - else if (clickType == CLICK_PICKUP_ALL && slotIndex >= 0) + else if (clickType == CLICK_PICKUP_ALL && slotIndex >= 0) { Slot *slot = slots.at(slotIndex); shared_ptr carried = inventory->getCarried(); - if (carried != nullptr && (slot == nullptr || !slot->hasItem() || !slot->mayPickup(player))) + if (carried != NULL && (slot == NULL || !slot->hasItem() || !slot->mayPickup(player))) { - int start = buttonNum == 0 ? 0 : static_cast(slots.size()) - 1; + int start = buttonNum == 0 ? 0 : slots.size() - 1; int step = buttonNum == 0 ? 1 : -1; for (int pass = 0; pass < 2; pass++ ) { // In the first pass, we only get partial stacks. - for (size_t i = start; i >= 0 && i < static_cast(slots.size()) && carried->count < carried->getMaxStackSize(); i += step) + for (int i = start; i >= 0 && i < slots.size() && carried->count < carried->getMaxStackSize(); i += step) { Slot *target = slots.at(i); @@ -514,7 +514,7 @@ bool AbstractContainerMenu::canTakeItemForPickAll(shared_ptr carri // 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr player) { - while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != nullptr) + while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != NULL) { } } @@ -527,7 +527,7 @@ bool AbstractContainerMenu::mayCombine(Slot *slot, shared_ptr item void AbstractContainerMenu::removed(shared_ptr player) { shared_ptr inventory = player->inventory; - if (inventory->getCarried() != nullptr) + if (inventory->getCarried() != NULL) { player->drop(inventory->getCarried()); inventory->setCarried(nullptr); @@ -605,7 +605,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, Slot *slot = slots.at(destSlot); shared_ptr target = slot->getItem(); - if (target != nullptr && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue()) + if (target != NULL && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue()) && ItemInstance::tagMatches(itemStack, target) ) { int totalStack = target->count + itemStack->count; @@ -652,7 +652,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, Slot *slot = slots.at(destSlot); shared_ptr target = slot->getItem(); - if (target == nullptr) + if (target == NULL) { slot->set(itemStack->copy()); slot->setChanged(); @@ -707,9 +707,9 @@ void AbstractContainerMenu::resetQuickCraft() bool AbstractContainerMenu::canItemQuickReplace(Slot *slot, shared_ptr item, bool ignoreSize) { - bool canReplace = slot == nullptr || !slot->hasItem(); + bool canReplace = slot == NULL || !slot->hasItem(); - if (slot != nullptr && slot->hasItem() && item != nullptr && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item)) + if (slot != NULL && slot->hasItem() && item != NULL && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item)) { canReplace |= slot->getItem()->count + (ignoreSize ? 0 : item->count) <= item->getMaxStackSize(); } @@ -722,7 +722,7 @@ void AbstractContainerMenu::getQuickCraftSlotCount(unordered_set *quickC switch (quickCraftingType) { case QUICKCRAFT_TYPE_CHARITABLE: - item->count = Mth::floor(item->count / static_cast(quickCraftSlots->size())); + item->count = Mth::floor(item->count / (float) quickCraftSlots->size()); break; case QUICKCRAFT_TYPE_GREEDY: item->count = 1; @@ -739,7 +739,7 @@ bool AbstractContainerMenu::canDragTo(Slot *slot) int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr container) { - if (container == nullptr) return 0; + if (container == NULL) return 0; int count = 0; float totalPct = 0; @@ -747,9 +747,9 @@ int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { - totalPct += item->count / static_cast(min(container->getMaxStackSize(), item->getMaxStackSize())); + totalPct += item->count / (float) min(container->getMaxStackSize(), item->getMaxStackSize()); count++; } } diff --git a/Minecraft.World/AbstractContainerMenu.h b/Minecraft.World/AbstractContainerMenu.h index 9c7600ce..5ac115de 100644 --- a/Minecraft.World/AbstractContainerMenu.h +++ b/Minecraft.World/AbstractContainerMenu.h @@ -35,7 +35,7 @@ public: static const int CONTAINER_ID_INVENTORY = 0; static const int CONTAINER_ID_CREATIVE = -2; - vector> lastSlots; + vector > lastSlots; vector slots; int containerId; @@ -95,7 +95,7 @@ public: virtual bool stillValid(shared_ptr player) = 0; // 4J Stu Added for UI - unsigned int getSize() { return static_cast(slots.size()); } + unsigned int getSize() { return (unsigned int)slots.size(); } protected: diff --git a/Minecraft.World/Achievement.cpp b/Minecraft.World/Achievement.cpp index e449f776..2c0d85d4 100644 --- a/Minecraft.World/Achievement.cpp +++ b/Minecraft.World/Achievement.cpp @@ -58,7 +58,7 @@ bool Achievement::isAchievement() wstring Achievement::getDescription() { - if (descFormatter != nullptr) + if (descFormatter != NULL) { return descFormatter->format(desc); } diff --git a/Minecraft.World/Achievements.cpp b/Minecraft.World/Achievements.cpp index 1b00acc0..a3d33cbd 100644 --- a/Minecraft.World/Achievements.cpp +++ b/Minecraft.World/Achievements.cpp @@ -17,79 +17,79 @@ int Achievements::yMax = 0; vector *Achievements::achievements = new vector; -Achievement *Achievements::openInventory = nullptr; -Achievement *Achievements::mineWood = nullptr; -Achievement *Achievements::buildWorkbench = nullptr; -Achievement *Achievements::buildPickaxe = nullptr; -Achievement *Achievements::buildFurnace = nullptr; -Achievement *Achievements::acquireIron = nullptr; -Achievement *Achievements::buildHoe = nullptr; -Achievement *Achievements::makeBread = nullptr; -Achievement *Achievements::bakeCake = nullptr; -Achievement *Achievements::buildBetterPickaxe = nullptr; -Achievement *Achievements::cookFish = nullptr; -Achievement *Achievements::onARail = nullptr; -Achievement *Achievements::buildSword = nullptr; -Achievement *Achievements::killEnemy = nullptr; -Achievement *Achievements::killCow = nullptr; -Achievement *Achievements::flyPig = nullptr; +Achievement *Achievements::openInventory = NULL; +Achievement *Achievements::mineWood = NULL; +Achievement *Achievements::buildWorkbench = NULL; +Achievement *Achievements::buildPickaxe = NULL; +Achievement *Achievements::buildFurnace = NULL; +Achievement *Achievements::acquireIron = NULL; +Achievement *Achievements::buildHoe = NULL; +Achievement *Achievements::makeBread = NULL; +Achievement *Achievements::bakeCake = NULL; +Achievement *Achievements::buildBetterPickaxe = NULL; +Achievement *Achievements::cookFish = NULL; +Achievement *Achievements::onARail = NULL; +Achievement *Achievements::buildSword = NULL; +Achievement *Achievements::killEnemy = NULL; +Achievement *Achievements::killCow = NULL; +Achievement *Achievements::flyPig = NULL; -Achievement *Achievements::snipeSkeleton = nullptr; -Achievement *Achievements::diamonds = nullptr; -//Achievement *Achievements::portal = nullptr; -Achievement *Achievements::ghast = nullptr; -Achievement *Achievements::blazeRod = nullptr; -Achievement *Achievements::potion = nullptr; -Achievement *Achievements::theEnd = nullptr; -Achievement *Achievements::winGame = nullptr; -Achievement *Achievements::enchantments = nullptr; -//Achievement *Achievements::overkill = nullptr; -//Achievement *Achievements::bookcase = nullptr; +Achievement *Achievements::snipeSkeleton = NULL; +Achievement *Achievements::diamonds = NULL; +//Achievement *Achievements::portal = NULL; +Achievement *Achievements::ghast = NULL; +Achievement *Achievements::blazeRod = NULL; +Achievement *Achievements::potion = NULL; +Achievement *Achievements::theEnd = NULL; +Achievement *Achievements::winGame = NULL; +Achievement *Achievements::enchantments = NULL; +//Achievement *Achievements::overkill = NULL; +//Achievement *Achievements::bookcase = NULL; // 4J : WESTY : Added new acheivements. -Achievement *Achievements::leaderOfThePack = nullptr; -Achievement *Achievements::MOARTools = nullptr; -Achievement *Achievements::dispenseWithThis = nullptr; -Achievement *Achievements::InToTheNether = nullptr; +Achievement *Achievements::leaderOfThePack = NULL; +Achievement *Achievements::MOARTools = NULL; +Achievement *Achievements::dispenseWithThis = NULL; +Achievement *Achievements::InToTheNether = NULL; // 4J : WESTY : Added other awards. -Achievement *Achievements::socialPost = nullptr; -Achievement *Achievements::eatPorkChop = nullptr; -Achievement *Achievements::play100Days = nullptr; -Achievement *Achievements::arrowKillCreeper = nullptr; -Achievement *Achievements::mine100Blocks = nullptr; -Achievement *Achievements::kill10Creepers = nullptr; +Achievement *Achievements::socialPost = NULL; +Achievement *Achievements::eatPorkChop = NULL; +Achievement *Achievements::play100Days = NULL; +Achievement *Achievements::arrowKillCreeper = NULL; +Achievement *Achievements::mine100Blocks = NULL; +Achievement *Achievements::kill10Creepers = NULL; #ifdef _EXTENDED_ACHIEVEMENTS -Achievement *Achievements::overkill = nullptr; // Restored old achivements. -Achievement *Achievements::bookcase = nullptr; // Restored old achivements. +Achievement *Achievements::overkill = NULL; // Restored old achivements. +Achievement *Achievements::bookcase = NULL; // Restored old achivements. // 4J-JEV: New Achievements for Orbis. -Achievement *Achievements::adventuringTime = nullptr; -Achievement *Achievements::repopulation = nullptr; -//Achievement *Achievements::porkChop = nullptr; -Achievement *Achievements::diamondsToYou = nullptr; -//Achievement *Achievements::passingTheTime = nullptr; -//Achievement *Achievements::archer = nullptr; -Achievement *Achievements::theHaggler = nullptr; -Achievement *Achievements::potPlanter = nullptr; -Achievement *Achievements::itsASign = nullptr; -Achievement *Achievements::ironBelly = nullptr; -Achievement *Achievements::haveAShearfulDay = nullptr; -Achievement *Achievements::rainbowCollection = nullptr; -Achievement *Achievements::stayinFrosty = nullptr; -Achievement *Achievements::chestfulOfCobblestone = nullptr; -Achievement *Achievements::renewableEnergy = nullptr; -Achievement *Achievements::musicToMyEars = nullptr; -Achievement *Achievements::bodyGuard = nullptr; -Achievement *Achievements::ironMan = nullptr; -Achievement *Achievements::zombieDoctor = nullptr; -Achievement *Achievements::lionTamer = nullptr; +Achievement *Achievements::adventuringTime = NULL; +Achievement *Achievements::repopulation = NULL; +//Achievement *Achievements::porkChop = NULL; +Achievement *Achievements::diamondsToYou = NULL; +//Achievement *Achievements::passingTheTime = NULL; +//Achievement *Achievements::archer = NULL; +Achievement *Achievements::theHaggler = NULL; +Achievement *Achievements::potPlanter = NULL; +Achievement *Achievements::itsASign = NULL; +Achievement *Achievements::ironBelly = NULL; +Achievement *Achievements::haveAShearfulDay = NULL; +Achievement *Achievements::rainbowCollection = NULL; +Achievement *Achievements::stayinFrosty = NULL; +Achievement *Achievements::chestfulOfCobblestone = NULL; +Achievement *Achievements::renewableEnergy = NULL; +Achievement *Achievements::musicToMyEars = NULL; +Achievement *Achievements::bodyGuard = NULL; +Achievement *Achievements::ironMan = NULL; +Achievement *Achievements::zombieDoctor = NULL; +Achievement *Achievements::lionTamer = NULL; #endif void Achievements::staticCtor() { - Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, nullptr))->setAwardLocallyOnly()->postConstruct(); + Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, NULL))->setAwardLocallyOnly()->postConstruct(); Achievements::mineWood = (new Achievement(eAward_GettingWood, L"mineWood", 2, 1, Tile::treeTrunk, (Achievement *) openInventory))->postConstruct(); Achievements::buildWorkbench = (new Achievement(eAward_Benchmarking, L"buildWorkBench", 4, -1, Tile::workBench, (Achievement *) mineWood))->postConstruct(); Achievements::buildPickaxe = (new Achievement(eAward_TimeToMine, L"buildPickaxe", 4, 2, Item::pickAxe_wood, (Achievement *) buildWorkbench))->postConstruct(); @@ -152,26 +152,26 @@ void Achievements::staticCtor() Achievements::overkill = (new Achievement(eAward_overkill, L"overkill", -4,1, Item::sword_diamond, (Achievement *)enchantments) )->setGolden()->postConstruct(); Achievements::bookcase = (new Achievement(eAward_bookcase, L"bookcase", -3,6, Tile::bookshelf, (Achievement *)enchantments) )->postConstruct(); - Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); //Achievements::porkChoop // // // // // // - Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - //Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - //Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); - Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); - Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + //Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + //Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); + Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); #endif } diff --git a/Minecraft.World/AddEntityPacket.cpp b/Minecraft.World/AddEntityPacket.cpp index f70082b8..6231537d 100644 --- a/Minecraft.World/AddEntityPacket.cpp +++ b/Minecraft.World/AddEntityPacket.cpp @@ -32,9 +32,9 @@ void AddEntityPacket::_init(shared_ptr e, int type, int data, int xp, in if (xd > m) xd = m; if (yd > m) yd = m; if (zd > m) zd = m; - xa = static_cast(xd * 8000.0); - ya = static_cast(yd * 8000.0); - za = static_cast(zd * 8000.0); + xa = (int) (xd * 8000.0); + ya = (int) (yd * 8000.0); + za = (int) (zd * 8000.0); } } diff --git a/Minecraft.World/AddEntityPacket.h b/Minecraft.World/AddEntityPacket.h index d40a8437..29396479 100644 --- a/Minecraft.World/AddEntityPacket.h +++ b/Minecraft.World/AddEntityPacket.h @@ -52,6 +52,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddEntityPacket()); } virtual int getId() { return 23; } }; \ No newline at end of file diff --git a/Minecraft.World/AddExperienceOrbPacket.h b/Minecraft.World/AddExperienceOrbPacket.h index f955a8bd..59accfb3 100644 --- a/Minecraft.World/AddExperienceOrbPacket.h +++ b/Minecraft.World/AddExperienceOrbPacket.h @@ -19,6 +19,6 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddExperienceOrbPacket()); } virtual int getId() { return 26; } }; \ No newline at end of file diff --git a/Minecraft.World/AddGlobalEntityPacket.h b/Minecraft.World/AddGlobalEntityPacket.h index 9959dc77..80c10db2 100644 --- a/Minecraft.World/AddGlobalEntityPacket.h +++ b/Minecraft.World/AddGlobalEntityPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddGlobalEntityPacket()); } virtual int getId() { return 71; } }; \ No newline at end of file diff --git a/Minecraft.World/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index d5ccfe08..878e2ee7 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/AddMobPacket.cpp @@ -17,7 +17,7 @@ AddMobPacket::AddMobPacket() yRot = 0; xRot = 0; entityData = nullptr; - unpack = nullptr; + unpack = NULL; } AddMobPacket::~AddMobPacket() @@ -29,7 +29,7 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i { id = mob->entityId; - type = static_cast(EntityIO::getId(mob)); + type = (byte) EntityIO::getId(mob); // 4J Stu - We should add entities at their "last sent" position so that the relative update packets // put them in the correct place x = xp;//Mth::floor(mob->x * 32); @@ -54,14 +54,14 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i if (xd > m) xd = m; if (yd > m) yd = m; if (zd > m) zd = m; - this->xd = static_cast(xd * 8000.0); - this->yd = static_cast(yd * 8000.0); - this->zd = static_cast(zd * 8000.0); + this->xd = (int) (xd * 8000.0); + this->yd = (int) (yd * 8000.0); + this->zd = (int) (zd * 8000.0); // printf("%d: New add mob rot %d\n",id,yRot); entityData = mob->getEntityData(); - unpack = nullptr; + unpack = NULL; } void AddMobPacket::read(DataInputStream *dis) //throws IOException @@ -118,11 +118,11 @@ void AddMobPacket::handle(PacketListener *listener) int AddMobPacket::getEstimatedSize() { int size = 11; - if( entityData != nullptr ) + if( entityData != NULL ) { size += entityData->getSizeInBytes(); } - else if( unpack != nullptr ) + else if( unpack != NULL ) { // 4J Stu - This is an incoming value which we aren't currently analysing //size += unpack->get @@ -132,7 +132,7 @@ int AddMobPacket::getEstimatedSize() vector > *AddMobPacket::getUnpackedData() { - if (unpack == nullptr) + if (unpack == NULL) { unpack = entityData->getAll(); } diff --git a/Minecraft.World/AddMobPacket.h b/Minecraft.World/AddMobPacket.h index 9f7c1e1c..6af72655 100644 --- a/Minecraft.World/AddMobPacket.h +++ b/Minecraft.World/AddMobPacket.h @@ -32,6 +32,6 @@ public: vector > *getUnpackedData(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddMobPacket()); } virtual int getId() { return 24; } }; diff --git a/Minecraft.World/AddPaintingPacket.h b/Minecraft.World/AddPaintingPacket.h index a50c1b77..a5694b74 100644 --- a/Minecraft.World/AddPaintingPacket.h +++ b/Minecraft.World/AddPaintingPacket.h @@ -22,6 +22,6 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddPaintingPacket()); } virtual int getId() { return 25; } }; diff --git a/Minecraft.World/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index fbee1fc5..93984367 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/AddPlayerPacket.cpp @@ -24,12 +24,12 @@ AddPlayerPacket::AddPlayerPacket() m_capeId = 0; m_uiGamePrivileges = 0; entityData = nullptr; - unpack = nullptr; + unpack = NULL; } AddPlayerPacket::~AddPlayerPacket() { - if(unpack != nullptr) delete unpack; + if(unpack != NULL) delete unpack; } AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp) @@ -51,17 +51,17 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, Play //printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot); shared_ptr itemInstance = player->inventory->getSelected(); - carriedItem = itemInstance == nullptr ? 0 : itemInstance->id; + carriedItem = itemInstance == NULL ? 0 : itemInstance->id; this->xuid = xuid; this->OnlineXuid = OnlineXuid; - m_playerIndex = static_cast(player->getPlayerIndex()); + m_playerIndex = (BYTE)player->getPlayerIndex(); m_skinId = player->getCustomSkin(); m_capeId = player->getCustomCape(); m_uiGamePrivileges = player->getAllPlayerGamePrivileges(); entityData = player->getEntityData(); - unpack = nullptr; + unpack = NULL; } void AddPlayerPacket::read(DataInputStream *dis) //throws IOException @@ -119,11 +119,11 @@ int AddPlayerPacket::getEstimatedSize() { int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(byte); - if( entityData != nullptr ) + if( entityData != NULL ) { iSize += entityData->getSizeInBytes(); } - else if( unpack != nullptr ) + else if( unpack != NULL ) { // 4J Stu - This is an incoming value which we aren't currently analysing //iSize += unpack->get @@ -134,7 +134,7 @@ int AddPlayerPacket::getEstimatedSize() vector > *AddPlayerPacket::getUnpackedData() { - if (unpack == nullptr) + if (unpack == NULL) { unpack = entityData->getAll(); } diff --git a/Minecraft.World/AddPlayerPacket.h b/Minecraft.World/AddPlayerPacket.h index af90c97d..30f6bcdd 100644 --- a/Minecraft.World/AddPlayerPacket.h +++ b/Minecraft.World/AddPlayerPacket.h @@ -38,6 +38,6 @@ public: vector > *getUnpackedData(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AddPlayerPacket()); } virtual int getId() { return 20; } }; diff --git a/Minecraft.World/AgableMob.cpp b/Minecraft.World/AgableMob.cpp index 892a14e5..307aa767 100644 --- a/Minecraft.World/AgableMob.cpp +++ b/Minecraft.World/AgableMob.cpp @@ -17,7 +17,7 @@ bool AgableMob::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != nullptr && item->id == Item::spawnEgg_Id) + if (item != NULL && item->id == Item::spawnEgg_Id) { if (!level->isClientSide) { @@ -27,10 +27,10 @@ bool AgableMob::mobInteract(shared_ptr player) int error; shared_ptr result = SpawnEggItem::canSpawn(item->getAuxValue(), level, &error); - if (result != nullptr) + if (result != NULL) { shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); - if (offspring != nullptr) + if (offspring != NULL) { offspring->setAge(BABY_START_AGE); offspring->moveTo(x, y, z, 0, 0); diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index 68278162..ecda8fc5 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -72,13 +72,13 @@ void Animal::checkHurtTarget(shared_ptr target, float d) { double xd = target->x - x; double zd = target->z - z; - yRot = static_cast(atan2(zd, xd) * 180 / PI) - 90; + yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; holdGround = true; } shared_ptr p = dynamic_pointer_cast(target); - if (p->getSelectedItem() == nullptr || !isFood(p->getSelectedItem())) + if (p->getSelectedItem() == NULL || !isFood(p->getSelectedItem())) { attackTarget = nullptr; } @@ -97,7 +97,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) } else if (getInLoveValue() > 0 && a->getInLoveValue() > 0) { - if (a->attackTarget == nullptr) a->attackTarget = shared_from_this(); + if (a->attackTarget == NULL) a->attackTarget = shared_from_this(); if (a->attackTarget == shared_from_this() && d < 3.5) { @@ -134,9 +134,9 @@ void Animal::breedWith(shared_ptr target) target->loveTime = 0; target->setInLoveValue(0); - // 4J - we have offspring of nullptr returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually + // 4J - we have offspring of NULL returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually // spawning the entity. - if (offspring != nullptr) + if (offspring != NULL) { // Only want to set the age to this +ve value if something is actually spawned, as during this period the animal will attempt to follow offspring and ignore players. setAge(5 * 60 * 20); @@ -154,7 +154,7 @@ void Animal::breedWith(shared_ptr target) } level->addEntity(offspring); - level->addEntity(std::make_shared(level, x, y, z, random->nextInt(4) + 1)); + level->addEntity( shared_ptr( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) ); } setDespawnProtected(); @@ -169,7 +169,7 @@ float Animal::getWalkTargetValue(int x, int y, int z) bool Animal::hurt(DamageSource *dmgSource, float dmg) { if (isInvulnerable()) return false; - if (dynamic_cast(dmgSource) != nullptr) + if (dynamic_cast(dmgSource) != NULL) { shared_ptr source = dmgSource->getDirectEntity(); @@ -179,12 +179,12 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg) return false; } - if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) ) + if ( (source != NULL) && source->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = 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) && !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackAnimals() ) + if (arrow->owner != NULL && arrow->owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackAnimals() ) { return false; } @@ -196,7 +196,7 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg) if (!useNewAi()) { AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); - if (speed->getModifier(eModifierId_MOB_FLEEING) == nullptr) + if (speed->getModifier(eModifierId_MOB_FLEEING) == NULL) { speed->addModifier(new AttributeModifier(*Animal::SPEED_MODIFIER_FLEEING)); } @@ -255,7 +255,7 @@ shared_ptr Animal::findAttackTarget() setDespawnProtected(); shared_ptr p = dynamic_pointer_cast(it); - if (p->getSelectedItem() != nullptr && this->isFood(p->getSelectedItem())) + if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem())) { delete players; return p; @@ -317,7 +317,7 @@ bool Animal::isFood(shared_ptr itemInstance) bool Animal::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != nullptr && isFood(item) && getAge() == 0 && getInLoveValue() <= 0) + if (item != NULL && isFood(item) && getAge() == 0 && getInLoveValue() <= 0) { if (!player->abilities.instabuild) { diff --git a/Minecraft.World/AnimatePacket.h b/Minecraft.World/AnimatePacket.h index 7075ffab..0287b9a6 100644 --- a/Minecraft.World/AnimatePacket.h +++ b/Minecraft.World/AnimatePacket.h @@ -26,6 +26,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AnimatePacket()); } virtual int getId() { return 18; } }; \ No newline at end of file diff --git a/Minecraft.World/AnvilMenu.cpp b/Minecraft.World/AnvilMenu.cpp index 78d72daf..83d38142 100644 --- a/Minecraft.World/AnvilMenu.cpp +++ b/Minecraft.World/AnvilMenu.cpp @@ -8,8 +8,8 @@ AnvilMenu::AnvilMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt, shared_ptr player) { - resultSlots = std::make_shared(); - repairSlots = std::make_shared(this,IDS_REPAIR_AND_NAME, true, 2); + resultSlots = shared_ptr( new ResultContainer() ); + repairSlots = shared_ptr( new RepairContainer(this,IDS_REPAIR_AND_NAME, true, 2) ); cost = 0; repairItemCountCost = 0; @@ -55,7 +55,7 @@ void AnvilMenu::createResult() if (DEBUG_COST) app.DebugPrintf("----"); - if (input == nullptr) + if (input == NULL) { resultSlots->setItem(0, nullptr); cost = 0; @@ -68,15 +68,15 @@ void AnvilMenu::createResult() unordered_map *enchantments = EnchantmentHelper::getEnchantments(result); bool usingBook = false; - tax += input->getBaseRepairCost() + (addition == nullptr ? 0 : addition->getBaseRepairCost()); + tax += input->getBaseRepairCost() + (addition == NULL ? 0 : addition->getBaseRepairCost()); if (DEBUG_COST) { - app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == nullptr ? 0 : addition->getBaseRepairCost())); + app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == NULL ? 0 : addition->getBaseRepairCost())); } repairItemCountCost = 0; - if (addition != nullptr) + if (addition != NULL) { usingBook = addition->id == Item::enchantedBook_Id && Item::enchantedBook->getEnchantments(addition)->size() > 0; @@ -290,10 +290,10 @@ void AnvilMenu::createResult() result = nullptr; } - if (result != nullptr) + if (result != NULL) { int baseCost = result->getBaseRepairCost(); - if (addition != nullptr && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost(); + if (addition != NULL && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost(); if (result->hasCustomHoverName()) baseCost -= 9; if (baseCost < 0) baseCost = 0; baseCost += 2; @@ -344,7 +344,7 @@ void AnvilMenu::removed(shared_ptr player) for (int i = 0; i < repairSlots->getContainerSize(); i++) { shared_ptr item = repairSlots->removeItemNoUpdate(i); - if (item != nullptr) + if (item != NULL) { player->drop(item); } @@ -362,7 +362,7 @@ shared_ptr AnvilMenu::quickMoveStack(shared_ptr player, in { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/AnvilTile.cpp b/Minecraft.World/AnvilTile.cpp index 5d186c28..8789cb7c 100644 --- a/Minecraft.World/AnvilTile.cpp +++ b/Minecraft.World/AnvilTile.cpp @@ -21,7 +21,7 @@ AnvilTile::AnvilTile(int id) : HeavyTile(id, Material::heavyMetal, isSolidRender { part = PART_BASE; setLightBlock(0); - icons = nullptr; + icons = NULL; } bool AnvilTile::isCubeShaped() diff --git a/Minecraft.World/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index d4581182..46d43868 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -13,12 +13,12 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; ArmorItem *armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) { target = item; } @@ -37,7 +37,7 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le } } - return target != nullptr && !dyes.empty(); + return target != NULL && !dyes.empty(); } shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr craftSlots) @@ -46,19 +46,19 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrgetContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) { target = item->copy(); target->count = 1; @@ -66,9 +66,9 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrhasCustomColor(item)) { int color = armor->getColor(target); - float red = static_cast((color >> 16) & 0xFF) / 0xFF; - float green = static_cast((color >> 8) & 0xFF) / 0xFF; - float blue = static_cast(color & 0xFF) / 0xFF; + float red = (float) ((color >> 16) & 0xFF) / 0xFF; + float green = (float) ((color >> 8) & 0xFF) / 0xFF; + float blue = (float) (color & 0xFF) / 0xFF; intensityTotal += max(red, max(green, blue)) * 0xFF; @@ -86,9 +86,9 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrid == Item::dye_powder_Id) { int tileData = ColoredTile::getTileDataForItemAuxValue(item->getAuxValue()); - int red = static_cast(Sheep::COLOR[tileData][0] * 0xFF); - int green = static_cast(Sheep::COLOR[tileData][1] * 0xFF); - int blue = static_cast(Sheep::COLOR[tileData][2] * 0xFF); + int red = (int) (Sheep::COLOR[tileData][0] * 0xFF); + int green = (int) (Sheep::COLOR[tileData][1] * 0xFF); + int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF); intensityTotal += max(red, max(green, blue)); @@ -104,19 +104,19 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr(intensityTotal) / colourCounts; - float resultIntensity = static_cast(max(red, max(green, blue))); + float averageIntensity = (float) intensityTotal / colourCounts; + float resultIntensity = (float) max(red, max(green, blue)); // System.out.println(averageIntensity + ", " + resultIntensity); - red = static_cast((float)red * averageIntensity / resultIntensity); - green = static_cast((float)green * averageIntensity / resultIntensity); - blue = static_cast((float)blue * averageIntensity / resultIntensity); + red = (int) ((float) red * averageIntensity / resultIntensity); + green = (int) ((float) green * averageIntensity / resultIntensity); + blue = (int) ((float) blue * averageIntensity / resultIntensity); int rgb = red; rgb = (rgb << 8) + green; @@ -138,7 +138,7 @@ int ArmorDyeRecipe::size() const ItemInstance *ArmorDyeRecipe::getResultItem() { - return nullptr; + return NULL; } const int ArmorDyeRecipe::getGroup() @@ -175,7 +175,7 @@ void ArmorDyeRecipe::reqs(INGREDIENTS_REQUIRED *pIngReq) #if 0 for ( ItemInstance *expected : *ingredients ) { - if (expected!=nullptr) + if (expected!=NULL) { int iAuxVal = expected->getAuxValue(); TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24; diff --git a/Minecraft.World/ArmorItem.cpp b/Minecraft.World/ArmorItem.cpp index 93d58cdd..114b200b 100644 --- a/Minecraft.World/ArmorItem.cpp +++ b/Minecraft.World/ArmorItem.cpp @@ -170,9 +170,9 @@ int ArmorItem::getColor(shared_ptr item) if (armorType != ArmorMaterial::CLOTH) return -1; CompoundTag *tag = item->getTag(); - if (tag == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); + if (tag == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); CompoundTag *display = tag->getCompound(L"display"); - if (display == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); + if (display == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); if (display->contains(L"color")) { @@ -197,7 +197,7 @@ void ArmorItem::clearColor(shared_ptr item) { if (armorType != ArmorMaterial::CLOTH) return; CompoundTag *tag = item->getTag(); - if (tag == nullptr) return; + if (tag == NULL) return; CompoundTag *display = tag->getCompound(L"display"); if (display->contains(L"color")) display->remove(L"color"); } @@ -215,7 +215,7 @@ void ArmorItem::setColor(shared_ptr item, int color) CompoundTag *tag = item->getTag(); - if (tag == nullptr) + if (tag == NULL) { tag = new CompoundTag(); item->setTag(tag); @@ -262,5 +262,5 @@ Icon *ArmorItem::getEmptyIcon(int slot) return Item::boots_diamond->iconEmpty; } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.World/ArmorSlot.cpp b/Minecraft.World/ArmorSlot.cpp index 2e85fed3..7707635a 100644 --- a/Minecraft.World/ArmorSlot.cpp +++ b/Minecraft.World/ArmorSlot.cpp @@ -19,11 +19,11 @@ int ArmorSlot::getMaxStackSize() const bool ArmorSlot::mayPlace(shared_ptr item) { - if (item == nullptr) + if (item == NULL) { return false; } - if ( dynamic_cast( item->getItem() ) != nullptr) + if ( dynamic_cast( item->getItem() ) != NULL) { return dynamic_cast( item->getItem() )->slot == slotNum; } @@ -43,7 +43,7 @@ Icon *ArmorSlot::getNoItemIcon() //bool ArmorSlot::mayCombine(shared_ptr item) //{ // shared_ptr thisItemI = getItem(); -// if(thisItemI == nullptr || item == nullptr) return false; +// if(thisItemI == NULL || item == NULL) return false; // // ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem(); // bool thisIsDyableArmor = thisItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH; @@ -53,7 +53,7 @@ Icon *ArmorSlot::getNoItemIcon() // //shared_ptr ArmorSlot::combine(shared_ptr item) //{ -// shared_ptr craftSlots = shared_ptr( new CraftingContainer(nullptr, 2, 2) ); +// shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); // craftSlots->setItem(0, item); // craftSlots->setItem(1, getItem()); // Armour item needs to go second // shared_ptr result = ArmorDyeRecipe::assembleDyedArmor(craftSlots); diff --git a/Minecraft.World/ArrayWithLength.h b/Minecraft.World/ArrayWithLength.h index ab491aa8..e22724c6 100644 --- a/Minecraft.World/ArrayWithLength.h +++ b/Minecraft.World/ArrayWithLength.h @@ -10,7 +10,7 @@ template class arrayWithLength public: T *data; unsigned int length; - arrayWithLength() { data = nullptr; length = 0; } + arrayWithLength() { data = NULL; length = 0; } arrayWithLength(unsigned int elements, bool bClearArray=true) { assert(elements!=0); data = new T[elements]; if(bClearArray){ memset( data,0,sizeof(T)*elements); } this->length = elements; } // 4J Stu Added this ctor so I static init arrays in the Item derivation tree @@ -24,7 +24,7 @@ public: T *temp = new T[elements]; memset( temp,0,sizeof(T)*elements); - if( data != nullptr ) + if( data != NULL ) { std::copy( data, data+length, temp ); @@ -45,7 +45,7 @@ template class array2DWithLength public: _parrayWithLength *data; unsigned int length; - array2DWithLength() { data = nullptr; length = 0; } + array2DWithLength() { data = NULL; length = 0; } array2DWithLength(unsigned int dimA, unsigned int dimB) { data = new _parrayWithLength[dimA]; diff --git a/Minecraft.World/Arrow.cpp b/Minecraft.World/Arrow.cpp index c433715a..ab942aac 100644 --- a/Minecraft.World/Arrow.cpp +++ b/Minecraft.World/Arrow.cpp @@ -72,15 +72,15 @@ Arrow::Arrow(Level *level, shared_ptr mob, shared_ptr(atan2(zd, xd) * 180 / PI) - 90; - float xRot = static_cast(-(atan2(yd, sd) * 180 / PI)); + float yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; + float xRot = (float) -(atan2(yd, sd) * 180 / PI); double xdn = xd / sd; double zdn = zd / sd; moveTo(mob->x + xdn, y, mob->z + zdn, yRot, xRot); heightOffset = 0; - float yo = static_cast(sd) * 0.2f; + float yo = (float) sd * 0.2f; shoot(xd, yd + yo, zd, power, uncertainty); } @@ -123,13 +123,13 @@ Arrow::Arrow(Level *level, shared_ptr mob, float power) : Entity( void Arrow::defineSynchedData() { - entityData->define(ID_FLAGS, static_cast(0)); + entityData->define(ID_FLAGS, (byte) 0); } void Arrow::shoot(double xd, double yd, double zd, float pow, float uncertainty) { - float dist = static_cast(sqrt(xd * xd + yd * yd + zd * zd)); + float dist = (float) sqrt(xd * xd + yd * yd + zd * zd); xd /= dist; yd /= dist; @@ -149,8 +149,8 @@ void Arrow::shoot(double xd, double yd, double zd, float pow, float uncertainty) double sd = sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); life = 0; } @@ -168,8 +168,8 @@ void Arrow::lerpMotion(double xd, double yd, double zd) if (xRotO == 0 && yRotO == 0) { double sd = sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRotO = yRot = (float) (atan2( xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2( yd, sd) * 180 / PI); xRotO = xRot; yRotO = yRot; app.DebugPrintf("%f %f : 0x%x\n",xRot,yRot,&yRot); @@ -186,8 +186,8 @@ void Arrow::tick() if (xRotO == 0 && yRotO == 0) { double sd = sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); } @@ -197,7 +197,7 @@ void Arrow::tick() { Tile::tiles[t]->updateShape(level, xTile, yTile, zTile); AABB *aabb = Tile::tiles[t]->getAABB(level, xTile, yTile, zTile); - if (aabb != nullptr && aabb->contains(Vec3::newTemp(x, y, z))) + if (aabb != NULL && aabb->contains(Vec3::newTemp(x, y, z))) { inGround = true; } @@ -242,7 +242,7 @@ void Arrow::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != nullptr) + if (res != NULL) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -256,7 +256,7 @@ void Arrow::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != nullptr) + if (p != NULL) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -268,33 +268,33 @@ void Arrow::tick() } } - if (hitEntity != nullptr) + if (hitEntity != NULL) { delete res; res = new HitResult(hitEntity); } - if ( (res != nullptr) && (res->entity != nullptr) && res->entity->instanceof(eTYPE_PLAYER)) + if ( (res != NULL) && (res->entity != NULL) && res->entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(res->entity); // 4J: Check for owner being null - if ( player->abilities.invulnerable || ((owner != nullptr) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(owner)->canHarmPlayer(player)))) + if ( player->abilities.invulnerable || ((owner != NULL) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(owner)->canHarmPlayer(player)))) { - res = nullptr; + res = NULL; } } - if (res != nullptr) + if (res != NULL) { - if (res->entity != nullptr) + if (res->entity != NULL) { float pow = Mth::sqrt(xd * xd + yd * yd + zd * zd); - int dmg = (int) Mth::ceil(static_cast(pow * baseDamage)); + int dmg = (int) Mth::ceil((float)(pow * baseDamage)); if(isCritArrow()) dmg += random->nextInt(dmg / 2 + 2); - DamageSource *damageSource = nullptr; - if (owner == nullptr) + DamageSource *damageSource = NULL; + if (owner == NULL) { damageSource = DamageSource::arrow(dynamic_pointer_cast(shared_from_this()), shared_from_this()); } @@ -331,19 +331,19 @@ void Arrow::tick() } } - if (owner != nullptr) + if (owner != NULL) { ThornsEnchantment::doThornsAfterAttack(owner, mob, random); } - if (owner != nullptr && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER) + if (owner != NULL && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER) { - dynamic_pointer_cast(owner)->connection->send(std::make_shared(GameEventPacket::SUCCESSFUL_BOW_HIT, 0)); + dynamic_pointer_cast(owner)->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::SUCCESSFUL_BOW_HIT, 0)) ); } } // 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 + if (owner != NULL && 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 @@ -376,10 +376,10 @@ void Arrow::tick() zTile = res->z; lastTile = level->getTile(xTile, yTile, zTile); lastData = level->getData(xTile, yTile, zTile); - xd = static_cast(res->pos->x - x); - yd = static_cast(res->pos->y - y); - zd = static_cast(res->pos->z - z); - float dd = static_cast(sqrt(xd * xd + yd * yd + zd * zd)); + xd = (float) (res->pos->x - x); + yd = (float) (res->pos->y - y); + zd = (float) (res->pos->z - z); + float dd = (float) sqrt(xd * xd + yd * yd + zd * zd); // 4J added check - zero dd here was creating NaNs if( dd > 0.0001f ) { @@ -414,8 +414,8 @@ void Arrow::tick() z += zd; double sd = sqrt(xd * xd + zd * zd); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -456,14 +456,14 @@ void Arrow::tick() void Arrow::addAdditonalSaveData(CompoundTag *tag) { - tag->putShort(L"xTile", static_cast(xTile)); - tag->putShort(L"yTile", static_cast(yTile)); - tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"inData", static_cast(lastData)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); - tag->putByte(L"pickup", static_cast(pickup)); + tag->putShort(L"xTile", (short) xTile); + tag->putShort(L"yTile", (short) yTile); + tag->putShort(L"zTile", (short) zTile); + tag->putByte(L"inTile", (byte) lastTile); + tag->putByte(L"inData", (byte) lastData); + tag->putByte(L"shake", (byte) shakeTime); + tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); + tag->putByte(L"pickup", (byte) pickup); tag->putDouble(L"damage", baseDamage); } @@ -499,7 +499,7 @@ void Arrow::playerTouch(shared_ptr player) if (pickup == PICKUP_ALLOWED) { - if (!player->inventory->add(std::make_shared(Item::arrow, 1))) + if (!player->inventory->add( shared_ptr( new ItemInstance(Item::arrow, 1) ) )) { bRemove = false; } @@ -548,11 +548,11 @@ void Arrow::setCritArrow(bool critArrow) byte flags = entityData->getByte(ID_FLAGS); if (critArrow) { - entityData->set(ID_FLAGS, static_cast(flags | FLAG_CRIT)); + entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT)); } else { - entityData->set(ID_FLAGS, static_cast(flags & ~FLAG_CRIT)); + entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT)); } } diff --git a/Minecraft.World/AttributeModifier.cpp b/Minecraft.World/AttributeModifier.cpp index 17090289..c479853d 100644 --- a/Minecraft.World/AttributeModifier.cpp +++ b/Minecraft.World/AttributeModifier.cpp @@ -61,7 +61,7 @@ AttributeModifier *AttributeModifier::setSerialize(bool serialize) bool AttributeModifier::equals(AttributeModifier *modifier) { if (this == modifier) return true; - if (modifier == nullptr) return false; //|| getClass() != o.getClass()) return false; + if (modifier == NULL) return false; //|| getClass() != o.getClass()) return false; if (id != modifier->id) return false; @@ -123,7 +123,7 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute) } wchar_t formatted[256]; - swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), static_cast(displayAmount), (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute))); + swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), (int) displayAmount, (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute))); return HtmlString(formatted, color); } \ No newline at end of file diff --git a/Minecraft.World/AvoidPlayerGoal.cpp b/Minecraft.World/AvoidPlayerGoal.cpp index f9c6641a..53aebe89 100644 --- a/Minecraft.World/AvoidPlayerGoal.cpp +++ b/Minecraft.World/AvoidPlayerGoal.cpp @@ -33,12 +33,12 @@ AvoidPlayerGoal::AvoidPlayerGoal(PathfinderMob *mob, const type_info& avoidType, entitySelector = new AvoidPlayerGoalEntitySelector(this); toAvoid = weak_ptr(); - path = nullptr; + path = NULL; } AvoidPlayerGoal::~AvoidPlayerGoal() { - if(path != nullptr) delete path; + if(path != NULL) delete path; delete entitySelector; } @@ -47,9 +47,9 @@ bool AvoidPlayerGoal::canUse() if (avoidType == typeid(Player)) { shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); - if (tamableAnimal != nullptr && tamableAnimal->isTame()) return false; + if (tamableAnimal != NULL && tamableAnimal->isTame()) return false; toAvoid = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist)); - if (toAvoid.lock() == nullptr) return false; + if (toAvoid.lock() == NULL) return false; } else { @@ -64,24 +64,24 @@ bool AvoidPlayerGoal::canUse() } Vec3 *pos = RandomPos::getPosAvoid(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z)); - if (pos == nullptr) return false; + if (pos == NULL) return false; if (toAvoid.lock()->distanceToSqr(pos->x, pos->y, pos->z) < toAvoid.lock()->distanceToSqr(mob->shared_from_this())) return false; delete path; path = pathNav->createPath(pos->x, pos->y, pos->z); - if (path == nullptr) return false; + if (path == NULL) return false; if (!path->endsInXZ(pos)) return false; return true; } bool AvoidPlayerGoal::canContinueToUse() { - return toAvoid.lock() != nullptr && !pathNav->isDone(); + return toAvoid.lock() != NULL && !pathNav->isDone(); } void AvoidPlayerGoal::start() { pathNav->moveTo(path, walkSpeedModifier); - path = nullptr; + path = NULL; } void AvoidPlayerGoal::stop() diff --git a/Minecraft.World/AwardStatPacket.cpp b/Minecraft.World/AwardStatPacket.cpp index 07888541..43328794 100644 --- a/Minecraft.World/AwardStatPacket.cpp +++ b/Minecraft.World/AwardStatPacket.cpp @@ -8,7 +8,7 @@ AwardStatPacket::AwardStatPacket() { - this->m_paramData.data = nullptr; + this->m_paramData.data = NULL; this->m_paramData.length = 0; } @@ -28,17 +28,17 @@ AwardStatPacket::AwardStatPacket(int statId, byteArray paramData) AwardStatPacket::~AwardStatPacket() { - if (m_paramData.data != nullptr) + if (m_paramData.data != NULL) { delete [] m_paramData.data; - m_paramData.data = nullptr; + m_paramData.data = NULL; } } void AwardStatPacket::handle(PacketListener *listener) { listener->handleAwardStat(shared_from_this()); - m_paramData.data = nullptr; + m_paramData.data = NULL; } void AwardStatPacket::read(DataInputStream *dis) //throws IOException diff --git a/Minecraft.World/AwardStatPacket.h b/Minecraft.World/AwardStatPacket.h index 01cad26d..6b79c023 100644 --- a/Minecraft.World/AwardStatPacket.h +++ b/Minecraft.World/AwardStatPacket.h @@ -24,7 +24,7 @@ public: virtual int getEstimatedSize(); virtual bool isAync(); - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new AwardStatPacket()); } virtual int getId() { return 200; } public: diff --git a/Minecraft.World/BaseAttributeMap.cpp b/Minecraft.World/BaseAttributeMap.cpp index 151448b5..8fb1b1f1 100644 --- a/Minecraft.World/BaseAttributeMap.cpp +++ b/Minecraft.World/BaseAttributeMap.cpp @@ -24,7 +24,7 @@ AttributeInstance *BaseAttributeMap::getInstance(eATTRIBUTE_ID id) } else { - return nullptr; + return NULL; } } @@ -50,7 +50,7 @@ void BaseAttributeMap::removeItemModifiers(shared_ptr item) AttributeInstance* attribute = getInstance(it.first); AttributeModifier* modifier = it.second; - if (attribute != nullptr) + if (attribute != NULL) { attribute->removeModifier(modifier); } @@ -72,7 +72,7 @@ void BaseAttributeMap::addItemModifiers(shared_ptr item) AttributeInstance* attribute = getInstance(it.first); AttributeModifier* modifier = it.second; - if (attribute != nullptr) + if (attribute != NULL) { attribute->removeModifier(modifier); attribute->addModifier(new AttributeModifier(*modifier)); diff --git a/Minecraft.World/BaseEntityTile.cpp b/Minecraft.World/BaseEntityTile.cpp index 7dc06f77..2edfbf92 100644 --- a/Minecraft.World/BaseEntityTile.cpp +++ b/Minecraft.World/BaseEntityTile.cpp @@ -25,7 +25,7 @@ bool BaseEntityTile::triggerEvent(Level *level, int x, int y, int z, int b0, int { Tile::triggerEvent(level, x, y, z, b0, b1); shared_ptr te = level->getTileEntity(x, y, z); - if (te != nullptr) + if (te != NULL) { return te->triggerEvent(b0, b1); } diff --git a/Minecraft.World/BaseMobSpawner.cpp b/Minecraft.World/BaseMobSpawner.cpp index b01aeb09..0e37e444 100644 --- a/Minecraft.World/BaseMobSpawner.cpp +++ b/Minecraft.World/BaseMobSpawner.cpp @@ -8,10 +8,10 @@ BaseMobSpawner::BaseMobSpawner() { - spawnPotentials = nullptr; + spawnPotentials = NULL; spawnDelay = 20; entityId = L"Pig"; - nextSpawnData = nullptr; + nextSpawnData = NULL; spin = oSpin = 0.0; minSpawnDelay = SharedConstants::TICKS_PER_SECOND * 10; @@ -37,7 +37,7 @@ BaseMobSpawner::~BaseMobSpawner() wstring BaseMobSpawner::getEntityId() { - if (getNextSpawnData() == nullptr) + if (getNextSpawnData() == NULL) { if (entityId.compare(L"Minecart") == 0) { @@ -58,7 +58,7 @@ void BaseMobSpawner::setEntityId(const wstring &entityId) bool BaseMobSpawner::isNearPlayer() { - return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != nullptr; + return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != NULL; } void BaseMobSpawner::tick() @@ -78,7 +78,7 @@ void BaseMobSpawner::tick() if (spawnDelay > 0) spawnDelay--; oSpin = spin; - spin = static_cast(spin + 1000 / (spawnDelay + 200.0f)) % 360; + spin = (int)(spin + 1000 / (spawnDelay + 200.0f)) % 360; } else { @@ -95,7 +95,7 @@ void BaseMobSpawner::tick() for (int c = 0; c < spawnCount; c++) { shared_ptr entity = EntityIO::newEntity(getEntityId(), getLevel()); - if (entity == nullptr) return; + if (entity == NULL) return; int nearBy = getLevel()->getEntitiesOfClass( typeid(entity.get()), AABB::newTemp(getX(), getY(), getZ(), getX() + 1, getY() + 1, getZ() + 1)->grow(spawnRange * 2, 4, spawnRange * 2))->size(); if (nearBy >= maxNearbyEntities) @@ -111,12 +111,12 @@ void BaseMobSpawner::tick() entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0); - if (mob == nullptr || mob->canSpawn()) + if (mob == NULL || mob->canSpawn()) { loadDataAndAddEntity(entity); getLevel()->levelEvent(LevelEvent::PARTICLES_MOBTILE_SPAWN, getX(), getY(), getZ(), 0); - if (mob != nullptr) + if (mob != NULL) { mob->spawnAnim(); } @@ -131,7 +131,7 @@ void BaseMobSpawner::tick() shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entity) { - if (getNextSpawnData() != nullptr) + if (getNextSpawnData() != NULL) { CompoundTag *data = new CompoundTag(); entity->save(data); @@ -147,7 +147,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit } entity->load(data); - if (entity->level != nullptr) entity->level->addEntity(entity); + if (entity->level != NULL) entity->level->addEntity(entity); // add mounts shared_ptr rider = entity; @@ -155,7 +155,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit { CompoundTag *ridingTag = data->getCompound(Entity::RIDING_TAG); shared_ptr mount = EntityIO::newEntity(ridingTag->getString(L"id"), entity->level); - if (mount != nullptr) + if (mount != NULL) { CompoundTag *mountData = new CompoundTag(); mount->save(mountData); @@ -172,7 +172,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit mount->load(mountData); mount->moveTo(rider->x, rider->y, rider->z, rider->yRot, rider->xRot); - if (entity->level != nullptr) entity->level->addEntity(mount); + if (entity->level != NULL) entity->level->addEntity(mount); rider->ride(mount); } rider = mount; @@ -180,9 +180,9 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit } } - else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != nullptr) + else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != NULL) { - dynamic_pointer_cast( entity )->finalizeMobSpawn(nullptr); + dynamic_pointer_cast( entity )->finalizeMobSpawn(NULL); getLevel()->addEntity(entity); } @@ -200,9 +200,9 @@ void BaseMobSpawner::delay() spawnDelay = minSpawnDelay + getLevel()->random->nextInt(maxSpawnDelay - minSpawnDelay); } - if ( (spawnPotentials != nullptr) && (spawnPotentials->size() > 0) ) + if ( (spawnPotentials != NULL) && (spawnPotentials->size() > 0) ) { - setNextSpawnData( static_cast(WeighedRandom::getRandomItem((Random *)getLevel()->random, (vector *)spawnPotentials)) ); + setNextSpawnData( (SpawnData*) WeighedRandom::getRandomItem((Random*)getLevel()->random, (vector*)spawnPotentials) ); } broadcastEvent(EVENT_SPAWN); @@ -225,7 +225,7 @@ void BaseMobSpawner::load(CompoundTag *tag) } else { - spawnPotentials = nullptr; + spawnPotentials = NULL; } if (tag->contains(L"SpawnData")) @@ -234,7 +234,7 @@ void BaseMobSpawner::load(CompoundTag *tag) } else { - setNextSpawnData(nullptr); + setNextSpawnData(NULL); } if (tag->contains(L"MinSpawnDelay")) @@ -252,7 +252,7 @@ void BaseMobSpawner::load(CompoundTag *tag) if (tag->contains(L"SpawnRange")) spawnRange = tag->getShort(L"SpawnRange"); - if (getLevel() != nullptr && getLevel()->isClientSide) + if (getLevel() != NULL && getLevel()->isClientSide) { displayEntity = nullptr; } @@ -261,20 +261,20 @@ void BaseMobSpawner::load(CompoundTag *tag) void BaseMobSpawner::save(CompoundTag *tag) { tag->putString(L"EntityId", getEntityId()); - tag->putShort(L"Delay", static_cast(spawnDelay)); - tag->putShort(L"MinSpawnDelay", static_cast(minSpawnDelay)); - tag->putShort(L"MaxSpawnDelay", static_cast(maxSpawnDelay)); - tag->putShort(L"SpawnCount", static_cast(spawnCount)); - tag->putShort(L"MaxNearbyEntities", static_cast(maxNearbyEntities)); - tag->putShort(L"RequiredPlayerRange", static_cast(requiredPlayerRange)); - tag->putShort(L"SpawnRange", static_cast(spawnRange)); + tag->putShort(L"Delay", (short) spawnDelay); + tag->putShort(L"MinSpawnDelay", (short) minSpawnDelay); + tag->putShort(L"MaxSpawnDelay", (short) maxSpawnDelay); + tag->putShort(L"SpawnCount", (short) spawnCount); + tag->putShort(L"MaxNearbyEntities", (short) maxNearbyEntities); + tag->putShort(L"RequiredPlayerRange", (short) requiredPlayerRange); + tag->putShort(L"SpawnRange", (short) spawnRange); - if (getNextSpawnData() != nullptr) + if (getNextSpawnData() != NULL) { - tag->putCompound(L"SpawnData", static_cast(getNextSpawnData()->tag->copy())); + tag->putCompound(L"SpawnData", (CompoundTag *) getNextSpawnData()->tag->copy()); } - if (getNextSpawnData() != nullptr || (spawnPotentials != nullptr && spawnPotentials->size() > 0)) + if (getNextSpawnData() != NULL || (spawnPotentials != NULL && spawnPotentials->size() > 0)) { ListTag *list = new ListTag(); @@ -296,9 +296,9 @@ void BaseMobSpawner::save(CompoundTag *tag) shared_ptr BaseMobSpawner::getDisplayEntity() { - if (displayEntity == nullptr) + if (displayEntity == NULL) { - shared_ptr e = EntityIO::newEntity(getEntityId(), nullptr); + shared_ptr e = EntityIO::newEntity(getEntityId(), NULL); e = loadDataAndAddEntity(e); displayEntity = e; } @@ -333,7 +333,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *base) : WeighedRandomItem(base if (_type.compare(L"Minecart") == 0) { - if (tag != nullptr) + if (tag != NULL) { switch (tag->getInt(L"Type")) { @@ -362,7 +362,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *tag, wstring _type) : WeighedR { if (_type.compare(L"Minecart") == 0) { - if (tag != nullptr) + if (tag != NULL) { switch (tag->getInt(L"Type")) { diff --git a/Minecraft.World/BasePressurePlateTile.cpp b/Minecraft.World/BasePressurePlateTile.cpp index cd4c821c..128a4216 100644 --- a/Minecraft.World/BasePressurePlateTile.cpp +++ b/Minecraft.World/BasePressurePlateTile.cpp @@ -43,7 +43,7 @@ int BasePressurePlateTile::getTickDelay(Level *level) AABB *BasePressurePlateTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool BasePressurePlateTile::isSolidRender(bool isServerLevel) diff --git a/Minecraft.World/BaseRailTile.cpp b/Minecraft.World/BaseRailTile.cpp index 0494e266..db854bb3 100644 --- a/Minecraft.World/BaseRailTile.cpp +++ b/Minecraft.World/BaseRailTile.cpp @@ -19,7 +19,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z) if(m_bValidRail) { int direction = level->getData(x, y, z); - if (static_cast(Tile::tiles[id])->usesDataBit) + if (((BaseRailTile *) Tile::tiles[id])->usesDataBit) { usesDataBit = true; direction = direction & ~RAIL_DATA_BIT; @@ -34,7 +34,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z) BaseRailTile::Rail::~Rail() { - for( size_t i = 0; i < connections.size(); i++ ) + for( int i = 0; i < connections.size(); i++ ) { delete connections[i]; } @@ -44,7 +44,7 @@ void BaseRailTile::Rail::updateConnections(int direction) { if(m_bValidRail) { - for( size_t i = 0; i < connections.size(); i++ ) + for( int i = 0; i < connections.size(); i++ ) { delete connections[i]; } @@ -102,7 +102,7 @@ void BaseRailTile::Rail::removeSoftConnections() for (unsigned int i = 0; i < connections.size(); i++) { Rail *rail = getRail(connections[i]); - if (rail == nullptr || !rail->connectsTo(this)) + if (rail == NULL || !rail->connectsTo(this)) { delete connections[i]; connections.erase(connections.begin()+i); @@ -130,11 +130,11 @@ bool BaseRailTile::Rail::hasRail(int x, int y, int z) BaseRailTile::Rail *BaseRailTile::Rail::getRail(TilePos *p) { - if(!m_bValidRail) return nullptr; + if(!m_bValidRail) return NULL; if (isRail(level, p->x, p->y, p->z)) return new Rail(level, p->x, p->y, p->z); if (isRail(level, p->x, p->y + 1, p->z)) return new Rail(level, p->x, p->y + 1, p->z); if (isRail(level, p->x, p->y - 1, p->z)) return new Rail(level, p->x, p->y - 1, p->z); - return nullptr; + return NULL; } @@ -253,7 +253,7 @@ bool BaseRailTile::Rail::hasNeighborRail(int x, int y, int z) if(!m_bValidRail) return false; TilePos tp(x,y,z); Rail *neighbor = getRail( &tp ); - if (neighbor == nullptr) return false; + if (neighbor == NULL) return false; neighbor->removeSoftConnections(); bool retval = neighbor->canConnectTo(this); delete neighbor; @@ -331,7 +331,7 @@ void BaseRailTile::Rail::place(bool hasSignal, bool first) for ( auto& it : connections ) { Rail *neighbor = getRail(it); - if (neighbor == nullptr) continue; + if (neighbor == NULL) continue; neighbor->removeSoftConnections(); if (neighbor->canConnectTo(this)) @@ -359,7 +359,7 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit) : Tile(id, Material::decora this->usesDataBit = usesDataBit; setShape(0, 0, 0, 1, 2 / 16.0f, 1); - iconTurn = nullptr; + iconTurn = NULL; } bool BaseRailTile::isUsesDataBit() @@ -369,7 +369,7 @@ bool BaseRailTile::isUsesDataBit() AABB *BaseRailTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool BaseRailTile::blocksLight() diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index fc08a5f7..c1c92287 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -34,7 +34,7 @@ BasicTree::BasicTree(bool doUpdate) : Feature(doUpdate) trunkWidth = 1; heightVariance = 12; foliageHeight = 4; - foliageCoords = nullptr; + foliageCoords = NULL; foliageCoordsLength = 0; } @@ -44,9 +44,9 @@ void BasicTree::prepare() // Populate the list of foliage cluster locations. // Designed to be overridden in child classes to change basic // tree properties (trunk width, branch angle, foliage density, etc..). - trunkHeight = static_cast(height * trunkHeightScale); + trunkHeight = (int) (height * trunkHeightScale); if (trunkHeight >= height) trunkHeight = height - 1; - int clustersPerY = static_cast(1.382 + pow(foliageDensity * height / 13.0, 2)); + int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2)); if (clustersPerY < 1) clustersPerY = 1; // The foliage coordinates are a list of [x,y,z,y of branch base] values for each cluster int **tempFoliageCoords = new int *[clustersPerY * height]; @@ -100,7 +100,7 @@ void BasicTree::prepare() } else { - checkBranchBase[1] = static_cast(checkStart[1] - branchHeight); + checkBranchBase[1] = (int) (checkStart[1] - branchHeight); } // Now check the branch path if (checkLine(checkBranchBase, checkStart) == -1) @@ -126,7 +126,7 @@ void BasicTree::prepare() for( int i = clusterCount; i < clustersPerY * height; i++ ) { delete [] tempFoliageCoords[i]; - tempFoliageCoords[i] = nullptr; + tempFoliageCoords[i] = NULL; } // 4J - original code for above is the following, it isn't obvious to me why it is doing a copy of the array, so let's not for now // foliageCoords = new int[clusterCount][4]; @@ -147,7 +147,7 @@ void BasicTree::crossection(int x, int y, int z, float radius, byte direction, i // radius is the radius of the section from the center // direction is the direction the cross section is pointed, 0 for x, 1 for y, 2 for z // material is the index number for the material to use - int rad = static_cast(radius + 0.618); + int rad = (int) (radius + 0.618); byte secidx1 = axisConversionArray[direction]; byte secidx2 = axisConversionArray[direction + 3]; int center[] = { x, y, z }; @@ -197,15 +197,15 @@ float BasicTree::treeShape(int y) // This method is intended for overriding in child classes, allowing // different shaped trees. // This method should return a consistent value for each y (don't randomize). - if (y < (static_cast(height) * 0.3)) return (float) -1.618; - float radius = static_cast(height) / static_cast(2.0); - float adjacent = (static_cast(height) / static_cast(2.0)) - y; + if (y < (((float) height) * 0.3)) return (float) -1.618; + float radius = ((float) height) / ((float) 2.0); + float adjacent = (((float) height) / ((float) 2.0)) - y; float distance; if (adjacent == 0) distance = radius; - else if (abs(adjacent) >= radius) distance = static_cast(0.0); - else distance = static_cast(sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2))); + else if (abs(adjacent) >= radius) distance = (float) 0.0; + else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2)); // Alter this factor to change the overall width of the tree. - distance *= static_cast(0.5); + distance *= (float) 0.5; return distance; } @@ -216,9 +216,9 @@ float BasicTree::foliageShape(int y) // Return a negative number if no foliage should be created at this level // this method is intended for overriding in child classes, allowing // foliage of different sizes and shapes. - if ((y < 0) || (y >= foliageHeight)) return static_cast(-1); - else if ((y == 0) || (y == (foliageHeight - 1))) return static_cast(2); - else return static_cast(3); + if ((y < 0) || (y >= foliageHeight)) return (float) -1; + else if ((y == 0) || (y == (foliageHeight - 1))) return (float) 2; + else return (float) 3; } void BasicTree::foliageCluster(int x, int y, int z) @@ -270,8 +270,8 @@ void BasicTree::limb(int *start, int *end, int material) if (delta[primidx] > 0) primsign = 1; else primsign = -1; // Initilize the per-step movement for the non-primary axies. - double secfac1 = static_cast(delta[secidx1]) / static_cast(delta[primidx]); - double secfac2 = static_cast(delta[secidx2]) / static_cast(delta[primidx]); + double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]); + double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]); // Initialize the coordinates. int coordinate[] = { 0, 0, 0 }; // Loop through each crossection along the primary axis, from start to end @@ -411,8 +411,8 @@ int BasicTree::checkLine(int *start, int *end) if (delta[primidx] > 0) primsign = 1; else primsign = -1; // Initilize the per-step movement for the non-primary axies. - double secfac1 = static_cast(delta[secidx1]) / static_cast(delta[primidx]); - double secfac2 = static_cast(delta[secidx2]) / static_cast(delta[primidx]); + double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]); + double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]); // Initialize the coordinates. int coordinate[] = { 0, 0, 0 }; // Loop through each crossection along the primary axis, from start to end @@ -460,7 +460,7 @@ bool BasicTree::checkLocation() int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] }; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(startPosition[0], startPosition[1], startPosition[2], endPosition[0], endPosition[1], endPosition[2]); @@ -507,7 +507,7 @@ void BasicTree::init(double heightInit, double widthInit, double foliageDensityI // // Note, you can call "place" without calling "init". // This is the same as calling init(1.0,1.0,1.0) and then calling place. - heightVariance = static_cast(heightInit * 12); + heightVariance = (int) (heightInit * 12); if (heightInit > 0.5) foliageHeight = 5; widthScale = widthInit; foliageDensity = foliageDensityInit; diff --git a/Minecraft.World/BasicTypeContainers.cpp b/Minecraft.World/BasicTypeContainers.cpp index ba2359d8..9ecc865c 100644 --- a/Minecraft.World/BasicTypeContainers.cpp +++ b/Minecraft.World/BasicTypeContainers.cpp @@ -18,5 +18,5 @@ const double Double::MIN_NORMAL = DBL_MIN; int Integer::parseInt(wstring &str, int radix /* = 10*/) { - return wcstol( str.c_str(), nullptr, radix ); + return wcstol( str.c_str(), NULL, radix ); } \ No newline at end of file diff --git a/Minecraft.World/Bat.cpp b/Minecraft.World/Bat.cpp index 462fef57..d3bd3521 100644 --- a/Minecraft.World/Bat.cpp +++ b/Minecraft.World/Bat.cpp @@ -15,7 +15,7 @@ Bat::Bat(Level *level) : AmbientCreature(level) registerAttributes(); setHealth(getMaxHealth()); - targetPosition = nullptr; + targetPosition = NULL; setSize(.5f, .9f); setResting(true); @@ -90,11 +90,11 @@ void Bat::setResting(bool value) char current = entityData->getByte(DATA_ID_FLAGS); if (value) { - entityData->set(DATA_ID_FLAGS, static_cast(current | FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, (char) (current | FLAG_RESTING)); } else { - entityData->set(DATA_ID_FLAGS, static_cast(current & ~FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, (char) (current & ~FLAG_RESTING)); } } @@ -128,10 +128,10 @@ void Bat::newServerAiStep() if (isResting()) { - if (!level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) + if (!level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z))) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); } else { @@ -141,25 +141,25 @@ void Bat::newServerAiStep() yHeadRot = random->nextInt(360); } - if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr) + if (level->getNearestPlayer(shared_from_this(), 4.0f) != NULL) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); } } } else { - if (targetPosition != nullptr && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) + if (targetPosition != NULL && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) { delete targetPosition; - targetPosition = nullptr; + targetPosition = NULL; } - if (targetPosition == nullptr || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast(x), static_cast(y), static_cast(z)) < 4) + if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr((int) x, (int) y, (int) z) < 4) { delete targetPosition; - targetPosition = new Pos(static_cast(x) + random->nextInt(7) - random->nextInt(7), static_cast(y) + random->nextInt(6) - 2, static_cast(z) + random->nextInt(7) - random->nextInt(7)); + targetPosition = new Pos((int) x + random->nextInt(7) - random->nextInt(7), (int) y + random->nextInt(6) - 2, (int) z + random->nextInt(7) - random->nextInt(7)); } double dx = (targetPosition->x + .5) - x; @@ -170,12 +170,12 @@ void Bat::newServerAiStep() yd = yd + (signum(dy) * .7f - yd) * .1f; zd = zd + (signum(dz) * .5f - zd) * .1f; - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; float rotDiff = Mth::wrapDegrees(yRotD - yRot); yya = .5f; yRot += rotDiff; - if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) + if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z))) { setResting(true); } diff --git a/Minecraft.World/BeachBiome.cpp b/Minecraft.World/BeachBiome.cpp index 475f8468..50e7cc1c 100644 --- a/Minecraft.World/BeachBiome.cpp +++ b/Minecraft.World/BeachBiome.cpp @@ -8,8 +8,8 @@ BeachBiome::BeachBiome(int id) : Biome(id) // remove default mob spawn settings friendlies.clear(); friendlies_chicken.clear(); // 4J added - topMaterial = static_cast(Tile::sand_Id); - material = static_cast(Tile::sand_Id); + topMaterial = (byte) Tile::sand_Id; + material = (byte) Tile::sand_Id; decorator->treeCount = -999; decorator->deadBushCount = 0; diff --git a/Minecraft.World/BeaconMenu.cpp b/Minecraft.World/BeaconMenu.cpp index 0d7e54b4..62908b4f 100644 --- a/Minecraft.World/BeaconMenu.cpp +++ b/Minecraft.World/BeaconMenu.cpp @@ -60,7 +60,7 @@ shared_ptr BeaconMenu::quickMoveStack(shared_ptr player, i { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -127,7 +127,7 @@ BeaconMenu::PaymentSlot::PaymentSlot(shared_ptr container, int slot, bool BeaconMenu::PaymentSlot::mayPlace(shared_ptr item) { - if (item != nullptr) + if (item != NULL) { return (item->id == Item::emerald_Id || item->id == Item::diamond_Id || item->id == Item::goldIngot_Id || item->id == Item::ironIngot_Id); } diff --git a/Minecraft.World/BeaconTile.cpp b/Minecraft.World/BeaconTile.cpp index 04b17d11..f002cbe2 100644 --- a/Minecraft.World/BeaconTile.cpp +++ b/Minecraft.World/BeaconTile.cpp @@ -11,7 +11,7 @@ BeaconTile::BeaconTile(int id) : BaseEntityTile(id, Material::glass, isSolidRend shared_ptr BeaconTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new BeaconTileEntity() ); } bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) @@ -19,7 +19,7 @@ bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr playe if (level->isClientSide) return true; shared_ptr beacon = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (beacon != nullptr) player->openBeacon(beacon); + if (beacon != NULL) player->openBeacon(beacon); return true; } diff --git a/Minecraft.World/BeaconTileEntity.cpp b/Minecraft.World/BeaconTileEntity.cpp index 633930f4..d80eb906 100644 --- a/Minecraft.World/BeaconTileEntity.cpp +++ b/Minecraft.World/BeaconTileEntity.cpp @@ -10,7 +10,7 @@ shared_ptr BeaconTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new BeaconTileEntity() ); TileEntity::clone(result); result->primaryPower = primaryPower; @@ -28,7 +28,7 @@ void BeaconTileEntity::staticCtor() { for(unsigned int effect = 0; effect < BEACON_EFFECTS_EFFECTS; ++effect) { - BEACON_EFFECTS[tier][effect] = nullptr; + BEACON_EFFECTS[tier][effect] = NULL; } } BEACON_EFFECTS[0][0] = MobEffect::movementSpeed; @@ -163,18 +163,18 @@ float BeaconTileEntity::getAndUpdateClientSideScale() return 0; } - int renderDelta = static_cast(level->getGameTime() - clientSideRenderTick); + int renderDelta = (int) (level->getGameTime() - clientSideRenderTick); clientSideRenderTick = level->getGameTime(); if (renderDelta > 1) { - clientSideRenderScale -= (static_cast(renderDelta) / static_cast(SCALE_TIME)); + clientSideRenderScale -= ((float) renderDelta / (float) SCALE_TIME); if (clientSideRenderScale < 0) { clientSideRenderScale = 0; } } - clientSideRenderScale += (1.0f / static_cast(SCALE_TIME)); + clientSideRenderScale += (1.0f / (float) SCALE_TIME); if (clientSideRenderScale > 1) { clientSideRenderScale = 1; @@ -213,7 +213,7 @@ void BeaconTileEntity::setPrimaryPower(int primaryPower) for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e) { MobEffect *effect = BEACON_EFFECTS[tier][e]; - if(effect == nullptr) break; + if(effect == NULL) break; if (effect->id == primaryPower) { @@ -236,7 +236,7 @@ void BeaconTileEntity::setSecondaryPower(int secondaryPower) for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e) { MobEffect *effect = BEACON_EFFECTS[tier][e]; - if(effect == nullptr) break; + if(effect == NULL) break; if (effect->id == secondaryPower) { @@ -252,7 +252,7 @@ shared_ptr BeaconTileEntity::getUpdatePacket() { CompoundTag *tag = new CompoundTag(); save(tag); - return std::make_shared(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag); + return shared_ptr( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag) ); } double BeaconTileEntity::getViewDistance() @@ -295,7 +295,7 @@ shared_ptr BeaconTileEntity::getItem(unsigned int slot) shared_ptr BeaconTileEntity::removeItem(unsigned int slot, int count) { - if (slot == 0 && paymentItem != nullptr) + if (slot == 0 && paymentItem != NULL) { if (count >= paymentItem->count) { @@ -306,7 +306,7 @@ shared_ptr BeaconTileEntity::removeItem(unsigned int slot, int cou else { paymentItem->count -= count; - return std::make_shared(paymentItem->id, count, paymentItem->getAuxValue()); + return shared_ptr( new ItemInstance(paymentItem->id, count, paymentItem->getAuxValue()) ); } } return nullptr; @@ -314,7 +314,7 @@ shared_ptr BeaconTileEntity::removeItem(unsigned int slot, int cou shared_ptr BeaconTileEntity::removeItemNoUpdate(int slot) { - if (slot == 0 && paymentItem != nullptr) + if (slot == 0 && paymentItem != NULL) { shared_ptr returnItem = paymentItem; paymentItem = nullptr; diff --git a/Minecraft.World/BedItem.cpp b/Minecraft.World/BedItem.cpp index c8765b74..a55f277e 100644 --- a/Minecraft.World/BedItem.cpp +++ b/Minecraft.World/BedItem.cpp @@ -24,7 +24,7 @@ bool BedItem::useOn(shared_ptr itemInstance, shared_ptr pl // place on top of tile y = y + 1; - BedTile *tile = static_cast(Tile::bed); + BedTile *tile = (BedTile *) Tile::bed; int dir = ( Mth::floor(player->yRot * 4 / (360) + 0.5f) ) & 3; int xra = 0; diff --git a/Minecraft.World/BedTile.cpp b/Minecraft.World/BedTile.cpp index 5597f740..039943bd 100644 --- a/Minecraft.World/BedTile.cpp +++ b/Minecraft.World/BedTile.cpp @@ -16,9 +16,9 @@ BedTile::BedTile(int id) : DirectionalTile(id, Material::cloth, isSolidRender()) { setShape(); - iconEnd = nullptr; - iconSide = nullptr; - iconTop = nullptr; + iconEnd = NULL; + iconSide = NULL; + iconTop = NULL; } // 4J Added override @@ -120,7 +120,7 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, } } - if (sleepingPlayer == nullptr) + if (sleepingPlayer == NULL) { setOccupied(level, x, y, z, false); } @@ -309,7 +309,7 @@ Pos *BedTile::findStandUpPosition(Level *level, int x, int y, int z, int skipCou } } - return nullptr; + return NULL; } void BedTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus) diff --git a/Minecraft.World/BegGoal.cpp b/Minecraft.World/BegGoal.cpp index 3f059b66..97553928 100644 --- a/Minecraft.World/BegGoal.cpp +++ b/Minecraft.World/BegGoal.cpp @@ -20,14 +20,14 @@ BegGoal::BegGoal(Wolf *wolf, float lookDistance) bool BegGoal::canUse() { player = weak_ptr(level->getNearestPlayer(wolf->shared_from_this(), lookDistance)); - if (player.lock() == nullptr) return false; + if (player.lock() == NULL) return false; wolf->setDespawnProtected(); return playerHoldingInteresting(player.lock()); } bool BegGoal::canContinueToUse() { - if (player.lock() == nullptr || !player.lock()->isAlive()) return false; + if (player.lock() == NULL || !player.lock()->isAlive()) return false; if (wolf->distanceToSqr(player.lock()) > lookDistance * lookDistance) return false; wolf->setDespawnProtected(); return lookTime > 0 && playerHoldingInteresting(player.lock()); @@ -54,7 +54,7 @@ void BegGoal::tick() bool BegGoal::playerHoldingInteresting(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item == nullptr) return false; + if (item == NULL) return false; if (!wolf->isTame() && item->id == Item::bone_Id) return true; return wolf->isFood(item); } \ No newline at end of file diff --git a/Minecraft.World/BinaryHeap.cpp b/Minecraft.World/BinaryHeap.cpp index 4fc5ce45..3a3d1c1e 100644 --- a/Minecraft.World/BinaryHeap.cpp +++ b/Minecraft.World/BinaryHeap.cpp @@ -58,7 +58,7 @@ Node *BinaryHeap::pop() { Node *popped = heap[0]; heap[0] = heap[--sizeVar]; - heap[sizeVar] = nullptr; + heap[sizeVar] = NULL; if (sizeVar > 0) downHeap(0); popped->heapIdx=-1; return popped; @@ -68,7 +68,7 @@ void BinaryHeap::remove(Node *node) { // This is what node.heapIdx is for. heap[node->heapIdx] = heap[--sizeVar]; - heap[sizeVar] = nullptr; + heap[sizeVar] = NULL; if (sizeVar > node->heapIdx) { if (heap[node->heapIdx]->f < node->f) @@ -145,7 +145,7 @@ void BinaryHeap::downHeap(int idx) if (rightIdx >= sizeVar) { // Only need to compare with left. - rightNode = nullptr; + rightNode = NULL; rightCost = Float::POSITIVE_INFINITY; } else diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 66265765..169db77e 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -13,34 +13,34 @@ //public static final Biome[] biomes = new Biome[256]; Biome *Biome::biomes[256]; -Biome *Biome::ocean = nullptr; -Biome *Biome::plains = nullptr; -Biome *Biome::desert = nullptr; +Biome *Biome::ocean = NULL; +Biome *Biome::plains = NULL; +Biome *Biome::desert = NULL; -Biome *Biome::extremeHills = nullptr; -Biome *Biome::forest = nullptr; -Biome *Biome::taiga = nullptr; +Biome *Biome::extremeHills = NULL; +Biome *Biome::forest = NULL; +Biome *Biome::taiga = NULL; -Biome *Biome::swampland = nullptr; -Biome *Biome::river = nullptr; +Biome *Biome::swampland = NULL; +Biome *Biome::river = NULL; -Biome *Biome::hell = nullptr; -Biome *Biome::sky = nullptr; +Biome *Biome::hell = NULL; +Biome *Biome::sky = NULL; -Biome *Biome::frozenOcean = nullptr; -Biome *Biome::frozenRiver = nullptr; -Biome *Biome::iceFlats = nullptr; -Biome *Biome::iceMountains = nullptr; -Biome *Biome::mushroomIsland = nullptr; -Biome *Biome::mushroomIslandShore = nullptr; -Biome *Biome::beaches = nullptr; -Biome *Biome::desertHills = nullptr; -Biome *Biome::forestHills = nullptr; -Biome *Biome::taigaHills = nullptr; -Biome *Biome::smallerExtremeHills = nullptr; +Biome *Biome::frozenOcean = NULL; +Biome *Biome::frozenRiver = NULL; +Biome *Biome::iceFlats = NULL; +Biome *Biome::iceMountains = NULL; +Biome *Biome::mushroomIsland = NULL; +Biome *Biome::mushroomIslandShore = NULL; +Biome *Biome::beaches = NULL; +Biome *Biome::desertHills = NULL; +Biome *Biome::forestHills = NULL; +Biome *Biome::taigaHills = NULL; +Biome *Biome::smallerExtremeHills = NULL; -Biome *Biome::jungle = nullptr; -Biome *Biome::jungleHills = nullptr; +Biome *Biome::jungle = NULL; +Biome *Biome::jungleHills = NULL; void Biome::staticCtor() @@ -86,8 +86,8 @@ Biome::Biome(int id) : id(id) color = 0; // snowCovered = false; // 4J - this isn't set by the java game any more so removing to save confusion - topMaterial = static_cast(Tile::grass_Id); - material = static_cast(Tile::dirt_Id); + topMaterial = (byte) Tile::grass_Id; + material = (byte) Tile::dirt_Id; leafColor = 0x4EE031; _hasRain = true; depth = 0.1f; @@ -95,7 +95,7 @@ Biome::Biome(int id) : id(id) temperature = 0.5f; downfall = 0.5f; //waterColor = 0xffffff; // 4J Stu - Not used - decorator = nullptr; + decorator = NULL; m_grassColor = eMinecraftColour_NOT_SET; m_foliageColor = eMinecraftColour_NOT_SET; @@ -132,7 +132,7 @@ Biome::Biome(int id) : id(id) Biome::~Biome() { - if(decorator != nullptr) delete decorator; + if(decorator != NULL) delete decorator; } BiomeDecorator *Biome::createDecorator() @@ -228,7 +228,7 @@ vector *Biome::getMobs(MobCategory *category) if (category == MobCategory::creature_wolf) return &friendlies_wolf; if (category == MobCategory::creature_mushroomcow) return &friendlies_mushroomcow; if (category == MobCategory::ambient) return &ambientFriendlies; - return nullptr; + return NULL; } bool Biome::hasSnow() @@ -261,12 +261,12 @@ float Biome::getCreatureProbability() int Biome::getDownfallInt() { - return static_cast(downfall * 65536); + return (int) (downfall * 65536); } int Biome::getTemperatureInt() { - return static_cast(temperature * 65536); + return (int) (temperature * 65536); } // 4J - brought forward from 1.2.3 diff --git a/Minecraft.World/BiomeCache.cpp b/Minecraft.World/BiomeCache.cpp index 286e2f7e..54be445c 100644 --- a/Minecraft.World/BiomeCache.cpp +++ b/Minecraft.World/BiomeCache.cpp @@ -10,7 +10,7 @@ BiomeCache::Block::Block(int x, int z, BiomeCache *parent) // temps = floatArray(ZONE_SIZE * ZONE_SIZE, false); // MGH - added "no clear" flag to arrayWithLength // downfall = floatArray(ZONE_SIZE * ZONE_SIZE, false); // biomes = BiomeArray(ZONE_SIZE * ZONE_SIZE, false); - biomeIndices = byteArray(static_cast(ZONE_SIZE * ZONE_SIZE), false); + biomeIndices = byteArray(ZONE_SIZE * ZONE_SIZE, false); lastUse = 0; this->x = x; @@ -34,7 +34,7 @@ Biome *BiomeCache::Block::getBiome(int x, int z) { // return biomes[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; - const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; + int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; return Biome::biomes[biomeIndex]; } @@ -42,7 +42,7 @@ float BiomeCache::Block::getTemperature(int x, int z) { // return temps[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; - const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; + int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; return Biome::biomes[biomeIndex]->getTemperature(); } @@ -51,7 +51,7 @@ float BiomeCache::Block::getDownfall(int x, int z) { // return downfall[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; - const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; + int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)]; return Biome::biomes[biomeIndex]->getDownfall(); } @@ -72,7 +72,7 @@ BiomeCache::~BiomeCache() // 4J Stu - Delete source? // delete source; - for(const auto& it : all ) + for( auto& it : all ) { delete it; } @@ -85,9 +85,9 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z) EnterCriticalSection(&m_CS); x >>= ZONE_SIZE_BITS; z >>= ZONE_SIZE_BITS; - const int64_t slot = (static_cast(x) & 0xffffffffl) | ((static_cast(z) & 0xffffffffl) << 32l); - const auto it = cached.find(slot); - Block *block = nullptr; + int64_t slot = (((int64_t) x) & 0xffffffffl) | ((((int64_t) z) & 0xffffffffl) << 32l); + auto it = cached.find(slot); + Block *block = NULL; if (it == cached.end()) { MemSect(48); @@ -124,20 +124,20 @@ float BiomeCache::getDownfall(int x, int z) void BiomeCache::update() { EnterCriticalSection(&m_CS); - const int64_t now = app.getAppTime(); - const int64_t utime = now - lastUpdateTime; + int64_t now = app.getAppTime(); + int64_t utime = now - lastUpdateTime; if (utime > DECAY_TIME / 4 || utime < 0) { lastUpdateTime = now; for (auto it = all.begin(); it != all.end();) { - const Block *block = *it; - const int64_t time = now - block->lastUse; + Block *block = *it; + int64_t time = now - block->lastUse; if (time > DECAY_TIME || time < 0) { it = all.erase(it); - int64_t slot = (static_cast(block->x) & 0xffffffffl) | ((static_cast(block->z) & 0xffffffffl) << 32l); + int64_t slot = (((int64_t) block->x) & 0xffffffffl) | ((((int64_t) block->z) & 0xffffffffl) << 32l); cached.erase(slot); delete block; } diff --git a/Minecraft.World/BiomeDecorator.cpp b/Minecraft.World/BiomeDecorator.cpp index add156e8..a3cbf546 100644 --- a/Minecraft.World/BiomeDecorator.cpp +++ b/Minecraft.World/BiomeDecorator.cpp @@ -9,8 +9,8 @@ BiomeDecorator::BiomeDecorator(Biome *biome) _init(); // 4J inits - level = nullptr; - random = nullptr; + level = NULL; + random = NULL; xo = 0; zo = 0; @@ -19,7 +19,7 @@ BiomeDecorator::BiomeDecorator(Biome *biome) void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo) { - if (this->level != nullptr) + if (this->level != NULL) { app.DebugPrintf("BiomeDecorator::decorate - Already decorating!!\n"); #ifndef _CONTENT_PACKAGE @@ -34,8 +34,8 @@ void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo) decorate(); - this->level = nullptr; - this->random = nullptr; + this->level = NULL; + this->random = NULL; } @@ -164,7 +164,7 @@ void BiomeDecorator::decorate() // 4J Stu - For some reason this was created each time round in the loop // I assume there is a case where deadBushCount could be 0 - DeadBushFeature *deadBushFeature = nullptr; + DeadBushFeature *deadBushFeature = NULL; if(deadBushCount > 0) deadBushFeature = new DeadBushFeature(Tile::deadBush_Id); for (int i = 0; i < deadBushCount; i++) { @@ -174,7 +174,7 @@ void BiomeDecorator::decorate() //new DeadBushFeature(Tile::deadBush_Id)->place(level, random, x, y, z); deadBushFeature->place(level, random, x, y, z); } - if(deadBushFeature != nullptr)delete deadBushFeature; + if(deadBushFeature != NULL)delete deadBushFeature; for (int i = 0; i < waterlilyCount; i++) { diff --git a/Minecraft.World/BiomeOverrideLayer.cpp b/Minecraft.World/BiomeOverrideLayer.cpp index 84605740..a44295dc 100644 --- a/Minecraft.World/BiomeOverrideLayer.cpp +++ b/Minecraft.World/BiomeOverrideLayer.cpp @@ -11,14 +11,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) #ifdef _UNICODE wstring path = L"GAME:\\GameRules\\biomemap.bin"; - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #else #ifdef _WINDOWS64 string path = "GameRules\\biomemap.bin"; #else string path = "GAME:\\GameRules\\biomemap.bin"; #endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -35,14 +35,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); #endif if(dwFileSize > m_biomeOverride.length) { app.DebugPrintf("Biomemap binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 89422677..2ab6182e 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -87,17 +87,17 @@ floatArray BiomeSource::getDownfallBlock(int x, int z, int w, int h) const void BiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const { IntCache::releaseAll(); - //if (downfalls == nullptr || downfalls->length < w * h) - if (downfalls.data == nullptr || downfalls.length < w * h) + //if (downfalls == NULL || downfalls->length < w * h) + if (downfalls.data == NULL || downfalls.length < w * h) { - if(downfalls.data != nullptr) delete [] downfalls.data; + if(downfalls.data != NULL) delete [] downfalls.data; downfalls = floatArray(w * h); } intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - float d = static_cast(Biome::biomes[result[i]]->getDownfallInt()) / 65536.0f; + float d = (float) Biome::biomes[result[i]]->getDownfallInt() / 65536.0f; if (d > 1) d = 1; downfalls[i] = d; } @@ -132,16 +132,16 @@ void BiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, in { IntCache::releaseAll(); //if (temperatures == null || temperatures.length < w * h) { - if (temperatures.data == nullptr || temperatures.length < w * h) + if (temperatures.data == NULL || temperatures.length < w * h) { - if( temperatures.data != nullptr ) delete [] temperatures.data; + if( temperatures.data != NULL ) delete [] temperatures.data; temperatures = floatArray(w * h); } intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - float t = static_cast(Biome::biomes[result[i]]->getTemperatureInt()) / 65536.0f; + float t = (float) Biome::biomes[result[i]]->getTemperatureInt() / 65536.0f; if (t > 1) t = 1; temperatures[i] = t; } @@ -170,9 +170,9 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomes.data == nullptr || biomes.length < w * h) + if (biomes.data == NULL || biomes.length < w * h) { - if(biomes.data != nullptr) delete [] biomes.data; + if(biomes.data != NULL) delete [] biomes.data; biomes = BiomeArray(w * h); } @@ -181,7 +181,7 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int { biomes[i] = Biome::biomes[result[i]]; #ifndef _CONTENT_PACKAGE - if(biomes[i] == nullptr) + if(biomes[i] == NULL) { app.DebugPrintf("Tried to assign null biome %d\n", result[i]); __debugbreak(); @@ -208,9 +208,9 @@ void BiomeSource::getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h, { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomes.data == nullptr || biomes.length < w * h) + if (biomes.data == NULL || biomes.length < w * h) { - if(biomes.data != nullptr) delete [] biomes.data; + if(biomes.data != NULL) delete [] biomes.data; biomes = BiomeArray(w * h); } @@ -248,9 +248,9 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomeIndices.data == nullptr || biomeIndices.length < w * h) + if (biomeIndices.data == NULL || biomeIndices.length < w * h) { - if(biomeIndices.data != nullptr) delete [] biomeIndices.data; + if(biomeIndices.data != NULL) delete [] biomeIndices.data; biomeIndices = byteArray(w * h); } @@ -264,7 +264,7 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - biomeIndices[i] = static_cast(result[i]); + biomeIndices[i] = (byte)result[i]; } } @@ -341,7 +341,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand int w = x1 - x0 + 1; int h = z1 - z0 + 1; intArray biomes = layer->getArea(x0, z0, w, h); - TilePos *res = nullptr; + TilePos *res = NULL; int found = 0; int biomesCount = w*h; for (unsigned int i = 0; i < biomesCount; i++) @@ -351,7 +351,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand Biome *b = Biome::biomes[biomes[i]]; if (b == toFind) { - if (res == nullptr || random->nextInt(found + 1) == 0) + if (res == NULL || random->nextInt(found + 1) == 0) { res = new TilePos(xx, 0, zz); found++; @@ -380,7 +380,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector allowed, Ra int h = z1 - z0 + 1; MemSect(50); intArray biomes = layer->getArea(x0, z0, w, h); - TilePos *res = nullptr; + TilePos *res = NULL; int found = 0; for (unsigned int i = 0; i < w * h; i++) { @@ -389,7 +389,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector allowed, Ra Biome *b = Biome::biomes[biomes[i]]; if (find(allowed.begin(), allowed.end(), b) != allowed.end()) { - if (res == nullptr || random->nextInt(found + 1) == 0) + if (res == NULL || random->nextInt(found + 1) == 0) { delete res; res = new TilePos(xx, 0, zz); @@ -553,7 +553,7 @@ void BiomeSource::getFracs(intArray indices, float *fracs) for( int i = 0; i < Biome::BIOME_COUNT; i++ ) { - fracs[i] /= static_cast(indices.length); + fracs[i] /= (float)(indices.length); } } diff --git a/Minecraft.World/BirchFeature.cpp b/Minecraft.World/BirchFeature.cpp index 3c423564..d7a57514 100644 --- a/Minecraft.World/BirchFeature.cpp +++ b/Minecraft.World/BirchFeature.cpp @@ -42,7 +42,7 @@ bool BirchFeature::place(Level *level, Random *random, int x, int y, int z) if ((belowTile != Tile::grass_Id && belowTile != Tile::dirt_Id) || y >= Level::maxBuildHeight - treeHeight - 1) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); int radius = 3; diff --git a/Minecraft.World/Blaze.cpp b/Minecraft.World/Blaze.cpp index ec72dfcb..d87a83b2 100644 --- a/Minecraft.World/Blaze.cpp +++ b/Minecraft.World/Blaze.cpp @@ -42,7 +42,7 @@ void Blaze::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, (byte) 0); } int Blaze::getAmbientSound() @@ -84,10 +84,10 @@ void Blaze::aiStep() if (nextHeightOffsetChangeTick <= 0) { nextHeightOffsetChangeTick = SharedConstants::TICKS_PER_SECOND * 5; - allowedHeightOffset = .5f + static_cast(random->nextGaussian()) * 3; + allowedHeightOffset = .5f + (float) random->nextGaussian() * 3; } - if (getAttackTarget() != nullptr && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) + if (getAttackTarget() != NULL && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) { yd = yd + (.3f - yd) * .3f; } @@ -149,10 +149,10 @@ void Blaze::checkHurtTarget(shared_ptr target, float d) { float sqd = sqrt(d) * .5f; - level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0); // level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f); for (int i = 0; i < 1; i++) { - shared_ptr ie = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd); + shared_ptr ie = shared_ptr( new SmallFireball(level, dynamic_pointer_cast( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) ); // Vec3 v = getViewVector(1); // ie.x = x + v.x * 1.5; ie->y = y + bbHeight / 2 + 0.5f; @@ -162,7 +162,7 @@ void Blaze::checkHurtTarget(shared_ptr target, float d) } } - yRot = static_cast(atan2(zd, xd) * 180 / PI) - 90; + yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; holdGround = true; } diff --git a/Minecraft.World/BlockRegionUpdatePacket.h b/Minecraft.World/BlockRegionUpdatePacket.h index d823acaf..54dfea4e 100644 --- a/Minecraft.World/BlockRegionUpdatePacket.h +++ b/Minecraft.World/BlockRegionUpdatePacket.h @@ -28,6 +28,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new BlockRegionUpdatePacket()); } virtual int getId() { return 51; } }; diff --git a/Minecraft.World/BlockReplacements.cpp b/Minecraft.World/BlockReplacements.cpp index f60d9e2a..7b8aee51 100644 --- a/Minecraft.World/BlockReplacements.cpp +++ b/Minecraft.World/BlockReplacements.cpp @@ -8,8 +8,8 @@ void BlockReplacements::staticCtor() { for (int i = 0; i < 256; i++) { - byte b = static_cast(i); - if (b != 0 && Tile::tiles[b & 0xff] == nullptr) + byte b = (byte) i; + if (b != 0 && Tile::tiles[b & 0xff] == NULL) { b = 0; } diff --git a/Minecraft.World/Boat.cpp b/Minecraft.World/Boat.cpp index a470936a..e3387581 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/Boat.cpp @@ -74,7 +74,7 @@ bool Boat::isPushable() Boat::Boat(Level *level, double x, double y, double z) : Entity( level ) { _init(); - setPos(x, y + heightOffset, z); + setPos(x, y + heightOffset + 0.1, z); xd = 0; yd = 0; @@ -97,7 +97,7 @@ bool Boat::hurt(DamageSource *source, float hurtDamage) // 4J-JEV: Fix for #88212, // Untrusted players shouldn't be able to damage minecarts or boats. - if (dynamic_cast(source) != nullptr) + if (dynamic_cast(source) != NULL) { shared_ptr attacker = source->getDirectEntity(); @@ -113,18 +113,18 @@ bool Boat::hurt(DamageSource *source, float hurtDamage) // 4J Stu - If someone is riding in this, then it can tick multiple times which causes the damage to // decrease too quickly. So just make the damage a bit higher to start with for similar behaviour // to an unridden one. Only do this change if the riding player is attacking it. - if( rider.lock() != nullptr && rider.lock() == source->getEntity() ) hurtDamage += 1; + if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1; setDamage(getDamage() + hurtDamage * 10); markHurt(); // 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: 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) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; + bool creativePlayer = (source->getEntity() != NULL) && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { - if (rider.lock() != nullptr) rider.lock()->ride( shared_from_this() ); + if (rider.lock() != NULL) rider.lock()->ride( shared_from_this() ); if (!creativePlayer) spawnAtLocation(Item::boat_Id, 1, 0); remove(); } @@ -209,30 +209,9 @@ void Boat::tick() } double lastSpeed = sqrt(xd * xd + zd * zd); - if (lastSpeed > MAX_COLLISION_SPEED) + if (lastSpeed > MAX_COLLISION_SPEED && waterPercentage > 1) { - double xa = cos(yRot * PI / 180); - double za = sin(yRot * PI / 180); - - for (int i = 0; i < 1 + lastSpeed * 60; i++) - { - - double side = (random->nextFloat() * 2 - 1); - - double side2 = (random->nextInt(2) * 2 - 1) * 0.7; - if (random->nextBoolean()) - { - double xx = x - xa * side * 0.8 + za * side2; - double zz = z - za * side * 0.8 - xa * side2; - level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd); - } - else - { - double xx = x + xa + za * side * 0.7; - double zz = z + za - xa * side * 0.7; - level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd); - } - } + createSplash(lastSpeed); } if (level->isClientSide && doLerp) @@ -254,7 +233,6 @@ void Boat::tick() } else { -#if 1 // Original //double xt = x + xd; //double yt = y + yd; @@ -273,52 +251,24 @@ void Boat::tick() xd *= 0.99f; yd *= 0.95f; zd *= 0.99f; -#else - // 4J Stu - Fix for #8280 - Gameplay : Boats behave erratically when exited next to land. - // The client shouldn't change the position of the boat - double xt = x;// + xd; - double yt = y + yd; - double zt = z;// + zd; - this->setPos(xt, yt, zt); - - // 4J Stu - Fix for #9579 - GAMEPLAY: Boats with a player in them slowly sink under the water over time, and with no player in them they float into the sky. - // Just make the boats bob up and down rather than any other client-side movement when not receiving packets from server - if (waterPercentage > 0) - { - double bob = waterPercentage * 2 - 1; - yd += 0.04f * bob; - } - else - { - if (yd < 0) yd /= 2; - yd += 0.007f; - } - //if (onGround) - //{ - xd *= 0.5f; - yd *= 0.5f; - zd *= 0.5f; - //} - //xd *= 0.99f; - //yd *= 0.95f; - //zd *= 0.99f; -#endif } return; } + // Bob on water if (waterPercentage > 0) { double bob = waterPercentage * 2 - 1; yd += 0.04f * bob; } - else - { - yd = 0; + + // Reimplement "gravity" + if (level->getTile(x, Mth::floor(y - 0.15), z) == 0 && !onGround) { + yd += 0.04f * -1.0; // -1.0 is what bob should return in this situation, just hardcoded. } - - if ( rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) + // Rider Controls + if ( rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr livingRider = dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; @@ -334,6 +284,7 @@ void Boat::tick() double curSpeed = sqrt(xd * xd + zd * zd); + // Speed Clamp if (curSpeed > MAX_SPEED) { double ratio = MAX_SPEED / curSpeed; @@ -354,14 +305,15 @@ void Boat::tick() if (acceleration < MIN_ACCELERATION) acceleration = MIN_ACCELERATION; } + // Slow speed on ground if (onGround) { xd *= 0.5f; - yd *= 0.5f; zd *= 0.5f; } move(xd, yd, zd); + // Break boat if ((horizontalCollision && lastSpeed > 0.20)) { if (!level->isClientSide && !removed) @@ -401,6 +353,7 @@ void Boat::tick() yRot += (float) rotDiff; setRot(yRot, xRot); + // Server only code below if(level->isClientSide) return; vector > *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, 0, 0.2f)); @@ -438,19 +391,43 @@ void Boat::tick() } - if (rider.lock() != nullptr) + if (rider.lock() != NULL) { if (rider.lock()->removed) rider = weak_ptr(); } } +void Boat::createSplash(double particleStrengh) { + double xa = cos(yRot * PI / 180); + double za = sin(yRot * PI / 180); + + for (int i = 0; i < 1 + particleStrengh * 60; i++) + { + double side = (random->nextFloat() * 2 - 1); + + double side2 = (random->nextInt(2) * 2 - 1) * 0.7; + if (random->nextBoolean()) + { + double xx = x - xa * side * 0.8 + za * side2; + double zz = z - za * side * 0.8 - xa * side2; + level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd); + } + else + { + double xx = x + xa + za * side * 0.7; + double zz = z + za - xa * side * 0.7; + level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd); + } + } +} + void Boat::positionRider() { - if (rider.lock() == nullptr) return; + if (rider.lock() == NULL) return; double xa = cos(yRot * PI / 180) * 0.4; double za = sin(yRot * PI / 180) * 0.4; - rider.lock()->setPos(x + xa, y + getRideHeight() + rider.lock()->getRidingHeight(), z + za); + rider.lock()->setPos(x + xa, y + getRideHeight() + rider.lock()->getRidingHeight()-0.5, z + za); } @@ -475,7 +452,7 @@ wstring Boat::getName() bool Boat::interact(shared_ptr player) { - if ( (rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && (rider.lock() != player) ) return true; + if ( (rider.lock() != NULL) && 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 (issue #4446) diff --git a/Minecraft.World/BoatItem.cpp b/Minecraft.World/BoatItem.cpp index 5cf2cd38..d2bb75b5 100644 --- a/Minecraft.World/BoatItem.cpp +++ b/Minecraft.World/BoatItem.cpp @@ -39,7 +39,7 @@ bool BoatItem::TestUse(shared_ptr itemInstance, Level *level, shar double range = 5; Vec3 *to = from->add(xa * range, ya * range, za * range); HitResult *hr = level->clip(from, to, true); - if (hr == nullptr) return false; + if (hr == NULL) return false; if (hr->type == HitResult::TILE) { @@ -74,7 +74,7 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le double range = 5; Vec3 *to = from->add(xa * range, ya * range, za * range); HitResult *hr = level->clip(from, to, true); - if (hr == nullptr) return itemInstance; + if (hr == NULL) return itemInstance; // check entity collision Vec3 *b = player->getViewVector(a); @@ -107,7 +107,7 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le if (level->getTile(xt, yt, zt) == Tile::topSnow_Id) yt--; if( level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit { - shared_ptr boat = std::make_shared(level, xt + 0.5f, yt + 1.0f, zt + 0.5f); + shared_ptr boat = shared_ptr( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) ); boat->yRot = ((Mth::floor(player->yRot * 4.0F / 360.0F + 0.5) & 0x3) - 1) * 90; if (!level->getCubes(boat, boat->bb->grow(-.1, -.1, -.1))->empty()) { diff --git a/Minecraft.World/BonusChestFeature.cpp b/Minecraft.World/BonusChestFeature.cpp index cd33e60a..6d083f54 100644 --- a/Minecraft.World/BonusChestFeature.cpp +++ b/Minecraft.World/BonusChestFeature.cpp @@ -59,7 +59,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, { level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x2, y2, z2)); - if (chest != nullptr) + if (chest != NULL) { WeighedTreasure::addChestItems(random, treasureList, chest, numRolls); chest->isBonusChest = true; // 4J added diff --git a/Minecraft.World/BottleItem.cpp b/Minecraft.World/BottleItem.cpp index 3e526b2a..0f8e3c35 100644 --- a/Minecraft.World/BottleItem.cpp +++ b/Minecraft.World/BottleItem.cpp @@ -18,7 +18,7 @@ Icon *BottleItem::getIcon(int auxValue) shared_ptr BottleItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == nullptr) return itemInstance; + if (hr == NULL) return itemInstance; if (hr->type == HitResult::TILE) { @@ -40,13 +40,13 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, itemInstance->count--; if (itemInstance->count <= 0) { - return std::make_shared(static_cast(Item::potion)); + return shared_ptr( new ItemInstance( (Item *)Item::potion) ); } else { - if (!player->inventory->add(std::make_shared(static_cast(Item::potion)))) + if (!player->inventory->add(shared_ptr( new ItemInstance( (Item *)Item::potion) ))) { - player->drop(std::make_shared(Item::potion_Id, 1, 0)); + player->drop( shared_ptr( new ItemInstance(Item::potion_Id, 1, 0) )); } } } @@ -63,7 +63,7 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, bool BottleItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == nullptr) return false; + if (hr == NULL) return false; if (hr->type == HitResult::TILE) { diff --git a/Minecraft.World/BoundingBox.cpp b/Minecraft.World/BoundingBox.cpp index e93158f2..74dba470 100644 --- a/Minecraft.World/BoundingBox.cpp +++ b/Minecraft.World/BoundingBox.cpp @@ -115,7 +115,7 @@ BoundingBox *BoundingBox::getIntersection(BoundingBox *other) { if (!intersects(other)) { - return nullptr; + return NULL; } BoundingBox *result = new BoundingBox(); result->x0 = Math::_max(x0, other->x0); diff --git a/Minecraft.World/BowItem.cpp b/Minecraft.World/BowItem.cpp index a2d34b89..949b71e7 100644 --- a/Minecraft.World/BowItem.cpp +++ b/Minecraft.World/BowItem.cpp @@ -15,7 +15,7 @@ BowItem::BowItem(int id) : Item( id ) maxStackSize = 1; setMaxDamage(384); - icons = nullptr; + icons = NULL; } void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft) @@ -25,17 +25,17 @@ void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, if (infiniteArrows || player->inventory->hasResource(Item::arrow_Id)) { int timeHeld = getUseDuration(itemInstance) - durationLeft; - float pow = timeHeld / static_cast(MAX_DRAW_DURATION); + float pow = timeHeld / (float) MAX_DRAW_DURATION; pow = ((pow * pow) + pow * 2) / 3; if (pow < 0.1) return; if (pow > 1) pow = 1; - shared_ptr arrow = std::make_shared(level, player, pow * 2.0f); + shared_ptr arrow = shared_ptr( new Arrow(level, player, pow * 2.0f) ); if (pow == 1) arrow->setCritArrow(true); int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance); if (damageBonus > 0) { - arrow->setBaseDamage(arrow->getBaseDamage() + static_cast(damageBonus) * .5 + .5); + arrow->setBaseDamage(arrow->getBaseDamage() + (double) damageBonus * .5 + .5); } int knockbackBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowKnockback->id, itemInstance); if (knockbackBonus > 0) diff --git a/Minecraft.World/BowlFoodItem.cpp b/Minecraft.World/BowlFoodItem.cpp index 66e1dbb1..f8ab0605 100644 --- a/Minecraft.World/BowlFoodItem.cpp +++ b/Minecraft.World/BowlFoodItem.cpp @@ -12,5 +12,5 @@ shared_ptr BowlFoodItem::useTimeDepleted(shared_ptr { FoodItem::useTimeDepleted(instance, level, player); - return std::make_shared(Item::bowl); + return shared_ptr(new ItemInstance(Item::bowl)); } \ No newline at end of file diff --git a/Minecraft.World/BreakDoorGoal.cpp b/Minecraft.World/BreakDoorGoal.cpp index ea00f500..f63b4eb0 100644 --- a/Minecraft.World/BreakDoorGoal.cpp +++ b/Minecraft.World/BreakDoorGoal.cpp @@ -47,7 +47,7 @@ void BreakDoorGoal::tick() breakTime++; - int progress = static_cast(breakTime / (float)DOOR_BREAK_TIME * 10); + int progress = (int) (breakTime / (float) DOOR_BREAK_TIME * 10); if (progress != lastBreakProgress) { mob->level->destroyTileProgress(mob->entityId, doorX, doorY, doorZ, progress); diff --git a/Minecraft.World/BreedGoal.cpp b/Minecraft.World/BreedGoal.cpp index 10aa6844..1c46fd90 100644 --- a/Minecraft.World/BreedGoal.cpp +++ b/Minecraft.World/BreedGoal.cpp @@ -25,12 +25,12 @@ bool BreedGoal::canUse() { if (!animal->isInLove()) return false; partner = weak_ptr(getFreePartner()); - return partner.lock() != nullptr; + return partner.lock() != NULL; } bool BreedGoal::canContinueToUse() { - return partner.lock() != nullptr && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3; + return partner.lock() != NULL && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3; } void BreedGoal::stop() @@ -74,21 +74,21 @@ void BreedGoal::breed() shared_ptr offspring = animal->getBreedOffspring(partner.lock()); animal->setDespawnProtected(); partner.lock()->setDespawnProtected(); - if (offspring == nullptr) + if (offspring == NULL) { - // This will be nullptr if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring + // This will be NULL if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring animal->resetLove(); partner.lock()->resetLove(); return; } shared_ptr loveCause = animal->getLoveCause(); - if (loveCause == nullptr && partner.lock()->getLoveCause() != nullptr) + if (loveCause == NULL && partner.lock()->getLoveCause() != NULL) { loveCause = partner.lock()->getLoveCause(); } - if (loveCause != nullptr) + if (loveCause != NULL) { // Record mob bred stat. loveCause->awardStat(GenericStats::breedEntity(offspring->GetType()),GenericStats::param_breedEntity(offspring->GetType())); @@ -118,5 +118,5 @@ void BreedGoal::breed() * animal->bbWidth * 2 - animal->bbWidth, xa, ya, za); } // 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs. - level->addEntity(std::make_shared(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1)); + level->addEntity( shared_ptr( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) ); } diff --git a/Minecraft.World/BrewingStandMenu.cpp b/Minecraft.World/BrewingStandMenu.cpp index 2200f47c..4f9e2ac3 100644 --- a/Minecraft.World/BrewingStandMenu.cpp +++ b/Minecraft.World/BrewingStandMenu.cpp @@ -69,7 +69,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla Slot *PotionSlot2 = slots.at(BOTTLE_SLOT_START+1); Slot *PotionSlot3 = slots.at(BOTTLE_SLOT_START+2); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -199,7 +199,7 @@ bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr second) bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr item) { - return item != nullptr && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); + return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); } @@ -210,7 +210,7 @@ BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr contain bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) { - if (item != nullptr) + if (item != NULL) { if (PotionBrewing::SIMPLIFIED_BREWING) { diff --git a/Minecraft.World/BrewingStandTile.cpp b/Minecraft.World/BrewingStandTile.cpp index ec7242c8..1aeb52d8 100644 --- a/Minecraft.World/BrewingStandTile.cpp +++ b/Minecraft.World/BrewingStandTile.cpp @@ -10,7 +10,7 @@ BrewingStandTile::BrewingStandTile(int id) : BaseEntityTile(id, Material::metal, isSolidRender()) { random = new Random(); - iconBase = nullptr; + iconBase = NULL; } BrewingStandTile::~BrewingStandTile() @@ -30,7 +30,7 @@ int BrewingStandTile::getRenderShape() shared_ptr BrewingStandTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr(new BrewingStandTileEntity()); } bool BrewingStandTile::isCubeShaped() @@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr return true; } shared_ptr brewingStand = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (brewingStand != nullptr) player->openBrewingStand(brewingStand); + if (brewingStand != NULL) player->openBrewingStand(brewingStand); return true; } @@ -86,13 +86,13 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != nullptr && ( dynamic_pointer_cast(tileEntity) != nullptr) ) + if (tileEntity != NULL && ( dynamic_pointer_cast(tileEntity) != NULL) ) { shared_ptr container = dynamic_pointer_cast(tileEntity); for (int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -104,14 +104,14 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, shared_ptr(new ItemInstance(item->id, count, item->getAuxValue()))); + shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue())))); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 3d081bae..5bc6fd27 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/BrewingStandTileEntity.cpp @@ -96,7 +96,7 @@ int BrewingStandTileEntity::getBrewTime() bool BrewingStandTileEntity::isBrewable() { - if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0) + if (items[INGREDIENT_SLOT] == NULL || items[INGREDIENT_SLOT]->count <= 0) { return false; } @@ -111,7 +111,7 @@ bool BrewingStandTileEntity::isBrewable() bool oneResult = false; for (int dest = 0; dest < 3; dest++) { - if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) + if (items[dest] != NULL && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -129,7 +129,7 @@ bool BrewingStandTileEntity::isBrewable() // TODO - find out whether actually checking pointers to MobEffectInstance classes for equality // is of any use bool equals = false; - if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) ) + if( ( currentEffects != NULL ) && ( newEffects != NULL ) ) { if( currentEffects->size() == newEffects->size() ) { @@ -141,7 +141,7 @@ bool BrewingStandTileEntity::isBrewable() } if ((currentBrew > 0 && currentEffects == newEffects) || - (currentEffects != nullptr && (equals || newEffects == nullptr))) + (currentEffects != NULL && (equals || newEffects == NULL))) { } else if (currentBrew != newBrew) @@ -166,7 +166,7 @@ bool BrewingStandTileEntity::isBrewable() bool oneResult = false; for (int dest = 0; dest < 3; dest++) { - if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) + if (items[dest] != NULL && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -176,7 +176,7 @@ bool BrewingStandTileEntity::isBrewable() break; } } - else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id) + else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id) { oneResult = true; break; @@ -199,7 +199,7 @@ void BrewingStandTileEntity::doBrew() { for (int dest = 0; dest < 3; dest++) { - if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) + if (items[dest] != NULL && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -211,7 +211,7 @@ void BrewingStandTileEntity::doBrew() // TODO - find out whether actually checking pointers to MobEffectInstance classes for equality // is of any use bool equals = false; - if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) ) + if( ( currentEffects != NULL ) && ( newEffects != NULL ) ) { if( currentEffects->size() == newEffects->size() ) { @@ -223,7 +223,7 @@ void BrewingStandTileEntity::doBrew() } if ((currentBrew > 0 && currentEffects == newEffects) || - (currentEffects != nullptr && (equals || newEffects == nullptr))) + (currentEffects != NULL && (equals || newEffects == NULL))) { if (!PotionItem::isThrowable(currentBrew) && PotionItem::isThrowable(newBrew)) { @@ -246,22 +246,22 @@ void BrewingStandTileEntity::doBrew() for (int dest = 0; dest < 3; dest++) { - if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) + if (items[dest] != NULL && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); items[dest]->setAuxValue(newBrew); } - else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id) + else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id) { - items[dest] = std::make_shared(Item::potion); + items[dest] = shared_ptr(new ItemInstance(Item::potion)); } } } if (Item::items[ingredient->id]->hasCraftingRemainingItem()) { - items[INGREDIENT_SLOT] = std::make_shared(Item::items[ingredient->id]->getCraftingRemainingItem()); + items[INGREDIENT_SLOT] = shared_ptr(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem())); } else { @@ -275,7 +275,7 @@ void BrewingStandTileEntity::doBrew() int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr ingredient) { - if (ingredient == nullptr) + if (ingredient == NULL) { return currentBrew; } @@ -322,15 +322,15 @@ void BrewingStandTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BrewTime", static_cast(brewTime)); + base->putShort(L"BrewTime", (short) (brewTime)); ListTag *listTag = new ListTag(); for (int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } @@ -354,7 +354,7 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i // option on the ingredients slot // Fix for #65373 - TU8: Content: UI: Command "Take Half" in the Brewing Stand interface doesn't work as intended. - if (slot >= 0 && slot < items.length && items[slot] != nullptr) + if (slot >= 0 && slot < items.length && items[slot] != NULL) { if (items[slot]->count <= count) { @@ -445,7 +445,7 @@ int BrewingStandTileEntity::getPotionBits() int newCount = 0; for (int potion = 0; potion < 3; potion++) { - if (items[potion] != nullptr) + if (items[potion] != NULL) { newCount |= (1 << potion); } @@ -476,7 +476,7 @@ bool BrewingStandTileEntity::canTakeItemThroughFace(int slot, shared_ptr BrewingStandTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new BrewingStandTileEntity() ); TileEntity::clone(result); result->brewTime = brewTime; @@ -485,7 +485,7 @@ shared_ptr BrewingStandTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items.data[i] != nullptr) + if (items.data[i] != NULL) { result->items.data[i] = ItemInstance::clone(items.data[i]); } diff --git a/Minecraft.World/BucketItem.cpp b/Minecraft.World/BucketItem.cpp index cb9d54b6..a3bd7bee 100644 --- a/Minecraft.World/BucketItem.cpp +++ b/Minecraft.World/BucketItem.cpp @@ -28,7 +28,7 @@ bool BucketItem::TestUse(shared_ptr itemInstance, Level *level, sh { bool pickLiquid = content == 0; HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid); - if (hr == nullptr) return false; + if (hr == NULL) return false; if (hr->type == HitResult::TILE) { @@ -105,7 +105,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, bool pickLiquid = content == 0; HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid); - if (hr == nullptr) return itemInstance; + if (hr == NULL) return itemInstance; if (hr->type == HitResult::TILE) { @@ -117,10 +117,10 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, { app.DebugPrintf("!!!!!!!!!!! Can't place that here\n"); shared_ptr servPlayer = dynamic_pointer_cast(player); - if( servPlayer != nullptr ) + if( servPlayer != NULL ) { app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n"); - servPlayer->connection->send(std::make_shared(L"", ChatPacket::e_ChatCannotPlaceLava)); + servPlayer->connection->send( shared_ptr( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) ); } delete hr; @@ -141,13 +141,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (--itemInstance->count <= 0) { - return std::make_shared(Item::bucket_water); + return shared_ptr( new ItemInstance(Item::bucket_water) ); } else { - if (!player->inventory->add(std::make_shared(Item::bucket_water))) + if (!player->inventory->add(shared_ptr( new ItemInstance(Item::bucket_water)))) { - player->drop(std::make_shared(Item::bucket_water_Id, 1, 0)); + player->drop(shared_ptr(new ItemInstance(Item::bucket_water_Id, 1, 0))); } return itemInstance; } @@ -168,13 +168,13 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, } if (--itemInstance->count <= 0) { - return std::make_shared(Item::bucket_lava); + return shared_ptr( new ItemInstance(Item::bucket_lava) ); } else { - if (!player->inventory->add(std::make_shared(Item::bucket_lava))) + if (!player->inventory->add(shared_ptr( new ItemInstance(Item::bucket_lava)))) { - player->drop(std::make_shared(Item::bucket_lava_Id, 1, 0)); + player->drop(shared_ptr(new ItemInstance(Item::bucket_lava_Id, 1, 0))); } return itemInstance; } @@ -183,7 +183,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, else if (content < 0) { delete hr; - return std::make_shared(Item::bucket_empty); + return shared_ptr( new ItemInstance(Item::bucket_empty) ); } else { @@ -199,7 +199,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, if (emptyBucket(level, xt, yt, zt) && !player->abilities.instabuild) { - return std::make_shared(Item::bucket_empty); + return shared_ptr( new ItemInstance(Item::bucket_empty) ); } } diff --git a/Minecraft.World/BufferedOutputStream.cpp b/Minecraft.World/BufferedOutputStream.cpp index 4f9edbf6..19fc95af 100644 --- a/Minecraft.World/BufferedOutputStream.cpp +++ b/Minecraft.World/BufferedOutputStream.cpp @@ -79,7 +79,7 @@ void BufferedOutputStream::write(byteArray b) //b - the byte to be written. void BufferedOutputStream::write(unsigned int b) { - buf[count++] = static_cast(b); + buf[count++] = (byte) b; if( count == buf.length ) { flush(); diff --git a/Minecraft.World/Bush.cpp b/Minecraft.World/Bush.cpp index 5575c837..6f8e8d91 100644 --- a/Minecraft.World/Bush.cpp +++ b/Minecraft.World/Bush.cpp @@ -63,7 +63,7 @@ bool Bush::canSurvive(Level *level, int x, int y, int z) AABB *Bush::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool Bush::blocksLight() diff --git a/Minecraft.World/ButtonTile.cpp b/Minecraft.World/ButtonTile.cpp index b05d597d..045d5597 100644 --- a/Minecraft.World/ButtonTile.cpp +++ b/Minecraft.World/ButtonTile.cpp @@ -21,7 +21,7 @@ Icon *ButtonTile::getTexture(int face, int data) AABB *ButtonTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } int ButtonTile::getTickDelay(Level *level) @@ -302,7 +302,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z) bool shouldBePressed; updateShape(data); - Tile::ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + Tile::ThreadStorage *tls = (Tile::ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); vector > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); shouldBePressed = !entities->empty(); delete entities; diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp index d79eff36..b0167300 100644 --- a/Minecraft.World/ByteArrayInputStream.cpp +++ b/Minecraft.World/ByteArrayInputStream.cpp @@ -114,5 +114,5 @@ int64_t ByteArrayInputStream::skip(int64_t n) ByteArrayInputStream::~ByteArrayInputStream() { - if(buf.data != nullptr) delete [] buf.data; + if(buf.data != NULL) delete [] buf.data; } \ No newline at end of file diff --git a/Minecraft.World/ByteArrayOutputStream.cpp b/Minecraft.World/ByteArrayOutputStream.cpp index a9f36e04..9296fe5e 100644 --- a/Minecraft.World/ByteArrayOutputStream.cpp +++ b/Minecraft.World/ByteArrayOutputStream.cpp @@ -20,7 +20,7 @@ ByteArrayOutputStream::ByteArrayOutputStream(unsigned int size) ByteArrayOutputStream::~ByteArrayOutputStream() { - if (buf.data != nullptr) + if (buf.data != NULL) delete[] buf.data; } @@ -33,7 +33,7 @@ void ByteArrayOutputStream::write(unsigned int b) if( count + 1 >= buf.length ) buf.resize( buf.length * 2 ); - buf[count] = static_cast(b); + buf[count] = (byte) b; count++; } diff --git a/Minecraft.World/ByteArrayTag.h b/Minecraft.World/ByteArrayTag.h index 1d3e3875..598515ac 100644 --- a/Minecraft.World/ByteArrayTag.h +++ b/Minecraft.World/ByteArrayTag.h @@ -40,8 +40,8 @@ public: { if (Tag::equals(obj)) { - ByteArrayTag *o = static_cast(obj); - return ((data.data == nullptr && o->data.data == nullptr) || (data.data != nullptr && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) ); + ByteArrayTag *o = (ByteArrayTag *) obj; + return ((data.data == NULL && o->data.data == NULL) || (data.data != NULL && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) ); } return false; } diff --git a/Minecraft.World/ByteTag.h b/Minecraft.World/ByteTag.h index ef236472..6b319c0b 100644 --- a/Minecraft.World/ByteTag.h +++ b/Minecraft.World/ByteTag.h @@ -23,7 +23,7 @@ public: { if (Tag::equals(obj)) { - ByteTag *o = static_cast(obj); + ByteTag *o = (ByteTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index 7993a0f6..d0794f06 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -21,7 +21,7 @@ CRITICAL_SECTION C4JThread::ms_threadListCS; #ifdef _XBOX_ONE // 4J Stu - On XboxOne the main thread is not the one that does all the static init, so we have to set this up later -C4JThread *C4JThread::m_mainThread = nullptr; +C4JThread *C4JThread::m_mainThread = NULL; void C4JThread::StaticInit() { @@ -109,12 +109,12 @@ C4JThread::C4JThread( C4JThreadStartFunc* startFunc, void* param, const char* th CPU = SCE_KERNEL_CPU_MASK_USER_1; } - m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, nullptr); + m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, NULL); app.DebugPrintf("***************************** start thread %s **************************\n", m_threadName); #else m_threadID = 0; m_threadHandle = 0; - m_threadHandle = CreateThread(nullptr, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); + m_threadHandle = CreateThread(NULL, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); #endif EnterCriticalSection(&ms_threadListCS); ms_threadList.push_back(this); @@ -128,8 +128,8 @@ C4JThread::C4JThread( const char* mainThreadName) user_registerthread(); #endif - m_startFunc = nullptr; - m_threadParam = nullptr; + m_startFunc = NULL; + m_threadParam = NULL; m_stackSize = 0; #ifdef __PS3__ @@ -178,7 +178,7 @@ C4JThread::~C4JThread() #endif #if defined __ORBIS__ - scePthreadJoin(m_threadID, nullptr); + scePthreadJoin(m_threadID, NULL); #endif EnterCriticalSection(&ms_threadListCS); @@ -212,7 +212,7 @@ void * C4JThread::entryPoint(void *param) pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_completionFlag->Set(); pThread->m_isRunning = false; - scePthreadExit(nullptr); + scePthreadExit(NULL); } #elif defined __PSVITA__ struct StrArg { @@ -233,14 +233,14 @@ SceInt32 C4JThread::entryPoint(SceSize argSize, void *pArgBlock) PSVitaTLSStorage::RemoveThread(pThread->m_threadID); user_removethread(); - sceKernelExitDeleteThread(nullptr); + sceKernelExitDeleteThread(NULL); return pThread->m_exitCode; } #else DWORD WINAPI C4JThread::entryPoint(LPVOID lpParam) { - C4JThread* pThread = static_cast(lpParam); + C4JThread* pThread = (C4JThread*)lpParam; SetThreadName(-1, pThread->m_threadName); pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_isRunning = false; @@ -270,7 +270,7 @@ void C4JThread::Run() scePthreadAttrDestroy(&m_threadAttr); #elif defined __PSVITA__ StrArg strArg = {this}; -// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, nullptr); +// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, NULL); sceKernelStartThread( m_threadID, sizeof(strArg), &strArg); #else ResumeThread(m_threadHandle); @@ -439,7 +439,7 @@ C4JThread* C4JThread::getCurrentThread() #endif //__PS3__ EnterCriticalSection(&ms_threadListCS); - for(size_t i=0;im_threadID) { @@ -450,7 +450,7 @@ C4JThread* C4JThread::getCurrentThread() LeaveCriticalSection(&ms_threadListCS); - return nullptr; + return NULL; } bool C4JThread::isMainThread() @@ -480,12 +480,12 @@ C4JThread::Event::Event(EMode mode/* = e_modeAutoClear*/) #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #elif defined __PSVITA__ char name[1] = {0}; - m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #else - m_event = CreateEvent( nullptr, (m_mode == e_modeManualClear), FALSE, nullptr ); + m_event = CreateEvent( NULL, (m_mode == e_modeManualClear), FALSE, NULL ); #endif //__PS3__ } @@ -554,7 +554,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceKernelUseconds *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = nullptr; + pTimeoutMicrosecs = NULL; } else { @@ -566,7 +566,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -579,7 +579,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceUInt32 *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = nullptr; + pTimeoutMicrosecs = NULL; } else { @@ -591,7 +591,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -623,15 +623,15 @@ C4JThread::EventArray::EventArray( int size, EMode mode/* = e_modeAutoClear*/) assert(err == CELL_OK); #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #elif defined __PSVITA__ char name[1] = {0}; - m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); + m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); #else m_events = new HANDLE[size]; for(int i=0;i(lpParam); + EventQueue* p = (EventQueue*)lpParam; p->threadPoll(); return 0; } diff --git a/Minecraft.World/CactusTile.cpp b/Minecraft.World/CactusTile.cpp index c306f11a..cdce293c 100644 --- a/Minecraft.World/CactusTile.cpp +++ b/Minecraft.World/CactusTile.cpp @@ -11,8 +11,8 @@ CactusTile::CactusTile(int id) : Tile(id, Material::cactus,isSolidRender()) { setTicking(true); - iconTop = nullptr; - iconBottom = nullptr; + iconTop = NULL; + iconBottom = NULL; } void CactusTile::tick(Level *level, int x, int y, int z, Random *random) diff --git a/Minecraft.World/CakeTile.cpp b/Minecraft.World/CakeTile.cpp index 0ef4fe18..55dff176 100644 --- a/Minecraft.World/CakeTile.cpp +++ b/Minecraft.World/CakeTile.cpp @@ -13,9 +13,9 @@ CakeTile::CakeTile(int id) : Tile(id, Material::cake,isSolidRender()) { setTicking(true); - iconTop = nullptr; - iconBottom = nullptr; - iconInner = nullptr; + iconTop = NULL; + iconBottom = NULL; + iconInner = NULL; } void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param diff --git a/Minecraft.World/CanyonFeature.cpp b/Minecraft.World/CanyonFeature.cpp index d25def53..a375db7d 100644 --- a/Minecraft.World/CanyonFeature.cpp +++ b/Minecraft.World/CanyonFeature.cpp @@ -141,11 +141,11 @@ void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray bloc { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = (byte) Tile::lava_Id; } else { - blocks[p] = static_cast(0); + blocks[p] = (byte) 0; if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; } } @@ -179,7 +179,7 @@ void CanyonFeature::addFeature(Level *level, int x, int z, int xOffs, int zOffs, addTunnel(random->nextLong(), xOffs, zOffs, blocks, xCave, yCave, zCave, thickness, yRot, xRot, 0, 0, 3.0); // 4J Add to feature list - app.AddTerrainFeaturePosition(eTerrainFeature_Ravine,static_cast(xCave / 16.0),static_cast(yCave / 16.0)); + app.AddTerrainFeaturePosition(eTerrainFeature_Ravine,(int)(xCave/16.0),(int)(yCave/16.0)); } } \ No newline at end of file diff --git a/Minecraft.World/CarrotOnAStickItem.cpp b/Minecraft.World/CarrotOnAStickItem.cpp index cc39196c..3701fce1 100644 --- a/Minecraft.World/CarrotOnAStickItem.cpp +++ b/Minecraft.World/CarrotOnAStickItem.cpp @@ -35,7 +35,7 @@ shared_ptr CarrotOnAStickItem::use(shared_ptr itemIn if (itemInstance->count == 0) { - shared_ptr replacement = std::make_shared(Item::fishingRod); + shared_ptr replacement = shared_ptr(new ItemInstance(Item::fishingRod)); replacement->setTag(itemInstance->tag); return replacement; } diff --git a/Minecraft.World/CauldronTile.cpp b/Minecraft.World/CauldronTile.cpp index c77ebd28..f7a8d044 100644 --- a/Minecraft.World/CauldronTile.cpp +++ b/Minecraft.World/CauldronTile.cpp @@ -13,9 +13,9 @@ const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender()) { - iconInner = nullptr; - iconTop = nullptr; - iconBottom = nullptr; + iconInner = NULL; + iconTop = NULL; + iconBottom = NULL; } Icon *CauldronTile::getTexture(int face, int data) @@ -43,7 +43,7 @@ Icon *CauldronTile::getTexture(const wstring &name) { if (name.compare(TEXTURE_INSIDE) == 0) return Tile::cauldron->iconInner; if (name.compare(TEXTURE_BOTTOM) == 0) return Tile::cauldron->iconBottom; - return nullptr; + return NULL; } void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) @@ -93,7 +93,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla } shared_ptr item = player->inventory->getSelected(); - if (item == nullptr) + if (item == NULL) { return true; } @@ -107,7 +107,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla { if (!player->abilities.instabuild) { - player->inventory->setItem(player->inventory->selected, std::make_shared(Item::bucket_empty)); + player->inventory->setItem(player->inventory->selected, shared_ptr(new ItemInstance(Item::bucket_empty))); } level->setData(x, y, z, 3, Tile::UPDATE_CLIENTS); @@ -119,10 +119,10 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla { if (fillLevel > 0) { - shared_ptr potion = std::make_shared(Item::potion, 1, 0); + shared_ptr potion = shared_ptr(new ItemInstance(Item::potion, 1, 0)); if (!player->inventory->add(potion)) { - level->addEntity(std::make_shared(level, x + 0.5, y + 1.5, z + 0.5, potion)); + level->addEntity(shared_ptr(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); } // 4J Stu - Brought forward change to update inventory when filling bottles with water else if (player->instanceof(eTYPE_SERVERPLAYER)) diff --git a/Minecraft.World/CaveFeature.cpp b/Minecraft.World/CaveFeature.cpp index edd81788..8183fbdf 100644 --- a/Minecraft.World/CaveFeature.cpp +++ b/Minecraft.World/CaveFeature.cpp @@ -35,7 +35,7 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z) double hr = (Mth::sin(d / 16.0f * PI) * radius + 1) * ss + 1; // 4J Stu Added to stop cave features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects((xx - r / 2), (yy - hr / 2), (zz - r / 2), (xx + r / 2), (yy + hr / 2), (zz + r / 2)); @@ -46,9 +46,9 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z) } } - for (int x2 = static_cast(xx - r / 2); x2 <= static_cast(xx + r / 2); x2++) - for (int y2 = static_cast(yy - hr / 2); y2 <= static_cast(yy + hr / 2); y2++) - for (int z2 = static_cast(zz - r / 2); z2 <= static_cast(zz + r / 2); z2++) + for (int x2 = (int) (xx - r / 2); x2 <= (int) (xx + r / 2); x2++) + for (int y2 = (int) (yy - hr / 2); y2 <= (int) (yy + hr / 2); y2++) + for (int z2 = (int) (zz - r / 2); z2 <= (int) (zz + r / 2); z2++) { double xd = ((x2 + 0.5) - xx) / (r / 2); double yd = ((y2 + 0.5) - yy) / (hr / 2); diff --git a/Minecraft.World/ChatPacket.cpp b/Minecraft.World/ChatPacket.cpp index c4a3ca7c..2988962e 100644 --- a/Minecraft.World/ChatPacket.cpp +++ b/Minecraft.World/ChatPacket.cpp @@ -43,7 +43,7 @@ ChatPacket::ChatPacket(const wstring& message, EChatPacketMessage type, int sour // Read chat packet (throws IOException) void ChatPacket::read(DataInputStream *dis) { - m_messageType = static_cast(dis->readShort()); + m_messageType = (EChatPacketMessage) dis->readShort(); short packedCounts = dis->readShort(); int stringCount = (packedCounts >> 4) & 0xF; @@ -71,12 +71,12 @@ void ChatPacket::write(DataOutputStream *dos) dos->writeShort(packedCounts); - for(size_t i = 0; i < m_stringArgs.size(); i++) + for(int i = 0; i < m_stringArgs.size(); i++) { writeUtf(m_stringArgs[i], dos); } - for(size_t i = 0; i < m_intArgs.size(); i++) + for(int i = 0; i < m_intArgs.size(); i++) { dos->writeInt(m_intArgs[i]); } @@ -92,7 +92,7 @@ void ChatPacket::handle(PacketListener *listener) int ChatPacket::getEstimatedSize() { int stringsSize = 0; - for(size_t i = 0; i < m_stringArgs.size(); i++) + for(int i = 0; i < m_stringArgs.size(); i++) { stringsSize += m_stringArgs[i].length(); } diff --git a/Minecraft.World/ChatPacket.h b/Minecraft.World/ChatPacket.h index ea9b3806..ca9e4955 100644 --- a/Minecraft.World/ChatPacket.h +++ b/Minecraft.World/ChatPacket.h @@ -119,7 +119,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ChatPacket()); } virtual int getId() { return 3; } }; diff --git a/Minecraft.World/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index ff3c0b40..11178b8a 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/ChestTile.cpp @@ -208,18 +208,18 @@ void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type) { BaseEntityTile::neighborChanged(level, x, y, z, type); shared_ptr(cte) = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (cte != nullptr) cte->clearCache(); + if (cte != NULL) cte->clearCache(); } void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != nullptr ) + if (container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -231,16 +231,16 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (count > item->count) count = item->count; item->count -= count; - shared_ptr newItem = std::make_shared(item->id, count, item->getAuxValue()); + shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, newItem); + shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } level->addEntity(itemEntity); @@ -272,7 +272,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player } shared_ptr container = getContainer(level, x, y, z); - if (container != nullptr) + if (container != NULL) { player->openContainer(container); } @@ -283,7 +283,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container == nullptr) return nullptr; + if (container == NULL) return nullptr; if (level->isSolidBlockingTile(x, y + 1, z)) return nullptr; if (isCatSittingOnChest(level,x, y, z)) return nullptr; @@ -293,10 +293,10 @@ shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return nullptr; if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return nullptr; - if (level->getTile(x - 1, y, z) == id) container = std::make_shared(IDS_CHEST_LARGE, dynamic_pointer_cast(level->getTileEntity(x - 1, y, z)), container); - if (level->getTile(x + 1, y, z) == id) container = std::make_shared(IDS_CHEST_LARGE, container, dynamic_pointer_cast(level->getTileEntity(x + 1, y, z))); - if (level->getTile(x, y, z - 1) == id) container = std::make_shared(IDS_CHEST_LARGE, dynamic_pointer_cast(level->getTileEntity(x, y, z - 1)), container); - if (level->getTile(x, y, z + 1) == id) container = std::make_shared(IDS_CHEST_LARGE, container, dynamic_pointer_cast(level->getTileEntity(x, y, z + 1))); + if (level->getTile(x - 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x - 1, y, z) ), container) ); + if (level->getTile(x + 1, y, z) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x + 1, y, z) )) ); + if (level->getTile(x, y, z - 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast( level->getTileEntity(x, y, z - 1) ), container) ); + if (level->getTile(x, y, z + 1) == id) container = shared_ptr( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast( level->getTileEntity(x, y, z + 1) )) ); return container; } @@ -304,7 +304,7 @@ shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) shared_ptr ChestTile::newTileEntity(Level *level) { MemSect(50); - shared_ptr retval = std::make_shared(); + shared_ptr retval = shared_ptr( new ChestTileEntity() ); MemSect(0); return retval; } diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index ba277e24..b8f323f4 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -65,7 +65,7 @@ shared_ptr ChestTileEntity::getItem(unsigned int slot) shared_ptr ChestTileEntity::removeItem(unsigned int slot, int count) { - if (items->data[slot] != nullptr) + if (items->data[slot] != NULL) { if (items->data[slot]->count <= count) { @@ -91,7 +91,7 @@ shared_ptr ChestTileEntity::removeItem(unsigned int slot, int coun shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) { - if (items->data[slot] != nullptr) + if (items->data[slot] != NULL) { shared_ptr item = items->data[slot]; items->data[slot] = nullptr; @@ -103,7 +103,7 @@ shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) void ChestTileEntity::setItem(unsigned int slot, shared_ptr item) { items->data[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); this->setChanged(); } @@ -154,10 +154,10 @@ void ChestTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != nullptr) + if (items->data[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items->data[i]->save(tag); listTag->add(tag); } @@ -244,17 +244,17 @@ void ChestTileEntity::checkNeighbors() } shared_ptr cteThis = dynamic_pointer_cast(shared_from_this()); - if (n.lock() != nullptr) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH); - if (s.lock() != nullptr) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH); - if (e.lock() != nullptr) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); - if (w.lock() != nullptr) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); + if (n.lock() != NULL) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH); + if (s.lock() != NULL) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH); + if (e.lock() != NULL) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); + if (w.lock() != NULL) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); } bool ChestTileEntity::isSameChest(int x, int y, int z) { Tile *tile = Tile::tiles[level->getTile(x, y, z)]; - if (tile == nullptr || !(dynamic_cast(tile) != nullptr)) return false; - return static_cast(tile)->type == getType(); + if (tile == NULL || !(dynamic_cast(tile) != NULL)) return false; + return ((ChestTile *) tile)->type == getType(); } void ChestTileEntity::tick() @@ -283,7 +283,7 @@ void ChestTileEntity::tick() shared_ptr container = containerMenu->getContainer(); shared_ptr thisContainer = dynamic_pointer_cast(shared_from_this()); shared_ptr compoundContainer = dynamic_pointer_cast(container); - if ((container == thisContainer) || (compoundContainer != nullptr && compoundContainer->contains(thisContainer))) + if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer))) { openCount++; } @@ -298,12 +298,12 @@ void ChestTileEntity::tick() float speed = 0.10f; if (openCount > 0 && openness == 0) { - if (n.lock() == nullptr && w.lock() == nullptr) + if (n.lock() == NULL && w.lock() == NULL) { double xc = x + 0.5; double zc = z + 0.5; - if (s.lock() != nullptr) zc += 0.5; - if (e.lock() != nullptr) xc += 0.5; + if (s.lock() != NULL) zc += 0.5; + if (e.lock() != NULL) xc += 0.5; // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); @@ -323,12 +323,12 @@ void ChestTileEntity::tick() { // Fix for #64546 - Customer Encountered: TU7: Chests placed by the Player are closing too fast. //openness = 0; - if (n.lock() == nullptr && w.lock() == nullptr) + if (n.lock() == NULL && w.lock() == NULL) { double xc = x + 0.5; double zc = z + 0.5; - if (s.lock() != nullptr) zc += 0.5; - if (e.lock() != nullptr) xc += 0.5; + if (s.lock() != NULL) zc += 0.5; + if (e.lock() != NULL) xc += 0.5; // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); @@ -366,7 +366,7 @@ void ChestTileEntity::startOpen() void ChestTileEntity::stopOpen() { - if (getTile() == nullptr || !( dynamic_cast( getTile() ) != nullptr)) return; + if (getTile() == NULL || !( dynamic_cast( getTile() ) != NULL)) return; openCount--; level->tileEvent(x, y, z, getTile()->id, ChestTile::EVENT_SET_OPEN_COUNT, openCount); level->updateNeighborsAt(x, y, z, getTile()->id); @@ -389,9 +389,9 @@ int ChestTileEntity::getType() { if (type == -1) { - if (level != nullptr && dynamic_cast( getTile() ) != nullptr) + if (level != NULL && dynamic_cast( getTile() ) != NULL) { - type = static_cast(getTile())->type; + type = ((ChestTile *) getTile())->type; } else { @@ -405,12 +405,12 @@ int ChestTileEntity::getType() // 4J Added shared_ptr ChestTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new ChestTileEntity() ); TileEntity::clone(result); for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != nullptr) + if (items->data[i] != NULL) { result->items->data[i] = ItemInstance::clone(items->data[i]); } diff --git a/Minecraft.World/Chicken.cpp b/Minecraft.World/Chicken.cpp index 355d8a25..5f4cf2a7 100644 --- a/Minecraft.World/Chicken.cpp +++ b/Minecraft.World/Chicken.cpp @@ -143,7 +143,7 @@ shared_ptr Chicken::getBreedOffspring(shared_ptr target) // 4J - added limit to chickens that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return std::make_shared(level); + return shared_ptr(new Chicken(level)); } else { diff --git a/Minecraft.World/ChunkPos.cpp b/Minecraft.World/ChunkPos.cpp index 6d37a446..acf885c0 100644 --- a/Minecraft.World/ChunkPos.cpp +++ b/Minecraft.World/ChunkPos.cpp @@ -16,8 +16,8 @@ int64_t ChunkPos::hashCode(int x, int z) int ChunkPos::hashCode() { int64_t hash = hashCode(x, z); - const int h1 = static_cast(hash); - const int h2 = static_cast(hash >> 32l); + int h1 = (int) (hash); + int h2 = (int) (hash >> 32l); return h1 ^ h2; } diff --git a/Minecraft.World/ChunkSource.h b/Minecraft.World/ChunkSource.h index 37b0ecc3..c537651c 100644 --- a/Minecraft.World/ChunkSource.h +++ b/Minecraft.World/ChunkSource.h @@ -73,7 +73,7 @@ public: virtual bool tick() = 0; virtual bool shouldSave() = 0; - virtual LevelChunk **getCache() { return nullptr; } // 4J added + virtual LevelChunk **getCache() { return NULL; } // 4J added virtual void dataReceived(int x, int z) {} // 4J added /** diff --git a/Minecraft.World/ChunkStorageProfileDecorator.cpp b/Minecraft.World/ChunkStorageProfileDecorator.cpp index 375048db..5d757811 100644 --- a/Minecraft.World/ChunkStorageProfileDecorator.cpp +++ b/Minecraft.World/ChunkStorageProfileDecorator.cpp @@ -45,7 +45,7 @@ void ChunkStorageProfilerDecorator::tick() #ifdef __PSVITA__ sprintf(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); #else - sprintf(buf,"Average load time: %f (%I64d)",0.000001 * static_cast(timeSpentLoading) / static_cast(loadCount), loadCount); + sprintf(buf,"Average load time: %f (%I64d)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); #endif app.DebugPrintf(buf); #endif @@ -56,7 +56,7 @@ void ChunkStorageProfilerDecorator::tick() #ifdef __PSVITA__ sprintf(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); #else - sprintf(buf,"Average save time: %f (%I64d)",0.000001 * static_cast(timeSpentSaving) / static_cast(loadCount), loadCount); + sprintf(buf,"Average save time: %f (%I64d)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); #endif app.DebugPrintf(buf); #endif diff --git a/Minecraft.World/ChunkTilesUpdatePacket.cpp b/Minecraft.World/ChunkTilesUpdatePacket.cpp index de5abea1..d90e6b2f 100644 --- a/Minecraft.World/ChunkTilesUpdatePacket.cpp +++ b/Minecraft.World/ChunkTilesUpdatePacket.cpp @@ -42,8 +42,8 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi int y = (positions[i]) & 255; this->positions[i] = positions[i]; - blocks[i] = static_cast(levelChunk->getTile(x, y, z)); - data[i] = static_cast(levelChunk->getData(x, y, z)); + blocks[i] = (byte) levelChunk->getTile(x, y, z); + data[i] = (byte) levelChunk->getData(x, y, z); } levelIdx = ( ( level->dimension->id == 0 ) ? 0 : ( (level->dimension->id == -1) ? 1 : 2 ) ); } diff --git a/Minecraft.World/ChunkTilesUpdatePacket.h b/Minecraft.World/ChunkTilesUpdatePacket.h index 7cbc3c65..a97f49a3 100644 --- a/Minecraft.World/ChunkTilesUpdatePacket.h +++ b/Minecraft.World/ChunkTilesUpdatePacket.h @@ -25,7 +25,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ChunkTilesUpdatePacket()); } virtual int getId() { return 52; } }; diff --git a/Minecraft.World/ChunkVisibilityAreaPacket.h b/Minecraft.World/ChunkVisibilityAreaPacket.h index 9442b6f7..33087497 100644 --- a/Minecraft.World/ChunkVisibilityAreaPacket.h +++ b/Minecraft.World/ChunkVisibilityAreaPacket.h @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ChunkVisibilityAreaPacket()); } virtual int getId() { return 155; } }; diff --git a/Minecraft.World/ChunkVisibilityPacket.h b/Minecraft.World/ChunkVisibilityPacket.h index 74af7f4d..8c5856c7 100644 --- a/Minecraft.World/ChunkVisibilityPacket.h +++ b/Minecraft.World/ChunkVisibilityPacket.h @@ -22,7 +22,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ChunkVisibilityPacket()); } virtual int getId() { return 50; } }; diff --git a/Minecraft.World/ClientCommandPacket.h b/Minecraft.World/ClientCommandPacket.h index b3578a10..2f614ddf 100644 --- a/Minecraft.World/ClientCommandPacket.h +++ b/Minecraft.World/ClientCommandPacket.h @@ -19,6 +19,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ClientCommandPacket()); } virtual int getId() { return 205; } }; \ No newline at end of file diff --git a/Minecraft.World/ClientSideMerchant.cpp b/Minecraft.World/ClientSideMerchant.cpp index 1b54580b..ba179300 100644 --- a/Minecraft.World/ClientSideMerchant.cpp +++ b/Minecraft.World/ClientSideMerchant.cpp @@ -7,8 +7,8 @@ ClientSideMerchant::ClientSideMerchant(shared_ptr source, const wstring { this->source = source; // 4J Stu - Need to do this after creating as a shared_ptr - container = nullptr; //new MerchantContainer(source, this); - currentOffers = nullptr; + container = NULL; //new MerchantContainer(source, this); + currentOffers = NULL; m_name = name; } diff --git a/Minecraft.World/ClockItem.cpp b/Minecraft.World/ClockItem.cpp index 83b8e7a4..afe0544d 100644 --- a/Minecraft.World/ClockItem.cpp +++ b/Minecraft.World/ClockItem.cpp @@ -12,7 +12,7 @@ const wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0",L"cl ClockItem::ClockItem(int id) : Item(id) { - icons = nullptr; + icons = NULL; } // 4J Added so that we can override the icon id used to calculate the texture UV's for each player @@ -21,7 +21,7 @@ Icon *ClockItem::getIcon(int auxValue) Icon *icon = Item::getIcon(auxValue); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->player != nullptr && auxValue == 0 ) + if( pMinecraft->player != NULL && auxValue == 0 ) { icon = icons[pMinecraft->player->GetXboxPad()]; } diff --git a/Minecraft.World/CocoaTile.cpp b/Minecraft.World/CocoaTile.cpp index 3df58eb8..095f9b52 100644 --- a/Minecraft.World/CocoaTile.cpp +++ b/Minecraft.World/CocoaTile.cpp @@ -151,7 +151,7 @@ void CocoaTile::spawnResources(Level *level, int x, int y, int z, int data, floa } for (int i = 0; i < count; i++) { - popResource(level, x, y, z, std::make_shared(Item::dye_powder, 1, DyePowderItem::BROWN)); + popResource(level, x, y, z, shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) )); } } diff --git a/Minecraft.World/Color.cpp b/Minecraft.World/Color.cpp index 554ee379..256e9017 100644 --- a/Minecraft.World/Color.cpp +++ b/Minecraft.World/Color.cpp @@ -18,7 +18,7 @@ Color::Color( float r, float g, float b) assert( b >= 0.0f && b <= 1.0f ); //argb - colour = ( (0xFF<<24) | ( static_cast(r * 255)<<16 ) | ( static_cast(g * 255)<<8 ) | static_cast(b * 255) ); + colour = ( (0xFF<<24) | ( (int)(r*255)<<16 ) | ( (int)(g*255)<<8 ) | ( (int)(b*255) ) ); } Color::Color( int r, int g, int b) @@ -43,7 +43,7 @@ Color Color::getHSBColor(float hue, float saturation, float brightness) int r = 0, g = 0, b = 0; if (saturation == 0) { - r = g = b = static_cast(brightness * 255.0f + 0.5f); + r = g = b = (int) (brightness * 255.0f + 0.5f); } else { @@ -52,37 +52,37 @@ Color Color::getHSBColor(float hue, float saturation, float brightness) float p = brightness * (1.0f - saturation); float q = brightness * (1.0f - saturation * f); float t = brightness * (1.0f - (saturation * (1.0f - f))); - switch (static_cast(h)) + switch ((int) h) { case 0: - r = static_cast(brightness * 255.0f + 0.5f); - g = static_cast(t * 255.0f + 0.5f); - b = static_cast(p * 255.0f + 0.5f); + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (t * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); break; case 1: - r = static_cast(q * 255.0f + 0.5f); - g = static_cast(brightness * 255.0f + 0.5f); - b = static_cast(p * 255.0f + 0.5f); + r = (int) (q * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); break; case 2: - r = static_cast(p * 255.0f + 0.5f); - g = static_cast(brightness * 255.0f + 0.5f); - b = static_cast(t * 255.0f + 0.5f); + r = (int) (p * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (t * 255.0f + 0.5f); break; case 3: - r = static_cast(p * 255.0f + 0.5f); - g = static_cast(q * 255.0f + 0.5f); - b = static_cast(brightness * 255.0f + 0.5f); + r = (int) (p * 255.0f + 0.5f); + g = (int) (q * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); break; case 4: - r = static_cast(t * 255.0f + 0.5f); - g = static_cast(p * 255.0f + 0.5f); - b = static_cast(brightness * 255.0f + 0.5f); + r = (int) (t * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); break; case 5: - r = static_cast(brightness * 255.0f + 0.5f); - g = static_cast(p * 255.0f + 0.5f); - b = static_cast(q * 255.0f + 0.5f); + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (q * 255.0f + 0.5f); break; } } diff --git a/Minecraft.World/ColoredTileItem.cpp b/Minecraft.World/ColoredTileItem.cpp index f659d7a5..37ea4c63 100644 --- a/Minecraft.World/ColoredTileItem.cpp +++ b/Minecraft.World/ColoredTileItem.cpp @@ -15,7 +15,7 @@ ColoredTileItem::ColoredTileItem(int id, bool stackedByData) : TileItem(id) ColoredTileItem::~ColoredTileItem() { - if(descriptionPostfixes.data != nullptr) delete [] descriptionPostfixes.data; + if(descriptionPostfixes.data != NULL) delete [] descriptionPostfixes.data; } int ColoredTileItem::getColor(shared_ptr item, int spriteLayer) @@ -35,7 +35,7 @@ int ColoredTileItem::getLevelDataForAuxValue(int auxValue) ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPostfixes) { - if(this->descriptionPostfixes.data != nullptr) delete this->descriptionPostfixes.data; + if(this->descriptionPostfixes.data != NULL) delete this->descriptionPostfixes.data; this->descriptionPostfixes = intArray(descriptionPostfixes.length); for(unsigned int i = 0; i < descriptionPostfixes.length; ++i ) { @@ -47,7 +47,7 @@ ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPo unsigned int ColoredTileItem::getDescriptionId(shared_ptr instance) { - if (descriptionPostfixes.data == nullptr) + if (descriptionPostfixes.data == NULL) { return TileItem::getDescriptionId(instance); } diff --git a/Minecraft.World/CombatEntry.cpp b/Minecraft.World/CombatEntry.cpp index 5fe2e6d3..903d95bb 100644 --- a/Minecraft.World/CombatEntry.cpp +++ b/Minecraft.World/CombatEntry.cpp @@ -6,8 +6,8 @@ CombatEntry::CombatEntry(DamageSource *source, int time, float health, float damage, CombatTracker::eLOCATION location, float fallDistance) { - this->source = nullptr; - if(source != nullptr) + this->source = NULL; + if(source != NULL) { // 4J: this might actually be a derived damage source so use copy func this->source = source->copy(); @@ -61,7 +61,7 @@ CombatTracker::eLOCATION CombatEntry::getLocation() wstring CombatEntry::getAttackerName() { - return getSource()->getEntity() == nullptr ? L"" : getSource()->getEntity()->getNetworkName(); + return getSource()->getEntity() == NULL ? L"" : getSource()->getEntity()->getNetworkName(); } float CombatEntry::getFallDistance() diff --git a/Minecraft.World/CombatTracker.cpp b/Minecraft.World/CombatTracker.cpp index 69029115..2d35913c 100644 --- a/Minecraft.World/CombatTracker.cpp +++ b/Minecraft.World/CombatTracker.cpp @@ -58,7 +58,7 @@ void CombatTracker::recordDamage(DamageSource *source, float health, float damag shared_ptr CombatTracker::getDeathMessagePacket() { - if (entries.size() == 0) return std::make_shared(mob->getNetworkName()); + if (entries.size() == 0) return shared_ptr(new ChatPacket(mob->getNetworkName())); CombatEntry *knockOffEntry = getMostSignificantFall(); CombatEntry *killingBlow = entries[entries.size() - 1]; @@ -67,7 +67,7 @@ shared_ptr CombatTracker::getDeathMessagePacket() shared_ptr killingEntity = killingBlow->getSource()->getEntity(); - if (knockOffEntry != nullptr && killingBlow->getSource()->equals(DamageSource::fall)) + if (knockOffEntry != NULL && killingBlow->getSource()->equals(DamageSource::fall)) { shared_ptr attackerEntity = knockOffEntry->getSource()->getEntity(); @@ -91,36 +91,36 @@ shared_ptr CombatTracker::getDeathMessagePacket() break; } - result = std::make_shared(mob->getNetworkName(), message); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), message)); } - else if (attackerEntity != nullptr && (killingEntity == nullptr || attackerEntity != killingEntity)) + else if (attackerEntity != NULL && (killingEntity == NULL || attackerEntity != killingEntity)) { shared_ptr attackerItem = attackerEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(attackerEntity)->getCarriedItem() : nullptr; - if (attackerItem != nullptr && attackerItem->hasCustomHoverName()) + if (attackerItem != NULL && attackerItem->hasCustomHoverName()) { - result = std::make_shared(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssistItem, attackerEntity->GetType(), attackerEntity->getNetworkName(), attackerItem->getHoverName()); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssistItem, attackerEntity->GetType(), attackerEntity->getNetworkName(), attackerItem->getHoverName())); } else { - result = std::make_shared(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssist, attackerEntity->GetType(), attackerEntity->getNetworkName()); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssist, attackerEntity->GetType(), attackerEntity->getNetworkName())); } } - else if (killingEntity != nullptr) + else if (killingEntity != NULL) { shared_ptr killerItem = killingEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(killingEntity)->getCarriedItem() : nullptr; - if (killerItem != nullptr && killerItem->hasCustomHoverName()) + if (killerItem != NULL && killerItem->hasCustomHoverName()) { - result = std::make_shared(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinishItem, killingEntity->GetType(), killingEntity->getNetworkName(), killerItem->getHoverName()); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinishItem, killingEntity->GetType(), killingEntity->getNetworkName(), killerItem->getHoverName())); } else { - result = std::make_shared(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinish, killingEntity->GetType(), killingEntity->getNetworkName()); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinish, killingEntity->GetType(), killingEntity->getNetworkName())); } } else { - result = std::make_shared(mob->getNetworkName(), ChatPacket::e_ChatDeathFellKiller); + result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellKiller)); } } else @@ -140,20 +140,20 @@ shared_ptr CombatTracker::getKiller() for ( CombatEntry *entry : entries ) { - if ( entry->getSource() != nullptr && entry->getSource()->getEntity() != nullptr && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage)) + if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == NULL || entry->getDamage() > bestPlayerDamage)) { bestPlayerDamage = entry->getDamage(); bestPlayer = 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)) + if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && (bestMob == NULL || entry->getDamage() > bestMobDamage)) { bestMobDamage = entry->getDamage(); bestMob = dynamic_pointer_cast(entry->getSource()->getEntity()); } } - if (bestPlayer != nullptr && bestPlayerDamage >= bestMobDamage / 3) + if (bestPlayer != NULL && bestPlayerDamage >= bestMobDamage / 3) { return bestPlayer; } @@ -165,20 +165,20 @@ shared_ptr CombatTracker::getKiller() CombatEntry *CombatTracker::getMostSignificantFall() { - CombatEntry *result = nullptr; - CombatEntry *alternative = nullptr; + CombatEntry *result = NULL; + CombatEntry *alternative = NULL; int altDamage = 0; float bestFall = 0; - for (size_t i = 0; i < entries.size(); i++) + for (int i = 0; i < entries.size(); i++) { CombatEntry *entry = entries.at(i); - CombatEntry *previous = i > 0 ? entries.at(i - 1) : nullptr; + CombatEntry *previous = i > 0 ? entries.at(i - 1) : NULL; bool isFall = entry->getSource()->equals(DamageSource::fall); bool isOutOfWorld = entry->getSource()->equals(DamageSource::outOfWorld); - if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == nullptr || entry->getFallDistance() > bestFall)) + if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == NULL || entry->getFallDistance() > bestFall)) { if (i > 0) { @@ -191,23 +191,23 @@ CombatEntry *CombatTracker::getMostSignificantFall() bestFall = entry->getFallDistance(); } - if (entry->getLocation() != eLocation_GENERIC && (alternative == nullptr || entry->getDamage() > altDamage)) + if (entry->getLocation() != eLocation_GENERIC && (alternative == NULL || entry->getDamage() > altDamage)) { alternative = entry; } } - if (bestFall > 5 && result != nullptr) + if (bestFall > 5 && result != NULL) { return result; } - else if (altDamage > 5 && alternative != nullptr) + else if (altDamage > 5 && alternative != NULL) { return alternative; } else { - return nullptr; + return NULL; } } diff --git a/Minecraft.World/Command.cpp b/Minecraft.World/Command.cpp index 2ec6853c..bf546f6e 100644 --- a/Minecraft.World/Command.cpp +++ b/Minecraft.World/Command.cpp @@ -24,7 +24,7 @@ void Command::logAdminAction(shared_ptr source, ChatPacket::EChat void Command::logAdminAction(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) { - if (logger != nullptr) + if (logger != NULL) { logger->logAdminCommand(source, type, messageType, message, customData, additionalMessage); } @@ -39,7 +39,7 @@ shared_ptr Command::getPlayer(PlayerUID playerId) { shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); - if (player == nullptr) + if (player == NULL) { return nullptr; } diff --git a/Minecraft.World/CommandBlock.cpp b/Minecraft.World/CommandBlock.cpp index c151172e..e1b6b8dd 100644 --- a/Minecraft.World/CommandBlock.cpp +++ b/Minecraft.World/CommandBlock.cpp @@ -10,7 +10,7 @@ CommandBlock::CommandBlock(int id) : BaseEntityTile(id, Material::metal, isSolid shared_ptr CommandBlock::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new CommandBlockEntity() ); } void CommandBlock::neighborChanged(Level *level, int x, int y, int z, int type) @@ -38,7 +38,7 @@ void CommandBlock::tick(Level *level, int x, int y, int z, Random *random) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) + if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) { shared_ptr commandBlock = dynamic_pointer_cast( tileEntity ); commandBlock->setSuccessCount(commandBlock->performCommand(level)); @@ -55,7 +55,7 @@ bool CommandBlock::use(Level *level, int x, int y, int z, shared_ptr pla { shared_ptr amce = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (amce != nullptr) + if (amce != NULL) { player->openTextEdit(amce); } @@ -72,7 +72,7 @@ int CommandBlock::getAnalogOutputSignal(Level *level, int x, int y, int z, int d { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) + if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) { return dynamic_pointer_cast( tileEntity )->getSuccessCount(); } diff --git a/Minecraft.World/CommandBlockEntity.cpp b/Minecraft.World/CommandBlockEntity.cpp index 00870ee4..1c518f4f 100644 --- a/Minecraft.World/CommandBlockEntity.cpp +++ b/Minecraft.World/CommandBlockEntity.cpp @@ -32,7 +32,7 @@ int CommandBlockEntity::performCommand(Level *level) } MinecraftServer *instance = MinecraftServer::getInstance(); - if (instance != nullptr && instance->isCommandBlockEnabled()) + if (instance != NULL && instance->isCommandBlockEnabled()) { CommandDispatcher *commandDispatcher = instance->getCommandDispatcher(); return commandDispatcher->performCommand(dynamic_pointer_cast(shared_from_this()), command, byteArray() ); @@ -94,7 +94,7 @@ shared_ptr CommandBlockEntity::getUpdatePacket() { CompoundTag *tag = new CompoundTag(); save(tag); - return std::make_shared(x, y, z, TileEntityDataPacket::TYPE_ADV_COMMAND, tag); + return shared_ptr( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_ADV_COMMAND, tag) ); } int CommandBlockEntity::getSuccessCount() @@ -110,7 +110,7 @@ void CommandBlockEntity::setSuccessCount(int successCount) // 4J Added shared_ptr CommandBlockEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new CommandBlockEntity() ); TileEntity::clone(result); result->successCount = successCount; diff --git a/Minecraft.World/CommonStats.cpp b/Minecraft.World/CommonStats.cpp index 5ad0e35b..abef92aa 100644 --- a/Minecraft.World/CommonStats.cpp +++ b/Minecraft.World/CommonStats.cpp @@ -50,26 +50,26 @@ Stat* CommonStats::get_killsNetherZombiePigman() { return Stats::killsNetherZomb Stat *CommonStats::get_breedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_COW) return GenericStats::repopulation(); - else return nullptr; + else return NULL; } Stat *CommonStats::get_tamedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_OCELOT) return GenericStats::lionTamer(); else if (mobType == eTYPE_WOLF) return Stats::befriendsWolf; - else return nullptr; + else return NULL; } Stat *CommonStats::get_craftedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_VILLAGERGOLEM) return GenericStats::bodyGuard(); - else return nullptr; + else return NULL; } Stat *CommonStats::get_shearedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_SHEEP) return GenericStats::haveAShearfulDay(); - else return nullptr; + else return NULL; } Stat *CommonStats::get_totalBlocksMined() { return Stats::totalBlocksMined; } @@ -81,7 +81,7 @@ Stat* CommonStats::get_blocksPlaced(int blockId) #if (defined _EXTENDED_ACHIEVEMENTS) && (!defined _XBOX_ONE) return Stats::blocksPlaced[blockId]; #else - return nullptr; + return NULL; #endif } @@ -97,7 +97,7 @@ Stat *CommonStats::get_itemsCollected(int itemId, int itemAux) #endif if (itemId != Item::emerald_Id) return Stats::itemsCollected[itemId]; - else return nullptr; + else return NULL; } Stat *CommonStats::get_itemsCrafted(int itemId) { return Stats::itemsCrafted[itemId]; } @@ -111,7 +111,7 @@ Stat *CommonStats::get_itemsUsed(int itemId) if (itemId == Item::porkChop_cooked_Id) return Stats::blocksPlaced[itemId]; #endif - return nullptr; + return NULL; } Stat *CommonStats::get_itemsBought(int itemId) @@ -121,7 +121,7 @@ Stat *CommonStats::get_itemsBought(int itemId) // StatArray for Items Bought. if (itemId == Item::emerald_Id) return Stats::itemsCollected[itemId]; - else return nullptr; + else return NULL; } Stat *CommonStats::get_killsEnderdragon() { return Stats::killsEnderdragon; } @@ -133,7 +133,7 @@ Stat *CommonStats::get_enteredBiome(int biomeId) #if (defined _EXTENDED_ACHIEVEMENTS) && (!defined _XBOX_ONE) return Stats::biomesVisisted[biomeId]; #else - return nullptr; + return NULL; #endif } @@ -171,7 +171,7 @@ Stat *CommonStats::get_achievement(eAward achievementId) #ifndef _XBOX case eAward_snipeSkeleton: return (Stat *) Achievements::snipeSkeleton; case eAward_diamonds: return (Stat *) Achievements::diamonds; - case eAward_portal: return (Stat *) nullptr; // TODO + case eAward_portal: return (Stat *) NULL; // TODO case eAward_ghast: return (Stat *) Achievements::ghast; case eAward_blazeRod: return (Stat *) Achievements::blazeRod; case eAward_potion: return (Stat *) Achievements::potion; @@ -205,7 +205,7 @@ Stat *CommonStats::get_achievement(eAward achievementId) case eAward_lionTamer: return (Stat *) Achievements::lionTamer; #endif - default: return (Stat *) nullptr; + default: return (Stat *) NULL; } } @@ -286,7 +286,7 @@ byteArray CommonStats::getParam_noArgs() byteArray CommonStats::makeParam(int count) { - byteArray out( static_cast(sizeof(int)) ); + byteArray out( sizeof(int) ); memcpy(out.data,&count,sizeof(int)); return out; } diff --git a/Minecraft.World/ComparatorTile.cpp b/Minecraft.World/ComparatorTile.cpp index e7d8f178..f611424d 100644 --- a/Minecraft.World/ComparatorTile.cpp +++ b/Minecraft.World/ComparatorTile.cpp @@ -235,7 +235,7 @@ bool ComparatorTile::triggerEvent(Level *level, int x, int y, int z, int b0, int { DiodeTile::triggerEvent(level, x, y, z, b0, b1); shared_ptr te = level->getTileEntity(x, y, z); - if (te != nullptr) + if (te != NULL) { return te->triggerEvent(b0, b1); } @@ -244,7 +244,7 @@ bool ComparatorTile::triggerEvent(Level *level, int x, int y, int z, int b0, int shared_ptr ComparatorTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new ComparatorTileEntity() ); } bool ComparatorTile::TestUse() diff --git a/Minecraft.World/ComparatorTileEntity.cpp b/Minecraft.World/ComparatorTileEntity.cpp index 7cd1f064..9a58d23c 100644 --- a/Minecraft.World/ComparatorTileEntity.cpp +++ b/Minecraft.World/ComparatorTileEntity.cpp @@ -27,7 +27,7 @@ void ComparatorTileEntity::setOutputSignal(int value) // 4J Added shared_ptr ComparatorTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new ComparatorTileEntity() ); TileEntity::clone(result); result->output = output; diff --git a/Minecraft.World/CompassItem.cpp b/Minecraft.World/CompassItem.cpp index 99d18ed0..57ad65d0 100644 --- a/Minecraft.World/CompassItem.cpp +++ b/Minecraft.World/CompassItem.cpp @@ -12,7 +12,7 @@ const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0", CompassItem::CompassItem(int id) : Item(id) { - icons = nullptr; + icons = NULL; } // 4J Added so that we can override the icon id used to calculate the texture UV's for each player @@ -22,7 +22,7 @@ Icon *CompassItem::getIcon(int auxValue) Icon *icon = Item::getIcon(auxValue); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->player != nullptr && auxValue == 0 ) + if( pMinecraft->player != NULL && auxValue == 0 ) { icon = icons[pMinecraft->player->GetXboxPad()]; } diff --git a/Minecraft.World/ComplexItemDataPacket.h b/Minecraft.World/ComplexItemDataPacket.h index 1e41c3e9..52de8f49 100644 --- a/Minecraft.World/ComplexItemDataPacket.h +++ b/Minecraft.World/ComplexItemDataPacket.h @@ -20,7 +20,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ComplexItemDataPacket()); } virtual int getId() { return 131; } }; diff --git a/Minecraft.World/CompoundContainer.cpp b/Minecraft.World/CompoundContainer.cpp index 50bfcc34..39da0e58 100644 --- a/Minecraft.World/CompoundContainer.cpp +++ b/Minecraft.World/CompoundContainer.cpp @@ -6,8 +6,8 @@ CompoundContainer::CompoundContainer(int name, shared_ptr c1, shared_ptr c2) { this->name = name; - if (c1 == nullptr) c1 = c2; - if (c2 == nullptr) c2 = c1; + if (c1 == NULL) c1 = c2; + if (c2 == NULL) c2 = c1; this->c1 = c1; this->c2 = c2; } diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index 5eaa2a05..83a6108f 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -123,14 +123,14 @@ public: void putBoolean(const wstring &name, bool val) { - putByte(name, val?static_cast(1):0); + putByte(name, val?(byte)1:0); } Tag *get(const wstring &name) { auto it = tags.find(name); if(it != tags.end()) return it->second; - return nullptr; + return NULL; } bool contains(const wstring &name) @@ -141,19 +141,19 @@ public: byte getByte(const wstring &name) { if (tags.find(name) == tags.end()) return (byte)0; - return static_cast(tags[name])->data; + return ((ByteTag *) tags[name])->data; } short getShort(const wstring &name) { if (tags.find(name) == tags.end()) return (short)0; - return static_cast(tags[name])->data; + return ((ShortTag *) tags[name])->data; } int getInt(const wstring &name) { if (tags.find(name) == tags.end()) return (int)0; - return static_cast(tags[name])->data; + return ((IntTag *) tags[name])->data; } int64_t getLong(const wstring &name) @@ -164,44 +164,44 @@ public: float getFloat(const wstring &name) { - if (tags.find(name) == tags.end()) return static_cast(0); - return static_cast(tags[name])->data; + if (tags.find(name) == tags.end()) return (float)0; + return ((FloatTag *) tags[name])->data; } double getDouble(const wstring &name) { if (tags.find(name) == tags.end()) return (double)0; - return static_cast(tags[name])->data; + return ((DoubleTag *) tags[name])->data; } wstring getString(const wstring &name) { if (tags.find(name) == tags.end()) return wstring( L"" ); - return static_cast(tags[name])->data; + return ((StringTag *) tags[name])->data; } byteArray getByteArray(const wstring &name) { if (tags.find(name) == tags.end()) return byteArray(); - return static_cast(tags[name])->data; + return ((ByteArrayTag *) tags[name])->data; } intArray getIntArray(const wstring &name) { if (tags.find(name) == tags.end()) return intArray(); - return static_cast(tags[name])->data; + return ((IntArrayTag *) tags[name])->data; } CompoundTag *getCompound(const wstring &name) { if (tags.find(name) == tags.end()) return new CompoundTag(name); - return static_cast(tags[name]); + return (CompoundTag *) tags[name]; } ListTag *getList(const wstring &name) { if (tags.find(name) == tags.end()) return new ListTag(name); - return static_cast *>(tags[name]); + return (ListTag *) tags[name]; } bool getBoolean(const wstring &string) @@ -271,7 +271,7 @@ public: { if (Tag::equals(obj)) { - CompoundTag *o = static_cast(obj); + CompoundTag *o = (CompoundTag *) obj; if(tags.size() == o->tags.size()) { diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index 8e4fd090..eb1b784a 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -23,11 +23,11 @@ CRITICAL_SECTION CompressedTileStorage::cs_write; #ifdef PSVITA_PRECOMPUTED_TABLE // AP - this will create a precomputed table to speed up getData -static int *CompressedTile_StorageIndexTable = nullptr; +static int *CompressedTile_StorageIndexTable = NULL; void CompressedTileStorage_InitTable() { - if( CompressedTile_StorageIndexTable == nullptr ) + if( CompressedTile_StorageIndexTable == NULL ) { CompressedTile_StorageIndexTable = (int*) malloc(sizeof(int) * 64); for(int j = 0;j < 64;j += 1 ) @@ -41,7 +41,7 @@ void CompressedTileStorage_InitTable() CompressedTileStorage::CompressedTileStorage() { - indicesAndData = nullptr; + indicesAndData = NULL; allocatedSize = 0; #ifdef PSVITA_PRECOMPUTED_TABLE @@ -55,12 +55,12 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage *copyFrom) allocatedSize = copyFrom->allocatedSize; if(allocatedSize > 0) { - indicesAndData = static_cast(XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc(allocatedSize); + indicesAndData = (unsigned char *)XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc(allocatedSize); XMemCpy(indicesAndData, copyFrom->indicesAndData, allocatedSize); } else { - indicesAndData = nullptr; + indicesAndData = NULL; } LeaveCriticalSection(&cs_write); @@ -71,11 +71,11 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage *copyFrom) CompressedTileStorage::CompressedTileStorage(byteArray initFrom, unsigned int initOffset) { - indicesAndData = nullptr; + indicesAndData = NULL; allocatedSize = 0; // We need 32768 bytes for a fully uncompressed chunk, plus 1024 for the index. Rounding up to nearest 4096 bytes for allocation - indicesAndData = static_cast(XPhysicalAlloc(32768 + 4096, MAXULONG_PTR, 4096, PAGE_READWRITE)); + indicesAndData = (unsigned char *)XPhysicalAlloc(32768+4096, MAXULONG_PTR, 4096, PAGE_READWRITE); unsigned short *indices = (unsigned short *)indicesAndData; unsigned char *data = indicesAndData + 1024; @@ -117,7 +117,7 @@ bool CompressedTileStorage::isCompressed() CompressedTileStorage::CompressedTileStorage(bool isEmpty) { - indicesAndData = nullptr; + indicesAndData = NULL; allocatedSize = 0; // Empty and already compressed, so we only need 1K. Rounding up to nearest 4096 bytes for allocation @@ -125,7 +125,7 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty) // XPhysicalAlloc just maps to malloc on PS3, so allocate the smallest amount indicesAndData = (unsigned char *)XPhysicalAlloc(1024, MAXULONG_PTR, 4096, PAGE_READWRITE); #else - indicesAndData = static_cast(XPhysicalAlloc(4096, MAXULONG_PTR, 4096, PAGE_READWRITE)); + indicesAndData = (unsigned char *)XPhysicalAlloc(4096, MAXULONG_PTR, 4096, PAGE_READWRITE); #endif //__PS3__ unsigned short *indices = (unsigned short *)indicesAndData; //unsigned char *data = indicesAndData + 1024; @@ -386,7 +386,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) // printf("%d: %d (0) %d (1) %d (2) %d (4) %d (8)\n", chunkTotal, type0 / chunkTotal, type1 / chunkTotal, type2 / chunkTotal, type4 / chunkTotal, type8 / chunkTotal); memToAlloc += 1024; // For the indices - unsigned char *newIndicesAndData = static_cast(XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc( memToAlloc ); + unsigned char *newIndicesAndData = (unsigned char *)XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc( memToAlloc ); unsigned char *pucData = newIndicesAndData + 1024; unsigned short usDataOffset = 0; unsigned short *newIndices = (unsigned short *) newIndicesAndData; @@ -401,7 +401,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) { if( _blockIndices[i] & INDEX_TYPE_0_BIT_FLAG ) { - newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (static_cast(data[getIndex(i, 0)]) << INDEX_TILE_SHIFT); + newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (((unsigned short)data[getIndex(i,0)]) << INDEX_TILE_SHIFT); } else { @@ -423,7 +423,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) ucMappings[j] = 255; } - unsigned char *repacked = nullptr; + unsigned char *repacked = NULL; int bitspertile = 1 << indexTypeNew; // will be 1, 2 or 4 (from index values of 0, 1, 2) int tiletypecount = 1 << bitspertile; // will be 2, 4 or 16 (from index values of 0, 1, 2) @@ -738,7 +738,7 @@ int CompressedTileStorage::setDataRegion(byteArray dataIn, int x0, int y0, int } ptrdiff_t count = pucIn - &dataIn.data[offset]; - return static_cast(count); + return (int)count; } // Tests whether setting data would actually change anything @@ -777,7 +777,7 @@ int CompressedTileStorage::getDataRegion(byteArray dataInOut, int x0, int y0, i } ptrdiff_t count = pucOut - &dataInOut.data[offset]; - return static_cast(count); + return (int)count; } void CompressedTileStorage::staticCtor() @@ -806,7 +806,7 @@ void CompressedTileStorage::tick() int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = nullptr; + unsigned char *toFree = NULL; do { toFree = deleteQueue[freeIndex].Pop(); @@ -887,7 +887,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) { unsigned short indexType = blockIndices[i] & INDEX_TYPE_MASK; - unsigned char *unpacked_data = nullptr; + unsigned char *unpacked_data = NULL; unsigned char *packed_data; // First task is to find out what type of storage each block needs. Need to unpack each where required. @@ -1049,8 +1049,8 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) if( needsCompressed ) { memToAlloc += 1024; // For the indices - unsigned char *newIndicesAndData = static_cast(XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc( memToAlloc ); - if( newIndicesAndData == nullptr ) + unsigned char *newIndicesAndData = (unsigned char *)XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc( memToAlloc ); + if( newIndicesAndData == NULL ) { DWORD lastError = GetLastError(); #ifndef _DURANGO @@ -1111,9 +1111,9 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) // If we're not done, then we actually need to recompress this block. First of all decompress from its current format. if( !done ) { - unsigned char *unpacked_data = nullptr; - unsigned char *tile_types = nullptr; - unsigned char *packed_data = nullptr; + unsigned char *unpacked_data = NULL; + unsigned char *tile_types = NULL; + unsigned char *packed_data = NULL; if( indexTypeOld == INDEX_TYPE_0_OR_8_BIT ) { if( blockIndices[i] & INDEX_TYPE_0_BIT_FLAG ) @@ -1159,13 +1159,13 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) } #endif - unsigned char *repacked = nullptr; + unsigned char *repacked = NULL; if( indexTypeNew == INDEX_TYPE_0_OR_8_BIT ) { if( _blockIndices[i] & INDEX_TYPE_0_BIT_FLAG ) { - newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (static_cast(unpacked_data[0]) << INDEX_TILE_SHIFT); + newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (((unsigned short)unpacked_data[0]) << INDEX_TILE_SHIFT); } else { @@ -1339,7 +1339,7 @@ void CompressedTileStorage::read(DataInputStream *dis) { XPhysicalFree(indicesAndData); } - indicesAndData = static_cast(XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + indicesAndData = (unsigned char *)XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE); byteArray wrapper(indicesAndData, allocatedSize); dis->readFully(wrapper); diff --git a/Minecraft.World/Connection.cpp b/Minecraft.World/Connection.cpp index 4015d8f6..09f72be0 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -61,17 +61,17 @@ Connection::~Connection() // These should all have been destroyed in close() but no harm in checking again delete byteArrayDos; - byteArrayDos = nullptr; + byteArrayDos = NULL; delete baos; - baos = nullptr; + baos = NULL; if( bufferedDos ) { bufferedDos->deleteChildStream(); delete bufferedDos; - bufferedDos = nullptr; + bufferedDos = NULL; } delete dis; - dis = nullptr; + dis = NULL; } Connection::Connection(Socket *socket, const wstring& id, PacketListener *packetListener) // throws IOException @@ -111,7 +111,7 @@ Connection::Connection(Socket *socket, const wstring& id, PacketListener *packet sprintf(readThreadName,"%s read\n",szId); sprintf(writeThreadName,"%s write\n",szId); - readThread = new C4JThread(runRead, static_cast(this), readThreadName, READ_STACK_SIZE); + readThread = new C4JThread(runRead, (void*)this, readThreadName, READ_STACK_SIZE); writeThread = new C4JThread(runWrite, this, writeThreadName, WRITE_STACK_SIZE); readThread->SetProcessor(CPU_CORE_CONNECTIONS); writeThread->SetProcessor(CPU_CORE_CONNECTIONS ); @@ -185,7 +185,7 @@ bool Connection::writeTick() bool didSomething = false; // 4J Stu - If the connection is closed and the output stream has been deleted - if(bufferedDos==nullptr || byteArrayDos==nullptr) + if(bufferedDos==NULL || byteArrayDos==NULL) return didSomething; // try { @@ -318,14 +318,14 @@ bool Connection::readTick() bool didSomething = false; // 4J Stu - If the connection has closed and the input stream has been deleted - if(dis==nullptr) + if(dis==NULL) return didSomething; //try { shared_ptr packet = Packet::readPacket(dis, packetListener->isServerPacketListener()); - if (packet != nullptr) + if (packet != NULL) { readSizes[packet->getId()] += packet->getEstimatedSize() + 1; EnterCriticalSection(&incoming_cs); @@ -341,7 +341,7 @@ bool Connection::readTick() // printf("Con:0x%x readTick close EOS\n",this); // 4J Stu - Remove this line - // Fix for #10410 - UI: If the player is removed from a splitscreened host�s game, the next game that player joins will produce a message stating that the host has left. + // Fix for #10410 - UI: If the player is removed from a splitscreened host’s game, the next game that player joins will produce a message stating that the host has left. //close(DisconnectPacket::eDisconnect_EndOfStream); } @@ -377,8 +377,8 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) disconnectReason = reason;//va_arg( input, const wstring ); vector objs = vector(); - void *i = nullptr; - while (i != nullptr) + void *i = NULL; + while (i != NULL) { i = va_arg( input, void* ); objs.push_back(i); @@ -390,7 +390,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) } else { - disconnectReasonObjects = nullptr; + disconnectReasonObjects = NULL; } // int count = 0, sum = 0, i = first; @@ -407,7 +407,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) // return( sum ? (sum / count) : 0 ); -// CreateThread(nullptr, 0, runClose, this, 0, &closeThreadID); +// CreateThread(NULL, 0, runClose, this, 0, &closeThreadID); running = false; @@ -419,24 +419,24 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) writeThread->WaitForCompletion(INFINITE); delete dis; - dis = nullptr; + dis = NULL; if( bufferedDos ) { bufferedDos->close(); bufferedDos->deleteChildStream(); delete bufferedDos; - bufferedDos = nullptr; + bufferedDos = NULL; } if( byteArrayDos ) { byteArrayDos->close(); delete byteArrayDos; - byteArrayDos = nullptr; + byteArrayDos = NULL; } if( socket ) { socket->close(packetListener->isServerPacketListener()); - socket = nullptr; + socket = NULL; } } @@ -473,7 +473,7 @@ void Connection::tick() tickCount++; if (tickCount % 20 == 0) { - send(std::make_shared()); + send( shared_ptr( new KeepAlivePacket() ) ); } // 4J Stu - 1.8.2 changed from 100 to 1000 @@ -498,7 +498,7 @@ void Connection::tick() LeaveCriticalSection(&incoming_cs); // MGH - moved the packet handling outside of the incoming_cs block, as it was locking up sometimes when disconnecting - for(size_t i = 0; i < packetsToHandle.size(); i++) + for(int i=0; igetId()); packetsToHandle[i]->handle(packetListener); @@ -552,22 +552,22 @@ void Connection::sendAndQuit() close(DisconnectPacket::eDisconnect_Closed); } #else - CreateThread(nullptr, 0, runSendAndQuit, this, 0, &saqThreadID); + CreateThread(NULL, 0, runSendAndQuit, this, 0, &saqThreadID); #endif } int Connection::countDelayedPackets() { - return static_cast(outgoing_slow.size()); + return (int)outgoing_slow.size(); } int Connection::runRead(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::eConnectionReadThreads); - Connection *con = static_cast(lpParam); + Connection *con = (Connection *)lpParam; - if (con == nullptr) + if (con == NULL) { #ifdef __PS3__ ShutdownManager::HasFinished(ShutdownManager::eConnectionReadThreads); @@ -615,9 +615,9 @@ int Connection::runRead(void* lpParam) int Connection::runWrite(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::eConnectionWriteThreads); - Connection *con = dynamic_cast(static_cast(lpParam)); + Connection *con = dynamic_cast((Connection *) lpParam); - if (con == nullptr) + if (con == NULL) { ShutdownManager::HasFinished(ShutdownManager::eConnectionWriteThreads); return 0; @@ -644,8 +644,8 @@ int Connection::runWrite(void* lpParam) // TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well waitResult = con->m_hWakeWriteThread->WaitForSignal(100L); - if (con->bufferedDos != nullptr) con->bufferedDos->flush(); - //if (con->byteArrayDos != nullptr) con->byteArrayDos->flush(); + if (con->bufferedDos != NULL) con->bufferedDos->flush(); + //if (con->byteArrayDos != NULL) con->byteArrayDos->flush(); } @@ -660,9 +660,9 @@ int Connection::runWrite(void* lpParam) int Connection::runClose(void* lpParam) { - Connection *con = dynamic_cast(static_cast(lpParam)); + Connection *con = dynamic_cast((Connection *) lpParam); - if (con == nullptr) return 0; + if (con == NULL) return 0; //try { @@ -683,10 +683,10 @@ int Connection::runClose(void* lpParam) int Connection::runSendAndQuit(void* lpParam) { - Connection *con = dynamic_cast(static_cast(lpParam)); + Connection *con = dynamic_cast((Connection *) lpParam); // printf("Con:0x%x runSendAndQuit\n",con); - if (con == nullptr) return 0; + if (con == NULL) return 0; //try { diff --git a/Minecraft.World/ConsoleSaveFile.h b/Minecraft.World/ConsoleSaveFile.h index 0f7c451e..39c1ec89 100644 --- a/Minecraft.World/ConsoleSaveFile.h +++ b/Minecraft.World/ConsoleSaveFile.h @@ -23,7 +23,7 @@ public: virtual void Flush(bool autosave, bool updateThumbnail = true) = 0; #ifndef _CONTENT_PACKAGE - virtual void DebugFlushToFile(void *compressedData = nullptr, unsigned int compressedDataSize = 0) = 0; + virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0) = 0; #endif virtual unsigned int getSizeOnDisk() = 0; virtual wstring getFilename() = 0; @@ -53,5 +53,5 @@ public: virtual void ConvertRegionFile(File sourceFile) = 0; virtual void ConvertToLocalPlatform() = 0; - virtual void *getWritePointer(FileEntry *file) { return nullptr; } + virtual void *getWritePointer(FileEntry *file) { return NULL; } }; diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index f7d8d0ee..21de3cbe 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -84,7 +84,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS vector *playerFiles = sourceSave->getFilesWithPrefix( DirectoryLevelStorage::getPlayerDir() ); #endif - if(playerFiles != nullptr) + if(playerFiles != NULL) { for(int fileIdx = 0; fileIdx < playerFiles->size();fileIdx++) { diff --git a/Minecraft.World/ConsoleSaveFileInputStream.cpp b/Minecraft.World/ConsoleSaveFileInputStream.cpp index db997918..93d49956 100644 --- a/Minecraft.World/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileInputStream.cpp @@ -9,7 +9,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = m_saveFile->createFile( file ); - m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); } ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -17,7 +17,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = file; - m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); } //Reads a byte of data from this input stream. This method blocks if no input is yet available. @@ -119,7 +119,7 @@ int ConsoleSaveFileInputStream::read(byteArray b, unsigned int offset, unsigned //If this stream has an associated channel then the channel is closed as well. void ConsoleSaveFileInputStream::close() { - if( m_saveFile != nullptr ) + if( m_saveFile != NULL ) { BOOL result = m_saveFile->closeHandle( m_file ); @@ -129,6 +129,6 @@ void ConsoleSaveFileInputStream::close() } // Stop the dtor from trying to close it again - m_saveFile = nullptr; + m_saveFile = NULL; } } diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index 8a7d1f9e..0b7c8d66 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -22,14 +22,14 @@ #endif unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; -void *ConsoleSaveFileOriginal::pvHeap = nullptr; +void *ConsoleSaveFileOriginal::pvHeap = NULL; -ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData /*= nullptr*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); // One time initialise of static stuff required for our storage - if( pvHeap == nullptr ) + if( pvHeap == NULL ) { // Reserve a chunk of 64MB of virtual address space for our saves, using 64KB pages. // We'll only be committing these as required to grow the storage we need, which will @@ -38,7 +38,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID // AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp. // All access to the memory must be done via the access function as the pointer returned from VirtualAlloc // can't be used directly. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); + pvHeap = VirtualAlloc(NULL, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); } pvSaveMem = pvHeap; @@ -49,13 +49,13 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID // Load a save from the game rules bool bLevelGenBaseSave = false; LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if( pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) + if( pvSaveData == NULL && levelGen != NULL && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; } - if( pvSaveData == nullptr || fileSize == 0) + if( pvSaveData == NULL || fileSize == 0) fileSize = StorageManager.GetSaveSize(); if( forceCleanSave ) @@ -75,7 +75,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID unsigned int pagesRequired = ( heapSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) + if( pvRet == NULL ) { #ifndef _CONTENT_PACKAGE // Out of physical memory @@ -87,7 +87,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID if( fileSize > 0) { bool AllocData = false; - if(pvSaveData != nullptr) + if(pvSaveData != NULL) { #ifdef __PSVITA__ // AP - use this to access the virtual memory @@ -141,10 +141,10 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID #else void* pvSourceData = pvSaveMem; #endif - int compressed = *static_cast(pvSourceData); + int compressed = *(int*)pvSourceData; if( compressed == 0 ) { - unsigned int decompSize = *( static_cast(pvSourceData)+1 ); + unsigned int decompSize = *( (int*)pvSourceData+1 ); if(isLocalEndianDifferent(plat)) System::ReverseULONG(&decompSize); // An invalid save, so clear the memory and start from scratch @@ -162,13 +162,13 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID #ifndef _XBOX if(plat == SAVE_FILE_PLATFORM_PSVITA) { - Compression::VitaVirtualDecompress(buf, &decompSize, static_cast(pvSourceData)+8, fileSize-8 ); + Compression::VitaVirtualDecompress(buf, &decompSize, (unsigned char *)pvSourceData+8, fileSize-8 ); } else #endif { Compression::getCompression()->SetDecompressionType(plat); // if this save is from another platform, set the correct decompression type - Compression::getCompression()->Decompress(buf, &decompSize, static_cast(pvSourceData)+8, fileSize-8 ); + Compression::getCompression()->Decompress(buf, &decompSize, (unsigned char *)pvSourceData+8, fileSize-8 ); Compression::getCompression()->SetDecompressionType(SAVE_FILE_PLATFORM_LOCAL); // and then set the decompression back to the local machine's standard type } @@ -181,7 +181,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID { unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) + if( pvRet == NULL ) { // Out of physical memory __debugbreak(); @@ -216,7 +216,7 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() #if defined _XBOX app.GetSaveThumbnail(NULL,NULL); #elif defined __PS3__ - app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr); + app.GetSaveThumbnail(NULL,NULL, NULL,NULL); #endif DeleteCriticalSection(&m_lock); @@ -235,7 +235,7 @@ FileEntry *ConsoleSaveFileOriginal::createFile( const ConsoleSavePath &fileName void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) { - if( file == nullptr ) return; + if( file == NULL ) return; LockSaveAccess(); @@ -248,18 +248,18 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) DWORD bufferDataSize = 0; - char *readStartOffset = static_cast(pvSaveMem) + file->data.startOffset + file->getFileSize(); + char *readStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); - char *writeStartOffset = static_cast(pvSaveMem) + file->data.startOffset; + char *writeStartOffset = (char *)pvSaveMem + file->data.startOffset; - char *endOfDataOffset = static_cast(pvSaveMem) + header.GetStartOfNextData(); + char *endOfDataOffset = (char *)pvSaveMem + header.GetStartOfNextData(); while(true) { // Fill buffer from file if( readStartOffset + bufferSize > endOfDataOffset ) { - amountToRead = static_cast(endOfDataOffset - readStartOffset); + amountToRead = (int)(endOfDataOffset - readStartOffset); } else { @@ -339,8 +339,8 @@ void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, DWORD nNumberOfB BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) + assert( pvSaveMem != NULL ); + if( pvSaveMem == NULL ) { return 0; } @@ -349,7 +349,7 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD PrepareForWrite( file, nNumberOfBytesToWrite ); - char *writeStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; + char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); #ifdef __PSVITA__ @@ -376,8 +376,8 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) + assert( pvSaveMem != NULL ); + if( pvSaveMem == NULL ) { return 0; } @@ -386,7 +386,7 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr PrepareForWrite( file, nNumberOfBytesToWrite ); - char *writeStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; + char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); #ifdef __PSVITA__ @@ -414,15 +414,15 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) { DWORD actualBytesToRead; - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) + assert( pvSaveMem != NULL ); + if( pvSaveMem == NULL ) { return 0; } LockSaveAccess(); - char *readStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; + char *readStartOffset = (char *)pvSaveMem + file->currentFilePointer; //printf("Read: pvSaveMem = %0xd, currentFilePointer = %d, readStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, readStartOffset); assert( nNumberOfBytesToRead <= file->getFileSize() ); @@ -506,7 +506,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt { unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) + if( pvRet == NULL ) { // Out of physical memory __debugbreak(); @@ -515,13 +515,13 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt } // This is the start of where we want the space to be, and the start of the data that we need to move - char *spaceStartOffset = static_cast(pvSaveMem) + file->data.startOffset + file->getFileSize(); + char *spaceStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); // This is the end of where we want the space to be char *spaceEndOffset = spaceStartOffset + nNumberOfBytesToWrite; // This is the current end of the data that we want to move - char *beginEndOfDataOffset = static_cast(pvSaveMem) + header.GetStartOfNextData(); + char *beginEndOfDataOffset = (char *)pvSaveMem + header.GetStartOfNextData(); // This is where the end of the data is going to be char *finishEndOfDataOffset = beginEndOfDataOffset + nNumberOfBytesToWrite; @@ -547,8 +547,8 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt uintptr_t uiFromEnd = (uintptr_t)beginEndOfDataOffset; // Round both of these values to get 4096 byte chunks that we will need to at least partially move - uintptr_t uiFromStartChunk = uiFromStart & ~static_cast(4095); - uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~static_cast(4095); + uintptr_t uiFromStartChunk = uiFromStart & ~((uintptr_t)4095); + uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~((uintptr_t)4095); // Loop through all the affected source 4096 chunks, going backwards so we don't overwrite anything we'll need in the future for( uintptr_t uiCurrentChunk = uiFromEndChunk; uiCurrentChunk >= uiFromStartChunk; uiCurrentChunk -= 4096 ) @@ -587,7 +587,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt // Fill buffer 1 from file if( (readStartOffset - bufferSize) < spaceStartOffset ) { - amountToRead = static_cast(readStartOffset - spaceStartOffset); + amountToRead = (DWORD)(readStartOffset - spaceStartOffset); } else { @@ -669,7 +669,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; float fElapsedTime = 0.0f; QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); + float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; unsigned int fileSize = header.GetFileSize(); @@ -688,17 +688,17 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) #else // Attempt to allocate the required memory // We do not own this, it belongs to the StorageManager - byte *compData = static_cast(StorageManager.AllocateSaveData(compLength)); + byte *compData = (byte *)StorageManager.AllocateSaveData( compLength ); #ifdef __PSVITA__ // AP - make sure we always allocate just what is needed so it will only SAVE what is needed. // If we don't do this the StorageManager will save a file of uncompressed size unnecessarily. - compData = nullptr; + compData = NULL; #endif - // If we failed to allocate then compData will be nullptr + // If we failed to allocate then compData will be NULL // Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer - if(compData == nullptr) + if(compData == NULL) { // Length should be 0 here so that the compression call knows that we want to know the length back compLength = 0; @@ -709,14 +709,14 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) QueryPerformanceCounter( &qwTime ); #ifdef __PSVITA__ // AP - get the compressed size via the access function. This uses a special RLE format - VirtualCompress(nullptr,&compLength,pvSaveMem,fileSize); + VirtualCompress(NULL,&compLength,pvSaveMem,fileSize); #else - Compression::getCompression()->Compress(nullptr,&compLength,pvSaveMem,fileSize); + Compression::getCompression()->Compress(NULL,&compLength,pvSaveMem,fileSize); #endif QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -726,11 +726,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) compLength = compLength+8; // Attempt to allocate the required memory - compData = static_cast(StorageManager.AllocateSaveData(compLength)); + compData = (byte *)StorageManager.AllocateSaveData( compLength ); } #endif - if(compData != nullptr) + if(compData != NULL) { // No compression on PS3 - see comment above #ifndef __PS3__ @@ -747,7 +747,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -760,10 +760,10 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, compLength); #endif - PBYTE pbThumbnailData=nullptr; + PBYTE pbThumbnailData=NULL; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=nullptr; + PBYTE pbDataSaveImage=NULL; DWORD dwDataSizeSaveImage=0; #if ( defined _XBOX || defined _DURANGO || defined _WINDOWS64 ) @@ -777,7 +777,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) int64_t seed = 0; bool hasSeed = false; - if(MinecraftServer::getInstance()!= nullptr && MinecraftServer::getInstance()->levels[0]!=nullptr) + if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL) { seed = MinecraftServer::getInstance()->levels[0]->getLevelData()->getSeed(); hasSeed = true; @@ -836,7 +836,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) { - ConsoleSaveFile *pClass=static_cast(lpParam); + ConsoleSaveFile *pClass=(ConsoleSaveFile *)lpParam; return 0; } @@ -844,7 +844,7 @@ int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) #endif #ifndef _CONTENT_PACKAGE -void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= nullptr*/, unsigned int compressedDataSize /*= 0*/) +void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, unsigned int compressedDataSize /*= 0*/) { LockSaveAccess(); @@ -884,16 +884,16 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= nullptr* LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + wstring(fileName) ); #endif #ifndef __PSVITA__ - HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); + HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); #endif - if(compressedData != nullptr && compressedDataSize > 0) + if(compressedData != NULL && compressedDataSize > 0) { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, nullptr); + VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); #else - WriteFile( hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,nullptr); + WriteFile( hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,NULL); #endif assert(numberOfBytesWritten == compressedDataSize); } @@ -901,9 +901,9 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= nullptr* { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, nullptr); + VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); #else - WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,nullptr); + WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,NULL); #endif assert(numberOfBytesWritten == fileSize); } @@ -934,7 +934,7 @@ vector *ConsoleSaveFileOriginal::getFilesWithPrefix(const wstring & vector *ConsoleSaveFileOriginal::getRegionFilesByDimension(unsigned int dimensionIndex) { - return nullptr; + return NULL; } #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) @@ -1083,5 +1083,5 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() void *ConsoleSaveFileOriginal::getWritePointer(FileEntry *file) { - return static_cast(pvSaveMem) + file->currentFilePointer;; + return (char *)pvSaveMem + file->currentFilePointer;; } diff --git a/Minecraft.World/ConsoleSaveFileOriginal.h b/Minecraft.World/ConsoleSaveFileOriginal.h index 9c91fafc..fd35aa1d 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/ConsoleSaveFileOriginal.h @@ -35,7 +35,7 @@ public: #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); #endif - ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData = nullptr, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); virtual ~ConsoleSaveFileOriginal(); // 4J Stu - Initial implementation is intended to have a similar interface to the standard Xbox file access functions @@ -56,7 +56,7 @@ public: virtual void Flush(bool autosave, bool updateThumbnail = true); #ifndef _CONTENT_PACKAGE - virtual void DebugFlushToFile(void *compressedData = nullptr, unsigned int compressedDataSize = 0); + virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0); #endif virtual unsigned int getSizeOnDisk(); diff --git a/Minecraft.World/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/ConsoleSaveFileOutputStream.cpp index c4812a73..3d8bb3f7 100644 --- a/Minecraft.World/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileOutputStream.cpp @@ -19,7 +19,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = m_saveFile->createFile(file); - m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); } ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -28,7 +28,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = file; - m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); } //Writes the specified byte to this file output stream. Implements the write method of OutputStream. @@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = static_cast(b); + byte value = (byte) b; BOOL result = m_saveFile->writeFile( m_file, @@ -115,7 +115,7 @@ void ConsoleSaveFileOutputStream::write(byteArray b, unsigned int offset, unsign //If this stream has an associated channel then the channel is closed as well. void ConsoleSaveFileOutputStream::close() { - if( m_saveFile != nullptr ) + if( m_saveFile != NULL ) { BOOL result = m_saveFile->closeHandle( m_file ); @@ -125,6 +125,6 @@ void ConsoleSaveFileOutputStream::close() } // Stop the dtor from trying to close it again - m_saveFile = nullptr; + m_saveFile = NULL; } } diff --git a/Minecraft.World/ContainerAckPacket.h b/Minecraft.World/ContainerAckPacket.h index be028774..00f3592e 100644 --- a/Minecraft.World/ContainerAckPacket.h +++ b/Minecraft.World/ContainerAckPacket.h @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerAckPacket()); } virtual int getId() { return 106; } }; diff --git a/Minecraft.World/ContainerButtonClickPacket.h b/Minecraft.World/ContainerButtonClickPacket.h index 01e8deb8..522c5f86 100644 --- a/Minecraft.World/ContainerButtonClickPacket.h +++ b/Minecraft.World/ContainerButtonClickPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerButtonClickPacket()); } virtual int getId() { return 108; } }; \ No newline at end of file diff --git a/Minecraft.World/ContainerClickPacket.h b/Minecraft.World/ContainerClickPacket.h index dee255b4..51686166 100644 --- a/Minecraft.World/ContainerClickPacket.h +++ b/Minecraft.World/ContainerClickPacket.h @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerClickPacket()); } virtual int getId() { return 102; } }; diff --git a/Minecraft.World/ContainerClosePacket.h b/Minecraft.World/ContainerClosePacket.h index c4b78570..bf032a97 100644 --- a/Minecraft.World/ContainerClosePacket.h +++ b/Minecraft.World/ContainerClosePacket.h @@ -17,7 +17,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerClosePacket()); } virtual int getId() { return 101; } }; diff --git a/Minecraft.World/ContainerMenu.cpp b/Minecraft.World/ContainerMenu.cpp index 3dcae136..b1fd4d6b 100644 --- a/Minecraft.World/ContainerMenu.cpp +++ b/Minecraft.World/ContainerMenu.cpp @@ -46,14 +46,14 @@ shared_ptr ContainerMenu::quickMoveStack(shared_ptr player { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); if (slotIndex < containerRows * 9) { - if(!moveItemStackTo(stack, containerRows * 9, static_cast(slots.size()), true)) + if(!moveItemStackTo(stack, containerRows * 9, (int)slots.size(), true)) { // 4J Stu - Brought forward from 1.2 return nullptr; @@ -97,7 +97,7 @@ shared_ptr ContainerMenu::clicked(int slotIndex, int buttonNum, in #ifdef _EXTENDED_ACHIEVEMENTS shared_ptr localPlayer = dynamic_pointer_cast(player); - if (localPlayer != nullptr) // 4J-JEV: For "Chestful o'Cobblestone" achievement. + if (localPlayer != NULL) // 4J-JEV: For "Chestful o'Cobblestone" achievement. { int cobblecount = 0; for (int i = 0; i < container->getContainerSize(); i++) diff --git a/Minecraft.World/ContainerOpenPacket.h b/Minecraft.World/ContainerOpenPacket.h index fac0e981..896b7dd9 100644 --- a/Minecraft.World/ContainerOpenPacket.h +++ b/Minecraft.World/ContainerOpenPacket.h @@ -46,7 +46,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerOpenPacket()); } virtual int getId() { return 100; } }; diff --git a/Minecraft.World/ContainerSetContentPacket.cpp b/Minecraft.World/ContainerSetContentPacket.cpp index ae76e0f0..13cfebd7 100644 --- a/Minecraft.World/ContainerSetContentPacket.cpp +++ b/Minecraft.World/ContainerSetContentPacket.cpp @@ -20,11 +20,11 @@ ContainerSetContentPacket::ContainerSetContentPacket() ContainerSetContentPacket::ContainerSetContentPacket(int containerId, vector > *newItems) { this->containerId = containerId; - items = ItemInstanceArray(static_cast(newItems->size())); + items = ItemInstanceArray((int)newItems->size()); for (unsigned int i = 0; i < items.length; i++) { shared_ptr item = newItems->at(i); - items[i] = item == nullptr ? nullptr : item->copy(); + items[i] = item == NULL ? nullptr : item->copy(); } } diff --git a/Minecraft.World/ContainerSetContentPacket.h b/Minecraft.World/ContainerSetContentPacket.h index 3159085b..10315f58 100644 --- a/Minecraft.World/ContainerSetContentPacket.h +++ b/Minecraft.World/ContainerSetContentPacket.h @@ -19,7 +19,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerSetContentPacket()); } virtual int getId() { return 104; } }; diff --git a/Minecraft.World/ContainerSetDataPacket.h b/Minecraft.World/ContainerSetDataPacket.h index c5d52a97..ce075e00 100644 --- a/Minecraft.World/ContainerSetDataPacket.h +++ b/Minecraft.World/ContainerSetDataPacket.h @@ -19,6 +19,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerSetDataPacket()); } virtual int getId() { return 105; } }; \ No newline at end of file diff --git a/Minecraft.World/ContainerSetSlotPacket.cpp b/Minecraft.World/ContainerSetSlotPacket.cpp index 6a038244..42892f3c 100644 --- a/Minecraft.World/ContainerSetSlotPacket.cpp +++ b/Minecraft.World/ContainerSetSlotPacket.cpp @@ -22,7 +22,7 @@ ContainerSetSlotPacket::ContainerSetSlotPacket(int containerId, int slot, shared { this->containerId = containerId; this->slot = slot; - this->item = item == nullptr ? item : item->copy(); + this->item = item == NULL ? item : item->copy(); } void ContainerSetSlotPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/ContainerSetSlotPacket.h b/Minecraft.World/ContainerSetSlotPacket.h index 86bca334..61269df0 100644 --- a/Minecraft.World/ContainerSetSlotPacket.h +++ b/Minecraft.World/ContainerSetSlotPacket.h @@ -23,7 +23,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ContainerSetSlotPacket()); } virtual int getId() { return 103; } }; diff --git a/Minecraft.World/ControlledByPlayerGoal.cpp b/Minecraft.World/ControlledByPlayerGoal.cpp index c5203e6e..cea227cd 100644 --- a/Minecraft.World/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/ControlledByPlayerGoal.cpp @@ -36,13 +36,13 @@ void ControlledByPlayerGoal::stop() bool ControlledByPlayerGoal::canUse() { - return mob->isAlive() && mob->rider.lock() != nullptr && mob->rider.lock()->instanceof(eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); + return mob->isAlive() && mob->rider.lock() != NULL && mob->rider.lock()->instanceof(eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() { shared_ptr player = dynamic_pointer_cast(mob->rider.lock()); - PathfinderMob *pig = static_cast(mob); + PathfinderMob *pig = (PathfinderMob *)mob; float yrd = Mth::wrapDegrees(player->yRot - mob->yRot) * 0.5f; if (yrd > 5) yrd = 5; @@ -62,7 +62,7 @@ void ControlledByPlayerGoal::tick() { boosting = false; } - moveSpeed += moveSpeed * 1.15f * Mth::sin(static_cast(boostTime) / boostTimeTotal * PI); + moveSpeed += moveSpeed * 1.15f * Mth::sin((float) boostTime / boostTimeTotal * PI); } float friction = 0.91f; @@ -117,13 +117,13 @@ void ControlledByPlayerGoal::tick() { shared_ptr carriedItem = player->getCarriedItem(); - if (carriedItem != nullptr && carriedItem->id == Item::carrotOnAStick_Id) + if (carriedItem != NULL && carriedItem->id == Item::carrotOnAStick_Id) { carriedItem->hurtAndBreak(1, player); if (carriedItem->count == 0) { - shared_ptr replacement = std::make_shared(Item::fishingRod); + shared_ptr replacement = shared_ptr(new ItemInstance(Item::fishingRod)); replacement->setTag(carriedItem->tag); player->inventory->items[player->inventory->selected] = replacement; } @@ -135,7 +135,7 @@ void ControlledByPlayerGoal::tick() bool ControlledByPlayerGoal::isNoJumpTile(int tile) { - return Tile::tiles[tile] != nullptr && (Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_STAIRS || (dynamic_cast(Tile::tiles[tile]) != nullptr) ); + return Tile::tiles[tile] != NULL && (Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_STAIRS || (dynamic_cast(Tile::tiles[tile]) != NULL) ); } bool ControlledByPlayerGoal::isBoosting() diff --git a/Minecraft.World/Cow.cpp b/Minecraft.World/Cow.cpp index 69628d64..05e70102 100644 --- a/Minecraft.World/Cow.cpp +++ b/Minecraft.World/Cow.cpp @@ -106,17 +106,17 @@ void Cow::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) bool Cow::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != nullptr && item->id == Item::bucket_empty->id && !player->abilities.instabuild) + if (item != NULL && item->id == Item::bucket_empty->id && !player->abilities.instabuild) { player->awardStat(GenericStats::cowsMilked(),GenericStats::param_cowsMilked()); if (item->count-- == 0) { - player->inventory->setItem(player->inventory->selected, std::make_shared(Item::bucket_milk)); + player->inventory->setItem(player->inventory->selected, shared_ptr( new ItemInstance(Item::bucket_milk) ) ); } - else if (!player->inventory->add(std::make_shared(Item::bucket_milk))) + else if (!player->inventory->add(shared_ptr( new ItemInstance(Item::bucket_milk) ))) { - player->drop(std::make_shared(Item::bucket_milk)); + player->drop(shared_ptr( new ItemInstance(Item::bucket_milk) )); } return true; @@ -129,7 +129,7 @@ shared_ptr Cow::getBreedOffspring(shared_ptr target) // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return std::make_shared(level); + return shared_ptr( new Cow(level) ); } else { diff --git a/Minecraft.World/CraftItemPacket.h b/Minecraft.World/CraftItemPacket.h index f6cbdd3d..9793d593 100644 --- a/Minecraft.World/CraftItemPacket.h +++ b/Minecraft.World/CraftItemPacket.h @@ -22,6 +22,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new CraftItemPacket()); } virtual int getId() { return 150; } }; \ No newline at end of file diff --git a/Minecraft.World/CraftingContainer.cpp b/Minecraft.World/CraftingContainer.cpp index 3ec1b039..47a11eb4 100644 --- a/Minecraft.World/CraftingContainer.cpp +++ b/Minecraft.World/CraftingContainer.cpp @@ -58,7 +58,7 @@ bool CraftingContainer::hasCustomName() shared_ptr CraftingContainer::removeItemNoUpdate(int slot) { - if ((*items)[slot] != nullptr) + if ((*items)[slot] != NULL) { shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; @@ -69,7 +69,7 @@ shared_ptr CraftingContainer::removeItemNoUpdate(int slot) shared_ptr CraftingContainer::removeItem(unsigned int slot, int count) { - if ((*items)[slot] != nullptr) + if ((*items)[slot] != NULL) { if ((*items)[slot]->count <= count) { diff --git a/Minecraft.World/CraftingMenu.cpp b/Minecraft.World/CraftingMenu.cpp index 6f24d310..c104bbec 100644 --- a/Minecraft.World/CraftingMenu.cpp +++ b/Minecraft.World/CraftingMenu.cpp @@ -19,8 +19,8 @@ const int CraftingMenu::USE_ROW_SLOT_END = CraftingMenu::USE_ROW_SLOT_START + 9; CraftingMenu::CraftingMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu() { - craftSlots = std::make_shared(this, 3, 3); - resultSlots = std::make_shared(); + craftSlots = shared_ptr( new CraftingContainer(this, 3, 3) ); + resultSlots = shared_ptr( new ResultContainer() ); this->level = level; x = xt; @@ -64,7 +64,7 @@ void CraftingMenu::removed(shared_ptr player) for (int i = 0; i < 9; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != nullptr) + if (item != NULL) { player->drop(item); } @@ -82,7 +82,7 @@ shared_ptr CraftingMenu::quickMoveStack(shared_ptr player, { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/Creeper.cpp b/Minecraft.World/Creeper.cpp index 0cd6b534..29be2c0c 100644 --- a/Minecraft.World/Creeper.cpp +++ b/Minecraft.World/Creeper.cpp @@ -64,9 +64,9 @@ bool Creeper::useNewAi() int Creeper::getMaxFallDistance() { - if (getTarget() == nullptr) return 3; + if (getTarget() == NULL) return 3; // As long as they survive the fall they should try. - return 3 + static_cast(getHealth() - 1); + return 3 + (int) (getHealth() - 1); } void Creeper::causeFallDamage(float distance) @@ -81,22 +81,22 @@ void Creeper::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_SWELL_DIR, static_cast(-1)); - entityData->define(DATA_IS_POWERED, static_cast(0)); + entityData->define(DATA_SWELL_DIR, (byte) -1); + entityData->define(DATA_IS_POWERED, (byte) 0); } void Creeper::addAdditonalSaveData(CompoundTag *entityTag) { Monster::addAdditonalSaveData(entityTag); if (entityData->getByte(DATA_IS_POWERED) == 1) entityTag->putBoolean(L"powered", true); - entityTag->putShort(L"Fuse", static_cast(maxSwell)); - entityTag->putByte(L"ExplosionRadius", static_cast(explosionRadius)); + entityTag->putShort(L"Fuse", (short) maxSwell); + entityTag->putByte(L"ExplosionRadius", (byte) explosionRadius); } void Creeper::readAdditionalSaveData(CompoundTag *tag) { Monster::readAdditionalSaveData(tag); - entityData->set(DATA_IS_POWERED, static_cast(tag->getBoolean(L"powered") ? 1 : 0)); + entityData->set(DATA_IS_POWERED, (byte) (tag->getBoolean(L"powered") ? 1 : 0)); if (tag->contains(L"Fuse")) maxSwell = tag->getShort(L"Fuse"); if (tag->contains(L"ExplosionRadius")) explosionRadius = tag->getByte(L"ExplosionRadius"); } @@ -142,13 +142,13 @@ void Creeper::die(DamageSource *source) { Monster::die(source); - if ( source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_SKELETON) ) + if ( source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_SKELETON) ) { int recordId = Item::record_01_Id + random->nextInt(Item::record_12_Id - Item::record_01_Id + 1); spawnAtLocation(recordId, 1); } - if ( source->getDirectEntity() != nullptr && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) ) + if ( source->getDirectEntity() != NULL && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast(source->getEntity()); player->awardStat(GenericStats::archer(), GenericStats::param_archer()); @@ -177,16 +177,16 @@ int Creeper::getDeathLoot() int Creeper::getSwellDir() { - return (int) static_cast(entityData->getByte(DATA_SWELL_DIR)); + return (int) (char) entityData->getByte(DATA_SWELL_DIR); } void Creeper::setSwellDir(int dir) { - entityData->set(DATA_SWELL_DIR, static_cast(dir)); + entityData->set(DATA_SWELL_DIR, (byte) dir); } void Creeper::thunderHit(const LightningBolt *lightningBolt) { Monster::thunderHit(lightningBolt); - entityData->set(DATA_IS_POWERED, static_cast(1)); + entityData->set(DATA_IS_POWERED, (byte) 1); } diff --git a/Minecraft.World/CropTile.cpp b/Minecraft.World/CropTile.cpp index 1a161199..0df71924 100644 --- a/Minecraft.World/CropTile.cpp +++ b/Minecraft.World/CropTile.cpp @@ -9,7 +9,7 @@ CropTile::CropTile(int id) : Bush(id) { setTicking(true); updateDefaultShape(); - icons = nullptr; + icons = NULL; setDestroyTime(0.0f); setSoundType(SOUND_GRASS); @@ -40,7 +40,7 @@ void CropTile::tick(Level *level, int x, int y, int z, Random *random) { float growthSpeed = getGrowthSpeed(level, x, y, z); - if (random->nextInt(static_cast(25 / growthSpeed) + 1) == 0) + if (random->nextInt((int) (25 / growthSpeed) + 1) == 0) { age++; level->setData(x, y, z, age, Tile::UPDATE_CLIENTS); @@ -136,7 +136,7 @@ void CropTile::spawnResources(Level *level, int x, int y, int z, int data, float for (int i = 0; i < count; i++) { if (level->random->nextInt(5 * 3) > data) continue; - popResource(level, x, y, z, std::make_shared(getBaseSeedId(), 1, 0)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(getBaseSeedId(), 1, 0))); } } } diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index 7281d298..0f4c6479 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -30,7 +30,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt string path = "GAME:\\GameRules\\heightmap.bin"; #endif #endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { app.FatalLoadError(); @@ -44,14 +44,14 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); #endif if(dwFileSize > m_heightmapOverride.length) { app.DebugPrintf("Heightmap binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { @@ -72,7 +72,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt string waterHeightPath = "GAME:\\GameRules\\waterheight.bin"; #endif #endif - file = CreateFile(waterHeightPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + file = CreateFile(waterHeightPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -86,14 +86,14 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); + DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); #endif if(dwFileSize > m_waterheightOverride.length) { app.DebugPrintf("waterheight binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,nullptr); + BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,NULL); if(bSuccess==FALSE) { @@ -196,7 +196,7 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) if( emin < falloffStart ) { int falloff = falloffStart - emin; - comp = (static_cast(falloff) / static_cast(falloffStart) ) * falloffMax; + comp = ((float)falloff / (float)falloffStart ) * falloffMax; } // 4J - end of extra code /////////////////////////////////////////////////////////////////// @@ -204,11 +204,11 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) // 4J - this comparison used to just be with 0.0f but is now varied by block above if (yc * CHUNK_HEIGHT + y < mapHeight) { - tileId = static_cast(Tile::stone_Id); + tileId = (byte) Tile::stone_Id; } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = static_cast(Tile::calmWater_Id); + tileId = (byte) Tile::calmWater_Id; } // 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that @@ -262,7 +262,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi Biome *b = biomes[z + x * 16]; float temp = b->getTemperature(); - int runDepth = static_cast(depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); int run = -1; @@ -270,7 +270,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi byte material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); - if(lgo != nullptr) + if(lgo != NULL) { lgo->getBiomeOverride(b->id,material,top); } @@ -290,7 +290,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in // if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; } else { @@ -307,13 +307,13 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = static_cast(Tile::stone_Id); + material = (byte) Tile::stone_Id; } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { top = b->topMaterial; material = b->material; - if(lgo != nullptr) + if(lgo != NULL) { lgo->getBiomeOverride(b->id,material,top); } @@ -321,8 +321,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = static_cast(Tile::ice_Id); - else top = static_cast(Tile::calmWater_Id); + if (temp < 0.15f) top = (byte) Tile::ice_Id; + else top = (byte) Tile::calmWater_Id; } run = runDepth; @@ -339,7 +339,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (run == 0 && material == Tile::sand_Id) { run = random->nextInt(4); - material = static_cast(Tile::sandStone_Id); + material = (byte) Tile::sandStone_Id; } } } @@ -357,7 +357,7 @@ LevelChunk *CustomLevelSource::create(int x, int z) #ifdef _OVERRIDE_HEIGHTMAP return getChunk(x,z); #else - return nullptr; + return NULL; #endif } @@ -368,7 +368,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::maxBuildHeight * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -411,7 +411,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) return levelChunk; #else - return nullptr; + return NULL; #endif } @@ -622,9 +622,9 @@ vector *CustomLevelSource::getMobsAt(MobCategory *mobCa { #ifdef _OVERRIDE_HEIGHTMAP Biome *biome = level->getBiome(x, z); - if (biome == nullptr) + if (biome == NULL) { - return nullptr; + return NULL; } if (mobCategory == MobCategory::monster && scatteredFeature->isSwamphut(x, y, z)) { @@ -632,19 +632,19 @@ vector *CustomLevelSource::getMobsAt(MobCategory *mobCa } return biome->getMobs(mobCategory); #else - return nullptr; + return NULL; #endif } TilePos *CustomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { #ifdef _OVERRIDE_HEIGHTMAP - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) + if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } #endif - return nullptr; + return NULL; } void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) @@ -652,10 +652,10 @@ void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) if (generateStructures) { #ifdef _OVERRIDE_HEIGHTMAP - mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray()); - villageFeature->apply(this, level, chunkX, chunkZ, byteArray()); - strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray()); - scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray()); + mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL); + villageFeature->apply(this, level, chunkX, chunkZ, NULL); + strongholdFeature->apply(this, level, chunkX, chunkZ, NULL); + scatteredFeature->apply(this, level, chunkX, chunkZ, NULL); #endif } } \ No newline at end of file diff --git a/Minecraft.World/CustomPayloadPacket.cpp b/Minecraft.World/CustomPayloadPacket.cpp index 46fde5aa..29e2828e 100644 --- a/Minecraft.World/CustomPayloadPacket.cpp +++ b/Minecraft.World/CustomPayloadPacket.cpp @@ -23,7 +23,7 @@ CustomPayloadPacket::CustomPayloadPacket(const wstring &identifier, byteArray da this->identifier = identifier; this->data = data; - if (data.data != nullptr) + if (data.data != NULL) { length = data.length; @@ -45,7 +45,7 @@ void CustomPayloadPacket::read(DataInputStream *dis) if (length > 0 && length < Short::MAX_VALUE) { - if(data.data != nullptr) + if(data.data != NULL) { delete [] data.data; } @@ -57,8 +57,8 @@ void CustomPayloadPacket::read(DataInputStream *dis) void CustomPayloadPacket::write(DataOutputStream *dos) { writeUtf(identifier, dos); - dos->writeShort(static_cast(length)); - if (data.data != nullptr) + dos->writeShort((short) length); + if (data.data != NULL) { dos->write(data); } diff --git a/Minecraft.World/CustomPayloadPacket.h b/Minecraft.World/CustomPayloadPacket.h index 82a3f6e2..95c5e708 100644 --- a/Minecraft.World/CustomPayloadPacket.h +++ b/Minecraft.World/CustomPayloadPacket.h @@ -30,6 +30,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new CustomPayloadPacket()); } virtual int getId() { return 250; } }; \ No newline at end of file diff --git a/Minecraft.World/DamageEnchantment.cpp b/Minecraft.World/DamageEnchantment.cpp index 4ca8c9a6..ce5a7c1f 100644 --- a/Minecraft.World/DamageEnchantment.cpp +++ b/Minecraft.World/DamageEnchantment.cpp @@ -51,7 +51,7 @@ int DamageEnchantment::getDescriptionId() bool DamageEnchantment::isCompatibleWith(Enchantment *other) const { - return dynamic_cast(other) == nullptr; + return dynamic_cast(other) == NULL; } bool DamageEnchantment::canEnchant(shared_ptr item) diff --git a/Minecraft.World/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index bc3adc80..1ed1c65f 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/DamageSource.cpp @@ -40,7 +40,7 @@ DamageSource *DamageSource::arrow(shared_ptr arrow, shared_ptr ow DamageSource *DamageSource::fireball(shared_ptr fireball, shared_ptr owner) { - if (owner == nullptr) + if (owner == NULL) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathOnFire, ChatPacket::e_ChatDeathOnFire, fireball, fireball))->setIsFire()->setProjectile(); } @@ -64,7 +64,7 @@ DamageSource *DamageSource::thorns(shared_ptr source) DamageSource *DamageSource::explosion(Explosion *explosion) { - if ( (explosion != nullptr) && (explosion->getSourceMob() != nullptr) ) + if ( (explosion != NULL) && (explosion->getSourceMob() != NULL) ) { return (new EntityDamageSource(ChatPacket::e_ChatDeathExplosionPlayer, ChatPacket::e_ChatDeathExplosionPlayer, explosion->getSourceMob()))->setScalesWithDifficulty()->setExplosion(); } @@ -191,13 +191,13 @@ DamageSource *DamageSource::setMagic() shared_ptr DamageSource::getDeathMessagePacket(shared_ptr player) { shared_ptr source = player->getKillCredit(); - if(source != nullptr) + if(source != NULL) { - return std::make_shared(player->getNetworkName(), m_msgWithItemId != ChatPacket::e_ChatCustom ? m_msgWithItemId : m_msgId, source->GetType(), source->getNetworkName()); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId != ChatPacket::e_ChatCustom ? m_msgWithItemId : m_msgId, source->GetType(), source->getNetworkName() ) ); } else { - return std::make_shared(player->getNetworkName(), m_msgId); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgId ) ); } } diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp index 4e4f5cd1..18deed39 100644 --- a/Minecraft.World/DataInputStream.cpp +++ b/Minecraft.World/DataInputStream.cpp @@ -92,12 +92,12 @@ bool DataInputStream::readBoolean() //the 8-bit value read. byte DataInputStream::readByte() { - return static_cast(stream->read()); + return (byte) stream->read(); } unsigned char DataInputStream::readUnsignedByte() { - return static_cast(stream->read()); + return (unsigned char) stream->read(); } //Reads two input bytes and returns a char value. Let a be the first byte read and b be the second byte. The value returned is: @@ -110,7 +110,7 @@ wchar_t DataInputStream::readChar() { int a = stream->read(); int b = stream->read(); - return static_cast((a << 8) | (b & 0xff)); + return (wchar_t)((a << 8) | (b & 0xff)); } //Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b. @@ -254,14 +254,14 @@ short DataInputStream::readShort() { int a = stream->read(); int b = stream->read(); - return static_cast((a << 8) | (b & 0xff)); + return (short)((a << 8) | (b & 0xff)); } unsigned short DataInputStream::readUnsignedShort() { int a = stream->read(); int b = stream->read(); - return static_cast((a << 8) | (b & 0xff)); + return (unsigned short)((a << 8) | (b & 0xff)); } //Reads in a string that has been encoded using a modified UTF-8 format. The general contract of readUTF is that it reads a representation @@ -301,7 +301,7 @@ wstring DataInputStream::readUTF() wstring outputString; int a = stream->read(); int b = stream->read(); - unsigned short UTFLength = static_cast(((a & 0xff) << 8) | (b & 0xff)); + unsigned short UTFLength = (unsigned short) (((a & 0xff) << 8) | (b & 0xff)); //// 4J Stu - I decided while writing DataOutputStream that we didn't need to bother using the UTF8 format //// used in the java libs, and just write in/out as wchar_t all the time @@ -343,7 +343,7 @@ wstring DataInputStream::readUTF() else if( (firstByte & 0x80) == 0x00 ) { // One byte UTF - wchar_t readChar = static_cast(firstByte); + wchar_t readChar = (wchar_t)firstByte; outputString.push_back( readChar ); continue; } @@ -374,7 +374,7 @@ wstring DataInputStream::readUTF() break; } - wchar_t readChar = static_cast(((firstByte & 0x1F) << 6) | (secondByte & 0x3F)); + wchar_t readChar = (wchar_t)( ((firstByte& 0x1F) << 6) | (secondByte & 0x3F) ); outputString.push_back( readChar ); continue; } @@ -422,7 +422,7 @@ wstring DataInputStream::readUTF() break; } - wchar_t readChar = static_cast(((firstByte & 0x0F) << 12) | ((secondByte & 0x3F) << 6) | (thirdByte & 0x3F)); + wchar_t readChar = (wchar_t)(((firstByte & 0x0F) << 12) | ((secondByte & 0x3F) << 6) | (thirdByte & 0x3F)); outputString.push_back( readChar ); continue; } diff --git a/Minecraft.World/DataLayer.cpp b/Minecraft.World/DataLayer.cpp index f3916320..a5e7d088 100644 --- a/Minecraft.World/DataLayer.cpp +++ b/Minecraft.World/DataLayer.cpp @@ -40,21 +40,21 @@ void DataLayer::set(int x, int y, int z, int val) if (part == 0) { - data[slot] = static_cast((data[slot] & 0xf0) | (val & 0xf)); + data[slot] = (byte) ((data[slot] & 0xf0) | (val & 0xf)); } else { - data[slot] = static_cast((data[slot] & 0x0f) | ((val & 0xf) << 4)); + data[slot] = (byte) ((data[slot] & 0x0f) | ((val & 0xf) << 4)); } } bool DataLayer::isValid() { - return data.data != nullptr; + return data.data != NULL; } void DataLayer::setAll(int br) { - byte val = static_cast(br & (br << 4)); + byte val = (byte) (br & (br << 4)); for (unsigned int i = 0; i < data.length; i++) { data[i] = val; diff --git a/Minecraft.World/DataOutputStream.cpp b/Minecraft.World/DataOutputStream.cpp index 1a3931cf..1a24e31a 100644 --- a/Minecraft.World/DataOutputStream.cpp +++ b/Minecraft.World/DataOutputStream.cpp @@ -184,7 +184,7 @@ void DataOutputStream::writeChars(const wstring& str) //v - a boolean value to be written. void DataOutputStream::writeBoolean(bool b) { - stream->write( b ? static_cast(1) : static_cast(0) ); + stream->write( b ? (byte)1 : (byte)0 ); // TODO 4J Stu - Error handling? written += 1; } @@ -199,7 +199,7 @@ void DataOutputStream::writeBoolean(bool b) //str - a string to be written. void DataOutputStream::writeUTF(const wstring& str) { - int strlen = static_cast(str.length()); + int strlen = (int)str.length(); int utflen = 0; int c, count = 0; @@ -227,15 +227,15 @@ void DataOutputStream::writeUTF(const wstring& str) byteArray bytearr(utflen+2); - bytearr[count++] = static_cast((utflen >> 8) & 0xFF); - bytearr[count++] = static_cast((utflen >> 0) & 0xFF); + bytearr[count++] = (byte) ((utflen >> 8) & 0xFF); + bytearr[count++] = (byte) ((utflen >> 0) & 0xFF); int i=0; for (i=0; i= 0x0001) && (c <= 0x007F))) break; - bytearr[count++] = static_cast(c); + bytearr[count++] = (byte) c; } for (;i < strlen; i++) @@ -243,19 +243,19 @@ void DataOutputStream::writeUTF(const wstring& str) c = str.at(i); if ((c >= 0x0001) && (c <= 0x007F)) { - bytearr[count++] = static_cast(c); + bytearr[count++] = (byte) c; } else if (c > 0x07FF) { - bytearr[count++] = static_cast(0xE0 | ((c >> 12) & 0x0F)); - bytearr[count++] = static_cast(0x80 | ((c >> 6) & 0x3F)); - bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); + bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); + bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } else { - bytearr[count++] = static_cast(0xC0 | ((c >> 6) & 0x1F)); - bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); + bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } } write(bytearr, 0, utflen+2); diff --git a/Minecraft.World/DaylightDetectorTile.cpp b/Minecraft.World/DaylightDetectorTile.cpp index 0bfc949b..1bc9943e 100644 --- a/Minecraft.World/DaylightDetectorTile.cpp +++ b/Minecraft.World/DaylightDetectorTile.cpp @@ -62,7 +62,7 @@ void DaylightDetectorTile::updateSignalStrength(Level *level, int x, int y, int sunAngle = sunAngle + (PI * 2.0f - sunAngle) * .2f; } - target = Math::round(static_cast(target) * Mth::cos(sunAngle)); + target = Math::round((float) target * Mth::cos(sunAngle)); if (target < 0) { target = 0; @@ -95,7 +95,7 @@ bool DaylightDetectorTile::isSignalSource() shared_ptr DaylightDetectorTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new DaylightDetectorTileEntity() ); } Icon *DaylightDetectorTile::getTexture(int face, int data) diff --git a/Minecraft.World/DaylightDetectorTileEntity.cpp b/Minecraft.World/DaylightDetectorTileEntity.cpp index 0cf1cec3..5a329413 100644 --- a/Minecraft.World/DaylightDetectorTileEntity.cpp +++ b/Minecraft.World/DaylightDetectorTileEntity.cpp @@ -9,12 +9,12 @@ DaylightDetectorTileEntity::DaylightDetectorTileEntity() void DaylightDetectorTileEntity::tick() { - if (level != nullptr && !level->isClientSide && (level->getGameTime() % SharedConstants::TICKS_PER_SECOND) == 0) + if (level != NULL && !level->isClientSide && (level->getGameTime() % SharedConstants::TICKS_PER_SECOND) == 0) { tile = getTile(); - if (tile != nullptr && dynamic_cast(tile) != nullptr) + if (tile != NULL && dynamic_cast(tile) != NULL) { - static_cast(tile)->updateSignalStrength(level, x, y, z); + ((DaylightDetectorTile *) tile)->updateSignalStrength(level, x, y, z); } } } @@ -22,7 +22,7 @@ void DaylightDetectorTileEntity::tick() // 4J Added shared_ptr DaylightDetectorTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new DaylightDetectorTileEntity() ); TileEntity::clone(result); return result; diff --git a/Minecraft.World/DeadBushTile.cpp b/Minecraft.World/DeadBushTile.cpp index 7f22f747..33fdfe6c 100644 --- a/Minecraft.World/DeadBushTile.cpp +++ b/Minecraft.World/DeadBushTile.cpp @@ -29,7 +29,7 @@ int DeadBushTile::getResource(int data, Random *random, int playerBonusLevel) void DeadBushTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears_Id) + if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears_Id) { player->awardStat( GenericStats::blocksMined(id), @@ -37,7 +37,7 @@ void DeadBushTile::playerDestroy(Level *level, shared_ptr player, int x, ); // drop leaf block instead of sapling - popResource(level, x, y, z, std::make_shared(Tile::deadBush, 1, data)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::deadBush, 1, data))); } else { diff --git a/Minecraft.World/DebugOptionsPacket.cpp b/Minecraft.World/DebugOptionsPacket.cpp index e62fb2eb..f287efcd 100644 --- a/Minecraft.World/DebugOptionsPacket.cpp +++ b/Minecraft.World/DebugOptionsPacket.cpp @@ -28,12 +28,12 @@ void DebugOptionsPacket::handle(PacketListener *listener) void DebugOptionsPacket::read(DataInputStream *dis) //throws IOException { - m_uiVal = static_cast(dis->readInt()); + m_uiVal = (unsigned int)dis->readInt(); } void DebugOptionsPacket::write(DataOutputStream *dos) // throws IOException { - dos->writeInt(static_cast(m_uiVal)); + dos->writeInt((int)m_uiVal); } int DebugOptionsPacket::getEstimatedSize() diff --git a/Minecraft.World/DebugOptionsPacket.h b/Minecraft.World/DebugOptionsPacket.h index 09167f8c..9ac5ef2f 100644 --- a/Minecraft.World/DebugOptionsPacket.h +++ b/Minecraft.World/DebugOptionsPacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new DebugOptionsPacket()); } virtual int getId() { return 152; } }; diff --git a/Minecraft.World/DefaultDispenseItemBehavior.cpp b/Minecraft.World/DefaultDispenseItemBehavior.cpp index 8563ef56..8fd13282 100644 --- a/Minecraft.World/DefaultDispenseItemBehavior.cpp +++ b/Minecraft.World/DefaultDispenseItemBehavior.cpp @@ -38,7 +38,7 @@ void DefaultDispenseItemBehavior::spawnItem(Level *world, shared_ptrgetY(); double spawnZ = position->getZ(); - shared_ptr itemEntity = std::make_shared(world, spawnX, spawnY - 0.3, spawnZ, item); + shared_ptr itemEntity = shared_ptr(new ItemEntity(world, spawnX, spawnY - 0.3, spawnZ, item)); double pow = world->random->nextDouble() * 0.1 + 0.2; itemEntity->xd = facing->getStepX() * pow; diff --git a/Minecraft.World/DefendVillageTargetGoal.cpp b/Minecraft.World/DefendVillageTargetGoal.cpp index 201738a3..6ed6af53 100644 --- a/Minecraft.World/DefendVillageTargetGoal.cpp +++ b/Minecraft.World/DefendVillageTargetGoal.cpp @@ -12,7 +12,7 @@ DefendVillageTargetGoal::DefendVillageTargetGoal(VillagerGolem *golem) : TargetG bool DefendVillageTargetGoal::canUse() { shared_ptr village = golem->getVillage(); - if (village == nullptr) return false; + if (village == NULL) return false; potentialTarget = weak_ptr(village->getClosestAggressor(dynamic_pointer_cast(golem->shared_from_this()))); shared_ptr potTarget = potentialTarget.lock(); if (!canAttack(potTarget, false)) diff --git a/Minecraft.World/DesertBiome.cpp b/Minecraft.World/DesertBiome.cpp index e67faef5..c36b0908 100644 --- a/Minecraft.World/DesertBiome.cpp +++ b/Minecraft.World/DesertBiome.cpp @@ -10,8 +10,8 @@ DesertBiome::DesertBiome(int id) : Biome(id) friendlies.clear(); friendlies_chicken.clear(); // 4J added friendlies_wolf.clear(); // 4J added - topMaterial = static_cast(Tile::sand_Id); - material = static_cast(Tile::sand_Id); + topMaterial = (BYTE) Tile::sand_Id; + material = (BYTE) Tile::sand_Id; decorator->treeCount = -999; decorator->deadBushCount = 2; diff --git a/Minecraft.World/DetectorRailTile.cpp b/Minecraft.World/DetectorRailTile.cpp index ce35a592..16265ceb 100644 --- a/Minecraft.World/DetectorRailTile.cpp +++ b/Minecraft.World/DetectorRailTile.cpp @@ -12,7 +12,7 @@ DetectorRailTile::DetectorRailTile(int id) : BaseRailTile(id, true) { setTicking(true); - icons = nullptr; + icons = NULL; } int DetectorRailTile::getTickDelay(Level *level) diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index b7a2ea7c..479edae8 100644 --- a/Minecraft.World/Dimension.cpp +++ b/Minecraft.World/Dimension.cpp @@ -30,7 +30,7 @@ void Dimension::updateLightRamp() float ambientLight = 0.00f; for (int i = 0; i <= Level::MAX_BRIGHTNESS; i++) { - float v = (1 - i / static_cast(Level::MAX_BRIGHTNESS)); + float v = (1 - i / (float) (Level::MAX_BRIGHTNESS)); brightnessRamp[i] = ((1 - v) / (v * 3 + 1)) * (1 - ambientLight) + ambientLight; } } @@ -70,7 +70,7 @@ Dimension::~Dimension() { delete[] brightnessRamp; - if(biomeSource != nullptr) + if(biomeSource != NULL) delete biomeSource; } @@ -115,7 +115,7 @@ bool Dimension::isValidSpawn(int x, int z) const float Dimension::getTimeOfDay(int64_t time, float a) const { - int dayStep = static_cast(time % Level::TICKS_PER_DAY); + int dayStep = (int) (time % Level::TICKS_PER_DAY); float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f; if (td < 0) td += 1; if (td > 1) td -= 1; @@ -127,7 +127,7 @@ float Dimension::getTimeOfDay(int64_t time, float a) const int Dimension::getMoonPhase(int64_t time) const { - return static_cast(time / Level::TICKS_PER_DAY) % 8; + return ((int) (time / Level::TICKS_PER_DAY)) % 8; } bool Dimension::isNaturalDimension() @@ -161,7 +161,7 @@ float *Dimension::getSunriseColor(float td, float a) return sunriseCol; } - return nullptr; + return NULL; } Vec3 *Dimension::getFogColor(float td, float a) const @@ -192,12 +192,12 @@ Dimension *Dimension::getNew(int id) if (id == 0) return new NormalDimension(); if (id == 1) return new TheEndDimension(); - return nullptr; + return NULL; } float Dimension::getCloudHeight() { - return static_cast(Level::genDepth); + return (float)Level::genDepth; } bool Dimension::hasGround() @@ -207,7 +207,7 @@ bool Dimension::hasGround() Pos *Dimension::getSpawnPos() { - return nullptr; + return NULL; } int Dimension::getSpawnYPosition() diff --git a/Minecraft.World/DiodeTile.cpp b/Minecraft.World/DiodeTile.cpp index b40a5af5..e5bbfede 100644 --- a/Minecraft.World/DiodeTile.cpp +++ b/Minecraft.World/DiodeTile.cpp @@ -299,7 +299,7 @@ bool DiodeTile::isSolidRender(bool isServerLevel) bool DiodeTile::isAlternateInput(int tile) { Tile *tt = Tile::tiles[tile]; - return tt != nullptr && tt->isSignalSource(); + return tt != NULL && tt->isSignalSource(); } int DiodeTile::getOutputSignal(LevelSource *level, int x, int y, int z, int data) diff --git a/Minecraft.World/Direction.cpp b/Minecraft.World/Direction.cpp index c9ac93c7..f758798b 100644 --- a/Minecraft.World/Direction.cpp +++ b/Minecraft.World/Direction.cpp @@ -65,7 +65,7 @@ int Direction::RELATIVE_DIRECTION_FACING[4][6] = int Direction::getDirection(double xd, double zd) { - if (Mth::abs(static_cast(xd)) > Mth::abs(static_cast(zd))) + if (Mth::abs((float) xd) > Mth::abs((float) zd)) { if (xd > 0) { diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index c557e37a..150df216 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -24,8 +24,8 @@ _MapDataMappings::_MapDataMappings() int _MapDataMappings::getDimension(int id) { - const int offset = (2*(id%4)); - const int val = (dimensions[id>>2] & (3 << offset))>>offset; + int offset = (2*(id%4)); + int val = (dimensions[id>>2] & (3 << offset))>>offset; int returnVal=0; @@ -54,7 +54,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension) { xuids[id] = xuid; - const int offset = (2*(id%4)); + int offset = (2*(id%4)); // Reset it first dimensions[id>>2] &= ~( 2 << offset ); @@ -108,7 +108,7 @@ void _MapDataMappings_old::setMapping(int id, PlayerUID xuid, int dimension) #ifdef _LARGE_WORLDS void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, int centreZ, int dimension, int scale) { - const int64_t index = ( static_cast(centreZ & 0x1FFFFFFF) << 34) | ( static_cast(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); m_mappings[index] = id; //app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index); } @@ -120,8 +120,8 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int //int64_t zShifted = zMasked << 34; //int64_t xShifted = xMasked << 5; //app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); - const int64_t index = ( static_cast(centreZ & 0x1FFFFFFF) << 34) | ( static_cast(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); - const auto it = m_mappings.find(index); + int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + auto it = m_mappings.find(index); if(it != m_mappings.end()) { id = it->second; @@ -138,7 +138,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int void DirectoryLevelStorage::PlayerMappings::writeMappings(DataOutputStream *dos) { dos->writeInt(m_mappings.size()); - for (const auto& it : m_mappings ) + for ( auto& it : m_mappings ) { app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", it.first, it.first, it.second); dos->writeLong(it.first); @@ -148,11 +148,11 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings(DataOutputStream *dos) void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis) { - const int count = dis->readInt(); + int count = dis->readInt(); for(unsigned int i = 0; i < count; ++i) { int64_t index = dis->readLong(); - const int id = dis->readInt(); + int id = dis->readInt(); m_mappings[index] = id; app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id); } @@ -174,7 +174,7 @@ DirectoryLevelStorage::~DirectoryLevelStorage() { delete m_saveFile; - for(const auto& it : m_cachedSaveData ) + for( auto& it : m_cachedSaveData ) { delete it.second; } @@ -188,7 +188,7 @@ void DirectoryLevelStorage::initiateSession() { // 4J Jev, removed try/catch. - const File dataFile = File( dir, wstring(L"session.lock") ); + File dataFile = File( dir, wstring(L"session.lock") ); FileOutputStream fos = FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); dos.writeLong(sessionId); @@ -217,15 +217,15 @@ ChunkStorage *DirectoryLevelStorage::createChunkStorage(Dimension *dimension) { // 4J Jev, removed try/catch. - if (dynamic_cast(dimension) != nullptr) + if (dynamic_cast(dimension) != NULL) { - const File dir2 = File(dir, LevelStorage::NETHER_FOLDER); + File dir2 = File(dir, LevelStorage::NETHER_FOLDER); //dir2.mkdirs(); // 4J Removed return new OldChunkStorage(dir2, true); } - if (dynamic_cast(dimension) != nullptr) + if (dynamic_cast(dimension) != NULL) { - const File dir2 = File(dir, LevelStorage::ENDER_FOLDER); + File dir2 = File(dir, LevelStorage::ENDER_FOLDER); //dir2.mkdirs(); // 4J Removed return new OldChunkStorage(dir2, true); } @@ -237,7 +237,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() { // 4J Stu Added #ifdef _LARGE_WORLDS - const ConsoleSavePath mapFile = getDataFile(L"largeMapDataMappings"); + ConsoleSavePath mapFile = getDataFile(L"largeMapDataMappings"); #else ConsoleSavePath mapFile = getDataFile(L"mapDataMappings"); #endif @@ -270,16 +270,16 @@ LevelData *DirectoryLevelStorage::prepareLevel() else #endif { - getSaveFile()->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN); + getSaveFile()->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); #ifdef _LARGE_WORLDS - const byteArray data(fileEntry->getFileSize()); + byteArray data(fileEntry->getFileSize()); getSaveFile()->readFile( fileEntry, data.data, fileEntry->getFileSize(), &NumberOfBytesRead); assert( NumberOfBytesRead == fileEntry->getFileSize() ); ByteArrayInputStream bais(data); DataInputStream dis(&bais); - const int count = dis.readInt(); + int count = dis.readInt(); app.DebugPrintf("Loading %d mappings\n", count); for(unsigned int i = 0; i < count; ++i) { @@ -332,7 +332,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() // 4J Jev, removed try/catch - const ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); if ( m_saveFile->doesFileExist( dataFile ) ) { @@ -344,7 +344,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() return ret; } - return nullptr; + return NULL; } void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) @@ -356,7 +356,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vectorput(L"Data", dataTag); - const ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); NbtIo::writeCompressed(root, &fos); @@ -373,7 +373,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData) CompoundTag *root = new CompoundTag(); root->put(L"Data", dataTag); - const ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); + ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); NbtIo::writeCompressed(root, &fos); @@ -398,7 +398,7 @@ void DirectoryLevelStorage::save(shared_ptr player) #elif defined(_DURANGO) ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + player->getXuid().toString() + L".dat" ); #else - const ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( player->getXuid() ) + L".dat" ); + ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( player->getXuid() ) + L".dat" ); #endif // If saves are disabled (e.g. because we are writing the save buffer to disk) then cache this player data if(StorageManager.GetSaveDisabled()) @@ -406,7 +406,7 @@ void DirectoryLevelStorage::save(shared_ptr player) ByteArrayOutputStream *bos = new ByteArrayOutputStream(); NbtIo::writeCompressed(tag,bos); - const auto it = m_cachedSaveData.find(realFile.getName()); + auto it = m_cachedSaveData.find(realFile.getName()); if(it != m_cachedSaveData.end() ) { delete it->second; @@ -432,7 +432,7 @@ void DirectoryLevelStorage::save(shared_ptr player) CompoundTag *DirectoryLevelStorage::load(shared_ptr player) { CompoundTag *tag = loadPlayerDataTag( player->getXuid() ); - if (tag != nullptr) + if (tag != NULL) { player->load(tag); } @@ -447,9 +447,9 @@ CompoundTag *DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) #elif defined(_DURANGO) ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + xuid.toString() + L".dat" ); #else - const ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( xuid ) + L".dat" ); + ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( xuid ) + L".dat" ); #endif - const auto it = m_cachedSaveData.find(realFile.getName()); + auto it = m_cachedSaveData.find(realFile.getName()); if(it != m_cachedSaveData.end() ) { ByteArrayOutputStream *bos = it->second; @@ -464,7 +464,7 @@ CompoundTag *DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(m_saveFile, realFile); return NbtIo::readCompressed(&fis); } - return nullptr; + return NULL; } // 4J Added function @@ -478,19 +478,19 @@ void DirectoryLevelStorage::clearOldPlayerFiles() vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); #endif - if( playerFiles != nullptr ) + if( playerFiles != NULL ) { #ifndef _FINAL_BUILD if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<size(); ++i ) { - const FileEntry *file = playerFiles->at(i); + FileEntry *file = playerFiles->at(i); wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) PlayerUID xuid(xuidStr); #else - const PlayerUID xuid = _fromString(xuidStr); + PlayerUID xuid = _fromString(xuidStr); #endif deleteMapFilesForPlayer(xuid); m_saveFile->deleteFile( playerFiles->at(i) ); @@ -504,12 +504,12 @@ void DirectoryLevelStorage::clearOldPlayerFiles() for(unsigned int i = MAX_PLAYER_DATA_SAVES; i < playerFiles->size(); ++i ) { - const FileEntry *file = playerFiles->at(i); + FileEntry *file = playerFiles->at(i); wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) PlayerUID xuid(xuidStr); #else - const PlayerUID xuid = _fromString(xuidStr); + PlayerUID xuid = _fromString(xuidStr); #endif deleteMapFilesForPlayer(xuid); m_saveFile->deleteFile( playerFiles->at(i) ); @@ -545,7 +545,7 @@ void DirectoryLevelStorage::flushSaveFile(bool autosave) if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<doesFileExist(gameRulesFiles)) { FileEntry *fe = m_saveFile->createFile(gameRulesFiles); @@ -564,7 +564,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions() #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) vector *playerFiles = m_saveFile->getValidPlayerDatFiles(); #else - const vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); + vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); #endif if ( playerFiles ) @@ -573,7 +573,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions() { ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(m_saveFile, realFile); CompoundTag *tag = NbtIo::readCompressed(&fis); - if (tag != nullptr) + if (tag != NULL) { // If the player is in the nether, set their y position above the top of the nether // This will force the player to be spawned in a valid position in the overworld when they are loaded @@ -599,7 +599,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, int bool foundMapping = false; #ifdef _LARGE_WORLDS - const auto it = m_playerMappings.find(xuid); + auto it = m_playerMappings.find(xuid); if(it != m_playerMappings.end()) { foundMapping = it->second.getMapping(mapId, centreXC, centreZC, dimension, scale); @@ -666,7 +666,7 @@ void DirectoryLevelStorage::saveMapIdLookup() if(StorageManager.GetSaveDisabled() ) return; #ifdef _LARGE_WORLDS - const ConsoleSavePath file = getDataFile(L"largeMapDataMappings"); + ConsoleSavePath file = getDataFile(L"largeMapDataMappings"); #else ConsoleSavePath file = getDataFile(L"mapDataMappings"); #endif @@ -675,7 +675,7 @@ void DirectoryLevelStorage::saveMapIdLookup() { DWORD NumberOfBytesWritten; FileEntry *fileEntry = m_saveFile->createFile(file); - m_saveFile->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN); + m_saveFile->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); #ifdef _LARGE_WORLDS ByteArrayOutputStream baos; @@ -712,13 +712,13 @@ void DirectoryLevelStorage::saveMapIdLookup() void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid) { #ifdef _LARGE_WORLDS - const auto it = m_playerMappings.find(xuid); + auto it = m_playerMappings.find(xuid); if(it != m_playerMappings.end()) { for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) { - const int index = itMap->second / 8; - const int offset = itMap->second % 8; + int index = itMap->second / 8; + int offset = itMap->second % 8; m_usedMappings[index] &= ~(1< player) { - const PlayerUID playerXuid = player->getXuid(); + PlayerUID playerXuid = player->getXuid(); if(playerXuid != INVALID_XUID) deleteMapFilesForPlayer(playerXuid); } void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) { #ifdef _LARGE_WORLDS - const auto it = m_playerMappings.find(xuid); + auto it = m_playerMappings.find(xuid); if(it != m_playerMappings.end()) { for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) @@ -758,8 +758,8 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) else m_saveFile->deleteFile( m_saveFile->createFile(file) ); } - const int index = itMap->second / 8; - const int offset = itMap->second % 8; + int index = itMap->second / 8; + int offset = itMap->second % 8; m_usedMappings[index] &= ~(1< *DirectoryLevelStorageSource::getLevelList() wstring levelId = wstring(L"World").append( std::to_wstring( (i+1) ) ); LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData != nullptr) + if (levelData != NULL) { levels->push_back(new LevelSummary(levelId, L"", levelData->getLastPlayed(), levelData->getSizeOnDisk(), levelData.getGameType(), false, levelData->isHardcore())); } @@ -59,7 +59,7 @@ LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, return ret; } - return nullptr; + return NULL; } void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstring& newLevelName) @@ -121,7 +121,7 @@ void DirectoryLevelStorageSource::deleteRecursive(vector *files) shared_ptr DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) { - return std::make_shared(saveFile, baseDir, levelId, createPlayerDir); + return shared_ptr (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } bool DirectoryLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) diff --git a/Minecraft.World/DisconnectPacket.cpp b/Minecraft.World/DisconnectPacket.cpp index 0b6f6bf8..da20686a 100644 --- a/Minecraft.World/DisconnectPacket.cpp +++ b/Minecraft.World/DisconnectPacket.cpp @@ -19,7 +19,7 @@ DisconnectPacket::DisconnectPacket(eDisconnectReason reason) void DisconnectPacket::read(DataInputStream *dis) //throws IOException { - reason = static_cast(dis->readInt()); + reason = (eDisconnectReason)dis->readInt(); } void DisconnectPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/DisconnectPacket.h b/Minecraft.World/DisconnectPacket.h index 3c96a429..34983754 100644 --- a/Minecraft.World/DisconnectPacket.h +++ b/Minecraft.World/DisconnectPacket.h @@ -66,7 +66,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new DisconnectPacket()); } virtual int getId() { return 255; } }; diff --git a/Minecraft.World/DispenserTile.cpp b/Minecraft.World/DispenserTile.cpp index 5098fe30..8758b3c5 100644 --- a/Minecraft.World/DispenserTile.cpp +++ b/Minecraft.World/DispenserTile.cpp @@ -18,9 +18,9 @@ DispenserTile::DispenserTile(int id) : BaseEntityTile(id, Material::stone) { random = new Random(); - iconTop = nullptr; - iconFront = nullptr; - iconFrontVertical = nullptr; + iconTop = NULL; + iconFront = NULL; + iconFrontVertical = NULL; } int DispenserTile::getTickDelay(Level *level) @@ -115,7 +115,7 @@ void DispenserTile::dispenseFrom(Level *level, int x, int y, int z) { BlockSourceImpl source(level, x, y, z); shared_ptr trap = dynamic_pointer_cast( source.getEntity() ); - if (trap == nullptr) return; + if (trap == NULL) return; int slot = trap->getRandomSlot(); if (slot < 0) @@ -168,7 +168,7 @@ void DispenserTile::tick(Level *level, int x, int y, int z, Random *random) shared_ptr DispenserTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new DispenserTileEntity() ); } void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by, shared_ptr itemInstance) @@ -186,12 +186,12 @@ void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr
  • container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != nullptr ) + if (container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -203,16 +203,16 @@ void DispenserTile::onRemove(Level *level, int x, int y, int z, int id, int data if (count > item->count) count = item->count; item->count -= count; - shared_ptr newItem = std::make_shared(item->id, count, item->getAuxValue()); + shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, newItem); + shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index b1d8ecde..3e743e22 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -35,7 +35,7 @@ shared_ptr DispenserTileEntity::getItem(unsigned int slot) shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int count) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -61,7 +61,7 @@ shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -73,7 +73,7 @@ shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) // 4J-PB added for spawn eggs not being useable due to limits, so add them in again void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { // just increment the count of the items if(item->id==items[slot]->id) @@ -85,7 +85,7 @@ void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int else { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } } @@ -99,10 +99,10 @@ bool DispenserTileEntity::removeProjectile(int itemId) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == itemId) + if (items[i] != NULL && items[i]->id == itemId) { shared_ptr removedItem = removeItem(i, 1); - return removedItem != nullptr; + return removedItem != NULL; } } return false; @@ -114,7 +114,7 @@ int DispenserTileEntity::getRandomSlot() int replaceOdds = 1; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && random->nextInt(replaceOdds++) == 0) + if (items[i] != NULL && random->nextInt(replaceOdds++) == 0) { replaceSlot = i; } @@ -126,7 +126,7 @@ int DispenserTileEntity::getRandomSlot() void DispenserTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } @@ -134,7 +134,7 @@ int DispenserTileEntity::addItem(shared_ptr item) { for (int i = 0; i < items.length; i++) { - if (items[i] == nullptr || items[i]->id == 0) + if (items[i] == NULL || items[i]->id == 0) { setItem(i, item); return i; @@ -186,10 +186,10 @@ void DispenserTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } @@ -231,12 +231,12 @@ bool DispenserTileEntity::canPlaceItem(int slot, shared_ptr item) // 4J Added shared_ptr DispenserTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new DispenserTileEntity() ); TileEntity::clone(result); for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/DoorInfo.cpp b/Minecraft.World/DoorInfo.cpp index 177b8885..0c61b635 100644 --- a/Minecraft.World/DoorInfo.cpp +++ b/Minecraft.World/DoorInfo.cpp @@ -12,7 +12,7 @@ DoorInfo::DoorInfo(int x, int y, int z, int insideDx, int insideDy, int timeStam int DoorInfo::distanceTo(int x2, int y2, int z2) { - return static_cast(sqrt((float)distanceToSqr(x2, y2, z2))); + return (int) sqrt((float)distanceToSqr(x2, y2, z2)); } int DoorInfo::distanceToSqr(int x2, int y2, int z2) diff --git a/Minecraft.World/DoorInteractGoal.cpp b/Minecraft.World/DoorInteractGoal.cpp index 45805744..1e3bfe11 100644 --- a/Minecraft.World/DoorInteractGoal.cpp +++ b/Minecraft.World/DoorInteractGoal.cpp @@ -9,7 +9,7 @@ DoorInteractGoal::DoorInteractGoal(Mob *mob) { doorX = doorY = doorZ = 0; - doorTile = nullptr; + doorTile = NULL; passed = false; doorOpenDirX = doorOpenDirZ = 0.0f; @@ -21,7 +21,7 @@ bool DoorInteractGoal::canUse() if (!mob->horizontalCollision) return false; PathNavigation *pathNav = mob->getNavigation(); Path *path = pathNav->getPath(); - if (path == nullptr || path->isDone() || !pathNav->canOpenDoors()) return false; + if (path == NULL || path->isDone() || !pathNav->canOpenDoors()) return false; for (int i = 0; i < min(path->getIndex() + 2, path->getSize()); ++i) { @@ -31,7 +31,7 @@ bool DoorInteractGoal::canUse() doorZ = n->z; if (mob->distanceToSqr(doorX, mob->y, doorZ) > 1.5 * 1.5) continue; doorTile = getDoorTile(doorX, doorY, doorZ); - if (doorTile == nullptr) continue; + if (doorTile == NULL) continue; return true; } @@ -39,7 +39,7 @@ bool DoorInteractGoal::canUse() doorY = Mth::floor(mob->y + 1); doorZ = Mth::floor(mob->z); doorTile = getDoorTile(doorX, doorY, doorZ); - return doorTile != nullptr; + return doorTile != NULL; } bool DoorInteractGoal::canContinueToUse() @@ -50,14 +50,14 @@ bool DoorInteractGoal::canContinueToUse() void DoorInteractGoal::start() { passed = false; - doorOpenDirX = static_cast(doorX + 0.5f - mob->x); - doorOpenDirZ = static_cast(doorZ + 0.5f - mob->z); + doorOpenDirX = (float) (doorX + 0.5f - mob->x); + doorOpenDirZ = (float) (doorZ + 0.5f - mob->z); } void DoorInteractGoal::tick() { - float newDoorDirX = static_cast(doorX + 0.5f - mob->x); - float newDoorDirZ = static_cast(doorZ + 0.5f - mob->z); + float newDoorDirX = (float) (doorX + 0.5f - mob->x); + float newDoorDirZ = (float) (doorZ + 0.5f - mob->z); float dot = doorOpenDirX * newDoorDirX + doorOpenDirZ * newDoorDirZ; if (dot < 0) { @@ -68,6 +68,6 @@ void DoorInteractGoal::tick() DoorTile *DoorInteractGoal::getDoorTile(int x, int y, int z) { int tileId = mob->level->getTile(x, y, z); - if (tileId != Tile::door_wood_Id) return nullptr; - return static_cast(Tile::tiles[tileId]); + if (tileId != Tile::door_wood_Id) return NULL; + return (DoorTile *) Tile::tiles[tileId]; } \ No newline at end of file diff --git a/Minecraft.World/DoubleTag.h b/Minecraft.World/DoubleTag.h index 60e5808a..1f768d5b 100644 --- a/Minecraft.World/DoubleTag.h +++ b/Minecraft.World/DoubleTag.h @@ -29,7 +29,7 @@ public: { if (Tag::equals(obj)) { - DoubleTag *o = static_cast(obj); + DoubleTag *o = (DoubleTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/DragonFireball.cpp b/Minecraft.World/DragonFireball.cpp index 348bc53e..335b345f 100644 --- a/Minecraft.World/DragonFireball.cpp +++ b/Minecraft.World/DragonFireball.cpp @@ -54,7 +54,7 @@ void DragonFireball::onHit(HitResult *res) } delete entitiesOfClass; } - level->levelEvent(LevelEvent::ENDERDRAGON_FIREBALL_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); + level->levelEvent(LevelEvent::ENDERDRAGON_FIREBALL_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); remove(); } diff --git a/Minecraft.World/DropperTile.cpp b/Minecraft.World/DropperTile.cpp index 180aec2a..a28228c9 100644 --- a/Minecraft.World/DropperTile.cpp +++ b/Minecraft.World/DropperTile.cpp @@ -27,14 +27,14 @@ DispenseItemBehavior *DropperTile::getDispenseMethod(shared_ptr it shared_ptr DropperTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new DropperTileEntity() ); } void DropperTile::dispenseFrom(Level *level, int x, int y, int z) { BlockSourceImpl source(level, x, y, z); shared_ptr trap = dynamic_pointer_cast( source.getEntity() ); - if (trap == nullptr) return; + if (trap == NULL) return; int slot = trap->getRandomSlot(); if (slot < 0) @@ -48,11 +48,11 @@ void DropperTile::dispenseFrom(Level *level, int x, int y, int z) shared_ptr into = HopperTileEntity::getContainerAt(level, x + Facing::STEP_X[face], y + Facing::STEP_Y[face], z + Facing::STEP_Z[face]); shared_ptr remaining = nullptr; - if (into != nullptr) + if (into != NULL) { remaining = HopperTileEntity::addItem(into.get(), item->copy()->remove(1), Facing::OPPOSITE_FACING[face]); - if (remaining == nullptr) + if (remaining == NULL) { remaining = item->copy(); if (--remaining->count == 0) remaining = nullptr; @@ -66,7 +66,7 @@ void DropperTile::dispenseFrom(Level *level, int x, int y, int z) else { remaining = DISPENSE_BEHAVIOUR->dispense(&source, item); - if (remaining != nullptr && remaining->count == 0) remaining = nullptr; + if (remaining != NULL && remaining->count == 0) remaining = nullptr; } trap->setItem(slot, remaining); diff --git a/Minecraft.World/DropperTileEntity.cpp b/Minecraft.World/DropperTileEntity.cpp index ad2a0e83..51bf6abf 100644 --- a/Minecraft.World/DropperTileEntity.cpp +++ b/Minecraft.World/DropperTileEntity.cpp @@ -10,7 +10,7 @@ wstring DropperTileEntity::getName() // 4J Added shared_ptr DropperTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new DropperTileEntity() ); TileEntity::clone(result); result->name = name; diff --git a/Minecraft.World/DungeonFeature.cpp b/Minecraft.World/DungeonFeature.cpp index 8c9abbe5..6c7dc673 100644 --- a/Minecraft.World/DungeonFeature.cpp +++ b/Minecraft.World/DungeonFeature.cpp @@ -142,12 +142,12 @@ void DungeonFeature::addTunnel(int xOffs, int zOffs, byteArray blocks, double xC { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = (byte) Tile::lava_Id; } else { - blocks[p] = static_cast(0); - if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = static_cast(Tile::grass_Id); + blocks[p] = (byte) 0; + if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) Tile::grass_Id; } } } diff --git a/Minecraft.World/DurangoStats.cpp b/Minecraft.World/DurangoStats.cpp index 7302d9ed..6e50fd20 100644 --- a/Minecraft.World/DurangoStats.cpp +++ b/Minecraft.World/DurangoStats.cpp @@ -267,11 +267,11 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrGetType(); - if ( (mobEType == eTYPE_SPIDER) && (mob->rider.lock() != nullptr) && (mob->rider.lock()->GetType() == eTYPE_SKELETON) && mob->rider.lock()->isAlive() ) + if ( (mobEType == eTYPE_SPIDER) && (mob->rider.lock() != NULL) && (mob->rider.lock()->GetType() == eTYPE_SKELETON) && mob->rider.lock()->isAlive() ) { mob_networking_id = SPIDER_JOCKEY_ID; // Spider jockey only a concept for leaderboards. } - else if ( (mobEType == eTYPE_SKELETON) && (mob->riding != nullptr) && (mob->riding->GetType() == eTYPE_SPIDER) && mob->riding->isAlive() ) + else if ( (mobEType == eTYPE_SKELETON) && (mob->riding != NULL) && (mob->riding->GetType() == eTYPE_SPIDER) && mob->riding->isAlive() ) { mob_networking_id = SPIDER_JOCKEY_ID; // Spider jockey only a concept for leaderboards. } @@ -303,7 +303,7 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrgetItem()->id : 0), + (item != NULL ? item->getItem()->id : 0), mob->distanceTo(player->x, player->y, player->z), 0/*not needed*/ }; @@ -345,7 +345,7 @@ void DsMobInteract::handleParamBlob(shared_ptr player, byteArray pa byteArray DsMobInteract::createParamBlob(eInteract interactionId, int entityId) { byteArray output; - Param param = { interactionId, EntityIO::eTypeToIoid(static_cast(entityId)) }; + Param param = { interactionId, EntityIO::eTypeToIoid((eINSTANCEOF)entityId) }; output.data = (byte*) new Param(param); output.length = sizeof(Param); return output; @@ -423,7 +423,7 @@ void DsTravel::flush(shared_ptr player) { if (param_cache[iPad][i] > 0) { - write( player, static_cast(i), param_cache[iPad][i] ); + write( player, (eMethod) i, param_cache[iPad][i] ); param_cache[iPad][i] = 0; } } @@ -729,7 +729,7 @@ Stat *DurangoStats::get_stat(int i) default: assert(false); break; } - return nullptr; + return NULL; } Stat* DurangoStats::get_walkOneM() @@ -833,7 +833,7 @@ Stat* DurangoStats::get_itemsCrafted(int itemId) case Item::diamond_Id: case Item::redStone_Id: case Item::emerald_Id: - return nullptr; + return NULL; case Item::dye_powder_Id: default: @@ -890,7 +890,7 @@ Stat* DurangoStats::get_achievement(eAward achievementId) } // Other achievements awarded through more detailed generic events. - return nullptr; + return NULL; } byteArray DurangoStats::getParam_walkOneM(int distance) @@ -1093,25 +1093,25 @@ bool DurangoStats::enhancedAchievement(eAward achievementId) void DurangoStats::generatePlayerSession() { - DurangoStats *dsInstance = static_cast(GenericStats::getInstance()); + DurangoStats *dsInstance = (DurangoStats *) GenericStats::getInstance(); CoCreateGuid( &dsInstance->playerSessionId ); } LPCGUID DurangoStats::getPlayerSession() { - DurangoStats *dsInstance = static_cast(GenericStats::getInstance()); + DurangoStats *dsInstance = (DurangoStats *) GenericStats::getInstance(); LPCGUID lpcguid = &dsInstance->playerSessionId; return lpcguid; } void DurangoStats::setMultiplayerCorrelationId(Platform::String^ mcpId) { - static_cast(GenericStats::getInstance())->multiplayerCorrelationId = mcpId; + ((DurangoStats*)GenericStats::getInstance())->multiplayerCorrelationId = mcpId; } LPCWSTR DurangoStats::getMultiplayerCorrelationId() { - return static_cast(GenericStats::getInstance())->multiplayerCorrelationId->Data(); + return ((DurangoStats*)GenericStats::getInstance())->multiplayerCorrelationId->Data(); } LPCWSTR DurangoStats::getUserId(shared_ptr player) @@ -1130,7 +1130,7 @@ LPCWSTR DurangoStats::getUserId(int iPad) void DurangoStats::playerSessionStart(PlayerUID uid, shared_ptr plr) { - if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) + if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { //wprintf(uid.toString().c_str()); @@ -1164,7 +1164,7 @@ void DurangoStats::playerSessionStart(int iPad) void DurangoStats::playerSessionPause(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) + if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { PlayerUID puid; ProfileManager.GetXUID(iPad, &puid, true); @@ -1187,7 +1187,7 @@ void DurangoStats::playerSessionPause(int iPad) void DurangoStats::playerSessionResume(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) + if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) { PlayerUID puid; ProfileManager.GetXUID(iPad, &puid, true); @@ -1214,7 +1214,7 @@ void DurangoStats::playerSessionResume(int iPad) void DurangoStats::playerSessionEnd(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != nullptr) + if (plr != NULL) { DurangoStats::getInstance()->travel->flush(plr); } diff --git a/Minecraft.World/DurangoStats.h b/Minecraft.World/DurangoStats.h index b2f24643..1b2f7723 100644 --- a/Minecraft.World/DurangoStats.h +++ b/Minecraft.World/DurangoStats.h @@ -165,7 +165,7 @@ public: class DurangoStats : public GenericStats { public: - static DurangoStats *getInstance() { return static_cast(GenericStats::getInstance()); } + static DurangoStats *getInstance() { return (DurangoStats*) GenericStats::getInstance(); } protected: enum { diff --git a/Minecraft.World/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index 3392da98..b4ab86fa 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -18,7 +18,7 @@ DyePowderItem::DyePowderItem(int id) : Item( id ) { setStackedByData(true); setMaxDamage(0); - icons = nullptr; + icons = NULL; } const unsigned int DyePowderItem::COLOR_DESCS[] = @@ -177,7 +177,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - if (level->random->nextFloat() < 0.45) static_cast(Tile::sapling)->advanceTree(level, x, y, z, level->random); + if (level->random->nextFloat() < 0.45) ((Sapling *) Tile::sapling)->advanceTree(level, x, y, z, level->random); itemInstance->count--; } } @@ -189,7 +189,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - if (level->random->nextFloat() < 0.4) static_cast(Tile::tiles[tile])->growTree(level, x, y, z, level->random); + if (level->random->nextFloat() < 0.4) ((Mushroom *) Tile::tiles[tile])->growTree(level, x, y, z, level->random); itemInstance->count--; } } @@ -202,7 +202,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - static_cast(Tile::tiles[tile])->growCrops(level, x, y, z); + ((StemTile *) Tile::tiles[tile])->growCrops(level, x, y, z); itemInstance->count--; } } @@ -215,7 +215,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - static_cast(Tile::tiles[tile])->growCrops(level, x, y, z); + ((CropTile *) Tile::tiles[tile])->growCrops(level, x, y, z); itemInstance->count--; } } @@ -228,7 +228,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - static_cast(Tile::tiles[tile])->growCrops(level, x, y, z); + ((CropTile *) Tile::tiles[tile])->growCrops(level, x, y, z); itemInstance->count--; } } @@ -306,9 +306,9 @@ void DyePowderItem::addGrowthParticles(Level *level, int x, int y, int z, int co { int id = level->getTile(x, y, z); if (count == 0) count = 15; - Tile *tile = id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; + Tile *tile = id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : NULL; - if (tile == nullptr) return; + if (tile == NULL) return; tile->updateShape(level, x, y, z); for (int i = 0; i < count; i++) @@ -322,7 +322,7 @@ void DyePowderItem::addGrowthParticles(Level *level, int x, int y, int z, int co bool DyePowderItem::interactEnemy(shared_ptr itemInstance, shared_ptr player, shared_ptr mob) { - if (dynamic_pointer_cast( mob ) != nullptr) + if (dynamic_pointer_cast( mob ) != NULL) { shared_ptr sheep = dynamic_pointer_cast(mob); // convert to tile-based color value (0 is white instead of black) diff --git a/Minecraft.World/EggItem.cpp b/Minecraft.World/EggItem.cpp index 3f3d123e..0655a2fa 100644 --- a/Minecraft.World/EggItem.cpp +++ b/Minecraft.World/EggItem.cpp @@ -26,6 +26,6 @@ shared_ptr EggItem::use(shared_ptr instance, Level * instance->count--; } level->playEntitySound( player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity(std::make_shared(level, player)); + if (!level->isClientSide) level->addEntity( shared_ptr(new ThrownEgg(level, player)) ); return instance; } diff --git a/Minecraft.World/EggTile.cpp b/Minecraft.World/EggTile.cpp index 7052fac9..3a11c0d1 100644 --- a/Minecraft.World/EggTile.cpp +++ b/Minecraft.World/EggTile.cpp @@ -40,7 +40,7 @@ void EggTile::checkSlide(Level *level, int x, int y, int z) } else { - shared_ptr e = std::make_shared(level, x + 0.5f, y + 0.5f, z + 0.5f, id); + shared_ptr e = shared_ptr(new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id)); level->addEntity(e); } } diff --git a/Minecraft.World/EmptyMapItem.cpp b/Minecraft.World/EmptyMapItem.cpp index 9c46938a..42adc304 100644 --- a/Minecraft.World/EmptyMapItem.cpp +++ b/Minecraft.World/EmptyMapItem.cpp @@ -23,7 +23,7 @@ shared_ptr EmptyMapItem::use(shared_ptr itemInstance //data.setDirty(); - shared_ptr map = std::make_shared(Item::map, 1, -1); + shared_ptr map = shared_ptr( new ItemInstance(Item::map, 1, -1) ); Item::map->onCraftedBy(map, level, player); itemInstance->count--; diff --git a/Minecraft.World/EnchantItemCommand.cpp b/Minecraft.World/EnchantItemCommand.cpp index c8411709..7ec57563 100644 --- a/Minecraft.World/EnchantItemCommand.cpp +++ b/Minecraft.World/EnchantItemCommand.cpp @@ -28,15 +28,15 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com shared_ptr player = getPlayer(uid); - if(player == nullptr) return; + if(player == NULL) return; shared_ptr selectedItem = player->getSelectedItem(); - if(selectedItem == nullptr) return; + if(selectedItem == NULL) return; Enchantment *e = Enchantment::enchantments[enchantmentId]; - if(e == nullptr) return; + if(e == NULL) return; if(!e->canEnchant(selectedItem)) return; if(enchantmentLevel < e->getMinLevel()) enchantmentLevel = e->getMinLevel(); @@ -45,13 +45,13 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com if (selectedItem->hasTag()) { ListTag *enchantmentTags = selectedItem->getEnchantmentTags(); - if (enchantmentTags != nullptr) + if (enchantmentTags != NULL) { for (int i = 0; i < enchantmentTags->size(); i++) { int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); - if (Enchantment::enchantments[type] != nullptr) + if (Enchantment::enchantments[type] != NULL) { Enchantment *other = Enchantment::enchantments[type]; if (!other->isCompatibleWith(e)) @@ -72,7 +72,7 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com shared_ptr EnchantItemCommand::preparePacket(shared_ptr player, int enchantmentId, int enchantmentLevel) { - if(player == nullptr) return nullptr; + if(player == NULL) return nullptr; ByteArrayOutputStream baos; DataOutputStream dos(&baos); @@ -81,5 +81,5 @@ shared_ptr EnchantItemCommand::preparePacket(shared_ptr(eGameCommand_EnchantItem, baos.toByteArray()); + return shared_ptr( new GameCommandPacket(eGameCommand_EnchantItem, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.World/EnchantedBookItem.cpp b/Minecraft.World/EnchantedBookItem.cpp index 70b15be4..88776c18 100644 --- a/Minecraft.World/EnchantedBookItem.cpp +++ b/Minecraft.World/EnchantedBookItem.cpp @@ -35,12 +35,12 @@ const Rarity *EnchantedBookItem::getRarity(shared_ptr itemInstance ListTag *EnchantedBookItem::getEnchantments(shared_ptr item) { - if (item->tag == nullptr || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())) + if (item->tag == NULL || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())) { return new ListTag(); } - return static_cast *>(item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())); + return (ListTag *) item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()); } void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced) @@ -49,7 +49,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, s ListTag *list = getEnchantments(itemInstance); - if (list != nullptr) + if (list != NULL) { wstring unformatted = L""; for (int i = 0; i < list->size(); i++) @@ -57,7 +57,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, s int type = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != nullptr) + if (Enchantment::enchantments[type] != NULL) { lines->push_back(Enchantment::enchantments[type]->getFullname(level)); } @@ -78,7 +78,7 @@ void EnchantedBookItem::addEnchantment(shared_ptr item, Enchantmen { if (tag->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL) < enchantment->level) { - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast(enchantment->level)); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short) enchantment->level); } add = false; @@ -90,8 +90,8 @@ void EnchantedBookItem::addEnchantment(shared_ptr item, Enchantmen { CompoundTag *tag = new CompoundTag(); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, static_cast(enchantment->enchantment->id)); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast(enchantment->level)); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, (short) enchantment->enchantment->id); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short) enchantment->level); enchantments->add(tag); } @@ -102,7 +102,7 @@ void EnchantedBookItem::addEnchantment(shared_ptr item, Enchantmen shared_ptr EnchantedBookItem::createForEnchantment(EnchantmentInstance *enchant) { - shared_ptr item = std::make_shared(this); + shared_ptr item = shared_ptr(new ItemInstance(this)); addEnchantment(item, enchant); return item; } @@ -118,7 +118,7 @@ void EnchantedBookItem::createForEnchantment(Enchantment *enchant, vector EnchantedBookItem::createForRandomLoot(Random *random) { Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())]; - shared_ptr book = std::make_shared(id, 1, 0); + shared_ptr book = shared_ptr(new ItemInstance(id, 1, 0)); int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel()); addEnchantment(book, new EnchantmentInstance(enchantment, level)); @@ -134,7 +134,7 @@ WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random) WeighedTreasure *EnchantedBookItem::createForRandomTreasure(Random *random, int minCount, int maxCount, int weight) { Enchantment *enchantment = Enchantment::validEnchantments[random->nextInt(Enchantment::validEnchantments.size())]; - shared_ptr book = std::make_shared(id, 1, 0); + shared_ptr book = shared_ptr(new ItemInstance(id, 1, 0)); int level = Mth::nextInt(random, enchantment->getMinLevel(), enchantment->getMaxLevel()); addEnchantment(book, new EnchantmentInstance(enchantment, level)); diff --git a/Minecraft.World/Enchantment.cpp b/Minecraft.World/Enchantment.cpp index c2f981a6..ae638b27 100644 --- a/Minecraft.World/Enchantment.cpp +++ b/Minecraft.World/Enchantment.cpp @@ -7,34 +7,34 @@ EnchantmentArray Enchantment::enchantments = EnchantmentArray( 256 ); vector Enchantment::validEnchantments; -Enchantment *Enchantment::allDamageProtection = nullptr; -Enchantment *Enchantment::fireProtection = nullptr; -Enchantment *Enchantment::fallProtection = nullptr; -Enchantment *Enchantment::explosionProtection = nullptr; -Enchantment *Enchantment::projectileProtection = nullptr; -Enchantment *Enchantment::drownProtection = nullptr; -Enchantment *Enchantment::waterWorker = nullptr; -Enchantment *Enchantment::thorns = nullptr; +Enchantment *Enchantment::allDamageProtection = NULL; +Enchantment *Enchantment::fireProtection = NULL; +Enchantment *Enchantment::fallProtection = NULL; +Enchantment *Enchantment::explosionProtection = NULL; +Enchantment *Enchantment::projectileProtection = NULL; +Enchantment *Enchantment::drownProtection = NULL; +Enchantment *Enchantment::waterWorker = NULL; +Enchantment *Enchantment::thorns = NULL; // weapon -Enchantment *Enchantment::damageBonus = nullptr; -Enchantment *Enchantment::damageBonusUndead = nullptr; -Enchantment *Enchantment::damageBonusArthropods = nullptr; -Enchantment *Enchantment::knockback = nullptr; -Enchantment *Enchantment::fireAspect = nullptr; -Enchantment *Enchantment::lootBonus = nullptr; +Enchantment *Enchantment::damageBonus = NULL; +Enchantment *Enchantment::damageBonusUndead = NULL; +Enchantment *Enchantment::damageBonusArthropods = NULL; +Enchantment *Enchantment::knockback = NULL; +Enchantment *Enchantment::fireAspect = NULL; +Enchantment *Enchantment::lootBonus = NULL; // digger -Enchantment *Enchantment::diggingBonus = nullptr; -Enchantment *Enchantment::untouching = nullptr; -Enchantment *Enchantment::digDurability = nullptr; -Enchantment *Enchantment::resourceBonus = nullptr; +Enchantment *Enchantment::diggingBonus = NULL; +Enchantment *Enchantment::untouching = NULL; +Enchantment *Enchantment::digDurability = NULL; +Enchantment *Enchantment::resourceBonus = NULL; // bows -Enchantment *Enchantment::arrowBonus = nullptr; -Enchantment *Enchantment::arrowKnockback = nullptr; -Enchantment *Enchantment::arrowFire = nullptr; -Enchantment *Enchantment::arrowInfinite = nullptr; +Enchantment *Enchantment::arrowBonus = NULL; +Enchantment *Enchantment::arrowKnockback = NULL; +Enchantment *Enchantment::arrowFire = NULL; +Enchantment *Enchantment::arrowInfinite = NULL; void Enchantment::staticCtor() { @@ -70,7 +70,7 @@ void Enchantment::staticCtor() for(unsigned int i = 0; i < 256; ++i) { Enchantment *enchantment = enchantments[i]; - if (enchantment != nullptr) + if (enchantment != NULL) { validEnchantments.push_back(enchantment); } @@ -79,7 +79,7 @@ void Enchantment::staticCtor() void Enchantment::_init(int id) { - if (enchantments[id] != nullptr) + if (enchantments[id] != NULL) { app.DebugPrintf("Duplicate enchantment id!"); #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.World/EnchantmentCategory.cpp b/Minecraft.World/EnchantmentCategory.cpp index b1c951ee..7fb44481 100644 --- a/Minecraft.World/EnchantmentCategory.cpp +++ b/Minecraft.World/EnchantmentCategory.cpp @@ -16,25 +16,25 @@ bool EnchantmentCategory::canEnchant(Item *item) const { if (this == all) return true; - if (dynamic_cast( item ) != nullptr) + if (dynamic_cast( item ) != NULL) { if (this == armor) return true; - ArmorItem *ai = static_cast(item); + ArmorItem *ai = (ArmorItem *) item; if (ai->slot == ArmorItem::SLOT_HEAD) return this == armor_head; if (ai->slot == ArmorItem::SLOT_LEGS) return this == armor_legs; if (ai->slot == ArmorItem::SLOT_TORSO) return this == armor_torso; if (ai->slot == ArmorItem::SLOT_FEET) return this == armor_feet; return false; } - else if (dynamic_cast(item) != nullptr) + else if (dynamic_cast(item) != NULL) { return this == weapon; } - else if (dynamic_cast(item) != nullptr) + else if (dynamic_cast(item) != NULL) { return this == digger; } - else if (dynamic_cast(item) != nullptr) + else if (dynamic_cast(item) != NULL) { return this == bow; } diff --git a/Minecraft.World/EnchantmentHelper.cpp b/Minecraft.World/EnchantmentHelper.cpp index 995670c8..7abc9856 100644 --- a/Minecraft.World/EnchantmentHelper.cpp +++ b/Minecraft.World/EnchantmentHelper.cpp @@ -11,12 +11,12 @@ Random EnchantmentHelper::random; int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, shared_ptr piece) { - if (piece == nullptr) + if (piece == NULL) { return 0; } ListTag *enchantmentTags = piece->getEnchantmentTags(); - if (enchantmentTags == nullptr) + if (enchantmentTags == NULL) { return 0; } @@ -38,7 +38,7 @@ unordered_map *EnchantmentHelper::getEnchantments(shared_ptr *result = new unordered_map(); ListTag *list = item->id == Item::enchantedBook_Id ? Item::enchantedBook->getEnchantments(item) : item->getEnchantmentTags(); - if (list != nullptr) + if (list != NULL) { for (int i = 0; i < list->size(); i++) { @@ -62,8 +62,8 @@ void EnchantmentHelper::setEnchantments(unordered_map *enchantments, s int id = it.first; CompoundTag *tag = new CompoundTag(); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, static_cast(id)); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast((int)it.second)); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, (short) id); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short)(int)it.second); list->add(tag); @@ -88,7 +88,7 @@ void EnchantmentHelper::setEnchantments(unordered_map *enchantments, s int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, ItemInstanceArray inventory) { - if (inventory.data == nullptr) return 0; + if (inventory.data == NULL) return 0; int bestLevel = 0; //for (ItemInstance piece : inventory) for(unsigned int i = 0; i < inventory.length; ++i) @@ -104,12 +104,12 @@ int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, ItemInstanceArray void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, shared_ptr piece) { - if (piece == nullptr) + if (piece == NULL) { return; } ListTag *enchantmentTags = piece->getEnchantmentTags(); - if (enchantmentTags == nullptr) + if (enchantmentTags == NULL) { return; } @@ -118,7 +118,7 @@ void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, s int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != nullptr) + if (Enchantment::enchantments[type] != NULL) { method.doEnchantment(Enchantment::enchantments[type], level); } @@ -245,7 +245,7 @@ shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *encha for(unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != nullptr && getEnchantmentLevel(enchantment->id, item) > 0) + if (item != NULL && getEnchantmentLevel(enchantment->id, item) > 0) { return item; } @@ -338,7 +338,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand if (itemBonus <= 0) { - return nullptr; + return NULL; } // 4J Stu - Update function to 1.3 version for TU7 itemBonus /= 2; @@ -348,13 +348,13 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand // the final enchantment cost will have another random span of +- 15% float deviation = (random->nextFloat() + random->nextFloat() - 1.0f) * .15f; - int realValue = static_cast((float)enchantmentValue * (1.0f + deviation) + .5f); + int realValue = (int) ((float) enchantmentValue * (1.0f + deviation) + .5f); if (realValue < 1) { realValue = 1; } - vector *results = nullptr; + vector *results = NULL; unordered_map *availableEnchantments = getAvailableEnchantmentResults(realValue, itemInstance); if (availableEnchantments && !availableEnchantments->empty()) @@ -364,7 +364,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand { values.push_back(it.second); } - EnchantmentInstance *instance = static_cast(WeighedRandom::getRandomItem(random, &values)); + EnchantmentInstance *instance = (EnchantmentInstance *) WeighedRandom::getRandomItem(random, &values); values.clear(); if (instance) @@ -409,7 +409,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand { values.push_back(it.second); } - EnchantmentInstance *nextInstance = static_cast(WeighedRandom::getRandomItem(random, &values)); + EnchantmentInstance *nextInstance = (EnchantmentInstance *) WeighedRandom::getRandomItem(random, &values); values.clear(); results->push_back( nextInstance->copy() ); // 4J Stu - Inserting a copy so we can clear memory from the availableEnchantments collection } @@ -433,7 +433,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, shared_ptr itemInstance) { Item *item = itemInstance->getItem(); - unordered_map *results = nullptr; + unordered_map *results = NULL; bool isBook = itemInstance->id == Item::book_Id; @@ -441,7 +441,7 @@ unordered_map *EnchantmentHelper::getAvailableEnchan for(unsigned int i = 0; i < Enchantment::enchantments.length; ++i) { Enchantment *e = Enchantment::enchantments[i]; - if (e == nullptr) + if (e == NULL) { continue; } @@ -456,7 +456,7 @@ unordered_map *EnchantmentHelper::getAvailableEnchan { if (value >= e->getMinCost(level) && value <= e->getMaxCost(level)) { - if (results == nullptr) + if (results == NULL) { results = new unordered_map(); } diff --git a/Minecraft.World/EnchantmentInstance.cpp b/Minecraft.World/EnchantmentInstance.cpp index 89a8bdd2..973cd220 100644 --- a/Minecraft.World/EnchantmentInstance.cpp +++ b/Minecraft.World/EnchantmentInstance.cpp @@ -13,5 +13,5 @@ EnchantmentInstance::EnchantmentInstance(int id, int level) : WeighedRandomItem( // 4J Added EnchantmentInstance *EnchantmentInstance::copy() { - return new EnchantmentInstance((Enchantment *)enchantment, static_cast(level)); + return new EnchantmentInstance((Enchantment *)enchantment, (int)level); } \ No newline at end of file diff --git a/Minecraft.World/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index f37f336e..fa769bf9 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -9,7 +9,7 @@ EnchantmentMenu::EnchantmentMenu(shared_ptr inventory, Level *level, int xt, int yt, int zt) { - enchantSlots = std::make_shared(this); + enchantSlots = shared_ptr( new EnchantmentContainer(this) ); for(int i = 0; i < 3; ++i) { @@ -53,7 +53,7 @@ void EnchantmentMenu::broadcastChanges() // 4J Added m_costsChanged to stop continually sending update packets even when no changes have been made if(m_costsChanged) { - for (size_t i = 0; i < containerListeners.size(); i++) + for (int i = 0; i < containerListeners.size(); i++) { ContainerListener *listener = containerListeners.at(i); listener->setContainerData(this, 0, costs[0]); @@ -81,7 +81,7 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr { shared_ptr item = enchantSlots->getItem(0); - if (item == nullptr || !item->isEnchantable()) + if (item == NULL || !item->isEnchantable()) { for (int i = 0; i < 3; i++) { @@ -153,14 +153,14 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) { shared_ptr item = enchantSlots->getItem(0); - if (costs[i] > 0 && item != nullptr && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) + if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) { if (!level->isClientSide) { bool isBook = item->id == Item::book_Id; vector *newEnchantment = EnchantmentHelper::selectEnchantment(&random, item, costs[i]); - if (newEnchantment != nullptr) + if (newEnchantment != NULL) { player->giveExperienceLevels(-costs[i]); if (isBook) item->id = Item::enchantedBook_Id; @@ -200,7 +200,7 @@ void EnchantmentMenu::removed(shared_ptr player) if (level->isClientSide) return; shared_ptr item = enchantSlots->removeItemNoUpdate(0); - if (item != nullptr) + if (item != NULL) { player->drop(item); } @@ -219,7 +219,7 @@ shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr play Slot *slot = slots.at(slotIndex); Slot *IngredientSlot = slots.at(INGREDIENT_SLOT); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/EnchantmentTableEntity.cpp b/Minecraft.World/EnchantmentTableEntity.cpp index dd9b6ad2..15131aa2 100644 --- a/Minecraft.World/EnchantmentTableEntity.cpp +++ b/Minecraft.World/EnchantmentTableEntity.cpp @@ -46,12 +46,12 @@ void EnchantmentTableEntity::tick() oRot = rot; shared_ptr player = level->getNearestPlayer(x + 0.5f, y + 0.5f, z + 0.5f, 3); - if (player != nullptr) + if (player != NULL) { double xd = player->x - (x + 0.5f); double zd = player->z - (z + 0.5f); - tRot = static_cast(atan2(zd, xd)); + tRot = (float) atan2(zd, xd); open += 0.1f; @@ -124,7 +124,7 @@ void EnchantmentTableEntity::setCustomName(const wstring &name) shared_ptr EnchantmentTableEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new EnchantmentTableEntity() ); TileEntity::clone(result); result->time = time; diff --git a/Minecraft.World/EnchantmentTableTile.cpp b/Minecraft.World/EnchantmentTableTile.cpp index a5c51849..d50fe5f5 100644 --- a/Minecraft.World/EnchantmentTableTile.cpp +++ b/Minecraft.World/EnchantmentTableTile.cpp @@ -14,8 +14,8 @@ EnchantmentTableTile::EnchantmentTableTile(int id) : BaseEntityTile(id, Material updateDefaultShape(); setLightBlock(0); - iconTop = nullptr; - iconBottom = nullptr; + iconTop = NULL; + iconBottom = NULL; } // 4J Added override @@ -69,7 +69,7 @@ Icon *EnchantmentTableTile::getTexture(int face, int data) shared_ptr EnchantmentTableTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr(new EnchantmentTableEntity()); } bool EnchantmentTableTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param diff --git a/Minecraft.World/EnderChestTile.cpp b/Minecraft.World/EnderChestTile.cpp index f1b4738f..ef3c2046 100644 --- a/Minecraft.World/EnderChestTile.cpp +++ b/Minecraft.World/EnderChestTile.cpp @@ -65,7 +65,7 @@ bool EnderChestTile::use(Level *level, int x, int y, int z, shared_ptr p { shared_ptr container = player->getEnderChestInventory(); shared_ptr enderChest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (container == nullptr || enderChest == nullptr) return true; + if (container == NULL || enderChest == NULL) return true; if (level->isSolidBlockingTile(x, y + 1, z)) return true; @@ -82,7 +82,7 @@ bool EnderChestTile::use(Level *level, int x, int y, int z, shared_ptr p shared_ptr EnderChestTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr(new EnderChestTileEntity()); } void EnderChestTile::animateTick(Level *level, int xt, int yt, int zt, Random *random) diff --git a/Minecraft.World/EnderChestTileEntity.cpp b/Minecraft.World/EnderChestTileEntity.cpp index 1ad682ae..8169c029 100644 --- a/Minecraft.World/EnderChestTileEntity.cpp +++ b/Minecraft.World/EnderChestTileEntity.cpp @@ -94,7 +94,7 @@ bool EnderChestTileEntity::stillValid(shared_ptr player) // 4J Added shared_ptr EnderChestTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new EnderChestTileEntity() ); TileEntity::clone(result); return result; diff --git a/Minecraft.World/EnderCrystal.cpp b/Minecraft.World/EnderCrystal.cpp index 40a82c3b..5e7a9edb 100644 --- a/Minecraft.World/EnderCrystal.cpp +++ b/Minecraft.World/EnderCrystal.cpp @@ -93,7 +93,7 @@ bool EnderCrystal::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; // 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() != NULL && source->getEntity()->instanceof(eTYPE_ENDERDRAGON) ) { return false; } diff --git a/Minecraft.World/EnderDragon.cpp b/Minecraft.World/EnderDragon.cpp index f8e4871f..e1dea172 100644 --- a/Minecraft.World/EnderDragon.cpp +++ b/Minecraft.World/EnderDragon.cpp @@ -78,7 +78,7 @@ void EnderDragon::_init() m_nodes = new NodeArray(24); openSet = new BinaryHeap(); - m_currentPath = nullptr; + m_currentPath = NULL; } EnderDragon::EnderDragon(Level *level) : Mob(level) @@ -100,14 +100,14 @@ EnderDragon::EnderDragon(Level *level) : Mob(level) // 4J - split off from ctor so we can use shared_from_this() void EnderDragon::AddParts() { - head = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"head", 6, 6); - neck = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"neck", 6, 6); // 4J Added - body = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"body", 8, 8); - tail1 = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4); - tail2 = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4); - tail3 = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4); - wing1 = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"wing", 4, 4); - wing2 = std::make_shared(dynamic_pointer_cast(shared_from_this()), L"wing", 4, 4); + head = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"head", 6, 6) ); + neck = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"neck", 6, 6) ); // 4J Added + body = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"body", 8, 8) ); + tail1 = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4) ); + tail2 = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4) ); + tail3 = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"tail", 4, 4) ); + wing1 = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"wing", 4, 4) ); + wing2 = shared_ptr( new MultiEntityMobPart(dynamic_pointer_cast(shared_from_this()), L"wing", 4, 4) ); subEntities.push_back(head); subEntities.push_back(neck); // 4J Added @@ -121,16 +121,16 @@ void EnderDragon::AddParts() EnderDragon::~EnderDragon() { - if(m_nodes->data != nullptr) + if(m_nodes->data != NULL) { for(unsigned int i = 0; i < m_nodes->length; ++i) { - if(m_nodes->data[i]!=nullptr) delete m_nodes->data[i]; + if(m_nodes->data[i]!=NULL) delete m_nodes->data[i]; } delete [] m_nodes->data; } delete openSet; - if( m_currentPath != nullptr ) delete m_currentPath; + if( m_currentPath != NULL ) delete m_currentPath; } void EnderDragon::registerAttributes() @@ -220,7 +220,7 @@ void EnderDragon::aiStep() checkCrystals(); float flapSpeed = 0.2f / (sqrt(xd * xd + zd * zd) * 10.0f + 1); - flapSpeed *= static_cast(pow(2.0, yd)); + flapSpeed *= (float) pow(2.0, yd); if ( getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || getSynchedAction() == e_EnderdragonAction_Sitting_Scanning || getSynchedAction() == e_EnderdragonAction_Sitting_Attacking) @@ -383,7 +383,7 @@ void EnderDragon::aiStep() attackTarget = level->getNearestPlayer( shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE ); ++m_actionTicks; - if( attackTarget != nullptr ) + if( attackTarget != NULL ) { if(m_actionTicks > SITTING_SCANNING_IDLE_TICKS/4) { @@ -464,11 +464,11 @@ void EnderDragon::aiStep() } else if( getSynchedAction() == e_EnderdragonAction_Sitting_Scanning ) { - if( attackTarget != nullptr) + if( attackTarget != NULL) { Vec3 *aim = Vec3::newTemp((attackTarget->x - x), 0, (attackTarget->z - z))->normalize(); Vec3 *dir = Vec3::newTemp(sin(yRot * PI / 180), 0, -cos(yRot * PI / 180))->normalize(); - float dot = static_cast(dir->dot(aim)); + float dot = (float)dir->dot(aim); float angleDegs = acos(dot)*180/PI; angleDegs = angleDegs + 0.5f; @@ -519,7 +519,7 @@ void EnderDragon::aiStep() // double xTargetO = xTarget; // double yTargetO = yTarget; // double zTargetO = zTarget; - if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != nullptr && m_currentPath != nullptr && m_currentPath->isDone()) + if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && m_currentPath != NULL && m_currentPath->isDone()) { xTarget = attackTarget->x; zTarget = attackTarget->z; @@ -561,7 +561,7 @@ void EnderDragon::aiStep() Vec3 *aim = Vec3::newTemp((xTarget - x), (yTarget - y), (zTarget - z))->normalize(); Vec3 *dir = Vec3::newTemp(sin(yRot * PI / 180), yd, -cos(yRot * PI / 180))->normalize(); - float dot = static_cast(dir->dot(aim) + 0.5f) / 1.5f; + float dot = (float) (dir->dot(aim) + 0.5f) / 1.5f; if (dot < 0) dot = 0; yRotA *= 0.80f; @@ -579,7 +579,7 @@ void EnderDragon::aiStep() } yRot += yRotA * 0.1f; - float span = static_cast(2.0f / (distToTarget + 1)); + float span = (float) (2.0f / (distToTarget + 1)); float speed = 0.06f; moveRelative(0, -1, speed * (dot * span + (1 - span))); if (inWall) @@ -593,7 +593,7 @@ void EnderDragon::aiStep() } Vec3 *actual = Vec3::newTemp(xd, yd, zd)->normalize(); - float slide = static_cast(actual->dot(dir) + 1) / 2.0f; + float slide = (float) (actual->dot(dir) + 1) / 2.0f; slide = 0.8f + 0.15f * slide; @@ -715,14 +715,14 @@ void EnderDragon::aiStep() if (!level->isClientSide) { double maxDist = 64.0f; - if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != nullptr && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) { if (this->canSee(attackTarget)) { m_fireballCharge++; Vec3 *aim = Vec3::newTemp((attackTarget->x - x), 0, (attackTarget->z - z))->normalize(); Vec3 *dir = Vec3::newTemp(sin(yRot * PI / 180), 0, -cos(yRot * PI / 180))->normalize(); - float dot = static_cast(dir->dot(aim)); + float dot = (float)dir->dot(aim); float angleDegs = acos(dot)*180/PI; angleDegs = angleDegs + 0.5f; @@ -738,8 +738,8 @@ void EnderDragon::aiStep() double ydd = (attackTarget->bb->y0 + attackTarget->bbHeight / 2) - (startingY + head->bbHeight / 2); double zdd = attackTarget->z - startingZ; - level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, static_cast(x), static_cast(y), static_cast(z), 0); - shared_ptr ie = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), xdd, ydd, zdd); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0); + shared_ptr ie = shared_ptr( new DragonFireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); ie->x = startingX; ie->y = startingY; ie->z = startingZ; @@ -747,7 +747,7 @@ void EnderDragon::aiStep() m_fireballCharge = 0; app.DebugPrintf("Finding new target due to having fired a fireball\n"); - if( m_currentPath != nullptr ) + if( m_currentPath != NULL ) { while(!m_currentPath->isDone()) { @@ -778,13 +778,13 @@ void EnderDragon::aiStep() void EnderDragon::checkCrystals() { - if (nearestCrystal != nullptr) + if (nearestCrystal != NULL) { if (nearestCrystal->removed) { if (!level->isClientSide) { - hurt(head, DamageSource::explosion(nullptr), 10); + hurt(head, DamageSource::explosion(NULL), 10); } nearestCrystal = nullptr; @@ -888,13 +888,13 @@ void EnderDragon::findNewTarget() case e_EnderdragonAction_Takeoff: case e_EnderdragonAction_HoldingPattern: { - if(!newTarget && m_currentPath != nullptr && m_currentPath->isDone()) + if(!newTarget && m_currentPath != NULL && m_currentPath->isDone()) { // Distance is 64, which is the radius of the circle int eggHeight = max(level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS)); //level->getHeightmap(4,4); playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 64.0); double dist = 64.0f; - if(playerNearestToEgg != nullptr) + if(playerNearestToEgg != NULL) { dist = playerNearestToEgg->distanceToSqr(PODIUM_X_POS, eggHeight, PODIUM_Z_POS); dist /= (8*8*8); @@ -909,7 +909,7 @@ void EnderDragon::findNewTarget() #endif } // More likely to strafe a player if they are close to the egg, or there are not many crystals remaining - else if( playerNearestToEgg != nullptr && (random->nextInt( abs(dist) + 2 ) == 0 || random->nextInt( m_remainingCrystalsCount + 2 ) == 0) ) + else if( playerNearestToEgg != NULL && (random->nextInt( abs(dist) + 2 ) == 0 || random->nextInt( m_remainingCrystalsCount + 2 ) == 0) ) { setSynchedAction(e_EnderdragonAction_StrafePlayer); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -921,7 +921,7 @@ void EnderDragon::findNewTarget() break; case e_EnderdragonAction_StrafePlayer: // Always return to the holding pattern after strafing - if(m_currentPath == nullptr || (m_currentPath->isDone() && newTarget) ) + if(m_currentPath == NULL || (m_currentPath->isDone() && newTarget) ) { setSynchedAction(e_EnderdragonAction_HoldingPattern); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -949,7 +949,7 @@ void EnderDragon::findNewTarget() newTarget = false; //if (random->nextInt(2) == 0 && level->players.size() > 0) - if(getSynchedAction() == e_EnderdragonAction_StrafePlayer && playerNearestToEgg != nullptr) + if(getSynchedAction() == e_EnderdragonAction_StrafePlayer && playerNearestToEgg != NULL) { attackTarget = playerNearestToEgg; strafeAttackTarget(); @@ -957,7 +957,7 @@ void EnderDragon::findNewTarget() else if(getSynchedAction() == e_EnderdragonAction_LandingApproach) { // Generate a new path if we don't currently have one - if( m_currentPath == nullptr || m_currentPath->isDone() ) + if( m_currentPath == NULL || m_currentPath->isDone() ) { int currentNodeIndex = findClosestNode(); @@ -966,7 +966,7 @@ void EnderDragon::findNewTarget() playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 128.0); int targetNodeIndex = 0 ; - if(playerNearestToEgg != nullptr) + if(playerNearestToEgg != NULL) { Vec3 *aim = Vec3::newTemp(playerNearestToEgg->x, 0, playerNearestToEgg->z)->normalize(); //app.DebugPrintf("Final marker node near (%f,%d,%f)\n", -aim->x*40,105,-aim->z*40 ); @@ -978,18 +978,18 @@ void EnderDragon::findNewTarget() } Node finalNode(PODIUM_X_POS, eggHeight, PODIUM_Z_POS); - if(m_currentPath != nullptr) delete m_currentPath; + if(m_currentPath != NULL) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex, &finalNode); // Always skip the first node (as that's where we are already) - if(m_currentPath != nullptr) m_currentPath->next(); + if(m_currentPath != NULL) m_currentPath->next(); } m_actionTicks = 0; navigateToNextPathNode(); - if(m_currentPath != nullptr && m_currentPath->isDone()) + if(m_currentPath != NULL && m_currentPath->isDone()) { setSynchedAction(e_EnderdragonAction_Landing); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -1007,7 +1007,7 @@ void EnderDragon::findNewTarget() { // Default is e_EnderdragonAction_HoldingPattern // Generate a new path if we don't currently have one - if(m_currentPath == nullptr || m_currentPath->isDone() ) + if(m_currentPath == NULL || m_currentPath->isDone() ) { int currentNodeIndex = findClosestNode(); int targetNodeIndex = currentNodeIndex; @@ -1044,11 +1044,11 @@ void EnderDragon::findNewTarget() if(targetNodeIndex < 0) targetNodeIndex += 12; } - if(m_currentPath != nullptr) delete m_currentPath; + if(m_currentPath != NULL) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex); // Always skip the first node (as that's where we are already) - if(m_currentPath != nullptr) m_currentPath->next(); + if(m_currentPath != NULL) m_currentPath->next(); } navigateToNextPathNode(); @@ -1063,7 +1063,7 @@ float EnderDragon::rotWrap(double d) d -= 360; while (d < -180) d += 360; - return static_cast(d); + return (float) d; } bool EnderDragon::checkWalls(AABB *bb) @@ -1125,9 +1125,9 @@ bool EnderDragon::hurt(shared_ptr MultiEntityMobPart, Damage //xTarget = x + ss1 * 5 + (random->nextFloat() - 0.5f) * 2; //yTarget = y + random->nextFloat() * 3 + 1; //zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2; - //attackTarget = nullptr; + //attackTarget = NULL; - if ( source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) || source->isExplosion() ) + if ( source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) || source->isExplosion() ) { int healthBefore = getHealth(); reallyHurt(source, damage); @@ -1142,7 +1142,7 @@ bool EnderDragon::hurt(shared_ptr MultiEntityMobPart, Damage if( setSynchedAction(e_EnderdragonAction_LandingApproach) ) { - if( m_currentPath != nullptr ) + if( m_currentPath != NULL ) { while(!m_currentPath->isDone()) { @@ -1214,12 +1214,12 @@ void EnderDragon::tickDeath() { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(std::make_shared(level, x, y, z, newCount)); + level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) )); } } if (dragonDeathTime == 1) { - level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, static_cast(x), static_cast(y), static_cast(z), 0); + level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, (int) x, (int) y, (int) z, 0); } } move(0, 0.1f, 0); @@ -1227,14 +1227,14 @@ void EnderDragon::tickDeath() if (dragonDeathTime == 200 && !level->isClientSide) { - //level->levelEvent(nullptr, LevelEvent::ENDERDRAGON_KILLED, (int) x, (int) y, (int) z, 0); + //level->levelEvent(NULL, LevelEvent::ENDERDRAGON_KILLED, (int) x, (int) y, (int) z, 0); int xpCount = 2000; while (xpCount > 0) { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(std::make_shared(level, x, y, z, newCount)); + level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount))); } int xo = 5 + random->nextInt(2) * 2 - 1; int zo = 5 + random->nextInt(2) * 2 - 1; @@ -1458,14 +1458,14 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, bool force /*= fal EnderDragon::EEnderdragonAction EnderDragon::getSynchedAction() { - return static_cast(entityData->getInteger(DATA_ID_SYNCHED_ACTION)); + return (EEnderdragonAction)entityData->getInteger(DATA_ID_SYNCHED_ACTION); } void EnderDragon::handleCrystalDestroyed(DamageSource *source) { AABB *tempBB = AABB::newTemp(PODIUM_X_POS,84.0,PODIUM_Z_POS,PODIUM_X_POS+1.0,85.0,PODIUM_Z_POS+1.0); vector > *crystals = level->getEntitiesOfClass(typeid(EnderCrystal), tempBB->grow(48, 40, 48)); - m_remainingCrystalsCount = static_cast(crystals->size()) - 1; + m_remainingCrystalsCount = (int)crystals->size() - 1; if(m_remainingCrystalsCount < 0) m_remainingCrystalsCount = 0; delete crystals; @@ -1477,7 +1477,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource *source) { if(setSynchedAction(e_EnderdragonAction_LandingApproach)) { - if( m_currentPath != nullptr ) + if( m_currentPath != NULL ) { while(!m_currentPath->isDone()) { @@ -1490,7 +1490,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource *source) #endif } } - else if(source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) + else if(source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER)) { if(setSynchedAction(e_EnderdragonAction_StrafePlayer)) { @@ -1521,10 +1521,10 @@ void EnderDragon::strafeAttackTarget() Node finalNode(finalXTarget, finalYTarget, finalZTarget); - if(m_currentPath != nullptr) delete m_currentPath; + if(m_currentPath != NULL) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex, &finalNode); - if(m_currentPath != nullptr) + if(m_currentPath != NULL) { // Always skip the first node (as that's where we are already) m_currentPath->next(); @@ -1535,7 +1535,7 @@ void EnderDragon::strafeAttackTarget() void EnderDragon::navigateToNextPathNode() { - if(m_currentPath != nullptr && !m_currentPath->isDone()) + if(m_currentPath != NULL && !m_currentPath->isDone()) { Vec3 *curr = m_currentPath->currentPos(); @@ -1563,7 +1563,7 @@ void EnderDragon::navigateToNextPathNode() int EnderDragon::findClosestNode() { // Setup all the nodes on the first time this is called - if(m_nodes->data[0] == nullptr) + if(m_nodes->data[0] == NULL) { // Path nodes for navigation // 0 - 11 are the outer ring at 60 blocks from centre @@ -1641,7 +1641,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) { float closestDist = 100.0f; int closestIndex = 0; - Node *currentPos = new Node(static_cast(floor(tX)), static_cast(floor(tY)), static_cast(floor(tZ))); + Node *currentPos = new Node((int) floor(tX), (int) floor(tY), (int) floor(tZ)); int startIndex = 0; if(m_remainingCrystalsCount <= 0) { @@ -1650,7 +1650,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) } for(unsigned int i = startIndex; i < 24; ++i) { - if( m_nodes->data[i] != nullptr ) + if( m_nodes->data[i] != NULL ) { float dist = m_nodes->data[i]->distanceTo(currentPos); if(dist < closestDist) @@ -1665,7 +1665,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) } // 4J Stu - A* taken from PathFinder and modified -Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = nullptr */) +Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = NULL */) { for(unsigned int i = 0; i < 24; ++i) { @@ -1674,7 +1674,7 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = n n->f = 0; n->g = 0; n->h = 0; - n->cameFrom = nullptr; + n->cameFrom = NULL; n->heapIdx = -1; } @@ -1704,7 +1704,7 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = n if (x->equals(to)) { app.DebugPrintf("Found path from %d to %d\n", startIndex, endIndex); - if(finalNode != nullptr) + if(finalNode != NULL) { finalNode->cameFrom = to; to = finalNode; @@ -1756,9 +1756,9 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = n } } - if (closest == from) return nullptr; + if (closest == from) return NULL; app.DebugPrintf("Failed to find path from %d to %d\n", startIndex, endIndex); - if(finalNode != nullptr) + if(finalNode != NULL) { finalNode->cameFrom = closest; closest = finalNode; @@ -1771,7 +1771,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) { int count = 1; Node *n = to; - while (n->cameFrom != nullptr) + while (n->cameFrom != NULL) { count++; n = n->cameFrom; @@ -1780,7 +1780,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != nullptr) + while (n->cameFrom != NULL) { n = n->cameFrom; nodes.data[--count] = n; @@ -1805,7 +1805,7 @@ void EnderDragon::readAdditionalSaveData(CompoundTag *tag) m_remainingCrystalsCount = tag->getShort(L"RemainingCrystals"); if(!tag->contains(L"RemainingCrystals")) m_remainingCrystalsCount = CRYSTAL_COUNT; - if(tag->contains(L"DragonState")) setSynchedAction( static_cast(tag->getInt(L"DragonState")), true); + if(tag->contains(L"DragonState")) setSynchedAction( (EEnderdragonAction)tag->getInt(L"DragonState"), true); Mob::readAdditionalSaveData(tag); } @@ -1923,7 +1923,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, doubleArray bodyPos, doub Vec3 *EnderDragon::getHeadLookVector(float a) { - Vec3 *result = nullptr; + Vec3 *result = NULL; if( getSynchedAction() == e_EnderdragonAction_Landing || getSynchedAction() == e_EnderdragonAction_Takeoff ) { diff --git a/Minecraft.World/EnderDragon.h b/Minecraft.World/EnderDragon.h index 9f39767e..a13ecaa2 100644 --- a/Minecraft.World/EnderDragon.h +++ b/Minecraft.World/EnderDragon.h @@ -163,7 +163,7 @@ private: EEnderdragonAction getSynchedAction(); int findClosestNode(double tX, double tY, double tZ); int findClosestNode(); - Path *findPath(int startIndex, int endIndex, Node *finalNode = nullptr); + Path *findPath(int startIndex, int endIndex, Node *finalNode = NULL); Path *reconstruct_path(Node *from, Node *to); void strafeAttackTarget(); diff --git a/Minecraft.World/EnderEyeItem.cpp b/Minecraft.World/EnderEyeItem.cpp index 25b16d05..063e1408 100644 --- a/Minecraft.World/EnderEyeItem.cpp +++ b/Minecraft.World/EnderEyeItem.cpp @@ -136,7 +136,7 @@ bool EnderEyeItem::useOn(shared_ptr instance, shared_ptr p bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); - if (hr != nullptr && hr->type == HitResult::TILE) + if (hr != NULL && hr->type == HitResult::TILE) { int tile = level->getTile(hr->x, hr->y, hr->z); delete hr; @@ -145,7 +145,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, return false; } } - else if( hr != nullptr ) + else if( hr != NULL ) { delete hr; } @@ -177,7 +177,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, } // TilePos *nearestMapFeature = level->findNearestMapFeature(LargeFeature::STRONGHOLD, (int) player->x, (int) player->y, (int) player->z); -// if (nearestMapFeature != nullptr) +// if (nearestMapFeature != NULL) // { // delete nearestMapFeature; // return true; @@ -189,7 +189,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr EnderEyeItem::use(shared_ptr instance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); - if (hr != nullptr && hr->type == HitResult::TILE) + if (hr != NULL && hr->type == HitResult::TILE) { int tile = level->getTile(hr->x, hr->y, hr->z); delete hr; @@ -198,7 +198,7 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le return instance; } } - else if( hr != nullptr ) + else if( hr != NULL ) { delete hr; } @@ -207,12 +207,12 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le { if((level->dimension->id==LevelData::DIMENSION_OVERWORLD) && level->getLevelData()->getHasStronghold()) { - shared_ptr eyeOfEnderSignal = std::make_shared(level, player->x, player->y + 1.62 - player->heightOffset, player->z); + shared_ptr eyeOfEnderSignal = shared_ptr( new EyeOfEnderSignal(level, player->x, player->y + 1.62 - player->heightOffset, player->z) ); eyeOfEnderSignal->signalTo(level->getLevelData()->getXStronghold()<<4, player->y + 1.62 - player->heightOffset, level->getLevelData()->getZStronghold()<<4); level->addEntity(eyeOfEnderSignal); level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - level->levelEvent(nullptr, LevelEvent::SOUND_LAUNCH, static_cast(player->x), static_cast(player->y), static_cast(player->z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_LAUNCH, (int) player->x, (int) player->y, (int) player->z, 0); if (!player->abilities.instabuild) { instance->count--; diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index e1231818..d099911c 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -67,16 +67,16 @@ void EnderMan::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_CARRY_ITEM_ID, static_cast(0)); - entityData->define(DATA_CARRY_ITEM_DATA, static_cast(0)); - entityData->define(DATA_CREEPY, static_cast(0)); + entityData->define(DATA_CARRY_ITEM_ID, (byte) 0); + entityData->define(DATA_CARRY_ITEM_DATA, (byte) 0); + entityData->define(DATA_CREEPY, (byte) 0); } void EnderMan::addAdditonalSaveData(CompoundTag *tag) { Monster::addAdditonalSaveData(tag); - tag->putShort(L"carried", static_cast(getCarryingTile())); - tag->putShort(L"carriedData", static_cast(getCarryingData())); + tag->putShort(L"carried", (short) getCarryingTile()); + tag->putShort(L"carriedData", (short) getCarryingData()); } void EnderMan::readAdditionalSaveData(CompoundTag *tag) @@ -96,7 +96,7 @@ shared_ptr EnderMan::findAttackTarget() #endif shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); - if (player != nullptr) + if (player != NULL) { if (isLookingAtMe(player)) { @@ -120,7 +120,7 @@ shared_ptr EnderMan::findAttackTarget() bool EnderMan::isLookingAtMe(shared_ptr player) { shared_ptr helmet = player->inventory->armor[3]; - if (helmet != nullptr && helmet->id == Tile::pumpkin_Id) return false; + if (helmet != NULL && helmet->id == Tile::pumpkin_Id) return false; Vec3 *look = player->getViewVector(1)->normalize(); Vec3 *dir = Vec3::newTemp(x - player->x, (bb->y0 + bbHeight / 2) - (player->y + player->getHeadHeight()), z - player->z); @@ -143,7 +143,7 @@ void EnderMan::aiStep() AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_ATTACKING); - if (attackTarget != nullptr) + if (attackTarget != NULL) { speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING)); } @@ -202,7 +202,7 @@ void EnderMan::aiStep() float br = getBrightness(1); if (br > 0.5f) { - if (level->canSeeSky(Mth::floor(x), static_cast(floor(y + 0.5)), Mth::floor(z)) && random->nextFloat() * 30 < (br - 0.4f) * 2) + if (level->canSeeSky(Mth::floor(x), (int)floor( y + 0.5 ), Mth::floor(z)) && random->nextFloat() * 30 < (br - 0.4f) * 2) { attackTarget = nullptr; setCreepy(false); @@ -226,14 +226,14 @@ void EnderMan::aiStep() } jumping = false; - if (attackTarget != nullptr) + if (attackTarget != NULL) { lookAt(attackTarget, 100, 100); } if (!level->isClientSide && isAlive()) { - if (attackTarget != nullptr) + if (attackTarget != NULL) { if ( attackTarget->instanceof(eTYPE_PLAYER) && isLookingAtMe(dynamic_pointer_cast(attackTarget))) { @@ -385,7 +385,7 @@ void EnderMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) // 4J Brought forward from 1.2.3 to help fix Enderman behaviour void EnderMan::setCarryingTile(int carryingTile) { - entityData->set(DATA_CARRY_ITEM_ID, static_cast(carryingTile & 0xff)); + entityData->set(DATA_CARRY_ITEM_ID, (byte) (carryingTile & 0xff)); } int EnderMan::getCarryingTile() @@ -395,7 +395,7 @@ int EnderMan::getCarryingTile() void EnderMan::setCarryingData(int carryingData) { - entityData->set(DATA_CARRY_ITEM_DATA, static_cast(carryingData & 0xff)); + entityData->set(DATA_CARRY_ITEM_DATA, (byte) (carryingData & 0xff)); } int EnderMan::getCarryingData() @@ -408,12 +408,12 @@ bool EnderMan::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; setCreepy(true); - if ( dynamic_cast(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) + if ( dynamic_cast(source) != NULL && source->getEntity()->instanceof(eTYPE_PLAYER)) { aggroedByPlayer = true; } - if (dynamic_cast(source) != nullptr) + if (dynamic_cast(source) != NULL) { aggroedByPlayer = false; for (int i = 0; i < 64; i++) @@ -435,5 +435,5 @@ bool EnderMan::isCreepy() void EnderMan::setCreepy(bool creepy) { - entityData->set(DATA_CREEPY, static_cast(creepy ? 1 : 0)); + entityData->set(DATA_CREEPY, (byte)(creepy ? 1 : 0)); } \ No newline at end of file diff --git a/Minecraft.World/EnderpearlItem.cpp b/Minecraft.World/EnderpearlItem.cpp index c024190b..e1ed693b 100644 --- a/Minecraft.World/EnderpearlItem.cpp +++ b/Minecraft.World/EnderpearlItem.cpp @@ -19,7 +19,7 @@ shared_ptr EnderpearlItem::use(shared_ptr instance, { // 4J-PB - Not sure why this was disabled for creative mode, so commenting out //if (player->abilities.instabuild) return instance; - if (player->riding != nullptr) return instance; + if (player->riding != NULL) return instance; if (!player->abilities.instabuild) { instance->count--; @@ -28,7 +28,7 @@ shared_ptr EnderpearlItem::use(shared_ptr instance, level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); if (!level->isClientSide) { - level->addEntity(std::make_shared(level, player)); + level->addEntity( shared_ptr( new ThrownEnderpearl(level, player) ) ); } return instance; } \ No newline at end of file diff --git a/Minecraft.World/Enemy.cpp b/Minecraft.World/Enemy.cpp index 5dd54846..b9aa3e20 100644 --- a/Minecraft.World/Enemy.cpp +++ b/Minecraft.World/Enemy.cpp @@ -5,5 +5,5 @@ EntitySelector *Enemy::ENEMY_SELECTOR = new Enemy::EnemyEntitySelector(); bool Enemy::EnemyEntitySelector::matches(shared_ptr entity) const { - return (entity != nullptr) && entity->instanceof(eTYPE_ENEMY); + return (entity != NULL) && entity->instanceof(eTYPE_ENEMY); } \ No newline at end of file diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index d754330b..e8233140 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -41,7 +41,7 @@ int Entity::extraWanderCount = 0; int Entity::getSmallId() { unsigned int *puiUsedFlags = entityIdUsedFlags; - unsigned int *puiRemovedFlags = nullptr; + unsigned int *puiRemovedFlags = NULL; // If we are the server (we should be, if we are allocating small Ids), then check with the server if there are any small Ids which are // still in the ServerPlayer's vectors of entities to be removed - these are used to gather up a set of entities into one network packet @@ -260,7 +260,7 @@ void Entity::_init(bool useSmallId, Level *level) riding = nullptr; forcedLoading = false; - //level = nullptr; // Level is assigned to in the original c_tor code + //level = NULL; // Level is assigned to in the original c_tor code xo = yo = zo = 0.0; x = y = z = 0.0; xd = yd = zd = 0.0; @@ -312,7 +312,7 @@ void Entity::_init(bool useSmallId, Level *level) // values that need to be sent to clients in SMP if( useSmallId ) { - entityData = std::make_shared(); + entityData = shared_ptr(new SynchedEntityData()); } else { @@ -355,14 +355,14 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter // resetPos(); setPos(0, 0, 0); - if (level != nullptr) + if (level != NULL) { dimension = level->dimension->id; } if( entityData ) { - entityData->define(DATA_SHARED_FLAGS_ID, static_cast(0)); + entityData->define(DATA_SHARED_FLAGS_ID, (byte) 0); entityData->define(DATA_AIR_SUPPLY_ID, TOTAL_AIR_SUPPLY); // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater. } @@ -398,7 +398,7 @@ return entityId; void Entity::resetPos() { - if (level == nullptr) return; + if (level == NULL) return; shared_ptr sharedThis = shared_from_this(); while (true && y > 0) @@ -510,7 +510,7 @@ void Entity::baseTick() // 4J Stu - Not needed //util.Timer.push("entityBaseTick"); - if (riding != nullptr && riding->removed) + if (riding != NULL && riding->removed) { riding = nullptr; } @@ -533,7 +533,7 @@ void Entity::baseTick() { if (server->isNetherEnabled()) { - if (riding == nullptr) + if (riding == NULL) { if (portalTime++ >= waitTime) { @@ -883,7 +883,7 @@ void Entity::move(double xa, double ya, double za, bool noEntityCubes) // 4J - double zm = z - zo; - if (makeStepSound() && !isPlayerSneaking && riding == nullptr) + if (makeStepSound() && !isPlayerSneaking && riding == NULL) { int xt = Mth::floor(x); int yt = Mth::floor(y - 0.2f - heightOffset); @@ -907,7 +907,7 @@ void Entity::move(double xa, double ya, double za, bool noEntityCubes) // 4J - if (moveDist > nextStep && t > 0) { - nextStep = static_cast(moveDist) + 1; + nextStep = (int) moveDist + 1; if (isInWater()) { float speed = Mth::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) * 0.35f; @@ -1023,13 +1023,13 @@ void Entity::checkFallDamage(double ya, bool onGround) } else { - if (ya < 0) fallDistance -= static_cast(ya); + if (ya < 0) fallDistance -= (float) ya; } } AABB *Entity::getCollideBox() { - return nullptr; + return NULL; } void Entity::burn(int dmg) @@ -1047,7 +1047,7 @@ bool Entity::isFireImmune() void Entity::causeFallDamage(float distance) { - if (rider.lock() != nullptr) rider.lock()->causeFallDamage(distance); + if (rider.lock() != NULL) rider.lock()->causeFallDamage(distance); } @@ -1072,7 +1072,7 @@ bool Entity::updateInWaterState() MemSect(31); playSound(eSoundType_RANDOM_SPLASH, speed, 1 + (random->nextFloat() - random->nextFloat()) * 0.4f); MemSect(0); - float yt = static_cast(Mth::floor(bb->y0)); + float yt = (float) Mth::floor(bb->y0); for (int i = 0; i < 1 + bbWidth * 20; i++) { float xo = (random->nextFloat() * 2 - 1) * bbWidth; @@ -1202,9 +1202,9 @@ void Entity::moveTo(double x, double y, double z, float yRot, float xRot) float Entity::distanceTo(shared_ptr e) { - float xd = static_cast(x - e->x); - float yd = static_cast(y - e->y); - float zd = static_cast(z - e->z); + float xd = (float) (x - e->x); + float yd = (float) (y - e->y); + float zd = (float) (z - e->z); return sqrt(xd * xd + yd * yd + zd * zd); } @@ -1348,7 +1348,7 @@ bool Entity::saveAsMount(CompoundTag *entityTag) bool Entity::save(CompoundTag *entityTag) { wstring id = getEncodeId(); - if (removed || id.empty() || (rider.lock() != nullptr) ) + if (removed || id.empty() || (rider.lock() != NULL) ) { return false; } @@ -1365,8 +1365,8 @@ void Entity::saveWithoutId(CompoundTag *entityTag) entityTag->put(L"Rotation", newFloatList(2, yRot, xRot)); entityTag->putFloat(L"FallDistance", fallDistance); - entityTag->putShort(L"Fire", static_cast(onFire)); - entityTag->putShort(L"Air", static_cast(getAirSupply())); + entityTag->putShort(L"Fire", (short) onFire); + entityTag->putShort(L"Air", (short) getAirSupply()); entityTag->putBoolean(L"OnGround", onGround); entityTag->putInt(L"Dimension", dimension); entityTag->putBoolean(L"Invulnerable", invulnerable); @@ -1376,7 +1376,7 @@ void Entity::saveWithoutId(CompoundTag *entityTag) addAdditonalSaveData(entityTag); - if (riding != nullptr) + if (riding != NULL) { CompoundTag *ridingTag = new CompoundTag(RIDING_TAG); if (riding->saveAsMount(ridingTag)) @@ -1511,7 +1511,7 @@ shared_ptr Entity::spawnAtLocation(int resource, int count) shared_ptr Entity::spawnAtLocation(int resource, int count, float yOffs) { - return spawnAtLocation(std::make_shared(resource, count, 0), yOffs); + return spawnAtLocation(shared_ptr( new ItemInstance(resource, count, 0) ), yOffs); } shared_ptr Entity::spawnAtLocation(shared_ptr itemInstance, float yOffs) @@ -1520,7 +1520,7 @@ shared_ptr Entity::spawnAtLocation(shared_ptr itemInst { return nullptr; } - shared_ptr ie = std::make_shared(level, x, y + yOffs, z, itemInstance); + shared_ptr ie = shared_ptr( new ItemEntity(level, x, y + yOffs, z, itemInstance) ); ie->throwTime = 10; level->addEntity(ie); return ie; @@ -1556,7 +1556,7 @@ bool Entity::interact(shared_ptr player) AABB *Entity::getCollideAgainstBox(shared_ptr entity) { - return nullptr; + return NULL; } void Entity::rideTick() @@ -1569,7 +1569,7 @@ void Entity::rideTick() xd = yd = zd = 0; tick(); - if (riding == nullptr) return; + if (riding == NULL) return; // Sets riders old&new position to it's mount's old&new position (plus the ride y-seperatation). riding->positionRider(); @@ -1605,7 +1605,7 @@ void Entity::rideTick() void Entity::positionRider() { shared_ptr lockedRider = rider.lock(); - if( lockedRider == nullptr) + if( lockedRider == NULL) { return; } @@ -1627,9 +1627,9 @@ void Entity::ride(shared_ptr e) xRideRotA = 0; yRideRotA = 0; - if (e == nullptr) + if (e == NULL) { - if (riding != nullptr) + if (riding != NULL) { // 4J Stu - Position should already be updated before the SetEntityLinkPacket comes in if(!level->isClientSide) moveTo(riding->x, riding->bb->y0 + riding->bbHeight, riding->z, yRot, xRot); @@ -1638,7 +1638,7 @@ void Entity::ride(shared_ptr e) riding = nullptr; return; } - if (riding != nullptr) + if (riding != NULL) { riding->rider = weak_ptr(); } @@ -1677,7 +1677,7 @@ float Entity::getPickRadius() Vec3 *Entity::getLookAngle() { - return nullptr; + return NULL; } void Entity::handleInsidePortal() @@ -1721,7 +1721,7 @@ void Entity::animateHurt() ItemInstanceArray Entity::getEquipmentSlots() // ItemInstance[] { - return ItemInstanceArray(); // Default ctor creates nullptr internal array + return ItemInstanceArray(); // Default ctor creates NULL internal array } // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game @@ -1736,7 +1736,7 @@ bool Entity::isOnFire() bool Entity::isRiding() { - return riding != nullptr; + return riding != NULL; } bool Entity::isSneaking() @@ -1823,11 +1823,11 @@ void Entity::setSharedFlag(int flag, bool value) byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID); if (value) { - entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue | (1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue | (1 << flag))); } else { - entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue & ~(1 << flag))); } } } @@ -1841,7 +1841,7 @@ int Entity::getAirSupply() // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater. void Entity::setAirSupply(int supply) { - entityData->set(DATA_AIR_SUPPLY_ID, static_cast(supply)); + entityData->set(DATA_AIR_SUPPLY_ID, (short) supply); } void Entity::thunderHit(const LightningBolt *lightningBolt) @@ -1937,7 +1937,7 @@ wstring Entity::getAName() vector > *Entity::getSubEntities() { - return nullptr; + return NULL; } bool Entity::is(shared_ptr other) @@ -2023,7 +2023,7 @@ void Entity::changeDimension(int i) server->getPlayers()->repositionAcrossDimension(shared_from_this(), lastDimension, oldLevel, newLevel); shared_ptr newEntity = EntityIO::newEntity(EntityIO::getEncodeId(shared_from_this()), newLevel); - if (newEntity != nullptr) + if (newEntity != NULL) { newEntity->restoreFrom(shared_from_this(), true); diff --git a/Minecraft.World/EntityActionAtPositionPacket.h b/Minecraft.World/EntityActionAtPositionPacket.h index 788c764b..35202017 100644 --- a/Minecraft.World/EntityActionAtPositionPacket.h +++ b/Minecraft.World/EntityActionAtPositionPacket.h @@ -18,6 +18,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new EntityActionAtPositionPacket()); } virtual int getId() { return 17; } }; \ No newline at end of file diff --git a/Minecraft.World/EntityDamageSource.cpp b/Minecraft.World/EntityDamageSource.cpp index 8639156d..22237bf1 100644 --- a/Minecraft.World/EntityDamageSource.cpp +++ b/Minecraft.World/EntityDamageSource.cpp @@ -23,7 +23,7 @@ shared_ptr EntityDamageSource::getEntity() shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptr player) { - shared_ptr held = (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; + shared_ptr held = (entity != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; wstring additional = L""; if (entity->instanceof(eTYPE_SERVERPLAYER)) @@ -39,19 +39,19 @@ shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptrhasCustomHoverName()) + if ( (held != NULL) && held->hasCustomHoverName()) { - return std::make_shared(player->getNetworkName(), m_msgWithItemId, entity->GetType(), additional, held->getHoverName()); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId, entity->GetType(), additional, held->getHoverName() ) ); } else { - return std::make_shared(player->getNetworkName(), m_msgId, entity->GetType(), additional); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgId, entity->GetType(), additional ) ); } } bool EntityDamageSource::scalesWithDifficulty() { - return (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) && !entity->instanceof(eTYPE_PLAYER); + return (entity != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) && !entity->instanceof(eTYPE_PLAYER); } // 4J: Copy function diff --git a/Minecraft.World/EntityEventPacket.h b/Minecraft.World/EntityEventPacket.h index 2b32dc29..a151dbdb 100644 --- a/Minecraft.World/EntityEventPacket.h +++ b/Minecraft.World/EntityEventPacket.h @@ -18,7 +18,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new EntityEventPacket()); } virtual int getId() { return 38; } }; diff --git a/Minecraft.World/EntityHorse.cpp b/Minecraft.World/EntityHorse.cpp index 32c9eb2d..90c2a6b9 100644 --- a/Minecraft.World/EntityHorse.cpp +++ b/Minecraft.World/EntityHorse.cpp @@ -100,7 +100,7 @@ void EntityHorse::defineSynchedData() { Animal::defineSynchedData(); entityData->define(DATA_ID_HORSE_FLAGS, 0); - entityData->define(DATA_ID_TYPE, static_cast(0)); + entityData->define(DATA_ID_TYPE, (byte) 0); entityData->define(DATA_ID_TYPE_VARIANT, 0); entityData->define(DATA_ID_OWNER_NAME, L""); entityData->define(DATA_ID_ARMOR, 0); @@ -108,7 +108,7 @@ void EntityHorse::defineSynchedData() void EntityHorse::setType(int i) { - entityData->set(DATA_ID_TYPE, static_cast(i)); + entityData->set(DATA_ID_TYPE, (byte) i); clearLayeredTextureInfo(); } @@ -202,7 +202,7 @@ float EntityHorse::getFoalScale() { return 1.0f; } - return .5f + static_cast(BABY_START_AGE - age) / static_cast(BABY_START_AGE) * .5f; + return .5f + (float) (BABY_START_AGE - age) / (float) BABY_START_AGE * .5f; } @@ -259,7 +259,7 @@ int EntityHorse::getArmorType() int EntityHorse::getArmorTypeForItem(shared_ptr armorItem) { - if (armorItem == nullptr) + if (armorItem == NULL) { return ARMOR_NONE; } @@ -350,7 +350,7 @@ bool EntityHorse::hurt(DamageSource *damagesource, float dmg) if (isTamed()) { shared_ptr entity = damagesource->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) + if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) { shared_ptr attacker = dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerName()); @@ -358,7 +358,7 @@ bool EntityHorse::hurt(DamageSource *damagesource, float dmg) } shared_ptr attacker = damagesource->getEntity(); - if (rider.lock() != nullptr && (rider.lock() == (attacker) )) + if (rider.lock() != NULL && (rider.lock() == (attacker) )) { return false; } @@ -375,7 +375,7 @@ int EntityHorse::getArmorValue() bool EntityHorse::isPushable() { - return rider.lock() == nullptr; + return rider.lock() == NULL; } // TODO: [EB]: Explain why this is being done - what side effect does getBiome have? @@ -424,7 +424,7 @@ void EntityHorse::causeFallDamage(float fallDistance) hurt(DamageSource::fall, dmg); - if (rider.lock() != nullptr) + if (rider.lock() != NULL) { rider.lock()->hurt(DamageSource::fall, dmg); } @@ -456,9 +456,9 @@ int EntityHorse::getInventorySize() void EntityHorse::createInventory() { shared_ptr old = inventory; - inventory = std::make_shared(L"HorseChest", getInventorySize()); + inventory = shared_ptr( new AnimalChest(L"HorseChest", getInventorySize()) ); inventory->setCustomName(getAName()); - if (old != nullptr) + if (old != NULL) { old->removeListener(this); @@ -466,7 +466,7 @@ void EntityHorse::createInventory() for (int slot = 0; slot < max; slot++) { shared_ptr item = old->getItem(slot); - if (item != nullptr) + if (item != NULL) { inventory->setItem(slot, item->copy()); } @@ -481,7 +481,7 @@ void EntityHorse::updateEquipment() { if (level && !level->isClientSide) { - setSaddled(inventory->getItem(INV_SLOT_SADDLE) != nullptr); + setSaddled(inventory->getItem(INV_SLOT_SADDLE) != NULL); if (canWearArmor()) { setArmorType(getArmorTypeForItem(inventory->getItem(INV_SLOT_ARMOR))); @@ -666,7 +666,7 @@ void EntityHorse::playStepSound(int xt, int yt, int zt, int t) if (!Tile::tiles[t]->material->isLiquid()) { int type = getType(); - if (rider.lock() != nullptr && type != TYPE_DONKEY && type != TYPE_MULE) + if (rider.lock() != NULL && type != TYPE_DONKEY && type != TYPE_MULE) { gallopSoundCounter++; if (gallopSoundCounter > 5 && gallopSoundCounter % 3 == 0) @@ -795,7 +795,7 @@ intArray EntityHorse::getLayeredTextureLayers() void EntityHorse::openInventory(shared_ptr player) { - if (!level->isClientSide && (rider.lock() == nullptr || rider.lock() == player) && isTamed()) + if (!level->isClientSide && (rider.lock() == NULL || rider.lock() == player) && isTamed()) { inventory->setCustomName(getAName()); player->openHorseInventory(dynamic_pointer_cast(shared_from_this()), inventory); @@ -806,7 +806,7 @@ bool EntityHorse::mobInteract(shared_ptr player) { shared_ptr itemstack = player->inventory->getSelected(); - if (itemstack != nullptr && itemstack->id == Item::spawnEgg_Id) + if (itemstack != NULL && itemstack->id == Item::spawnEgg_Id) { return Animal::mobInteract(player); } @@ -825,13 +825,13 @@ bool EntityHorse::mobInteract(shared_ptr player) return true; } - if (isRidable() && rider.lock() != nullptr) + if (isRidable() && rider.lock() != NULL) { return Animal::mobInteract(player); } // consumables - if (itemstack != nullptr) + if (itemstack != NULL) { bool itemUsed = false; @@ -944,7 +944,7 @@ bool EntityHorse::mobInteract(shared_ptr player) if (!isTamed() && !itemUsed) { - if (itemstack != nullptr && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) + if (itemstack != NULL && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) { return true; } @@ -985,17 +985,17 @@ bool EntityHorse::mobInteract(shared_ptr player) } } - if (isRidable() && rider.lock() == nullptr) + if (isRidable() && rider.lock() == NULL) { // for name tag items and such, we must call the item's interaction // method before riding - if (itemstack != nullptr && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) + if (itemstack != NULL && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) { return true; } doPlayerRide(player); - app.DebugPrintf(" Horse speed: %f\n", static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + app.DebugPrintf(" Horse speed: %f\n", (float) (getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); return true; } @@ -1046,7 +1046,7 @@ bool EntityHorse::canWearBags() bool EntityHorse::isImmobile() { - if (rider.lock() != nullptr && isSaddled()) + if (rider.lock() != NULL && isSaddled()) { return true; } @@ -1098,7 +1098,7 @@ int EntityHorse::nameYOffset() } else { - return static_cast(-5 - getFoalScale() * 80.0f); + return (int) (-5 - getFoalScale() * 80.0f); } } @@ -1127,7 +1127,7 @@ void EntityHorse::aiStep() heal(1); } - if (!isEating() && rider.lock() == nullptr && random->nextInt(300) == 0) + if (!isEating() && rider.lock() == NULL && random->nextInt(300) == 0) { if (level->getTile(Mth::floor(x), Mth::floor(y) - 1, Mth::floor(z)) == Tile::grass_Id) { @@ -1144,7 +1144,7 @@ void EntityHorse::aiStep() if (isBred() && !isAdult() && !isEating()) { shared_ptr mommy = getClosestMommy(shared_from_this(), 16); - if (mommy != nullptr && distanceToSqr(mommy) > 4.0) + if (mommy != NULL && distanceToSqr(mommy) > 4.0) { Path *pathentity = level->findPath(shared_from_this(), mommy, 16.0f, true, false, false, true); setPath(pathentity); @@ -1263,12 +1263,12 @@ void EntityHorse::openMouth() bool EntityHorse::isReadyForParenting() { - return rider.lock() == nullptr && riding == nullptr && isTamed() && isAdult() && !isSterile() && getHealth() >= getMaxHealth(); + return rider.lock() == NULL && riding == NULL && isTamed() && isAdult() && !isSterile() && getHealth() >= getMaxHealth(); } bool EntityHorse::renderName() { - return hasCustomName() && rider.lock() == nullptr; + return hasCustomName() && rider.lock() == NULL; } bool EntityHorse::rideableEntity() @@ -1320,12 +1320,12 @@ void EntityHorse::dropMyStuff() void EntityHorse::dropInventory(shared_ptr entity, shared_ptr animalchest) { - if (animalchest == nullptr || level->isClientSide) return; + if (animalchest == NULL || level->isClientSide) return; for (int i = 0; i < animalchest->getContainerSize(); i++) { shared_ptr itemstack = animalchest->getItem(i); - if (itemstack == nullptr) + if (itemstack == NULL) { continue; } @@ -1349,7 +1349,7 @@ void EntityHorse::travel(float xa, float ya) { // If the entity is not ridden by Player, then execute the normal // Entityliving code - if (rider.lock() == nullptr || !isSaddled()) + if (rider.lock() == NULL || !isSaddled()) { footSize = .5f; flyingSpeed = .02f; @@ -1407,7 +1407,7 @@ void EntityHorse::travel(float xa, float ya) flyingSpeed = getSpeed() * .1f; if (!level->isClientSide) { - setSpeed(static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + setSpeed((float) (getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); Animal::travel(xa, ya); } @@ -1455,11 +1455,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) { shared_ptr stack = inventory->getItem(i); - if (stack != nullptr) + if (stack != NULL) { CompoundTag *compoundTag = new CompoundTag(); - compoundTag->putByte(L"Slot", static_cast(i)); + compoundTag->putByte(L"Slot", (byte) i); stack->save(compoundTag); listTag->add(compoundTag); @@ -1468,11 +1468,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) tag->put(L"Items", listTag); } - if (inventory->getItem(INV_SLOT_ARMOR) != nullptr) + if (inventory->getItem(INV_SLOT_ARMOR) != NULL) { tag->put(L"ArmorItem", inventory->getItem(INV_SLOT_ARMOR)->save(new CompoundTag(L"ArmorItem"))); } - if (inventory->getItem(INV_SLOT_SADDLE) != nullptr) + if (inventory->getItem(INV_SLOT_SADDLE) != NULL) { tag->put(L"SaddleItem", inventory->getItem(INV_SLOT_SADDLE)->save(new CompoundTag(L"SaddleItem"))); } @@ -1498,7 +1498,7 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) // 4J: This is for handling old save data, not needed on console /*AttributeInstance *oldSpeedAttribute = getAttributes()->getInstance(SharedMonsterAttributes::MOVEMENT_SPEED); - if (oldSpeedAttribute != nullptr) + if (oldSpeedAttribute != NULL) { getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(oldSpeedAttribute->getBaseValue() * 0.25f); }*/ @@ -1523,7 +1523,7 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"ArmorItem")) { shared_ptr armor = ItemInstance::fromTag(tag->getCompound(L"ArmorItem")); - if (armor != nullptr && isHorseArmor(armor->id)) + if (armor != NULL && isHorseArmor(armor->id)) { inventory->setItem(INV_SLOT_ARMOR, armor); } @@ -1532,14 +1532,14 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"SaddleItem")) { shared_ptr saddleItem = ItemInstance::fromTag(tag->getCompound(L"SaddleItem")); - if (saddleItem != nullptr && saddleItem->id == Item::saddle_Id) + if (saddleItem != NULL && saddleItem->id == Item::saddle_Id) { inventory->setItem(INV_SLOT_SADDLE, saddleItem); } } else if (tag->getBoolean(L"Saddle")) { - inventory->setItem(INV_SLOT_SADDLE, std::make_shared(Item::saddle)); + inventory->setItem(INV_SLOT_SADDLE, shared_ptr( new ItemInstance(Item::saddle))); } updateEquipment(); } @@ -1566,7 +1566,7 @@ bool EntityHorse::canMate(shared_ptr partner) shared_ptr EntityHorse::getBreedOffspring(shared_ptr partner) { shared_ptr horsePartner = dynamic_pointer_cast(partner); - shared_ptr baby = std::make_shared(level); + shared_ptr baby = shared_ptr( new EntityHorse(level) ); int type = getType(); int partnerType = horsePartner->getType(); @@ -1637,10 +1637,10 @@ MobGroupData *EntityHorse::finalizeMobSpawn(MobGroupData *groupData, int extraDa int type = 0; int variant = 0; - if ( dynamic_cast(groupData) != nullptr ) + if ( dynamic_cast(groupData) != NULL ) { - type = static_cast(groupData)->horseType; - variant = static_cast(groupData)->horseVariant & 0xff | (random->nextInt(MARKINGS) << 8); + type = ((HorseGroupData *) groupData)->horseType; + variant = ((HorseGroupData *) groupData)->horseVariant & 0xff | (random->nextInt(MARKINGS) << 8); } else { @@ -1744,7 +1744,7 @@ void EntityHorse::onPlayerJump(int jumpAmount) } else { - playerJumpPendingScale = .4f + .4f * static_cast(jumpAmount) / 90.0f; + playerJumpPendingScale = .4f + .4f * (float) jumpAmount / 90.0f; } } } diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index 9c7c64d4..086015dc 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -135,8 +135,8 @@ shared_ptr EntityIO::newEntity(const wstring& id, Level *level) if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != nullptr) entity = shared_ptr(create(level)); - if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != NULL) entity = shared_ptr(create(level)); + if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } @@ -173,14 +173,14 @@ shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != nullptr) entity = shared_ptr(create(level)); - if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != NULL) entity = shared_ptr(create(level)); + if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } } - if (entity != nullptr) + if (entity != NULL) { entity->load(tag); } @@ -201,14 +201,14 @@ shared_ptr EntityIO::newById(int id, Level *level) if(it != numCreateMap->end() ) { entityCreateFn create = it->second; - if (create != nullptr) entity = shared_ptr(create(level)); - if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != NULL) entity = shared_ptr(create(level)); + if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } } - if (entity != nullptr) + if (entity != NULL) { } else @@ -229,8 +229,8 @@ shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) if(it2 != numCreateMap->end() ) { entityCreateFn create = it2->second; - if (create != nullptr) entity = shared_ptr(create(level)); - if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != NULL) entity = shared_ptr(create(level)); + if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } diff --git a/Minecraft.World/EntityPos.cpp b/Minecraft.World/EntityPos.cpp index 02f716ed..38b50573 100644 --- a/Minecraft.World/EntityPos.cpp +++ b/Minecraft.World/EntityPos.cpp @@ -58,5 +58,5 @@ EntityPos *EntityPos::lerp(shared_ptr e, float f) { return new EntityPos(yrd, xrd); } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.World/EntitySelector.cpp b/Minecraft.World/EntitySelector.cpp index 0f575c73..36c7bf88 100644 --- a/Minecraft.World/EntitySelector.cpp +++ b/Minecraft.World/EntitySelector.cpp @@ -12,7 +12,7 @@ bool AliveEntitySelector::matches(shared_ptr entity) const bool ContainerEntitySelector::matches(shared_ptr entity) const { - return (dynamic_pointer_cast(entity) != nullptr) && entity->isAlive(); + return (dynamic_pointer_cast(entity) != NULL) && entity->isAlive(); } MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector(shared_ptr item) @@ -27,7 +27,7 @@ bool MobCanWearArmourEntitySelector::matches(shared_ptr entity) const shared_ptr mob = dynamic_pointer_cast(entity); - if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != nullptr) return false; + if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != NULL) return false; if ( mob->instanceof(eTYPE_MOB) ) { diff --git a/Minecraft.World/ExperienceItem.cpp b/Minecraft.World/ExperienceItem.cpp index a28a5859..433c1207 100644 --- a/Minecraft.World/ExperienceItem.cpp +++ b/Minecraft.World/ExperienceItem.cpp @@ -27,6 +27,6 @@ shared_ptr ExperienceItem::use(shared_ptr itemInstan itemInstance->count--; } level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity(std::make_shared(level, player)); + if (!level->isClientSide) level->addEntity( shared_ptr( new ThrownExpBottle(level, player) )); return itemInstance; } \ No newline at end of file diff --git a/Minecraft.World/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp index cc4b12bc..9fed6d71 100644 --- a/Minecraft.World/ExperienceOrb.cpp +++ b/Minecraft.World/ExperienceOrb.cpp @@ -35,11 +35,11 @@ ExperienceOrb::ExperienceOrb(Level *level, double x, double y, double z, int cou heightOffset = bbHeight / 2.0f; setPos(x, y, z); - yRot = static_cast(Math::random() * 360); + yRot = (float) (Math::random() * 360); - xd = static_cast(Math::random() * 0.2f - 0.1f) * 2; - yd = static_cast(Math::random() * 0.2) * 2; - zd = static_cast(Math::random() * 0.2f - 0.1f) * 2; + xd = (float) (Math::random() * 0.2f - 0.1f) * 2; + yd = (float) (Math::random() * 0.2) * 2; + zd = (float) (Math::random() * 0.2f - 0.1f) * 2; value = count; } @@ -70,7 +70,7 @@ int ExperienceOrb::getLightColor(float a) int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br1 += static_cast(l * 15 * 16); + br1 += (int) (l * 15 * 16); if (br1 > 15 * 16) br1 = 15 * 16; // br2 = 15*16; return br1 | br2 << 16; @@ -99,13 +99,13 @@ void ExperienceOrb::tick() // Usually exp orbs will get created at the same time so smoothen the lagspikes if (followingTime < tickCount - SharedConstants::TICKS_PER_SECOND + (entityId % 100)) { - if (followingPlayer == nullptr || followingPlayer->distanceToSqr(shared_from_this()) > maxDist * maxDist) + if (followingPlayer == NULL || followingPlayer->distanceToSqr(shared_from_this()) > maxDist * maxDist) { followingPlayer = level->getNearestPlayer(shared_from_this(), maxDist); } followingTime = tickCount; } - if (followingPlayer != nullptr) + if (followingPlayer != NULL) { double xdd = (followingPlayer->x - x) / maxDist; double ydd = (followingPlayer->y + followingPlayer->getHeadHeight() - y) / maxDist; @@ -176,9 +176,9 @@ bool ExperienceOrb::hurt(DamageSource *source, float damage) void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", static_cast(health)); - entityTag->putShort(L"Age", static_cast(age)); - entityTag->putShort(L"Value", static_cast(value)); + entityTag->putShort(L"Health", (byte) health); + entityTag->putShort(L"Age", (short) age); + entityTag->putShort(L"Value", (short) value); } void ExperienceOrb::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/ExplodePacket.cpp b/Minecraft.World/ExplodePacket.cpp index 07626161..30d09e46 100644 --- a/Minecraft.World/ExplodePacket.cpp +++ b/Minecraft.World/ExplodePacket.cpp @@ -34,9 +34,9 @@ ExplodePacket::ExplodePacket(double x, double y, double z, float r, unordered_se if (knockback != nullptr) { - knockbackX = static_cast(knockback->x); - knockbackY = static_cast(knockback->y); - knockbackZ = static_cast(knockback->z); + knockbackX = (float) knockback->x; + knockbackY = (float) knockback->y; + knockbackZ = (float) knockback->z; } } @@ -52,14 +52,14 @@ void ExplodePacket::read(DataInputStream *dis) //throws IOException r = dis->readFloat(); int count = dis->readInt(); - int xp = static_cast(x); - int yp = static_cast(y); - int zp = static_cast(z); + int xp = (int)x; + int yp = (int)y; + int zp = (int)z; for (int i=0; i(dis->readByte())+xp; - int yy = static_cast(dis->readByte())+yp; - int zz = static_cast(dis->readByte())+zp; + int xx = ((signed char)dis->readByte())+xp; + int yy = ((signed char)dis->readByte())+yp; + int zz = ((signed char)dis->readByte())+zp; toBlow.push_back( TilePos(xx, yy, zz) ); } } @@ -79,11 +79,11 @@ void ExplodePacket::write(DataOutputStream *dos) //throws IOException dos->writeDouble(y); dos->writeDouble(z); dos->writeFloat(r); - dos->writeInt(static_cast(toBlow.size())); + dos->writeInt((int)toBlow.size()); - int xp = static_cast(x); - int yp = static_cast(y); - int zp = static_cast(z); + int xp = (int)x; + int yp = (int)y; + int zp = (int)z; for ( const TilePos& tp : toBlow ) { @@ -108,7 +108,7 @@ void ExplodePacket::handle(PacketListener *listener) int ExplodePacket::getEstimatedSize() { - return 8*3+4+4+static_cast(toBlow.size())*3+12; + return 8*3+4+4+(int)toBlow.size()*3+12; } float ExplodePacket::getKnockbackX() diff --git a/Minecraft.World/ExplodePacket.h b/Minecraft.World/ExplodePacket.h index caf77c77..d4d8b3f9 100644 --- a/Minecraft.World/ExplodePacket.h +++ b/Minecraft.World/ExplodePacket.h @@ -32,6 +32,6 @@ public: float getKnockbackZ(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ExplodePacket()); } virtual int getId() { return 60; } }; \ No newline at end of file diff --git a/Minecraft.World/Explosion.cpp b/Minecraft.World/Explosion.cpp index 65e719e4..ab305a02 100644 --- a/Minecraft.World/Explosion.cpp +++ b/Minecraft.World/Explosion.cpp @@ -72,10 +72,10 @@ void Explosion::explode() if (t > 0) { Tile *tile = Tile::tiles[t]; - float resistance = source != nullptr ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source); + float resistance = source != NULL ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source); remainingPower -= (resistance + 0.3f) * stepSize; } - if (remainingPower > 0&& (source == nullptr || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower))) + if (remainingPower > 0&& (source == NULL || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower))) { toBlow.insert(TilePos(xt, yt, zt)); } @@ -143,7 +143,7 @@ void Explosion::explode() double sp = level->getSeenPercent(center, e->bb); double pow = (1 - dist) * sp; - if(canDamage) e->hurt(DamageSource::explosion(this), static_cast((pow * pow + pow) / 2 * 8 * r + 1)); + if(canDamage) e->hurt(DamageSource::explosion(this), (int) ((pow * pow + pow) / 2 * 8 * r + 1)); double kbPower = ProtectionEnchantment::getExplosionKnockbackAfterDampener(e, pow); e->xd += xa *kbPower; @@ -163,7 +163,7 @@ void Explosion::explode() } -void Explosion::finalizeExplosion(bool generateParticles, vector *toBlowDirect/*=nullptr*/) // 4J - added toBlowDirect parameter +void Explosion::finalizeExplosion(bool generateParticles, vector *toBlowDirect/*=NULL*/) // 4J - added toBlowDirect parameter { level->playSound(x, y, z, eSoundType_RANDOM_EXPLODE, 4, (1 + (level->random->nextFloat() - level->random->nextFloat()) * 0.2f) * 0.7f); if (r < 2 || !destroyBlocks) @@ -185,7 +185,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector *toBlo app.DebugPrintf("Finalizing explosion size %d\n",toBlow.size()); static const int MAX_EXPLODE_PARTICLES = 50; // 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles - int fraction = static_cast(toBlowArray->size()) / MAX_EXPLODE_PARTICLES; + int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; if( fraction == 0 ) fraction = 1; size_t j = toBlowArray->size() - 1; //for (size_t j = toBlowArray->size() - 1; j >= 0; j--) @@ -262,7 +262,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector *toBlo } PIXEndNamedEvent(); - if( toBlowDirect == nullptr ) delete toBlowArray; + if( toBlowDirect == NULL ) delete toBlowArray; } Explosion::playerVec3Map *Explosion::getHitPlayers() @@ -281,7 +281,7 @@ Vec3 *Explosion::getHitPlayerKnockback( shared_ptr player ) shared_ptr Explosion::getSourceMob() { - if (source == nullptr) return nullptr; + if (source == NULL) return nullptr; if (source->instanceof(eTYPE_PRIMEDTNT)) return dynamic_pointer_cast(source)->getOwner(); if (source->instanceof(eTYPE_LIVINGENTITY)) return dynamic_pointer_cast(source); return nullptr; diff --git a/Minecraft.World/Explosion.h b/Minecraft.World/Explosion.h index 7cefb44b..1fe1e57b 100644 --- a/Minecraft.World/Explosion.h +++ b/Minecraft.World/Explosion.h @@ -36,7 +36,7 @@ public: void explode(); public: - void finalizeExplosion(bool generateParticles, vector *toBlowDirect = nullptr); // 4J - added toBlow parameter + void finalizeExplosion(bool generateParticles, vector *toBlowDirect = NULL); // 4J - added toBlow parameter playerVec3Map *getHitPlayers(); Vec3 *getHitPlayerKnockback( shared_ptr player ); shared_ptr getSourceMob(); diff --git a/Minecraft.World/EyeOfEnderSignal.cpp b/Minecraft.World/EyeOfEnderSignal.cpp index ca76b272..95747a89 100644 --- a/Minecraft.World/EyeOfEnderSignal.cpp +++ b/Minecraft.World/EyeOfEnderSignal.cpp @@ -80,9 +80,9 @@ void EyeOfEnderSignal::lerpMotion(double xd, double yd, double zd) this->zd = zd; if (xRotO == 0 && yRotO == 0) { - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); } } @@ -97,9 +97,9 @@ void EyeOfEnderSignal::tick() y += yd; z += zd; - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, (double)sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -117,8 +117,8 @@ void EyeOfEnderSignal::tick() if (!level->isClientSide) { double dx = tx - x, dz = tz - z; - float tdist = static_cast(sqrt(dx * dx + dz * dz)); - float angle = static_cast(atan2(dz, dx)); + float tdist = (float) sqrt(dx * dx + dz * dz); + float angle = (float) atan2(dz, dx); double tspeed = (sd + (tdist - sd) * .0025); if (tdist < 1) { @@ -163,11 +163,11 @@ void EyeOfEnderSignal::tick() remove(); if (surviveAfterDeath) { - level->addEntity(std::make_shared(level, x, y, z, shared_ptr(new ItemInstance(Item::eyeOfEnder)))); + level->addEntity(shared_ptr( new ItemEntity(level, x, y, z, shared_ptr(new ItemInstance(Item::eyeOfEnder))))); } else { - level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); + level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); } } } diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index 0ff776fd..c0eb7d22 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -24,7 +24,7 @@ void FallingTile::_init() hurtEntities = false; fallDamageMax = 40; fallDamageAmount = 2; - tileData = nullptr; + tileData = NULL; // 4J Added so that client-side falling tiles can fall through blocks // This fixes a bug on the host where the tile update from the server comes in before the client-side falling tile @@ -136,11 +136,11 @@ void FallingTile::tick() { hv->onLand(level, xt, yt, zt, data); } - if (tileData != nullptr && Tile::tiles[tile]->isEntityTile()) + if (tileData != NULL && Tile::tiles[tile]->isEntityTile()) { shared_ptr tileEntity = level->getTileEntity(xt, yt, zt); - if (tileEntity != nullptr) + if (tileEntity != NULL) { CompoundTag *swap = new CompoundTag(); tileEntity->save(swap); @@ -161,13 +161,13 @@ void FallingTile::tick() } else { - if(dropItem && !cancelDrop) spawnAtLocation(std::make_shared(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data)), 0); + if(dropItem && !cancelDrop) spawnAtLocation( shared_ptr(new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data))), 0); } } } else if ( (time > 20 * 5 && !level->isClientSide && (yt < 1 || yt > Level::maxBuildHeight)) || (time > 20 * 30)) { - if(dropItem) spawnAtLocation(std::make_shared(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data)), 0); + if(dropItem) spawnAtLocation( shared_ptr( new ItemInstance(tile, 1, Tile::tiles[tile]->getSpawnResourcesAuxValue(data) )), 0); remove(); } } @@ -212,15 +212,15 @@ void FallingTile::causeFallDamage(float distance) void FallingTile::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Tile", static_cast(tile)); + tag->putByte(L"Tile", (byte) tile); tag->putInt(L"TileID", tile); - tag->putByte(L"Data", static_cast(data)); - tag->putByte(L"Time", static_cast(time)); + tag->putByte(L"Data", (byte) data); + tag->putByte(L"Time", (byte) time); tag->putBoolean(L"DropItem", dropItem); tag->putBoolean(L"HurtEntities", hurtEntities); tag->putFloat(L"FallHurtAmount", fallDamageAmount); tag->putInt(L"FallHurtMax", fallDamageMax); - if (tileData != nullptr) tag->putCompound(L"TileEntityData", tileData); + if (tileData != NULL) tag->putCompound(L"TileEntityData", tileData); } void FallingTile::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/FarmTile.cpp b/Minecraft.World/FarmTile.cpp index 39bf685f..6cbe40ac 100644 --- a/Minecraft.World/FarmTile.cpp +++ b/Minecraft.World/FarmTile.cpp @@ -8,8 +8,8 @@ FarmTile::FarmTile(int id) : Tile(id, Material::dirt,isSolidRender()) { - iconWet = nullptr; - iconDry = nullptr; + iconWet = NULL; + iconDry = NULL; setTicking(true); updateDefaultShape(); diff --git a/Minecraft.World/FastNoise.cpp b/Minecraft.World/FastNoise.cpp index 399c427f..91d039b3 100644 --- a/Minecraft.World/FastNoise.cpp +++ b/Minecraft.World/FastNoise.cpp @@ -34,7 +34,7 @@ FastNoise::~FastNoise() doubleArray FastNoise::getRegion(doubleArray buffer, double x, double y, double z, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale) { - if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; @@ -50,23 +50,23 @@ doubleArray FastNoise::getRegion(doubleArray buffer, double x, double y, double for (int zp = 0; zp < zSize; zp++) { double zz = (z + zp) * zScale; - int Z = static_cast(zz); + int Z = (int) zz; if (zz < Z) Z -= 1; - int zl = static_cast((zz - Z) * 65536); + int zl = (int) ((zz - Z) * 65536); for (int yp = 0; yp < ySize; yp++) { double yy = (y + yp) * yScale; - int Y = static_cast(yy); + int Y = (int) yy; if (yy < Y) Y -= 1; - int yl = static_cast((yy - Y) * 65536); + int yl = (int) ((yy - Y) * 65536); for (int xp = 0; xp < xSize; xp++) { double xx = (x + xp) * xScale; - int X = static_cast(xx); + int X = (int) xx; if (xx < X) X -= 1; - int xl = static_cast((xx - X) * 65536); + int xl = (int) ((xx - X) * 65536); int X0 = (X + 0) * AA; int X1 = (X + 1) * AA; diff --git a/Minecraft.World/FenceGateTile.cpp b/Minecraft.World/FenceGateTile.cpp index bd1326a9..a8de450e 100644 --- a/Minecraft.World/FenceGateTile.cpp +++ b/Minecraft.World/FenceGateTile.cpp @@ -25,7 +25,7 @@ AABB *FenceGateTile::getAABB(Level *level, int x, int y, int z) int data = level->getData(x, y, z); if (isOpen(data)) { - return nullptr; + return NULL; } // 4J Brought forward change from 1.2.3 to fix hit box rotation if (data == Direction::NORTH || data == Direction::SOUTH) @@ -86,7 +86,7 @@ bool FenceGateTile::use(Level *level, int x, int y, int z, shared_ptr pl if (soundOnly) { // 4J - added - just do enough to play the sound - level->levelEvent(player, LevelEvent::SOUND_OPEN_DOOR, x, y, z, 0); // 4J - changed event to pass player rather than nullptr as the source of the event so we can filter the broadcast properly + level->levelEvent(player, LevelEvent::SOUND_OPEN_DOOR, x, y, z, 0); // 4J - changed event to pass player rather than NULL as the source of the event so we can filter the broadcast properly return false; } diff --git a/Minecraft.World/FenceTile.cpp b/Minecraft.World/FenceTile.cpp index 83c31167..39f4aac1 100644 --- a/Minecraft.World/FenceTile.cpp +++ b/Minecraft.World/FenceTile.cpp @@ -122,7 +122,7 @@ bool FenceTile::connectsTo(LevelSource *level, int x, int y, int z) return true; } Tile *tileInstance = Tile::tiles[tile]; - if (tileInstance != nullptr) + if (tileInstance != NULL) { if (tileInstance->material->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 11871e42..82e593dc 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -24,7 +24,7 @@ File::File( const File &parent, const std::wstring& child ) } //Creates a new File instance by converting the given pathname string into an abstract pathname. -File::File( const wstring& pathname ) //: parent( nullptr ) +File::File( const wstring& pathname ) //: parent( NULL ) { // #ifndef _CONTENT_PACKAGE // char buf[256]; @@ -62,7 +62,7 @@ File::File( const wstring& pathname ) //: parent( nullptr ) if( path.back().compare( pathRoot ) != 0 ) this->parent = new File( &path ); else - this->parent = nullptr; + this->parent = NULL; } */ } @@ -75,7 +75,7 @@ File::File( const std::wstring& parent, const std::wstring& child ) //: m_abstr //Creates a new File instance by converting the given path vector into an abstract pathname. /* -File::File( vector *path ) : parent( nullptr ) +File::File( vector *path ) : parent( NULL ) { m_abstractPathName = path->back(); path->pop_back(); @@ -86,7 +86,7 @@ if( path->size() > 0 ) if( path->back().compare( pathRoot ) != 0 ) this->parent = new File( path ); else -this->parent = nullptr; +this->parent = NULL; } } */ @@ -120,10 +120,10 @@ bool File::_delete() bool File::mkdir() const { #ifdef _UNICODE - return CreateDirectory( getPath().c_str(), nullptr) != 0; + return CreateDirectory( getPath().c_str(), NULL) != 0; #else - return CreateDirectory( wstringtofilename(getPath()), nullptr) != 0; + return CreateDirectory( wstringtofilename(getPath()), NULL) != 0; #endif } @@ -167,7 +167,7 @@ bool File::mkdirs() const #ifdef _UNICODE if( GetFileAttributes( pathToHere.c_str() ) == -1 ) { - DWORD result = CreateDirectory( pathToHere.c_str(), nullptr); + DWORD result = CreateDirectory( pathToHere.c_str(), NULL); if( result == 0 ) { // Failed to create @@ -177,7 +177,7 @@ bool File::mkdirs() const #else if( GetFileAttributes( wstringtofilename(pathToHere) ) == -1 ) { - DWORD result = CreateDirectory( wstringtofilename(pathToHere), nullptr); + DWORD result = CreateDirectory( wstringtofilename(pathToHere), NULL); if( result == 0 ) { // Failed to create @@ -321,7 +321,7 @@ std::vector *File::listFiles() const else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); - bool exists = sceFiosDirectoryExistsSync( nullptr, filePath ); + bool exists = sceFiosDirectoryExistsSync( NULL, filePath ); if( !exists ) { app.DebugPrintf("\nsceFiosDirectoryExistsSync - Directory doesn't exist\n"); @@ -334,7 +334,7 @@ std::vector *File::listFiles() const SceFiosDH dh = SCE_FIOS_DH_INVALID; SceFiosBuffer buf; buf.length = 0; - SceFiosOp op = sceFiosDHOpen(nullptr, &dh, filePath, buf); + SceFiosOp op = sceFiosDHOpen(NULL, &dh, filePath, buf); int err = sceFiosOpWait(op); if( err != SCE_FIOS_OK ) @@ -346,24 +346,24 @@ std::vector *File::listFiles() const buf.set(pBuf, (size_t)size); sceFiosOpDelete( op ); - sceFiosDHClose(nullptr, dh); + sceFiosDHClose(NULL, dh); - err = sceFiosDHOpenSync(nullptr, &dh, filePath, buf); + err = sceFiosDHOpenSync(NULL, &dh, filePath, buf); if( err != SCE_FIOS_OK ) { app.DebugPrintf("\nsceFiosDHOpenSync = 0x%x\n",err); } SceFiosDirEntry entry; ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(nullptr, dh, &entry); + err = sceFiosDHReadSync(NULL, dh, &entry); while( err == SCE_FIOS_OK) { vOutput->push_back( new File( *this, filenametowstring( entry.fullPath + entry.offsetToName ) ) ); ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(nullptr, dh, &entry); + err = sceFiosDHReadSync(NULL, dh, &entry); }; - sceFiosDHClose(nullptr, dh); + sceFiosDHClose(NULL, dh); delete pBuf; #else @@ -418,7 +418,7 @@ std::vector *File::listFiles(FileFilter *filter) const { // TODO 4J Stu - Also need to check for I/O errors? if( !isDirectory() ) - return nullptr; + return NULL; std::vector *vOutput = new std::vector(); @@ -576,7 +576,7 @@ int64_t File::length() // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) { return 0; } @@ -660,7 +660,7 @@ const std::wstring File::getPath() const { /* wstring path; - if ( parent != nullptr) + if ( parent != NULL) path = parent->getPath(); else path = wstring(pathRoot); @@ -673,7 +673,7 @@ const std::wstring File::getPath() const std::wstring File::getName() const { - size_t sep = m_abstractPathName.find_last_of(this->pathSeparator); + unsigned int sep = (unsigned int )(m_abstractPathName.find_last_of( this->pathSeparator )); return m_abstractPathName.substr( sep + 1, m_abstractPathName.length() ); } @@ -687,7 +687,7 @@ int File::hash_fnct(const File &k) { int hashCode = 0; - //if (k->parent != nullptr) + //if (k->parent != NULL) // hashCode = hash_fnct(k->getParent()); wchar_t *ref = (wchar_t *) k.m_abstractPathName.c_str(); diff --git a/Minecraft.World/FileHeader.cpp b/Minecraft.World/FileHeader.cpp index a7bdbc90..0a47e043 100644 --- a/Minecraft.World/FileHeader.cpp +++ b/Minecraft.World/FileHeader.cpp @@ -5,7 +5,7 @@ FileHeader::FileHeader() { - lastFile = nullptr; + lastFile = NULL; m_saveVersion = 0; // New saves should have an original version set to the latest version. This will be overridden when we load a save @@ -49,7 +49,7 @@ FileEntry *FileHeader::AddFile( const wstring &name, unsigned int length /* = 0 void FileHeader::RemoveFile( FileEntry *file ) { - if( file == nullptr ) return; + if( file == NULL ) return; AdjustStartOffsets(file, file->getFileSize(), true); @@ -72,13 +72,13 @@ void FileHeader::WriteHeader( LPVOID saveMem ) unsigned int headerOffset = GetStartOfNextData(); // 4J Changed for save version 2 to be the number of files rather than the size in bytes - unsigned int headerSize = static_cast(fileTable.size()); + unsigned int headerSize = (int)(fileTable.size()); //DWORD numberOfBytesWritten = 0; // Write the offset of the header //assert(numberOfBytesWritten == 4); - int *begin = static_cast(saveMem); + int *begin = (int *)saveMem; #ifdef __PSVITA__ VirtualCopyTo(begin, &headerOffset, sizeof(headerOffset)); #else @@ -115,7 +115,7 @@ void FileHeader::WriteHeader( LPVOID saveMem ) app.DebugPrintf("Write save file with original version: %d, and current version %d\n", m_originalSaveVersion, versionNumber); #endif - char *headerPosition = static_cast(saveMem) + headerOffset; + char *headerPosition = (char *)saveMem + headerOffset; #ifdef _DEBUG_FILE_HEADER app.DebugPrintf("\n\nWrite file Header: Offset = %d, Size = %d\n", headerOffset, headerSize); @@ -164,7 +164,7 @@ void FileHeader::ReadHeader( LPVOID saveMem, ESavePlatform plat /*= SAVE_FILE_PL // Read the offset of the header //assert(numberOfBytesRead == 4); - int *begin = static_cast(saveMem); + int *begin = (int *)saveMem; #ifdef __PSVITA__ VirtualCopyFrom(&headerOffset, begin, sizeof(headerOffset)); #else @@ -205,7 +205,7 @@ void FileHeader::ReadHeader( LPVOID saveMem, ESavePlatform plat /*= SAVE_FILE_PL app.DebugPrintf("\n\nRead file Header: Offset = %d, Size = %d\n", headerOffset, headerSize); #endif - char *headerPosition = static_cast(saveMem) + headerOffset; + char *headerPosition = (char *)saveMem + headerOffset; switch( m_saveVersion ) { @@ -321,7 +321,7 @@ unsigned int FileHeader::GetStartOfNextData() unsigned int FileHeader::GetFileSize() { - return GetStartOfNextData() + ( sizeof(FileEntrySaveData) * static_cast(fileTable.size()) ); + return GetStartOfNextData() + ( sizeof(FileEntrySaveData) * (unsigned int)fileTable.size() ); } void FileHeader::AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite, bool subtract /*= false*/) @@ -364,13 +364,13 @@ bool FileHeader::fileExists( const wstring &name ) vector *FileHeader::getFilesWithPrefix(const wstring &prefix) { - vector *files = nullptr; + vector *files = NULL; for( unsigned int i = 0; i < fileTable.size(); ++i ) { if( wcsncmp( fileTable[i]->data.filename, prefix.c_str(), prefix.size() ) == 0 ) { - if( files == nullptr ) + if( files == NULL ) { files = new vector(); } @@ -479,7 +479,7 @@ wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) vector *FileHeader::getValidPlayerDatFiles() { - vector *files = nullptr; + vector *files = NULL; // find filenames that match this pattern // P_5e7ff8372ea9_00000004_Mark_4J @@ -509,7 +509,7 @@ vector *FileHeader::getValidPlayerDatFiles() continue; // if we get here, it must be a valid filename - if( files == nullptr ) + if( files == NULL ) { files = new vector(); } @@ -524,21 +524,21 @@ vector *FileHeader::getValidPlayerDatFiles() vector *FileHeader::getDatFilesWithOnlineID(const PlayerUID& pUID) { if(pUID.isSignedIntoPSN() == false) - return nullptr; + return NULL; vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == nullptr) - return nullptr; + if(datFiles == NULL) + return NULL; // we're looking for the online name from the pUID in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J wchar_t onlineIDW[64]; mbstowcs(onlineIDW, pUID.getOnlineID(), 64); - vector *files = nullptr; + vector *files = NULL; int onlineIDSize = wcslen(onlineIDW); if(onlineIDSize == 0) - return nullptr; + return NULL; wcscat(onlineIDW, L".dat"); @@ -564,7 +564,7 @@ vector *FileHeader::getDatFilesWithOnlineID(const PlayerUID& pUID) { if(wcsncmp(&filenameOnly[onlineIDStart], onlineIDW, onlineIDSize) == 0) { - if( files == nullptr ) + if( files == NULL ) { files = new vector(); } @@ -582,8 +582,8 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU { vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == nullptr) - return nullptr; + if(datFiles == NULL) + return NULL; // we're looking for the mac address and userIDfrom the pUID in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J @@ -592,7 +592,7 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU const wchar_t* pMacStr = macStr.c_str(); const wchar_t* pUserStr = userStr.c_str(); - vector *files = nullptr; + vector *files = NULL; static const int macAddrStart = 2; // 2 characters into the filename static const int userIDStart = 15; // 15 characters into the filename @@ -609,7 +609,7 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU // check the userID matches if(wcsncmp(&filenameOnly[userIDStart], pUserStr, userStr.size()) == 0) { - if( files == nullptr ) + if( files == NULL ) { files = new vector(); } @@ -627,12 +627,12 @@ vector *FileHeader::getDatFilesWithPrimaryUser() { vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == nullptr) - return nullptr; + if(datFiles == NULL) + return NULL; // we're just looking for filenames starting with "P_" in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J - vector *files = nullptr; + vector *files = NULL; char tempStr[128]; for( unsigned int i = 0; i < datFiles->size(); ++i ) @@ -644,7 +644,7 @@ vector *FileHeader::getDatFilesWithPrimaryUser() // check for "P_" prefix if(wcsncmp(&filenameOnly[0], L"P_", 2) == 0) { - if( files == nullptr ) + if( files == NULL ) { files = new vector(); } diff --git a/Minecraft.World/FileInputStream.cpp b/Minecraft.World/FileInputStream.cpp index 7c34a22f..5e0f6ca5 100644 --- a/Minecraft.World/FileInputStream.cpp +++ b/Minecraft.World/FileInputStream.cpp @@ -24,20 +24,20 @@ FileInputStream::FileInputStream(const File &file) file.getPath().c_str(), // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else m_fileHandle = CreateFile( pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif @@ -68,7 +68,7 @@ int FileInputStream::read() &byteRead, // data buffer 1, // number of bytes to read &numberOfBytesRead, // number of bytes read - nullptr // overlapped buffer + NULL // overlapped buffer ); if( bSuccess==FALSE ) @@ -100,7 +100,7 @@ int FileInputStream::read(byteArray b) b.data, // data buffer b.length, // number of bytes to read &numberOfBytesRead, // number of bytes read - nullptr // overlapped buffer + NULL // overlapped buffer ); if( bSuccess==FALSE ) @@ -138,7 +138,7 @@ int FileInputStream::read(byteArray b, unsigned int offset, unsigned int length) &b[offset], // data buffer length, // number of bytes to read &numberOfBytesRead, // number of bytes read - nullptr // overlapped buffer + NULL // overlapped buffer ); if( bSuccess==FALSE ) diff --git a/Minecraft.World/FileOutputStream.cpp b/Minecraft.World/FileOutputStream.cpp index 58a0ecd9..557ba812 100644 --- a/Minecraft.World/FileOutputStream.cpp +++ b/Minecraft.World/FileOutputStream.cpp @@ -24,20 +24,20 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN file.getPath().c_str() , // file name GENERIC_WRITE, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_ALWAYS , // how to create FILE_ATTRIBUTE_NORMAL , // file attributes - nullptr // Unsupported + NULL // Unsupported ); #else m_fileHandle = CreateFile( wstringtofilename(file.getPath()) , // file name GENERIC_WRITE, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - nullptr, // Unused + NULL, // Unused OPEN_ALWAYS , // how to create FILE_ATTRIBUTE_NORMAL , // file attributes - nullptr // Unsupported + NULL // Unsupported ); #endif @@ -61,14 +61,14 @@ void FileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = static_cast(b); + byte value = (byte) b; BOOL result = WriteFile( m_fileHandle, // handle to file &value, // data buffer 1, // number of bytes to write &numberOfBytesWritten, // number of bytes written - nullptr // overlapped buffer + NULL // overlapped buffer ); if( result == 0 ) @@ -93,7 +93,7 @@ void FileOutputStream::write(byteArray b) &b.data, // data buffer b.length, // number of bytes to write &numberOfBytesWritten, // number of bytes written - nullptr // overlapped buffer + NULL // overlapped buffer ); if( result == 0 ) @@ -123,7 +123,7 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng &b[offset], // data buffer length, // number of bytes to write &numberOfBytesWritten, // number of bytes written - nullptr // overlapped buffer + NULL // overlapped buffer ); if( result == 0 ) diff --git a/Minecraft.World/FireChargeItem.cpp b/Minecraft.World/FireChargeItem.cpp index d3499cdc..7a865ff5 100644 --- a/Minecraft.World/FireChargeItem.cpp +++ b/Minecraft.World/FireChargeItem.cpp @@ -10,7 +10,7 @@ FireChargeItem::FireChargeItem(int id) : Item(id) { - m_dragonFireballIcon = nullptr; + m_dragonFireballIcon = NULL; } bool FireChargeItem::useOn(shared_ptr instance, shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) diff --git a/Minecraft.World/FireTile.cpp b/Minecraft.World/FireTile.cpp index 49f859b5..dfb4b961 100644 --- a/Minecraft.World/FireTile.cpp +++ b/Minecraft.World/FireTile.cpp @@ -24,7 +24,7 @@ FireTile::FireTile(int id) : Tile(id, Material::fire,isSolidRender()) burnOdds = new int[256]; memset( burnOdds,0,sizeof(int)*256); - icons = nullptr; + icons = NULL; setTicking(true); } @@ -64,7 +64,7 @@ void FireTile::setFlammable(int id, int flame, int burn) AABB *FireTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool FireTile::blocksLight() diff --git a/Minecraft.World/Fireball.cpp b/Minecraft.World/Fireball.cpp index b520f436..2a538b06 100644 --- a/Minecraft.World/Fireball.cpp +++ b/Minecraft.World/Fireball.cpp @@ -127,10 +127,10 @@ Fireball::Fireball(Level *level, shared_ptr mob, double xa, double void Fireball::tick() { // 4J-PB - Moved forward from 1.2.3 - //if (!level->isClientSide && (owner == nullptr || owner->removed)) + //if (!level->isClientSide && (owner == NULL || owner->removed)) if (!level->isClientSide) { - if((owner != nullptr && owner->removed) || !level->hasChunkAt(static_cast(x), static_cast(y), static_cast(z))) + if((owner != NULL && owner->removed) || !level->hasChunkAt((int) x, (int) y, (int) z)) { app.DebugPrintf("Fireball removed - owner is null or removed is true for owner\n"); remove(); @@ -193,7 +193,7 @@ void Fireball::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != nullptr) + if (res != NULL) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -207,7 +207,7 @@ void Fireball::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != nullptr) + if (p != NULL) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -220,14 +220,14 @@ void Fireball::tick() } - if (hitEntity != nullptr) + if (hitEntity != NULL) { delete res; res = new HitResult(hitEntity); } MemSect(0); - if (res != nullptr) + if (res != NULL) { onHit(res); } @@ -237,8 +237,8 @@ void Fireball::tick() z += zd; double sd = sqrt(xd * xd + zd * zd); - yRot = static_cast(atan2(zd, xd) * 180 / PI) + 90; - xRot = static_cast(atan2(sd, yd) * 180 / PI) - 90; + yRot = (float) (atan2(zd, xd) * 180 / PI) + 90; + xRot = (float) (atan2(sd, yd) * 180 / PI) - 90; while (xRot - xRotO < -180) xRotO -= 360; @@ -297,11 +297,11 @@ float Fireball::getInertia() void Fireball::addAdditonalSaveData(CompoundTag *tag) { - tag->putShort(L"xTile", static_cast(xTile)); - tag->putShort(L"yTile", static_cast(yTile)); - tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putShort(L"xTile", (short) xTile); + tag->putShort(L"yTile", (short) yTile); + tag->putShort(L"zTile", (short) zTile); + tag->putByte(L"inTile", (byte) lastTile); + tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); tag->put(L"direction", newDoubleList(3, xd, yd, zd)); } @@ -343,10 +343,10 @@ bool Fireball::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; markHurt(); - if (source->getEntity() != nullptr) + if (source->getEntity() != NULL) { Vec3 *lookAngle = source->getEntity()->getLookAngle(); - if (lookAngle != nullptr) + if (lookAngle != NULL) { xd = lookAngle->x; yd = lookAngle->y; diff --git a/Minecraft.World/FireworksChargeItem.cpp b/Minecraft.World/FireworksChargeItem.cpp index 8b12c98c..2de2be04 100644 --- a/Minecraft.World/FireworksChargeItem.cpp +++ b/Minecraft.World/FireworksChargeItem.cpp @@ -21,9 +21,9 @@ int FireworksChargeItem::getColor(shared_ptr item, int spriteLayer if (spriteLayer == 1) { Tag *colorTag = getExplosionTagField(item, FireworksItem::TAG_E_COLORS); - if (colorTag != nullptr) + if (colorTag != NULL) { - IntArrayTag *colors = static_cast(colorTag); + IntArrayTag *colors = (IntArrayTag *) colorTag; if (colors->data.length == 1) { return colors->data[0]; @@ -58,12 +58,12 @@ Tag *FireworksChargeItem::getExplosionTagField(shared_ptr instance if (instance->hasTag()) { CompoundTag *explosion = instance->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (explosion != nullptr) + if (explosion != NULL) { return explosion->get(field); } } - return nullptr; + return NULL; } void FireworksChargeItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced) @@ -71,7 +71,7 @@ void FireworksChargeItem::appendHoverText(shared_ptr itemInstance, if (itemInstance->hasTag()) { CompoundTag *explosion = itemInstance->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (explosion != nullptr) + if (explosion != NULL) { appendHoverText(explosion, lines); } diff --git a/Minecraft.World/FireworksItem.cpp b/Minecraft.World/FireworksItem.cpp index f1cdf309..f81b4588 100644 --- a/Minecraft.World/FireworksItem.cpp +++ b/Minecraft.World/FireworksItem.cpp @@ -26,7 +26,7 @@ bool FireworksItem::useOn(shared_ptr instance, shared_ptr if (!level->isClientSide) { - shared_ptr f(new FireworksRocketEntity(level, x + clickX, y + clickY, z + clickZ, instance)); + shared_ptr f = shared_ptr( new FireworksRocketEntity(level, x + clickX, y + clickY, z + clickZ, instance) ); level->addEntity(f); if (!player->abilities.instabuild) @@ -46,7 +46,7 @@ void FireworksItem::appendHoverText(shared_ptr itemInstance, share return; } CompoundTag *fireTag = itemInstance->getTag()->getCompound(TAG_FIREWORKS); - if (fireTag == nullptr) + if (fireTag == NULL) { return; } @@ -56,7 +56,7 @@ void FireworksItem::appendHoverText(shared_ptr itemInstance, share } ListTag *explosions = (ListTag *) fireTag->getList(TAG_EXPLOSIONS); - if (explosions != nullptr && explosions->size() > 0) + if (explosions != NULL && explosions->size() > 0) { for (int i = 0; i < explosions->size(); i++) @@ -69,7 +69,7 @@ void FireworksItem::appendHoverText(shared_ptr itemInstance, share if (eLines.size() > 0) { // Indent lines after first line - for (size_t i = 1; i < eLines.size(); i++) + for (int i = 1; i < eLines.size(); i++) { eLines[i].indent = true; } diff --git a/Minecraft.World/FireworksMenu.cpp b/Minecraft.World/FireworksMenu.cpp index cd9196af..68c9e0f2 100644 --- a/Minecraft.World/FireworksMenu.cpp +++ b/Minecraft.World/FireworksMenu.cpp @@ -15,8 +15,8 @@ FireworksMenu::FireworksMenu(shared_ptr inventory, Level *level, int m_canMakeCharge = false; m_canMakeFade = false; - craftSlots = std::make_shared(this, 3, 3); - resultSlots = std::make_shared(); + craftSlots = shared_ptr( new CraftingContainer(this, 3, 3) ); + resultSlots = shared_ptr( new ResultContainer() ); this->level = level; x = xt; @@ -61,7 +61,7 @@ void FireworksMenu::removed(shared_ptr player) for (int i = 0; i < 9; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != nullptr) + if (item != NULL) { player->drop(item); } @@ -77,7 +77,7 @@ shared_ptr FireworksMenu::quickMoveStack(shared_ptr player { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -145,6 +145,6 @@ bool FireworksMenu::canTakeItemForPickAll(shared_ptr carried, Slot bool FireworksMenu::isValidIngredient(shared_ptr item, int slotId) { - if(item == nullptr || slotId == RESULT_SLOT) return true; + if(item == NULL || slotId == RESULT_SLOT) return true; return FireworksRecipe::isValidIngredient(item, m_canMakeFireworks, m_canMakeCharge, m_canMakeFade); } \ No newline at end of file diff --git a/Minecraft.World/FireworksRecipe.cpp b/Minecraft.World/FireworksRecipe.cpp index feb1cf57..a357c9cb 100644 --- a/Minecraft.World/FireworksRecipe.cpp +++ b/Minecraft.World/FireworksRecipe.cpp @@ -3,7 +3,7 @@ #include "FireworksRecipe.h" DWORD FireworksRecipe::tlsIdx = 0; -FireworksRecipe::ThreadStorage *FireworksRecipe::tlsDefault = nullptr; +FireworksRecipe::ThreadStorage *FireworksRecipe::tlsDefault = NULL; FireworksRecipe::ThreadStorage::ThreadStorage() { @@ -13,7 +13,7 @@ FireworksRecipe::ThreadStorage::ThreadStorage() void FireworksRecipe::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == nullptr ) + if(tlsDefault == NULL ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -28,7 +28,7 @@ void FireworksRecipe::UseDefaultThreadStorage() void FireworksRecipe::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if( tls == tlsDefault ) return; delete tls; @@ -36,7 +36,7 @@ void FireworksRecipe::ReleaseThreadStorage() void FireworksRecipe::setResultItem(shared_ptr item) { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); tls->resultItem = item; } @@ -59,7 +59,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; if (item->id == Item::gunpowder_Id) { @@ -124,7 +124,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l // create fireworks if (sulphurCount >= 1 && paperCount == 1 && chargeComponents == 0) { - resultItem = std::make_shared(Item::fireworks); + resultItem = shared_ptr( new ItemInstance(Item::fireworks) ); if (chargeCount > 0) { CompoundTag *itemTag = new CompoundTag(); @@ -134,16 +134,16 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr || item->id != Item::fireworksCharge_Id) continue; + if (item == NULL || item->id != Item::fireworksCharge_Id) continue; if (item->hasTag() && item->getTag()->contains(FireworksItem::TAG_EXPLOSION)) { - expTags->add(static_cast(item->getTag()->getCompound(FireworksItem::TAG_EXPLOSION)->copy())); + expTags->add((CompoundTag *)item->getTag()->getCompound(FireworksItem::TAG_EXPLOSION)->copy()); } } fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphurCount)); + fireTag->putByte(FireworksItem::TAG_FLIGHT, (byte) sulphurCount); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); resultItem->setTag(itemTag); @@ -155,7 +155,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l if (sulphurCount == 1 && paperCount == 0 && chargeCount == 0 && colorCount > 0 && typeComponents <= 1) { - resultItem = std::make_shared(Item::fireworksCharge); + resultItem = shared_ptr( new ItemInstance(Item::fireworksCharge) ); CompoundTag *itemTag = new CompoundTag(); CompoundTag *expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION); @@ -165,7 +165,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; if (item->id == Item::dye_powder_Id) { @@ -195,10 +195,10 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l } else if (item->id == Item::skull_Id) { - type = FireworksItem::TYPE_CREEPER; + type = FireworksItem::TYPE_CREEPER; } } - intArray colorArray(static_cast(colors.size())); + intArray colorArray(colors.size()); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); @@ -221,7 +221,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; if (item->id == Item::dye_powder_Id) { @@ -230,18 +230,18 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l else if (item->id == Item::fireworksCharge_Id) { resultItem = item->copy(); - resultItem->count = 1; + resultItem->count = 1; } } - intArray colorArray(static_cast(colors.size())); + intArray colorArray(colors.size()); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); } - if (resultItem != nullptr && resultItem->hasTag()) + if (resultItem != NULL && resultItem->hasTag()) { CompoundTag *compound = resultItem->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (compound == nullptr) + if (compound == NULL) { delete colorArray.data; @@ -268,7 +268,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l shared_ptr FireworksRecipe::assemble(shared_ptr craftSlots) { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); return tls->resultItem->copy(); //return resultItem->copy(); } @@ -280,7 +280,7 @@ int FireworksRecipe::size() const ItemInstance *FireworksRecipe::getResultItem() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); return tls->resultItem.get(); //return resultItem.get(); } @@ -301,7 +301,7 @@ void FireworksRecipe::updatePossibleRecipes(shared_ptr craftS for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == nullptr) continue; + if (item == NULL) continue; if (item->id == Item::gunpowder_Id) { diff --git a/Minecraft.World/FireworksRocketEntity.cpp b/Minecraft.World/FireworksRocketEntity.cpp index d3897e4f..e84844f1 100644 --- a/Minecraft.World/FireworksRocketEntity.cpp +++ b/Minecraft.World/FireworksRocketEntity.cpp @@ -15,7 +15,7 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level) : Entity(level) void FireworksRocketEntity::defineSynchedData() { - entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, nullptr); + entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, NULL); } bool FireworksRocketEntity::shouldRenderAtSqrDistance(double distance) @@ -35,13 +35,13 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level, double x, double y, d heightOffset = 0; int flightCount = 1; - if (sourceItem != nullptr && sourceItem->hasTag()) + if (sourceItem != NULL && sourceItem->hasTag()) { entityData->set(DATA_ID_FIREWORKS_ITEM, sourceItem); CompoundTag *tag = sourceItem->getTag(); CompoundTag *compound = tag->getCompound(FireworksItem::TAG_FIREWORKS); - if (compound != nullptr) + if (compound != NULL) { flightCount += compound->getByte(FireworksItem::TAG_FLIGHT); } @@ -61,8 +61,8 @@ void FireworksRocketEntity::lerpMotion(double xd, double yd, double zd) if (xRotO == 0 && yRotO == 0) { double sd = Mth::sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); } } @@ -79,8 +79,8 @@ void FireworksRocketEntity::tick() move(xd, yd, zd); double sd = Mth::sqrt(xd * xd + zd * zd); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -120,8 +120,8 @@ void FireworksRocketEntity::handleEntityEvent(byte eventId) if (eventId == EntityEvent::FIREWORKS_EXPLODE && level->isClientSide) { shared_ptr sourceItem = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM); - CompoundTag *tag = nullptr; - if (sourceItem != nullptr && sourceItem->hasTag()) + CompoundTag *tag = NULL; + if (sourceItem != NULL && sourceItem->hasTag()) { tag = sourceItem->getTag()->getCompound(FireworksItem::TAG_FIREWORKS); } @@ -135,7 +135,7 @@ void FireworksRocketEntity::addAdditonalSaveData(CompoundTag *tag) tag->putInt(L"Life", life); tag->putInt(L"LifeTime", lifetime); shared_ptr itemInstance = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM); - if (itemInstance != nullptr) + if (itemInstance != NULL) { CompoundTag *itemTag = new CompoundTag(); itemInstance->save(itemTag); @@ -150,10 +150,10 @@ void FireworksRocketEntity::readAdditionalSaveData(CompoundTag *tag) lifetime = tag->getInt(L"LifeTime"); CompoundTag *itemTag = tag->getCompound(L"FireworksItem"); - if (itemTag != nullptr) + if (itemTag != NULL) { shared_ptr fromTag = ItemInstance::fromTag(itemTag); - if (fromTag != nullptr) + if (fromTag != NULL) { entityData->set(DATA_ID_FIREWORKS_ITEM, fromTag); } diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index ba0876d9..e38a64b6 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -102,7 +102,7 @@ bool FishingHook::shouldRenderAtSqrDistance(double distance) void FishingHook::shoot(double xd, double yd, double zd, float pow, float uncertainty) { - float dist = static_cast(sqrt(xd * xd + yd * yd + zd * zd)); + float dist = (float) sqrt(xd * xd + yd * yd + zd * zd); xd /= dist; yd /= dist; @@ -122,8 +122,8 @@ void FishingHook::shoot(double xd, double yd, double zd, float pow, float uncert double sd = sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); life = 0; } @@ -161,8 +161,8 @@ void FishingHook::tick() double yrd = Mth::wrapDegrees(lyr - yRot); - yRot += static_cast((yrd) / lSteps); - xRot += static_cast((lxr - xRot) / lSteps); + yRot += (float) ( (yrd) / lSteps ); + xRot += (float) ( (lxr - xRot) / lSteps ); lSteps--; setPos(xt, yt, zt); @@ -173,14 +173,14 @@ void FishingHook::tick() if (!level->isClientSide) { shared_ptr selectedItem = owner->getSelectedItem(); - if (owner->removed || !owner->isAlive() || selectedItem == nullptr || selectedItem->getItem() != Item::fishingRod || distanceToSqr(owner) > 32 * 32) + if (owner->removed || !owner->isAlive() || selectedItem == NULL || selectedItem->getItem() != Item::fishingRod || distanceToSqr(owner) > 32 * 32) { remove(); owner->fishing = nullptr; return; } - if (hookedIn != nullptr) + if (hookedIn != NULL) { if (hookedIn->removed) hookedIn = nullptr; else @@ -226,7 +226,7 @@ void FishingHook::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != nullptr) + if (res != NULL) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -241,7 +241,7 @@ void FishingHook::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != nullptr) + if (p != NULL) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -253,15 +253,15 @@ void FishingHook::tick() } } - if (hitEntity != nullptr) + if (hitEntity != NULL) { delete res; res = new HitResult(hitEntity); } - if (res != nullptr) + if (res != NULL) { - if (res->entity != nullptr) + if (res->entity != NULL) { // 4J Stu Move fix for : fix for #48587 - CRASH: Code: Gameplay: Hitting another player with the fishing bobber crashes the game. [Fishing pole, line] // Incorrect dynamic_pointer_cast used around the shared_from_this() @@ -284,8 +284,8 @@ void FishingHook::tick() move(xd, yd, zd); double sd = sqrt(xd * xd + zd * zd); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, sd) * 180 / PI); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -337,7 +337,7 @@ void FishingHook::tick() nibble = random->nextInt(30) + 10; yd -= 0.2f; playSound(eSoundType_RANDOM_SPLASH, 0.25f, 1 + (random->nextFloat() - random->nextFloat()) * 0.4f); - float yt = static_cast(Mth::floor(bb->y0)); + float yt = (float) Mth::floor(bb->y0); for (int i = 0; i < 1 + bbWidth * 20; i++) { float xo = (random->nextFloat() * 2 - 1) * bbWidth; @@ -377,12 +377,12 @@ void FishingHook::tick() void FishingHook::addAdditonalSaveData(CompoundTag *tag) { - tag->putShort(L"xTile", static_cast(xTile)); - tag->putShort(L"yTile", static_cast(yTile)); - tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putShort(L"xTile", (short) xTile); + tag->putShort(L"yTile", (short) yTile); + tag->putShort(L"zTile", (short) zTile); + tag->putByte(L"inTile", (byte) lastTile); + tag->putByte(L"shake", (byte) shakeTime); + tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); } void FishingHook::readAdditionalSaveData(CompoundTag *tag) @@ -405,7 +405,7 @@ int FishingHook::retrieve() if (level->isClientSide) return 0; int dmg = 0; - if (hookedIn != nullptr) + if (hookedIn != NULL) { double xa = owner->x - x; double ya = owner->y - y; @@ -420,7 +420,7 @@ int FishingHook::retrieve() } else if (nibble > 0) { - shared_ptr ie = std::make_shared(this->Entity::level, x, y, z, shared_ptr(new ItemInstance(Item::fish_raw))); + shared_ptr ie = shared_ptr( new ItemEntity(this->Entity::level, x, y, z, shared_ptr( new ItemInstance(Item::fish_raw) ) ) ); double xa = owner->x - x; double ya = owner->y - y; double za = owner->z - z; @@ -431,7 +431,7 @@ int FishingHook::retrieve() ie->Entity::yd = ya * speed + sqrt(dist) * 0.08; ie->Entity::zd = za * speed; level->addEntity(ie); - owner->level->addEntity(std::make_shared(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(6) + 1)); // 4J Stu brought forward from 1.4 + owner->level->addEntity( shared_ptr( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(6) + 1) ) ); // 4J Stu brought forward from 1.4 dmg = 1; } if (inGround) dmg = 2; @@ -445,5 +445,5 @@ int FishingHook::retrieve() void FishingHook::remove() { Entity::remove(); - if (owner != nullptr) owner->fishing = nullptr; + if (owner != NULL) owner->fishing = nullptr; } \ No newline at end of file diff --git a/Minecraft.World/FishingRodItem.cpp b/Minecraft.World/FishingRodItem.cpp index b9eafd18..883eb2de 100644 --- a/Minecraft.World/FishingRodItem.cpp +++ b/Minecraft.World/FishingRodItem.cpp @@ -17,7 +17,7 @@ FishingRodItem::FishingRodItem(int id) : Item(id) { setMaxDamage(64); setMaxStackSize(1); - emptyIcon = nullptr; + emptyIcon = NULL; } bool FishingRodItem::isHandEquipped() @@ -32,7 +32,7 @@ bool FishingRodItem::isMirroredArt() shared_ptr FishingRodItem::use(shared_ptr instance, Level *level, shared_ptr player) { - if (player->fishing != nullptr) + if (player->fishing != NULL) { int dmg = player->fishing->retrieve(); instance->hurtAndBreak(dmg, player); @@ -44,7 +44,7 @@ shared_ptr FishingRodItem::use(shared_ptr instance, if (!level->isClientSide) { // 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this' - shared_ptr hook = std::make_shared(level, player); + shared_ptr hook = shared_ptr( new FishingHook(level, player) ); player->fishing = hook; level->addEntity( shared_ptr( hook ) ); } diff --git a/Minecraft.World/FixedBiomeSource.cpp b/Minecraft.World/FixedBiomeSource.cpp index 2657bdb4..257ec3db 100644 --- a/Minecraft.World/FixedBiomeSource.cpp +++ b/Minecraft.World/FixedBiomeSource.cpp @@ -26,9 +26,9 @@ float FixedBiomeSource::getTemperature(int x, int z) void FixedBiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, int w, int h) const { - if (temperatures.data == nullptr || temperatures.length < w * h) + if (temperatures.data == NULL || temperatures.length < w * h) { - if(temperatures.data != nullptr) delete [] temperatures.data; + if(temperatures.data != NULL) delete [] temperatures.data; temperatures = floatArray(w * h); } @@ -52,9 +52,9 @@ void FixedBiomeSource::getTemperatureBlock(doubleArray& temperatures, int x, int void FixedBiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const { - if (downfalls.data == nullptr || downfalls.length < w * h) + if (downfalls.data == NULL || downfalls.length < w * h) { - if(downfalls.data != nullptr) delete [] downfalls.data; + if(downfalls.data != NULL) delete [] downfalls.data; downfalls = floatArray(w * h); } Arrays::fill(downfalls, 0, w * h, downfall); @@ -74,9 +74,9 @@ float FixedBiomeSource::getDownfall(int x, int z) const void FixedBiomeSource::getDownfallBlock(doubleArray downfalls, int x, int z, int w, int h) { - if (downfalls.data == nullptr || downfalls.length < w * h) + if (downfalls.data == NULL || downfalls.length < w * h) { - if(downfalls.data != nullptr) delete [] downfalls.data; + if(downfalls.data != NULL) delete [] downfalls.data; downfalls = doubleArray(w * h); } Arrays::fill(downfalls, 0, w * h, (double) downfall); @@ -129,7 +129,7 @@ TilePos *FixedBiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random return new TilePos(x - r + random->nextInt(r * 2 + 1), 0, z - r + random->nextInt(r * 2 + 1)); } - return nullptr; + return NULL; } TilePos *FixedBiomeSource::findBiome(int x, int z, int r, vector allowed, Random *random) @@ -139,7 +139,7 @@ TilePos *FixedBiomeSource::findBiome(int x, int z, int r, vector allowe return new TilePos(x - r + random->nextInt(r * 2 + 1), 0, z - r + random->nextInt(r * 2 + 1)); } - return nullptr; + return NULL; } bool FixedBiomeSource::containsOnly(int x, int z, int r, Biome *allowed) diff --git a/Minecraft.World/FlatGeneratorInfo.cpp b/Minecraft.World/FlatGeneratorInfo.cpp index c983fd2c..dfd4cb66 100644 --- a/Minecraft.World/FlatGeneratorInfo.cpp +++ b/Minecraft.World/FlatGeneratorInfo.cpp @@ -66,7 +66,7 @@ wstring FlatGeneratorInfo::toString() builder.append(SERIALIZATION_VERSION); builder.append(";"); - for (size_t i = 0; i < layers.size(); i++) + for (int i = 0; i < layers.size(); i++) { if (i > 0) builder.append(","); builder.append(layers.get(i).toString()); @@ -114,7 +114,7 @@ wstring FlatGeneratorInfo::toString() FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int yOffset) { - return nullptr; + return NULL; #if 0 std::vector parts = stringSplit(input, L'x'); @@ -135,7 +135,7 @@ FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int y id = _fromString(parts[0]); if (parts.size() > 1) data = _from_String(parts[1]); - if (Tile::tiles[id] == nullptr) + if (Tile::tiles[id] == NULL) { id = 0; data = 0; @@ -151,7 +151,7 @@ FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int y vector *FlatGeneratorInfo::getLayersFromString(const wstring &input) { - if (input.empty()) return nullptr; + if (input.empty()) return NULL; vector *result = new vector(); std::vector depths = stringSplit(input, L','); @@ -161,7 +161,7 @@ vector *FlatGeneratorInfo::getLayersFromString(const wstring &i for(auto& depth : depths) { FlatLayerInfo *layer = getLayerFromString(depth, yOffset); - if (layer == nullptr) return nullptr; + if (layer == NULL) return NULL; result->push_back(layer); yOffset += layer->getHeight(); } @@ -184,7 +184,7 @@ FlatGeneratorInfo *FlatGeneratorInfo::fromValue(const wstring &input) int index = parts.size() == 1 ? 0 : 1; vector *layers = getLayersFromString(parts[index++]); - if (layers == nullptr || layers->isEmpty()) + if (layers == NULL || layers->isEmpty()) { delete layers; return getDefault(); diff --git a/Minecraft.World/FlatLevelSource.cpp b/Minecraft.World/FlatLevelSource.cpp index 9ea1ed36..ec2c0f96 100644 --- a/Minecraft.World/FlatLevelSource.cpp +++ b/Minecraft.World/FlatLevelSource.cpp @@ -55,7 +55,7 @@ void FlatLevelSource::prepareHeights(byteArray blocks) { block = Tile::grass_Id; } - blocks[xc << 11 | zc << 7 | yc] = static_cast(block); + blocks[xc << 11 | zc << 7 | yc] = (byte) block; } } } @@ -70,7 +70,7 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) { // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -141,15 +141,15 @@ vector *FlatLevelSource::getMobsAt(MobCategory *mobCate { Biome *biome = level->getBiome(x, z); if (biome == NULL) - { - return nullptr; + { + return NULL; } return biome->getMobs(mobCategory); } TilePos *FlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return nullptr; + return NULL; } void FlatLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/FleeSunGoal.cpp b/Minecraft.World/FleeSunGoal.cpp index bf1c04ad..d58ad709 100644 --- a/Minecraft.World/FleeSunGoal.cpp +++ b/Minecraft.World/FleeSunGoal.cpp @@ -18,10 +18,10 @@ bool FleeSunGoal::canUse() { if (!level->isDay()) return false; if (!mob->isOnFire()) return false; - if (!level->canSeeSky(Mth::floor(mob->x), static_cast(mob->bb->y0), Mth::floor(mob->z))) return false; + if (!level->canSeeSky(Mth::floor(mob->x), (int) mob->bb->y0, Mth::floor(mob->z))) return false; Vec3 *pos = getHidePos(); - if (pos == nullptr) return false; + if (pos == NULL) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -48,5 +48,5 @@ Vec3 *FleeSunGoal::getHidePos() int zt = Mth::floor(mob->z + random->nextInt(20) - 10); if (!level->canSeeSky(xt, yt, zt) && mob->getWalkTargetValue(xt, yt, zt) < 0) return Vec3::newTemp(xt, yt, zt); } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.World/FlippedIcon.cpp b/Minecraft.World/FlippedIcon.cpp index 37122bfc..559423d7 100644 --- a/Minecraft.World/FlippedIcon.cpp +++ b/Minecraft.World/FlippedIcon.cpp @@ -41,7 +41,7 @@ float FlippedIcon::getU1(bool adjust/*=false*/) const float FlippedIcon::getU(double offset, bool adjust/*=false*/) const { float diff = getU1(adjust) - getU0(adjust); - return getU0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); + return getU0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } float FlippedIcon::getV0(bool adjust/*=false*/) const @@ -59,7 +59,7 @@ float FlippedIcon::getV1(bool adjust/*=false*/) const float FlippedIcon::getV(double offset, bool adjust/*=false*/) const { float diff = getV1(adjust) - getV0(adjust); - return getV0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); + return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); } wstring FlippedIcon::getName() const diff --git a/Minecraft.World/FloatTag.h b/Minecraft.World/FloatTag.h index cc687da8..80301649 100644 --- a/Minecraft.World/FloatTag.h +++ b/Minecraft.World/FloatTag.h @@ -29,7 +29,7 @@ public: { if (Tag::equals(obj)) { - FloatTag *o = static_cast(obj); + FloatTag *o = (FloatTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/FlowerFeature.cpp b/Minecraft.World/FlowerFeature.cpp index c5cd68c6..f24d61bf 100644 --- a/Minecraft.World/FlowerFeature.cpp +++ b/Minecraft.World/FlowerFeature.cpp @@ -12,7 +12,7 @@ FlowerFeature::FlowerFeature(int tile) bool FlowerFeature::place(Level *level, Random *random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 8, y - 4, z - 8, x + 8, y + 4, z + 8); diff --git a/Minecraft.World/FlowerPotTile.cpp b/Minecraft.World/FlowerPotTile.cpp index 80fdf2e4..4cdd529c 100644 --- a/Minecraft.World/FlowerPotTile.cpp +++ b/Minecraft.World/FlowerPotTile.cpp @@ -36,7 +36,7 @@ bool FlowerPotTile::isCubeShaped() bool FlowerPotTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { shared_ptr item = player->inventory->getSelected(); - if (item == nullptr) return false; + if (item == NULL) return false; if (level->getData(x, y, z) != 0) return false; int type = getTypeFromItem(item); @@ -62,7 +62,7 @@ int FlowerPotTile::cloneTileId(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == nullptr) + if (item == NULL) { return Item::flowerPot_Id; } @@ -76,7 +76,7 @@ int FlowerPotTile::cloneTileData(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == nullptr) + if (item == NULL) { return Item::flowerPot_Id; } @@ -113,7 +113,7 @@ void FlowerPotTile::spawnResources(Level *level, int x, int y, int z, int data, if (data > 0) { shared_ptr item = getItemFromType(data); - if (item != nullptr) popResource(level, x, y, z, item); + if (item != NULL) popResource(level, x, y, z, item); } } @@ -127,27 +127,27 @@ shared_ptr FlowerPotTile::getItemFromType(int type) switch (type) { case TYPE_FLOWER_RED: - return std::make_shared(Tile::rose); + return shared_ptr( new ItemInstance(Tile::rose) ); case TYPE_FLOWER_YELLOW: - return std::make_shared(Tile::flower); + return shared_ptr( new ItemInstance(Tile::flower) ); case TYPE_CACTUS: - return std::make_shared(Tile::cactus); + return shared_ptr( new ItemInstance(Tile::cactus) ); case TYPE_MUSHROOM_BROWN: - return std::make_shared(Tile::mushroom_brown); + return shared_ptr( new ItemInstance(Tile::mushroom_brown) ); case TYPE_MUSHROOM_RED: - return std::make_shared(Tile::mushroom_red); + return shared_ptr( new ItemInstance(Tile::mushroom_red) ); case TYPE_DEAD_BUSH: - return std::make_shared(Tile::deadBush); + return shared_ptr( new ItemInstance(Tile::deadBush) ); case TYPE_SAPLING_DEFAULT: - return std::make_shared(Tile::sapling, 1, Sapling::TYPE_DEFAULT); + return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_DEFAULT) ); case TYPE_SAPLING_BIRCH: - return std::make_shared(Tile::sapling, 1, Sapling::TYPE_BIRCH); + return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_BIRCH) ); case TYPE_SAPLING_EVERGREEN: - return std::make_shared(Tile::sapling, 1, Sapling::TYPE_EVERGREEN); + return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_EVERGREEN) ); case TYPE_SAPLING_JUNGLE: - return std::make_shared(Tile::sapling, 1, Sapling::TYPE_JUNGLE); + return shared_ptr( new ItemInstance(Tile::sapling, 1, Sapling::TYPE_JUNGLE) ); case TYPE_FERN: - return std::make_shared(Tile::tallgrass, 1, TallGrass::FERN); + return shared_ptr( new ItemInstance(Tile::tallgrass, 1, TallGrass::FERN) ); } return nullptr; diff --git a/Minecraft.World/FlyingMob.cpp b/Minecraft.World/FlyingMob.cpp index 28404108..1757ae58 100644 --- a/Minecraft.World/FlyingMob.cpp +++ b/Minecraft.World/FlyingMob.cpp @@ -75,7 +75,7 @@ void FlyingMob::travel(float xa, float ya) walkAnimSpeedO = walkAnimSpeed; double xxd = x - xo; double zzd = z - zo; - float wst = static_cast(sqrt(xxd * xxd + zzd * zzd)) * 4; + float wst = (float) sqrt(xxd * xxd + zzd * zzd) * 4; if (wst > 1) wst = 1; walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f; walkAnimPos += walkAnimSpeed; diff --git a/Minecraft.World/FollowOwnerGoal.cpp b/Minecraft.World/FollowOwnerGoal.cpp index 89ec4643..8565d782 100644 --- a/Minecraft.World/FollowOwnerGoal.cpp +++ b/Minecraft.World/FollowOwnerGoal.cpp @@ -25,7 +25,7 @@ FollowOwnerGoal::FollowOwnerGoal(TamableAnimal *tamable, double speedModifier, f bool FollowOwnerGoal::canUse() { shared_ptr owner = dynamic_pointer_cast( tamable->getOwner() ); - if (owner == nullptr) return false; + if (owner == NULL) return false; if (tamable->isSitting()) return false; if (tamable->distanceToSqr(owner) < startDistance * startDistance) return false; this->owner = weak_ptr(owner); @@ -34,7 +34,7 @@ bool FollowOwnerGoal::canUse() bool FollowOwnerGoal::canContinueToUse() { - return owner.lock() != nullptr && !navigation->isDone() && tamable->distanceToSqr(owner.lock()) > stopDistance * stopDistance && !tamable->isSitting(); + return owner.lock() != NULL && !navigation->isDone() && tamable->distanceToSqr(owner.lock()) > stopDistance * stopDistance && !tamable->isSitting(); } void FollowOwnerGoal::start() diff --git a/Minecraft.World/FollowParentGoal.cpp b/Minecraft.World/FollowParentGoal.cpp index d8f3bad9..8983590a 100644 --- a/Minecraft.World/FollowParentGoal.cpp +++ b/Minecraft.World/FollowParentGoal.cpp @@ -33,7 +33,7 @@ bool FollowParentGoal::canUse() } delete parents; - if (closest == nullptr) return false; + if (closest == NULL) return false; if (closestDistSqr < 3 * 3) return false; parent = weak_ptr(closest); return true; @@ -41,7 +41,7 @@ bool FollowParentGoal::canUse() bool FollowParentGoal::canContinueToUse() { - if (parent.lock() == nullptr || !parent.lock()->isAlive()) return false; + if (parent.lock() == NULL || !parent.lock()->isAlive()) return false; double distSqr = animal->distanceToSqr(parent.lock()); if (distSqr < 3 * 3 || distSqr > 16 * 16) return false; return true; diff --git a/Minecraft.World/FoodConstants.cpp b/Minecraft.World/FoodConstants.cpp index a8e024a2..6ced45d5 100644 --- a/Minecraft.World/FoodConstants.cpp +++ b/Minecraft.World/FoodConstants.cpp @@ -3,8 +3,8 @@ #include "FoodConstants.h" const int FoodConstants::MAX_FOOD = 20; -const float FoodConstants::MAX_SATURATION = static_cast(FoodConstants::MAX_FOOD); -const float FoodConstants::START_SATURATION = static_cast(FoodConstants::MAX_SATURATION) / 4.0f; +const float FoodConstants::MAX_SATURATION = (float) FoodConstants::MAX_FOOD; +const float FoodConstants::START_SATURATION = (float) FoodConstants::MAX_SATURATION / 4.0f; const float FoodConstants::SATURATION_FLOOR = FoodConstants::MAX_SATURATION / 8.0f; // this value modifies how quickly food is dropped diff --git a/Minecraft.World/FoodItem.h b/Minecraft.World/FoodItem.h index 3fa04ed4..16e6ce3f 100644 --- a/Minecraft.World/FoodItem.h +++ b/Minecraft.World/FoodItem.h @@ -8,7 +8,7 @@ class Level; class FoodItem : public Item { public: - static const int EAT_DURATION = static_cast(20 * 1.6); + static const int EAT_DURATION = (int) (20 * 1.6); private: const int nutrition; diff --git a/Minecraft.World/FurnaceMenu.cpp b/Minecraft.World/FurnaceMenu.cpp index 2bc2d2bd..f67d6388 100644 --- a/Minecraft.World/FurnaceMenu.cpp +++ b/Minecraft.World/FurnaceMenu.cpp @@ -86,7 +86,7 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, bool charcoalUsed = furnace->wasCharcoalUsed(); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -112,7 +112,7 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, return nullptr; } } - else if (FurnaceRecipes::getInstance()->getResult(stack->getItem()->id) != nullptr) + else if (FurnaceRecipes::getInstance()->getResult(stack->getItem()->id) != NULL) { if (!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT + 1, false)) { diff --git a/Minecraft.World/FurnaceRecipes.cpp b/Minecraft.World/FurnaceRecipes.cpp index f0a4c770..bed4e1b6 100644 --- a/Minecraft.World/FurnaceRecipes.cpp +++ b/Minecraft.World/FurnaceRecipes.cpp @@ -3,7 +3,7 @@ #include "Tile.h" #include "FurnaceRecipes.h" -FurnaceRecipes *FurnaceRecipes::instance = nullptr; +FurnaceRecipes *FurnaceRecipes::instance = NULL; void FurnaceRecipes::staticCtor() { @@ -63,7 +63,7 @@ ItemInstance *FurnaceRecipes::getResult(int itemId) { return it->second; } - return nullptr; + return NULL; } unordered_map *FurnaceRecipes::getRecipies() diff --git a/Minecraft.World/FurnaceResultSlot.cpp b/Minecraft.World/FurnaceResultSlot.cpp index 48f2f8fb..d845dada 100644 --- a/Minecraft.World/FurnaceResultSlot.cpp +++ b/Minecraft.World/FurnaceResultSlot.cpp @@ -61,8 +61,8 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr carried) } else if (value < 1) { - int baseValue = floor(static_cast(amount) * value); - if (baseValue < ceil(static_cast(amount) * value) && static_cast(Math::random()) < ((static_cast(amount) * value) - baseValue)) + int baseValue = floor((float) amount * value); + if (baseValue < ceil((float) amount * value) && (float) Math::random() < (((float) amount * value) - baseValue)) { baseValue++; } @@ -73,7 +73,7 @@ void FurnaceResultSlot::checkTakeAchievements(shared_ptr carried) { int newCount = ExperienceOrb::getExperienceValue(amount); amount -= newCount; - player->level->addEntity(std::make_shared(player->level, player->x, player->y + .5, player->z + .5, newCount)); + player->level->addEntity(shared_ptr( new ExperienceOrb(player->level, player->x, player->y + .5, player->z + .5, newCount) )); } } diff --git a/Minecraft.World/FurnaceTile.cpp b/Minecraft.World/FurnaceTile.cpp index d8856f4e..d22d6ca7 100644 --- a/Minecraft.World/FurnaceTile.cpp +++ b/Minecraft.World/FurnaceTile.cpp @@ -17,8 +17,8 @@ FurnaceTile::FurnaceTile(int id, bool lit) : BaseEntityTile(id, Material::stone) random = new Random(); this->lit = lit; - iconTop = nullptr; - iconFront = nullptr; + iconTop = NULL; + iconFront = NULL; } int FurnaceTile::getResource(int data, Random *random, int playerBonusLevel) @@ -117,7 +117,7 @@ bool FurnaceTile::use(Level *level, int x, int y, int z, shared_ptr play return true; } shared_ptr furnace = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (furnace != nullptr ) player->openFurnace(furnace); + if (furnace != NULL ) player->openFurnace(furnace); return true; } @@ -132,7 +132,7 @@ void FurnaceTile::setLit(bool lit, Level *level, int x, int y, int z) noDrop = false; level->setData(x, y, z, data, Tile::UPDATE_CLIENTS); - if( te != nullptr ) + if( te != NULL ) { te->clearRemoved(); level->setTileEntity(x, y, z, te); @@ -141,7 +141,7 @@ void FurnaceTile::setLit(bool lit, Level *level, int x, int y, int z) shared_ptr FurnaceTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new FurnaceTileEntity() ); } void FurnaceTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by, shared_ptr itemInstance) @@ -164,12 +164,12 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (!noDrop) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( container != nullptr ) + if( container != NULL ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -192,16 +192,16 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) } #endif - shared_ptr newItem = std::make_shared(item->id, count, item->getAuxValue()); + shared_ptr newItem = shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()) ); newItem->set4JData( item->get4JData() ); - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, newItem); + shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem) ); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 901235c0..1aa2c300 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/FurnaceTileEntity.cpp @@ -53,7 +53,7 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co { m_charcoalUsed = false; - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -79,7 +79,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) { m_charcoalUsed = false; - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -92,7 +92,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) void FurnaceTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } @@ -140,16 +140,16 @@ void FurnaceTileEntity::load(CompoundTag *base) void FurnaceTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BurnTime", static_cast(litTime)); - base->putShort(L"CookTime", static_cast(tickCount)); + base->putShort(L"BurnTime", (short) (litTime)); + base->putShort(L"CookTime", (short) (tickCount)); ListTag *listTag = new ListTag(); for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } @@ -194,7 +194,7 @@ void FurnaceTileEntity::tick() litTime--; } - if ( level != nullptr && !level->isClientSide) + if ( level != NULL && !level->isClientSide) { if (litTime == 0 && canBurn()) { @@ -202,7 +202,7 @@ void FurnaceTileEntity::tick() if (litTime > 0) { changed = true; - if (items[SLOT_FUEL] != nullptr) + if (items[SLOT_FUEL] != NULL) { // 4J Added: Keep track of whether charcoal was used in production of current stack. if ( items[SLOT_FUEL]->getItem()->id == Item::coal_Id @@ -215,7 +215,7 @@ void FurnaceTileEntity::tick() if (items[SLOT_FUEL]->count == 0) { Item *remaining = items[SLOT_FUEL]->getItem()->getCraftingRemainingItem(); - items[SLOT_FUEL] = remaining != nullptr ? std::make_shared(remaining) : nullptr; + items[SLOT_FUEL] = remaining != NULL ? shared_ptr(new ItemInstance(remaining)) : nullptr; } } } @@ -249,10 +249,10 @@ void FurnaceTileEntity::tick() bool FurnaceTileEntity::canBurn() { - if (items[SLOT_INPUT] == nullptr) return false; + if (items[SLOT_INPUT] == NULL) return false; const ItemInstance *burnResult = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (burnResult == nullptr) return false; - if (items[SLOT_RESULT] == nullptr) return true; + if (burnResult == NULL) return false; + if (items[SLOT_RESULT] == NULL) return true; if (!items[SLOT_RESULT]->sameItem_not_shared(burnResult)) return false; if (items[SLOT_RESULT]->count < getMaxStackSize() && items[SLOT_RESULT]->count < items[SLOT_RESULT]->getMaxStackSize()) return true; if (items[SLOT_RESULT]->count < burnResult->getMaxStackSize()) return true; @@ -265,7 +265,7 @@ void FurnaceTileEntity::burn() if (!canBurn()) return; const ItemInstance *result = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (items[SLOT_RESULT] == nullptr) items[SLOT_RESULT] = result->copy(); + if (items[SLOT_RESULT] == NULL) items[SLOT_RESULT] = result->copy(); else if (items[SLOT_RESULT]->id == result->id) items[SLOT_RESULT]->count++; items[SLOT_INPUT]->count--; @@ -275,12 +275,12 @@ void FurnaceTileEntity::burn() int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) { - if (itemInstance == nullptr) return 0; + if (itemInstance == NULL) return 0; int id = itemInstance->getItem()->id; Item *item = itemInstance->getItem(); - if (id < 256 && Tile::tiles[id] != nullptr) + if (id < 256 && Tile::tiles[id] != NULL) { Tile *tile = Tile::tiles[id]; @@ -300,15 +300,15 @@ int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) } } - if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + if (dynamic_cast(item) && ((DiggerItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && ((WeaponItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && ((HoeItem *) item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } @@ -396,7 +396,7 @@ bool FurnaceTileEntity::canTakeItemThroughFace(int slot, shared_ptr FurnaceTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new FurnaceTileEntity() ); TileEntity::clone(result); result->litTime = litTime; @@ -405,7 +405,7 @@ shared_ptr FurnaceTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/FuzzyZoomLayer.cpp b/Minecraft.World/FuzzyZoomLayer.cpp index c8cbf553..54155ff5 100644 --- a/Minecraft.World/FuzzyZoomLayer.cpp +++ b/Minecraft.World/FuzzyZoomLayer.cpp @@ -66,7 +66,7 @@ shared_ptrFuzzyZoomLayer::zoom(int64_t seed, shared_ptrsup, int co shared_ptr result = sup; for (int i = 0; i < count; i++) { - result = std::make_shared(seed + i, result); + result = shared_ptr(new FuzzyZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/GameCommandPacket.cpp b/Minecraft.World/GameCommandPacket.cpp index 17c5316a..98cdd312 100644 --- a/Minecraft.World/GameCommandPacket.cpp +++ b/Minecraft.World/GameCommandPacket.cpp @@ -15,7 +15,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, byteArray data) this->data = data; length = 0; - if (data.data != nullptr) + if (data.data != NULL) { length = data.length; @@ -37,12 +37,12 @@ GameCommandPacket::~GameCommandPacket() void GameCommandPacket::read(DataInputStream *dis) { - command = static_cast(dis->readInt()); + command = (EGameCommand)dis->readInt(); length = dis->readShort(); if (length > 0 && length < Short::MAX_VALUE) { - if(data.data != nullptr) + if(data.data != NULL) { delete [] data.data; } @@ -54,8 +54,8 @@ void GameCommandPacket::read(DataInputStream *dis) void GameCommandPacket::write(DataOutputStream *dos) { dos->writeInt(command); - dos->writeShort(static_cast(length)); - if (data.data != nullptr) + dos->writeShort((short) length); + if (data.data != NULL) { dos->write(data); } diff --git a/Minecraft.World/GameCommandPacket.h b/Minecraft.World/GameCommandPacket.h index d4827974..1f63e950 100644 --- a/Minecraft.World/GameCommandPacket.h +++ b/Minecraft.World/GameCommandPacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new GameCommandPacket()); } virtual int getId() { return 167; } }; \ No newline at end of file diff --git a/Minecraft.World/GameEventPacket.h b/Minecraft.World/GameEventPacket.h index c1134e7f..93ea911c 100644 --- a/Minecraft.World/GameEventPacket.h +++ b/Minecraft.World/GameEventPacket.h @@ -40,6 +40,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new GameEventPacket()); } virtual int getId() { return 70; } }; \ No newline at end of file diff --git a/Minecraft.World/GameModeCommand.cpp b/Minecraft.World/GameModeCommand.cpp index 6e4cd858..f8c1ffb6 100644 --- a/Minecraft.World/GameModeCommand.cpp +++ b/Minecraft.World/GameModeCommand.cpp @@ -37,7 +37,7 @@ void GameModeCommand::execute(shared_ptr source, byteArray comman GameType *GameModeCommand::getModeForString(shared_ptr source, const wstring &name) { - return nullptr; + return NULL; //if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) { // return GameType.SURVIVAL; //} else if (name.equalsIgnoreCase(GameType.CREATIVE.getName()) || name.equalsIgnoreCase("c")) { diff --git a/Minecraft.World/GenericStats.cpp b/Minecraft.World/GenericStats.cpp index d97c182a..1fa90151 100644 --- a/Minecraft.World/GenericStats.cpp +++ b/Minecraft.World/GenericStats.cpp @@ -4,161 +4,161 @@ #include "GenericStats.h" -GenericStats *GenericStats::instance = nullptr; +GenericStats *GenericStats::instance = NULL; Stat* GenericStats::get_walkOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_swimOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_fallOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_climbOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_minecartOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_boatOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_pigOneM() { - return nullptr; + return NULL; } Stat* GenericStats::get_portalsCreated() { - return nullptr; + return NULL; } Stat* GenericStats::get_cowsMilked() { - return nullptr; + return NULL; } Stat* GenericStats::get_netherLavaCollected() { - return nullptr; + return NULL; } Stat* GenericStats::get_killMob() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsZombie() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsSkeleton() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsCreeper() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsSpider() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsSpiderJockey() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsZombiePigman() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsSlime() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsGhast() { - return nullptr; + return NULL; } Stat* GenericStats::get_killsNetherZombiePigman() { - return nullptr; + return NULL; } Stat* GenericStats::get_breedEntity(eINSTANCEOF entityId) { - return nullptr; + return NULL; } Stat* GenericStats::get_tamedEntity(eINSTANCEOF entityId) { - return nullptr; + return NULL; } Stat* GenericStats::get_curedEntity(eINSTANCEOF entityId) { - return nullptr; + return NULL; } Stat* GenericStats::get_craftedEntity(eINSTANCEOF entityId) { - return nullptr; + return NULL; } Stat* GenericStats::get_shearedEntity(eINSTANCEOF entityId) { - return nullptr; + return NULL; } Stat* GenericStats::get_totalBlocksMined() { - return nullptr; + return NULL; } Stat* GenericStats::get_timePlayed() { - return nullptr; + return NULL; } Stat* GenericStats::get_blocksPlaced(int blockId) { - return nullptr; + return NULL; } Stat* GenericStats::get_blocksMined(int blockId) { - return nullptr; + return NULL; } Stat* GenericStats::get_itemsCollected(int itemId, int itemAux) { - return nullptr; + return NULL; } Stat* GenericStats::get_itemsCrafted(int itemId) { - return nullptr; + return NULL; } Stat* GenericStats::get_itemsSmelted(int itemId) @@ -168,37 +168,37 @@ Stat* GenericStats::get_itemsSmelted(int itemId) Stat* GenericStats::get_itemsUsed(int itemId) { - return nullptr; + return NULL; } Stat *GenericStats::get_itemsBought(int itemId) { - return nullptr; + return NULL; } Stat* GenericStats::get_killsEnderdragon() { - return nullptr; + return NULL; } Stat* GenericStats::get_completeTheEnd() { - return nullptr; + return NULL; } Stat* GenericStats::get_changedDimension(int from, int to) { - return nullptr; + return NULL; } Stat* GenericStats::get_enteredBiome(int biomeId) { - return nullptr; + return NULL; } Stat* GenericStats::get_achievement(eAward achievementId) { - return nullptr; + return NULL; } Stat* GenericStats::openInventory() @@ -286,7 +286,7 @@ Stat* GenericStats::snipeSkeleton() #ifndef _XBOX return instance->get_achievement( eAward_snipeSkeleton ); #else - return nullptr; + return NULL; #endif } @@ -295,7 +295,7 @@ Stat* GenericStats::diamonds() #ifndef _XBOX return instance->get_achievement( eAward_diamonds ); #else - return nullptr; + return NULL; #endif } @@ -304,7 +304,7 @@ Stat* GenericStats::ghast() #ifndef _XBOX return instance->get_achievement( eAward_ghast ); #else - return nullptr; + return NULL; #endif } @@ -313,7 +313,7 @@ Stat* GenericStats::blazeRod() #ifndef _XBOX return instance->get_achievement( eAward_blazeRod ); #else - return nullptr; + return NULL; #endif } @@ -322,7 +322,7 @@ Stat* GenericStats::potion() #ifndef _XBOX return instance->get_achievement( eAward_potion ); #else - return nullptr; + return NULL; #endif } @@ -331,7 +331,7 @@ Stat* GenericStats::theEnd() #ifndef _XBOX return instance->get_achievement( eAward_theEnd ); #else - return nullptr; + return NULL; #endif } @@ -340,7 +340,7 @@ Stat* GenericStats::winGame() #ifndef _XBOX return instance->get_achievement( eAward_winGame ); #else - return nullptr; + return NULL; #endif } @@ -349,7 +349,7 @@ Stat* GenericStats::enchantments() #ifndef _XBOX return instance->get_achievement( eAward_enchantments ); #else - return nullptr; + return NULL; #endif } @@ -358,7 +358,7 @@ Stat* GenericStats::overkill() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement( eAward_overkill ); #else - return nullptr; + return NULL; #endif } @@ -367,7 +367,7 @@ Stat* GenericStats::bookcase() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement( eAward_bookcase ); #else - return nullptr; + return NULL; #endif } @@ -426,7 +426,7 @@ Stat* GenericStats::adventuringTime() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_adventuringTime); #else - return nullptr; + return NULL; #endif } @@ -435,7 +435,7 @@ Stat* GenericStats::repopulation() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_repopulation); #else - return nullptr; + return NULL; #endif } @@ -444,7 +444,7 @@ Stat* GenericStats::porkChop() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_eatPorkChop); #else - return nullptr; + return NULL; #endif } @@ -453,7 +453,7 @@ Stat* GenericStats::diamondsToYou() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_diamondsToYou); #else - return nullptr; + return NULL; #endif } @@ -462,7 +462,7 @@ Stat* GenericStats::passingTheTime() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_play100Days); #else - return nullptr; + return NULL; #endif } @@ -471,7 +471,7 @@ Stat* GenericStats::archer() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_arrowKillCreeper); #else - return nullptr; + return NULL; #endif } @@ -480,7 +480,7 @@ Stat* GenericStats::theHaggler() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_theHaggler); #else - return nullptr; + return NULL; #endif } @@ -489,7 +489,7 @@ Stat* GenericStats::potPlanter() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_potPlanter); #else - return nullptr; + return NULL; #endif } @@ -498,7 +498,7 @@ Stat* GenericStats::itsASign() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_itsASign); #else - return nullptr; + return NULL; #endif } @@ -507,7 +507,7 @@ Stat* GenericStats::ironBelly() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_ironBelly); #else - return nullptr; + return NULL; #endif } @@ -516,7 +516,7 @@ Stat* GenericStats::haveAShearfulDay() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_haveAShearfulDay); #else - return nullptr; + return NULL; #endif } @@ -525,7 +525,7 @@ Stat* GenericStats::rainbowCollection() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_rainbowCollection); #else - return nullptr; + return NULL; #endif } @@ -534,7 +534,7 @@ Stat* GenericStats::stayinFrosty() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_stayinFrosty); #else - return nullptr; + return NULL; #endif } @@ -543,7 +543,7 @@ Stat* GenericStats::chestfulOfCobblestone() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_chestfulOfCobblestone); #else - return nullptr; + return NULL; #endif } @@ -552,7 +552,7 @@ Stat* GenericStats::renewableEnergy() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_renewableEnergy); #else - return nullptr; + return NULL; #endif } @@ -561,7 +561,7 @@ Stat* GenericStats::musicToMyEars() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_musicToMyEars); #else - return nullptr; + return NULL; #endif } @@ -570,7 +570,7 @@ Stat* GenericStats::bodyGuard() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_bodyGuard); #else - return nullptr; + return NULL; #endif } @@ -579,7 +579,7 @@ Stat* GenericStats::ironMan() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_ironMan); #else - return nullptr; + return NULL; #endif } @@ -588,7 +588,7 @@ Stat* GenericStats::zombieDoctor() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_zombieDoctor); #else - return nullptr; + return NULL; #endif } @@ -597,7 +597,7 @@ Stat* GenericStats::lionTamer() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_lionTamer); #else - return nullptr; + return NULL; #endif } @@ -835,7 +835,7 @@ byteArray GenericStats::param_itemsSmelted(int id, int aux, int count) byteArray GenericStats::param_itemsUsed(shared_ptr plr, shared_ptr itm) { - if ( (plr != nullptr) && (itm != nullptr) ) return instance->getParam_itemsUsed(plr, itm); + if ( (plr != NULL) && (itm != NULL) ) return instance->getParam_itemsUsed(plr, itm); else return instance->getParam_noArgs(); } @@ -846,7 +846,7 @@ byteArray GenericStats::param_itemsBought(int id, int aux, int count) byteArray GenericStats::param_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc) { - if ( (plr != nullptr) && (mob != nullptr) ) return instance->getParam_mobKill(plr, mob, dmgSrc); + if ( (plr != NULL) && (mob != NULL) ) return instance->getParam_mobKill(plr, mob, dmgSrc); else return instance->getParam_noArgs(); } diff --git a/Minecraft.World/GetInfoPacket.h b/Minecraft.World/GetInfoPacket.h index a7c758ba..90688f3e 100644 --- a/Minecraft.World/GetInfoPacket.h +++ b/Minecraft.World/GetInfoPacket.h @@ -11,6 +11,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new GetInfoPacket()); } virtual int getId() { return 254; } }; \ No newline at end of file diff --git a/Minecraft.World/Ghast.cpp b/Minecraft.World/Ghast.cpp index 738a42da..f0817791 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/Ghast.cpp @@ -56,7 +56,7 @@ 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() != NULL) && source->getEntity()->instanceof(eTYPE_PLAYER) ) { // reflected fireball, kill the ghast FlyingMob::hurt(source, 1000); @@ -72,7 +72,7 @@ void Ghast::defineSynchedData() { FlyingMob::defineSynchedData(); - entityData->define(DATA_IS_CHARGING, static_cast(0)); + entityData->define(DATA_IS_CHARGING, (byte) 0); } void Ghast::registerAttributes() @@ -121,37 +121,37 @@ void Ghast::serverAiStep() } } - if (target != nullptr && target->removed) target = nullptr; - if (target == nullptr || retargetTime-- <= 0) + if (target != NULL && target->removed) target = nullptr; + if (target == NULL || retargetTime-- <= 0) { target = level->getNearestAttackablePlayer(shared_from_this(), 100); - if (target != nullptr) + if (target != NULL) { retargetTime = 20; } } double maxDist = 64.0f; - if (target != nullptr && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (target != NULL && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) { double xdd = target->x - x; double ydd = (target->bb->y0 + target->bbHeight / 2) - (y + bbHeight / 2); double zdd = target->z - z; - yBodyRot = yRot = -static_cast(atan2(xdd, zdd)) * 180 / PI; + yBodyRot = yRot = -(float) atan2(xdd, zdd) * 180 / PI; if (canSee(target)) { if (charge == 10) { // 4J - change brought forward from 1.2.3 - level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_WARNING, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_WARNING, (int) x, (int) y, (int) z, 0); } charge++; if (charge == 20) { // 4J - change brought forward from 1.2.3 - level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, static_cast(x), static_cast(y), static_cast(z), 0); - shared_ptr ie = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), xdd, ydd, zdd); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0); + shared_ptr ie = shared_ptr( new LargeFireball(level, dynamic_pointer_cast( shared_from_this() ), xdd, ydd, zdd) ); ie->explosionPower = explosionPower; double d = 4; Vec3 *v = getViewVector(1); @@ -169,14 +169,14 @@ void Ghast::serverAiStep() } else { - yBodyRot = yRot = -static_cast(atan2(this->xd, this->zd)) * 180 / PI; + yBodyRot = yRot = -(float) atan2(this->xd, this->zd) * 180 / PI; if (charge > 0) charge--; } if (!level->isClientSide) { byte old = entityData->getByte(DATA_IS_CHARGING); - byte current = static_cast(charge > 10 ? 1 : 0); + byte current = (byte) (charge > 10 ? 1 : 0); if (old != current) { entityData->set(DATA_IS_CHARGING, current); diff --git a/Minecraft.World/GiveItemCommand.cpp b/Minecraft.World/GiveItemCommand.cpp index fa06d80d..b3cbff4f 100644 --- a/Minecraft.World/GiveItemCommand.cpp +++ b/Minecraft.World/GiveItemCommand.cpp @@ -30,9 +30,9 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman bais.reset(); shared_ptr player = getPlayer(uid); - if(player != nullptr && item > 0 && Item::items[item] != nullptr) + if(player != NULL && item > 0 && Item::items[item] != NULL) { - shared_ptr itemInstance = std::make_shared(item, amount, aux); + shared_ptr itemInstance = shared_ptr(new ItemInstance(item, amount, aux)); shared_ptr drop = player->drop(itemInstance); drop->throwTime = 0; //logAdminAction(source, L"commands.give.success", ChatPacket::e_ChatCustom, Item::items[item]->getName(itemInstance), item, amount, player->getAName()); @@ -42,7 +42,7 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman shared_ptr GiveItemCommand::preparePacket(shared_ptr player, int item, int amount, int aux, const wstring &tag) { - if(player == nullptr) return nullptr; + if(player == NULL) return nullptr; ByteArrayOutputStream baos; DataOutputStream dos(&baos); @@ -53,5 +53,5 @@ shared_ptr GiveItemCommand::preparePacket(shared_ptr dos.writeInt(aux); dos.writeUTF(tag); - return std::make_shared(eGameCommand_Give, baos.toByteArray()); + return shared_ptr( new GameCommandPacket(eGameCommand_Give, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.World/GrassTile.cpp b/Minecraft.World/GrassTile.cpp index 9be44d0e..68e7c233 100644 --- a/Minecraft.World/GrassTile.cpp +++ b/Minecraft.World/GrassTile.cpp @@ -12,9 +12,9 @@ GrassTile::GrassTile(int id) : Tile(id, Material::grass) { - iconTop = nullptr; - iconSnowSide = nullptr; - iconSideOverlay = nullptr; + iconTop = NULL; + iconSnowSide = NULL; + iconSideOverlay = NULL; setTicking(true); } diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 67d53114..26261710 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -35,16 +35,16 @@ HangingEntity::HangingEntity(Level *level, int xTile, int yTile, int zTile, int void HangingEntity::setDir(int dir) { this->dir = dir; - yRotO = yRot = static_cast(dir * 90); + yRotO = yRot = (float)(dir * 90); - float w = static_cast(getWidth()); - float h = static_cast(getHeight()); - float d = static_cast(getWidth()); + float w = (float)getWidth(); + float h = (float)getHeight(); + float d = (float)getWidth(); if (dir == Direction::NORTH || dir == Direction::SOUTH) { d = 0.5f; - yRot = yRotO = static_cast(Direction::DIRECTION_OPPOSITE[dir] * 90); + yRot = yRotO = (float)(Direction::DIRECTION_OPPOSITE[dir] * 90); } else { @@ -150,7 +150,7 @@ bool HangingEntity::survives() vector > *entities = level->getEntities(shared_from_this(), bb); - if (entities != nullptr && entities->size() > 0) + if (entities != NULL && entities->size() > 0) { for (auto& e : *entities) { @@ -184,11 +184,11 @@ bool HangingEntity::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; if (!removed && !level->isClientSide) { - if (dynamic_cast(source) != nullptr) + if (dynamic_cast(source) != NULL) { shared_ptr sourceEntity = source->getDirectEntity(); - if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) ) + if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) ) { return false; } @@ -199,12 +199,12 @@ bool HangingEntity::hurt(DamageSource *source, float damage) shared_ptr player = nullptr; shared_ptr e = source->getEntity(); - if ( (e!=nullptr) && e->instanceof(eTYPE_PLAYER) ) // check if it's serverplayer or player + if ( (e!=NULL) && e->instanceof(eTYPE_PLAYER) ) // check if it's serverplayer or player { player = dynamic_pointer_cast( e ); } - if (player != nullptr && player->abilities.instabuild) + if (player != NULL && player->abilities.instabuild) { return true; } @@ -235,7 +235,7 @@ void HangingEntity::push(double xa, double ya, double za) void HangingEntity::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Direction", static_cast(dir)); + tag->putByte(L"Direction", (byte) dir); tag->putInt(L"TileX", xTile); tag->putInt(L"TileY", yTile); tag->putInt(L"TileZ", zTile); diff --git a/Minecraft.World/HangingEntityItem.cpp b/Minecraft.World/HangingEntityItem.cpp index 97ddb31d..9e4e9d5b 100644 --- a/Minecraft.World/HangingEntityItem.cpp +++ b/Minecraft.World/HangingEntityItem.cpp @@ -35,7 +35,7 @@ bool HangingEntityItem::useOn(shared_ptr instance, shared_ptrmayUseItemAt(xt, yt, zt, face, instance)) return false; - if (entity != nullptr && entity->survives()) + if (entity != NULL && entity->survives()) { if (!level->isClientSide) { @@ -66,7 +66,7 @@ shared_ptr HangingEntityItem::createEntity(Level *level, int x, i { if (eType == eTYPE_PAINTING) { - shared_ptr painting = std::make_shared(level, x, y, z, dir); + shared_ptr painting = shared_ptr(new Painting(level, x, y, z, dir)); #ifndef _CONTENT_PACKAGE if (app.DebugArtToolsOn() && auxValue > 0) @@ -83,7 +83,7 @@ shared_ptr HangingEntityItem::createEntity(Level *level, int x, i } else if (eType == eTYPE_ITEM_FRAME) { - shared_ptr itemFrame = std::make_shared(level, x, y, z, dir); + shared_ptr itemFrame = shared_ptr(new ItemFrame(level, x, y, z, dir)); return dynamic_pointer_cast (itemFrame); } diff --git a/Minecraft.World/HatchetItem.cpp b/Minecraft.World/HatchetItem.cpp index dd74a2ed..7fa204ca 100644 --- a/Minecraft.World/HatchetItem.cpp +++ b/Minecraft.World/HatchetItem.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.tile.h" #include "HatchetItem.h" -TileArray *HatchetItem::diggables = nullptr; +TileArray *HatchetItem::diggables = NULL; void HatchetItem::staticCtor() { @@ -25,7 +25,7 @@ HatchetItem::HatchetItem(int id, const Tier *tier) : DiggerItem (id, 3, tier, di // 4J - brought forward from 1.2.3 float HatchetItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) { - if (tile != nullptr && (tile->material == Material::wood || tile->material == Material::plant || tile->material == Material::replaceable_plant)) + if (tile != NULL && (tile->material == Material::wood || tile->material == Material::plant || tile->material == Material::replaceable_plant)) { return speed; } diff --git a/Minecraft.World/HeavyTile.cpp b/Minecraft.World/HeavyTile.cpp index d4e65796..6c2b96e6 100644 --- a/Minecraft.World/HeavyTile.cpp +++ b/Minecraft.World/HeavyTile.cpp @@ -60,7 +60,7 @@ void HeavyTile::checkSlide(Level *level, int x, int y, int z) return; } - shared_ptr e = std::make_shared(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z)); + shared_ptr e = shared_ptr( new FallingTile(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z)) ); falling(e); level->addEntity(e); } diff --git a/Minecraft.World/HellDimension.cpp b/Minecraft.World/HellDimension.cpp index a765fd6f..63cb0df7 100644 --- a/Minecraft.World/HellDimension.cpp +++ b/Minecraft.World/HellDimension.cpp @@ -23,9 +23,9 @@ Vec3 *HellDimension::getFogColor(float td, float a) const byte greenComponent = ((colour>>8)&0xFF); byte blueComponent = ((colour)&0xFF); - float rr = static_cast(redComponent)/256;//0.2f; - float gg = static_cast(greenComponent)/256;//0.03f; - float bb = static_cast(blueComponent)/256;//0.03f; + float rr = (float)redComponent/256;//0.2f; + float gg = (float)greenComponent/256;//0.03f; + float bb = (float)blueComponent/256;//0.03f; return Vec3::newTemp(rr, gg, bb); } @@ -34,7 +34,7 @@ void HellDimension::updateLightRamp() float ambientLight = 0.10f; for (int i = 0; i <= Level::MAX_BRIGHTNESS; i++) { - float v = (1 - i / static_cast(Level::MAX_BRIGHTNESS)); + float v = (1 - i / (float) (Level::MAX_BRIGHTNESS)); brightnessRamp[i] = ((1 - v) / (v * 3 + 1)) * (1 - ambientLight) + ambientLight; } } @@ -85,5 +85,5 @@ bool HellDimension::isFoggyAt(int x, int z) int HellDimension::getXZSize() { - return ceil(static_cast(level->getLevelData()->getXZSize()) / level->getLevelData()->getHellScale()); + return ceil((float)level->getLevelData()->getXZSize() / level->getLevelData()->getHellScale()); } diff --git a/Minecraft.World/HellFlatLevelSource.cpp b/Minecraft.World/HellFlatLevelSource.cpp index c4ba062c..95144627 100644 --- a/Minecraft.World/HellFlatLevelSource.cpp +++ b/Minecraft.World/HellFlatLevelSource.cpp @@ -8,7 +8,7 @@ HellFlatLevelSource::HellFlatLevelSource(Level *level, int64_t seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); - m_XZSize = ceil(static_cast(xzSize) / hellScale); + m_XZSize = ceil((float)xzSize / hellScale); this->level = level; @@ -38,7 +38,7 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) block = Tile::netherRack_Id; } - blocks[xc << 11 | zc << 7 | yc] = static_cast(block); + blocks[xc << 11 | zc << 7 | yc] = (byte) block; } } } @@ -60,7 +60,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( z - random->nextInt( 4 ) <= 0 || xOffs < -(m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -68,7 +68,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( x - random->nextInt( 4 ) <= 0 || zOffs < -(m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -76,7 +76,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( z + random->nextInt(4) >= 15 || xOffs > (m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -84,7 +84,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( x + random->nextInt(4) >= 15 || zOffs > (m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -93,11 +93,11 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) if (y >= Level::genDepthMinusOne - random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; } else if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; } } } @@ -115,7 +115,7 @@ LevelChunk *HellFlatLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -211,16 +211,16 @@ wstring HellFlatLevelSource::gatherStats() vector *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == nullptr) + if (biome == NULL) { - return nullptr; + return NULL; } return biome->getMobs(mobCategory); } TilePos *HellFlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return nullptr; + return NULL; } void HellFlatLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index 26127dde..66444d13 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -11,7 +11,7 @@ HellRandomLevelSource::HellRandomLevelSource(Level *level, int64_t seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); - m_XZSize = ceil(static_cast(xzSize) / hellScale); + m_XZSize = ceil((float)xzSize / hellScale); netherBridgeFeature = new NetherBridgeFeature(); caveFeature = new LargeHellCaveFeature(); @@ -64,7 +64,7 @@ void HellRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray block { for (int yc = 0; yc < Level::genDepth / CHUNK_HEIGHT; yc++) { - double yStep = 1 / static_cast(CHUNK_HEIGHT); + double yStep = 1 / (double) CHUNK_HEIGHT; double s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; double s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; double s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; @@ -77,7 +77,7 @@ void HellRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray block for (int y = 0; y < CHUNK_HEIGHT; y++) { - double xStep = 1 / static_cast(CHUNK_WIDTH); + double xStep = 1 / (double) CHUNK_WIDTH; double _s0 = s0; double _s1 = s1; @@ -88,7 +88,7 @@ void HellRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray block { int offs = (x + xc * CHUNK_WIDTH) << Level::genDepthBitsPlusFour | (0 + zc * CHUNK_WIDTH) << Level::genDepthBits | (yc * CHUNK_HEIGHT + y); int step = 1 << Level::genDepthBits; - double zStep = 1 / static_cast(CHUNK_WIDTH); + double zStep = 1 / (double) CHUNK_WIDTH; double val = _s0; double vala = (_s1 - _s0) * zStep; @@ -104,7 +104,7 @@ void HellRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray block tileId = Tile::netherRack_Id; } - blocks[offs] = static_cast(tileId); + blocks[offs] = (byte) tileId; offs += step; val += vala; } @@ -143,7 +143,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { bool sand = (sandBuffer[x + z * 16] + random->nextDouble() * 0.2) > 0; bool gravel = (gravelBuffer[x + z * 16] + random->nextDouble() * 0.2) > 0; - int runDepth = static_cast(depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); int run = -1; @@ -160,7 +160,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( z - random->nextInt( 4 ) <= 0 || xOffs < -(m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -168,7 +168,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( x - random->nextInt( 4 ) <= 0 || zOffs < -(m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -176,7 +176,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( z + random->nextInt(4) >= 15 || xOffs > (m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -184,7 +184,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( x + random->nextInt(4) >= 15 || zOffs > (m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; blockSet = true; } } @@ -193,7 +193,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if (y >= Level::genDepthMinusOne - random->nextInt(5) || y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; } else { @@ -210,20 +210,20 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if (runDepth <= 0) { top = 0; - material = static_cast(Tile::netherRack_Id); + material = (byte) Tile::netherRack_Id; } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { - top = static_cast(Tile::netherRack_Id); - material = static_cast(Tile::netherRack_Id); - if (gravel) top = static_cast(Tile::gravel_Id); - if (gravel) material = static_cast(Tile::netherRack_Id); + top = (byte) Tile::netherRack_Id; + material = (byte) Tile::netherRack_Id; + if (gravel) top = (byte) Tile::gravel_Id; + if (gravel) material = (byte) Tile::netherRack_Id; if (sand) { // 4J Stu - Make some nether wart spawn outside of the nether fortresses if(random->nextInt(16) == 0) { - top = static_cast(Tile::netherStalk_Id); + top = (byte) Tile::netherStalk_Id; // Place the nether wart on top of the soul sand y += 1; @@ -234,13 +234,13 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks } else { - top = static_cast(Tile::soulsand_Id); + top = (byte) Tile::soulsand_Id; } } - if (sand) material = static_cast(Tile::soulsand_Id); + if (sand) material = (byte) Tile::soulsand_Id; } - if (y < waterHeight && top == 0) top = static_cast(Tile::calmLava_Id); + if (y < waterHeight && top == 0) top = (byte) Tile::calmLava_Id; run = runDepth; // 4J Stu - If sand, then allow adding nether wart at heights below the water level @@ -273,7 +273,7 @@ LevelChunk *HellRandomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -303,7 +303,7 @@ void HellRandomLevelSource::lightChunk(LevelChunk *lc) doubleArray HellRandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize) { - if (buffer.data == nullptr) + if (buffer.data == NULL) { buffer = doubleArray(xSize * ySize * zSize); } @@ -325,7 +325,7 @@ doubleArray HellRandomLevelSource::getHeights(doubleArray buffer, int x, int y, doubleArray yoffs = doubleArray(ySize); for (int yy = 0; yy < ySize; yy++) { - yoffs[yy] = cos(yy * PI * 6 / static_cast(ySize)) * 2; + yoffs[yy] = cos(yy * PI * 6 / (double) ySize) * 2; double dd = yy; if (yy > ySize / 2) @@ -547,19 +547,19 @@ vector *HellRandomLevelSource::getMobsAt(MobCategory *m } Biome *biome = level->getBiome(x, z); - if (biome == nullptr) + if (biome == NULL) { - return nullptr; + return NULL; } return biome->getMobs(mobCategory); } TilePos *HellRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return nullptr; + return NULL; } void HellRandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) { - netherBridgeFeature->apply(this, level, chunkX, chunkZ, byteArray()); + netherBridgeFeature->apply(this, level, chunkX, chunkZ, NULL); } \ No newline at end of file diff --git a/Minecraft.World/HopperMenu.cpp b/Minecraft.World/HopperMenu.cpp index 996651c6..afc700c3 100644 --- a/Minecraft.World/HopperMenu.cpp +++ b/Minecraft.World/HopperMenu.cpp @@ -35,7 +35,7 @@ shared_ptr HopperMenu::quickMoveStack(shared_ptr player, i { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/HopperTile.cpp b/Minecraft.World/HopperTile.cpp index 0371712a..c111105e 100644 --- a/Minecraft.World/HopperTile.cpp +++ b/Minecraft.World/HopperTile.cpp @@ -47,7 +47,7 @@ int HopperTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int shared_ptr HopperTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new HopperTileEntity() ); } void HopperTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr by, shared_ptr itemInstance) @@ -74,7 +74,7 @@ bool HopperTile::use(Level *level, int x, int y, int z, shared_ptr playe return true; } shared_ptr hopper = getHopper(level, x, y, z); - if (hopper != nullptr) player->openHopper(hopper); + if (hopper != NULL) player->openHopper(hopper); return true; } @@ -99,12 +99,12 @@ void HopperTile::checkPoweredState(Level *level, int x, int y, int z) void HopperTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != nullptr) + if (container != NULL) { for (int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random.nextFloat() * 0.8f + 0.1f; float yo = random.nextFloat() * 0.8f + 0.1f; @@ -116,17 +116,17 @@ void HopperTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, shared_ptr(new ItemInstance(item->id, count, item->getAuxValue()))); + shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue())))); if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } float pow = 0.05f; - itemEntity->xd = static_cast(random.nextGaussian()) * pow; - itemEntity->yd = static_cast(random.nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random.nextGaussian()) * pow; + itemEntity->xd = (float) random.nextGaussian() * pow; + itemEntity->yd = (float) random.nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random.nextGaussian() * pow; level->addEntity(itemEntity); } } @@ -197,7 +197,7 @@ Icon *HopperTile::getTexture(const wstring &name) { if (name.compare(TEXTURE_OUTSIDE) == 0) return Tile::hopper->hopperIcon; if (name.compare(TEXTURE_INSIDE) == 0) return Tile::hopper->hopperInnerIcon; - return nullptr; + return NULL; } wstring HopperTile::getTileItemIconName() diff --git a/Minecraft.World/HopperTileEntity.cpp b/Minecraft.World/HopperTileEntity.cpp index e44232dc..38a0e817 100644 --- a/Minecraft.World/HopperTileEntity.cpp +++ b/Minecraft.World/HopperTileEntity.cpp @@ -46,10 +46,10 @@ void HopperTileEntity::save(CompoundTag *base) for (int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } @@ -76,7 +76,7 @@ shared_ptr HopperTileEntity::getItem(unsigned int slot) shared_ptr HopperTileEntity::removeItem(unsigned int slot, int count) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -96,7 +96,7 @@ shared_ptr HopperTileEntity::removeItem(unsigned int slot, int cou shared_ptr HopperTileEntity::removeItemNoUpdate(int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -108,7 +108,7 @@ shared_ptr HopperTileEntity::removeItemNoUpdate(int slot) void HopperTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } wstring HopperTileEntity::getName() @@ -158,7 +158,7 @@ bool HopperTileEntity::canPlaceItem(int slot, shared_ptr item) void HopperTileEntity::tick() { - if (level == nullptr || level->isClientSide) return; + if (level == NULL || level->isClientSide) return; cooldownTime--; @@ -171,7 +171,7 @@ void HopperTileEntity::tick() bool HopperTileEntity::tryMoveItems() { - if (level == nullptr || level->isClientSide) return false; + if (level == NULL || level->isClientSide) return false; if (!isOnCooldown() && HopperTile::isTurnedOn(getData())) { @@ -192,19 +192,19 @@ bool HopperTileEntity::tryMoveItems() bool HopperTileEntity::ejectItems() { shared_ptr container = getAttachedContainer(); - if (container == nullptr) + if (container == NULL) { return false; } for (int slot = 0; slot < getContainerSize(); slot++) { - if (getItem(slot) == nullptr) continue; + if (getItem(slot) == NULL) continue; shared_ptr original = getItem(slot)->copy(); shared_ptr result = addItem(container.get(), removeItem(slot, 1), Facing::OPPOSITE_FACING[HopperTile::getAttachedFace(getData())]); - if (result == nullptr || result->count == 0) + if (result == NULL || result->count == 0) { container->setChanged(); return true; @@ -222,12 +222,12 @@ bool HopperTileEntity::suckInItems(Hopper *hopper) { shared_ptr container = getSourceContainer(hopper); - if (container != nullptr) + if (container != NULL) { int face = Facing::DOWN; shared_ptr worldly = dynamic_pointer_cast(container); - if ( (worldly != nullptr) && (face > -1) ) + if ( (worldly != NULL) && (face > -1) ) { intArray slots = worldly->getSlotsForFace(face); @@ -249,7 +249,7 @@ bool HopperTileEntity::suckInItems(Hopper *hopper) { shared_ptr above = getItemAt(hopper->getLevel(), hopper->getLevelX(), hopper->getLevelY() + 1, hopper->getLevelZ()); - if (above != nullptr) + if (above != NULL) { return addItem(hopper, above); } @@ -262,12 +262,12 @@ bool HopperTileEntity::tryTakeInItemFromSlot(Hopper *hopper, Container *containe { shared_ptr item = container->getItem(slot); - if (item != nullptr && canTakeItemFromContainer(container, item, slot, face)) + if (item != NULL && canTakeItemFromContainer(container, item, slot, face)) { shared_ptr original = item->copy(); shared_ptr result = addItem(hopper, container->removeItem(slot, 1), -1); - if (result == nullptr || result->count == 0) + if (result == NULL || result->count == 0) { container->setChanged(); return true; @@ -284,12 +284,12 @@ bool HopperTileEntity::tryTakeInItemFromSlot(Hopper *hopper, Container *containe bool HopperTileEntity::addItem(Container *container, shared_ptr item) { bool changed = false; - if (item == nullptr) return false; + if (item == NULL) return false; shared_ptr copy = item->getItem()->copy(); shared_ptr result = addItem(container, copy, -1); - if (result == nullptr || result->count == 0) + if (result == NULL || result->count == 0) { changed = true; @@ -305,12 +305,12 @@ bool HopperTileEntity::addItem(Container *container, shared_ptr item shared_ptr HopperTileEntity::addItem(Container *container, shared_ptr item, int face) { - if (dynamic_cast( container ) != nullptr && face > -1) + if (dynamic_cast( container ) != NULL && face > -1) { - WorldlyContainer *worldly = static_cast(container); + WorldlyContainer *worldly = (WorldlyContainer *) container; intArray slots = worldly->getSlotsForFace(face); - for (int i = 0; i < slots.length && item != nullptr && item->count > 0; i++) + for (int i = 0; i < slots.length && item != NULL && item->count > 0; i++) { item = tryMoveInItem(container, item, slots[i], face); } @@ -318,13 +318,13 @@ shared_ptr HopperTileEntity::addItem(Container *container, shared_ else { int size = container->getContainerSize(); - for (int i = 0; i < size && item != nullptr && item->count > 0; i++) + for (int i = 0; i < size && item != NULL && item->count > 0; i++) { item = tryMoveInItem(container, item, i, face); } } - if (item != nullptr && item->count == 0) + if (item != NULL && item->count == 0) { item = nullptr; } @@ -335,13 +335,13 @@ shared_ptr HopperTileEntity::addItem(Container *container, shared_ bool HopperTileEntity::canPlaceItemInContainer(Container *container, shared_ptr item, int slot, int face) { if (!container->canPlaceItem(slot, item)) return false; - if ( dynamic_cast( container ) != nullptr && !dynamic_cast( container )->canPlaceItemThroughFace(slot, item, face)) return false; + if ( dynamic_cast( container ) != NULL && !dynamic_cast( container )->canPlaceItemThroughFace(slot, item, face)) return false; return true; } bool HopperTileEntity::canTakeItemFromContainer(Container *container, shared_ptr item, int slot, int face) { - if (dynamic_cast( container ) != nullptr && !dynamic_cast( container )->canTakeItemThroughFace(slot, item, face)) return false; + if (dynamic_cast( container ) != NULL && !dynamic_cast( container )->canTakeItemThroughFace(slot, item, face)) return false; return true; } @@ -352,7 +352,7 @@ shared_ptr HopperTileEntity::tryMoveInItem(Container *container, s if (canPlaceItemInContainer(container, item, slot, face)) { bool success = false; - if (current == nullptr) + if (current == NULL) { container->setItem(slot, item); item = nullptr; @@ -370,7 +370,7 @@ shared_ptr HopperTileEntity::tryMoveInItem(Container *container, s if (success) { HopperTileEntity *hopper = dynamic_cast(container); - if (hopper != nullptr) + if (hopper != NULL) { hopper->setCooldown(MOVE_ITEM_SPEED); container->setChanged(); @@ -420,25 +420,25 @@ shared_ptr HopperTileEntity::getContainerAt(Level *level, double x, d shared_ptr entity = level->getTileEntity(xt, yt, zt); result = dynamic_pointer_cast(entity); - if (result != nullptr) + if (result != NULL) { - if ( dynamic_pointer_cast(result) != nullptr ) + if ( dynamic_pointer_cast(result) != NULL ) { int id = level->getTile(xt, yt, zt); Tile *tile = Tile::tiles[id]; - if ( dynamic_cast( tile ) != nullptr ) + if ( dynamic_cast( tile ) != NULL ) { - result = static_cast(tile)->getContainer(level, xt, yt, zt); + result = ((ChestTile *) tile)->getContainer(level, xt, yt, zt); } } } - if (result == nullptr) + if (result == NULL) { vector > *entities = level->getEntities(nullptr, AABB::newTemp(x, y, z, x + 1, y + 1, z + 1), EntitySelector::CONTAINER_ENTITY_SELECTOR); - if ( (entities != nullptr) && (entities->size() > 0) ) + if ( (entities != NULL) && (entities->size() > 0) ) { result = dynamic_pointer_cast( entities->at( level->random->nextInt(entities->size()) ) ); } @@ -489,14 +489,14 @@ bool HopperTileEntity::isOnCooldown() // 4J Added shared_ptr HopperTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new HopperTileEntity() ); TileEntity::clone(result); result->name = name; result->cooldownTime = cooldownTime; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/HorseInventoryMenu.cpp b/Minecraft.World/HorseInventoryMenu.cpp index 467b3545..7dba791f 100644 --- a/Minecraft.World/HorseInventoryMenu.cpp +++ b/Minecraft.World/HorseInventoryMenu.cpp @@ -75,7 +75,7 @@ shared_ptr HorseInventoryMenu::quickMoveStack(shared_ptr p { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/HouseFeature.cpp b/Minecraft.World/HouseFeature.cpp index b6bba5a5..40b4e770 100644 --- a/Minecraft.World/HouseFeature.cpp +++ b/Minecraft.World/HouseFeature.cpp @@ -185,7 +185,7 @@ bool HouseFeature::place(Level *level, Random *random, int x, int y, int z) } } - shared_ptr(pz) = std::make_shared(level); + shared_ptr(pz) = shared_ptr(new PigZombie(level)); pz->moveTo(x0 + w / 2.0 + 0.5, y0 + 0.5, z0 + d / 2.0 + 0.5, 0, 0); level->addEntity(pz); diff --git a/Minecraft.World/HtmlString.cpp b/Minecraft.World/HtmlString.cpp index af643671..ce25740e 100644 --- a/Minecraft.World/HtmlString.cpp +++ b/Minecraft.World/HtmlString.cpp @@ -38,7 +38,7 @@ wstring HtmlString::ToString() wstring HtmlString::Compose(vector *strings) { - if (strings == nullptr) return L""; + if (strings == NULL) return L""; std::wstringstream ss; diff --git a/Minecraft.World/HugeMushroomTile.cpp b/Minecraft.World/HugeMushroomTile.cpp index 8d3ef144..e96cfd1f 100644 --- a/Minecraft.World/HugeMushroomTile.cpp +++ b/Minecraft.World/HugeMushroomTile.cpp @@ -9,9 +9,9 @@ const wstring HugeMushroomTile::TEXTURE_TYPE[] = {L"skin_brown", L"skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material *material, int type) : Tile(id, material) { this->type = type; - icons = nullptr; - iconStem = nullptr; - iconInside = nullptr; + icons = NULL; + iconStem = NULL; + iconInside = NULL; } Icon *HugeMushroomTile::getTexture(int face, int data) diff --git a/Minecraft.World/HurtByTargetGoal.cpp b/Minecraft.World/HurtByTargetGoal.cpp index e70f8628..076e5b6a 100644 --- a/Minecraft.World/HurtByTargetGoal.cpp +++ b/Minecraft.World/HurtByTargetGoal.cpp @@ -30,7 +30,7 @@ void HurtByTargetGoal::start() { shared_ptr other = dynamic_pointer_cast(it); if (this->mob->shared_from_this() == other) continue; - if (other->getTarget() != nullptr) continue; + if (other->getTarget() != NULL) continue; if (other->isAlliedTo(mob->getLastHurtByMob())) continue; // don't target allies other->setTarget(mob->getLastHurtByMob()); } diff --git a/Minecraft.World/IceTile.cpp b/Minecraft.World/IceTile.cpp index 60e16291..938c098f 100644 --- a/Minecraft.World/IceTile.cpp +++ b/Minecraft.World/IceTile.cpp @@ -30,7 +30,7 @@ void IceTile::playerDestroy(Level *level, shared_ptr player, int x, int if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player)) { shared_ptr item = getSilkTouchItemInstance(data); - if (item != nullptr) + if (item != NULL) { popResource(level, x, y, z, item); } diff --git a/Minecraft.World/ImprovedNoise.cpp b/Minecraft.World/ImprovedNoise.cpp index 47f39085..8be9e385 100644 --- a/Minecraft.World/ImprovedNoise.cpp +++ b/Minecraft.World/ImprovedNoise.cpp @@ -46,9 +46,9 @@ double ImprovedNoise::noise(double _x, double _y, double _z) double y = _y + yo; double z = _z + zo; - int xf = static_cast(x); - int yf = static_cast(y); - int zf = static_cast(z); + int xf = (int) x; + int yf = (int) y; + int zf = (int) z; if (x < xf) xf--; if (y < yf) yf--; @@ -125,7 +125,7 @@ void ImprovedNoise::add(doubleArray buffer, double _x, double _y, double _z, int for (int xx = 0; xx < xSize; xx++) { double x = _x + (xx) * xs + xo; - int xf = static_cast(x); + int xf = (int) x; if (x < xf) xf--; int X = xf & 255; x -= xf; @@ -134,7 +134,7 @@ void ImprovedNoise::add(doubleArray buffer, double _x, double _y, double _z, int for (int zz = 0; zz < zSize; zz++) { double z = _z + (zz) * zs + zo; - int zf = static_cast(z); + int zf = (int) z; if (z < zf) zf--; int Z = zf & 255; z -= zf; @@ -163,7 +163,7 @@ void ImprovedNoise::add(doubleArray buffer, double _x, double _y, double _z, int for (int xx = 0; xx < xSize; xx++) { double x = _x + (xx) * xs + xo; - int xf = static_cast(x); + int xf = (int) x; if (x < xf) xf--; int X = xf & 255; x -= xf; @@ -173,7 +173,7 @@ void ImprovedNoise::add(doubleArray buffer, double _x, double _y, double _z, int for (int zz = 0; zz < zSize; zz++) { double z = _z + (zz) * zs + zo; - int zf = static_cast(z); + int zf = (int) z; if (z < zf) zf--; int Z = zf & 255; z -= zf; @@ -183,7 +183,7 @@ void ImprovedNoise::add(doubleArray buffer, double _x, double _y, double _z, int for (int yy = 0; yy < ySize; yy++) { double y = _y + (yy) * ys + yo; - int yf = static_cast(y); + int yf = (int) y; if (y < yf) yf--; int Y = yf & 255; y -= yf; diff --git a/Minecraft.World/IndirectEntityDamageSource.cpp b/Minecraft.World/IndirectEntityDamageSource.cpp index a24ad1a7..c2a67af5 100644 --- a/Minecraft.World/IndirectEntityDamageSource.cpp +++ b/Minecraft.World/IndirectEntityDamageSource.cpp @@ -32,26 +32,26 @@ shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(shared_ shared_ptr held = entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; wstring additional = L""; int type; - if(owner != nullptr) + if(owner != NULL) { type = owner->GetType(); if(type == eTYPE_SERVERPLAYER) { shared_ptr sourcePlayer = dynamic_pointer_cast(owner); - if(sourcePlayer != nullptr) additional = sourcePlayer->name; + if(sourcePlayer != NULL) additional = sourcePlayer->name; } } else { type = entity->GetType(); } - if(held != nullptr && held->hasCustomHoverName() ) + if(held != NULL && held->hasCustomHoverName() ) { - return std::make_shared(player->getNetworkName(), m_msgWithItemId, type, additional, held->getHoverName()); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId, type, additional, held->getHoverName() ) ); } else { - return std::make_shared(player->getNetworkName(), m_msgId, type, additional); + return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgId, type, additional ) ); } } diff --git a/Minecraft.World/InputStream.cpp b/Minecraft.World/InputStream.cpp index f31399cf..e325db8a 100644 --- a/Minecraft.World/InputStream.cpp +++ b/Minecraft.World/InputStream.cpp @@ -7,5 +7,5 @@ InputStream *InputStream::getResourceAsStream(const wstring &fileName) { File file( fileName ); - return file.exists() ? new FileInputStream( file ) : nullptr; + return file.exists() ? new FileInputStream( file ) : NULL; } \ No newline at end of file diff --git a/Minecraft.World/InputStreamReader.cpp b/Minecraft.World/InputStreamReader.cpp index 972c5316..4a565cf4 100644 --- a/Minecraft.World/InputStreamReader.cpp +++ b/Minecraft.World/InputStreamReader.cpp @@ -39,7 +39,7 @@ int InputStreamReader::read(wchar_t cbuf[], unsigned int offset, unsigned int le unsigned int charsRead = 0; for( unsigned int i = offset; i < offset + length; i++ ) { - wchar_t value = static_cast(stream->readUTFChar()); + wchar_t value = (wchar_t)stream->readUTFChar(); if( value != -1 ) { cbuf[i] = value; diff --git a/Minecraft.World/IntArrayTag.h b/Minecraft.World/IntArrayTag.h index 61ca59d0..48f4ce74 100644 --- a/Minecraft.World/IntArrayTag.h +++ b/Minecraft.World/IntArrayTag.h @@ -57,8 +57,8 @@ public: { if (Tag::equals(obj)) { - IntArrayTag *o = static_cast(obj); - return ((data.data == nullptr && o->data.data == nullptr) || (data.data != nullptr && data.length == o->data.length && memcmp(data.data, o->data.data, data.length * sizeof(int)) == 0) ); + IntArrayTag *o = (IntArrayTag *) obj; + return ((data.data == NULL && o->data.data == NULL) || (data.data != NULL && data.length == o->data.length && memcmp(data.data, o->data.data, data.length * sizeof(int)) == 0) ); } return false; } diff --git a/Minecraft.World/IntCache.cpp b/Minecraft.World/IntCache.cpp index cd980d16..174d01d3 100644 --- a/Minecraft.World/IntCache.cpp +++ b/Minecraft.World/IntCache.cpp @@ -28,7 +28,7 @@ IntCache::ThreadStorage::~ThreadStorage() { delete [] allocated[i].data; } - for( size_t i = 0; i < toosmall.size(); i++ ) + for( int i = 0; i < toosmall.size(); i++ ) { delete [] toosmall[i].data; } @@ -36,7 +36,7 @@ IntCache::ThreadStorage::~ThreadStorage() void IntCache::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); delete tls; @@ -44,13 +44,13 @@ void IntCache::ReleaseThreadStorage() intArray IntCache::allocate(int size) { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if (size <= TINY_CUTOFF) { if (tls->tcache.empty()) { - intArray result = intArray(static_cast(TINY_CUTOFF), true); + intArray result = intArray(TINY_CUTOFF, true); tls->tallocated.push_back(result); return result; } @@ -76,7 +76,7 @@ intArray IntCache::allocate(int size) tls->cache.clear(); tls->allocated.clear(); - intArray result = intArray(static_cast(tls->maxSize), true); + intArray result = intArray(tls->maxSize, true); tls->allocated.push_back(result); return result; } @@ -84,7 +84,7 @@ intArray IntCache::allocate(int size) { if (tls->cache.empty()) { - intArray result = intArray(static_cast(tls->maxSize), true); + intArray result = intArray(tls->maxSize, true); tls->allocated.push_back(result); return result; } @@ -100,10 +100,10 @@ intArray IntCache::allocate(int size) void IntCache::releaseAll() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); // 4J - added - we can now remove the vectors that were deemed as too small (see comment in IntCache::allocate) - for( size_t i = 0; i < tls->toosmall.size(); i++ ) + for( int i = 0; i < tls->toosmall.size(); i++ ) { delete [] tls->toosmall[i].data; } @@ -130,27 +130,27 @@ void IntCache::releaseAll() // 4J added so that we can fully reset between levels void IntCache::Reset() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); tls->maxSize = TINY_CUTOFF; - for( size_t i = 0; i < tls->allocated.size(); i++ ) + for( int i = 0; i < tls->allocated.size(); i++ ) { delete [] tls->allocated[i].data; } tls->allocated.clear(); - for( size_t i = 0; i < tls->cache.size(); i++ ) + for( int i = 0; i < tls->cache.size(); i++ ) { delete [] tls->cache[i].data; } tls->cache.clear(); - for( size_t i = 0; i < tls->tallocated.size(); i++ ) + for( int i = 0; i < tls->tallocated.size(); i++ ) { delete [] tls->tallocated[i].data; } tls->tallocated.clear(); - for( size_t i = 0; i < tls->tcache.size(); i++ ) + for( int i = 0; i < tls->tcache.size(); i++ ) { delete [] tls->tcache[i].data; } diff --git a/Minecraft.World/IntTag.h b/Minecraft.World/IntTag.h index 1f55c5f2..cce87da3 100644 --- a/Minecraft.World/IntTag.h +++ b/Minecraft.World/IntTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - IntTag *o = static_cast(obj); + IntTag *o = (IntTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/InteractPacket.h b/Minecraft.World/InteractPacket.h index aae16391..0141038d 100644 --- a/Minecraft.World/InteractPacket.h +++ b/Minecraft.World/InteractPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new InteractPacket()); } virtual int getId() { return 7; } }; \ No newline at end of file diff --git a/Minecraft.World/Inventory.cpp b/Minecraft.World/Inventory.cpp index ad0fc3ec..4a524bab 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -69,7 +69,7 @@ int Inventory::getSlot(int tileId) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == tileId) return i; + if (items[i] != NULL && items[i]->id == tileId) return i; } return -1; } @@ -78,7 +78,7 @@ int Inventory::getSlot(int tileId, int data) { for (int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == tileId && items[i]->getAuxValue() == data) return i; + if (items[i] != NULL && items[i]->id == tileId && items[i]->getAuxValue() == data) return i; } return -1; } @@ -87,7 +87,7 @@ int Inventory::getSlotWithRemainingSpace(shared_ptr item) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == item->id && items[i]->isStackable() + if (items[i] != NULL && items[i]->id == item->id && items[i]->isStackable() && items[i]->count < items[i]->getMaxStackSize() && items[i]->count < getMaxStackSize() && (!items[i]->isStackedByData() || items[i]->getAuxValue() == item->getAuxValue()) && ItemInstance::tagMatches(items[i], item)) @@ -102,7 +102,7 @@ int Inventory::getFreeSlot() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] == nullptr) return i; + if (items[i] == NULL) return i; } return -1; } @@ -160,7 +160,7 @@ int Inventory::clearInventory(int id, int data) for (int i = 0; i < items.length; i++) { shared_ptr item = items[i]; - if (item == nullptr) continue; + if (item == NULL) continue; if (id > -1 && item->id != id) continue; if (data > -1 && item->getAuxValue() != data) continue; @@ -170,7 +170,7 @@ int Inventory::clearInventory(int id, int data) for (int i = 0; i < armor.length; i++) { shared_ptr item = armor[i]; - if (item == nullptr) continue; + if (item == NULL) continue; if (id > -1 && item->id != id) continue; if (data > -1 && item->getAuxValue() != data) continue; @@ -178,7 +178,7 @@ int Inventory::clearInventory(int id, int data) armor[i] = nullptr; } - if (carried != nullptr) + if (carried != NULL) { if (id > -1 && carried->id != id) return count; if (data > -1 && carried->getAuxValue() != data) return count; @@ -192,10 +192,10 @@ int Inventory::clearInventory(int id, int data) void Inventory::replaceSlot(Item *item, int data) { - if (item != nullptr) + if (item != NULL) { // It's too easy to accidentally pick block and lose enchanted items. - if (heldItem != nullptr && heldItem->isEnchantable() && getSlot(heldItem->id, heldItem->getDamageValue()) == selected) + if (heldItem != NULL && heldItem->isEnchantable() && getSlot(heldItem->id, heldItem->getDamageValue()) == selected) { return; } @@ -205,11 +205,11 @@ void Inventory::replaceSlot(Item *item, int data) { int oldSlotCount = items[oldSlot]->count; items[oldSlot] = items[selected]; - items[selected] = std::make_shared(Item::items[item->id], oldSlotCount, data); + items[selected] = shared_ptr( new ItemInstance(Item::items[item->id], oldSlotCount, data) ); } else { - items[selected] = std::make_shared(Item::items[item->id], 1, data); + items[selected] = shared_ptr(new ItemInstance(Item::items[item->id], 1, data)); } } } @@ -226,7 +226,7 @@ int Inventory::addResource(shared_ptr itemInstance) { int slot = getFreeSlot(); if (slot < 0) return count; - if (items[slot] == nullptr) + if (items[slot] == NULL) { items[slot] = ItemInstance::clone(itemInstance); player->handleCollectItem(itemInstance); @@ -237,13 +237,13 @@ int Inventory::addResource(shared_ptr itemInstance) int slot = getSlotWithRemainingSpace(itemInstance); if (slot < 0) slot = getFreeSlot(); if (slot < 0) return count; - if (items[slot] == nullptr) + if (items[slot] == NULL) { - items[slot] = std::make_shared(type, 0, itemInstance->getAuxValue()); + items[slot] = shared_ptr( new ItemInstance(type, 0, itemInstance->getAuxValue()) ); // 4J Stu - Brought forward from 1.2 if (itemInstance->hasTag()) { - items[slot]->setTag(static_cast(itemInstance->getTag()->copy())); + items[slot]->setTag((CompoundTag *) itemInstance->getTag()->copy()); player->handleCollectItem(itemInstance); } } @@ -272,7 +272,7 @@ void Inventory::tick() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { items[i]->inventoryTick(player->level, player->shared_from_this(), i, selected == i); } @@ -299,12 +299,12 @@ bool Inventory::removeResource(int type,int iAuxVal) void Inventory::removeResources(shared_ptr item) { - if(item == nullptr) return; + if(item == NULL) return; int countToRemove = item->count; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->sameItemWithTags(item)) + if (items[i] != NULL && items[i]->sameItemWithTags(item)) { int slotCount = items[i]->count; items[i]->count -= countToRemove; @@ -348,7 +348,7 @@ int Inventory::countResource(int type, int auxVal) int count = 0; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->id == type && + if (items[i] != NULL && items[i]->id == type && (auxVal == -1 || items[i]->getAuxValue() == auxVal)) count += items[i]->count; } @@ -364,7 +364,7 @@ void Inventory::swapSlots(int from, int to) bool Inventory::add(shared_ptr item) { - if (item == nullptr) return false; + if (item == NULL) return false; if (item->count == 0) return false; if (!item->isDamaged()) @@ -427,7 +427,7 @@ shared_ptr Inventory::removeItem(unsigned int slot, int count) slot -= items.length; } - if (pile[slot] != nullptr) + if (pile[slot] != NULL) { if (pile[slot]->count <= count) { @@ -454,7 +454,7 @@ shared_ptr Inventory::removeItemNoUpdate(int slot) slot -= items.length; } - if (pile[slot] != nullptr) + if (pile[slot] != NULL) { shared_ptr item = pile[slot]; pile[slot] = nullptr; @@ -466,7 +466,7 @@ shared_ptr Inventory::removeItemNoUpdate(int slot) void Inventory::setItem(unsigned int slot, shared_ptr item) { #ifdef _DEBUG - if(item!=nullptr) + if(item!=NULL) { wstring itemstring=item->toString(); app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d ",slot,item->id); @@ -474,7 +474,7 @@ void Inventory::setItem(unsigned int slot, shared_ptr item) app.DebugPrintf("\n"); } #else - if(item!=nullptr) + if(item!=NULL) { app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d, aux = %d\n",slot,item->id,item->getAuxValue()); } @@ -504,7 +504,7 @@ void Inventory::setItem(unsigned int slot, shared_ptr item) float Inventory::getDestroySpeed(Tile *tile) { float speed = 1.0f; - if (items[selected] != nullptr) speed *= items[selected]->getDestroySpeed(tile); + if (items[selected] != NULL) speed *= items[selected]->getDestroySpeed(tile); return speed; } @@ -512,20 +512,20 @@ ListTag *Inventory::save(ListTag *listTag) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr) + if (armor[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i + 100)); + tag->putByte(L"Slot", (byte) (i + 100)); armor[i]->save(tag); listTag->add(tag); } @@ -535,15 +535,15 @@ ListTag *Inventory::save(ListTag *listTag) void Inventory::load(ListTag *inventoryList) { - if( items.data != nullptr) + if( items.data != NULL) { delete[] items.data; - items.data = nullptr; + items.data = NULL; } - if( armor.data != nullptr) + if( armor.data != NULL) { delete[] armor.data; - armor.data = nullptr; + armor.data = NULL; } items = ItemInstanceArray( INVENTORY_SIZE ); @@ -553,7 +553,7 @@ void Inventory::load(ListTag *inventoryList) CompoundTag *tag = inventoryList->get(i); unsigned int slot = tag->getByte(L"Slot") & 0xff; shared_ptr item = shared_ptr( ItemInstance::fromTag(tag) ); - if (item != nullptr) + if (item != NULL) { if (slot >= 0 && slot < items.length) items[slot] = item; if (slot >= 100 && slot < armor.length + 100) armor[slot - 100] = item; @@ -614,7 +614,7 @@ bool Inventory::canDestroy(Tile *tile) if (tile->material->isAlwaysDestroyable()) return true; shared_ptr item = getItem(selected); - if (item != nullptr) return item->canDestroySpecial(tile); + if (item != NULL) return item->canDestroySpecial(tile); return false; } @@ -628,7 +628,7 @@ int Inventory::getArmorValue() int val = 0; for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr && dynamic_cast( armor[i]->getItem() ) != nullptr ) + if (armor[i] != NULL && dynamic_cast( armor[i]->getItem() ) != NULL ) { int baseProtection = dynamic_cast(armor[i]->getItem())->defense; @@ -647,9 +647,9 @@ void Inventory::hurtArmor(float dmg) } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr && dynamic_cast( armor[i]->getItem() ) != nullptr ) + if (armor[i] != NULL && dynamic_cast( armor[i]->getItem() ) != NULL ) { - armor[i]->hurtAndBreak( static_cast(dmg), dynamic_pointer_cast( player->shared_from_this() ) ); + armor[i]->hurtAndBreak( (int) dmg, dynamic_pointer_cast( player->shared_from_this() ) ); if (armor[i]->count == 0) { armor[i] = nullptr; @@ -662,7 +662,7 @@ void Inventory::dropAll() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { player->drop(items[i], true); items[i] = nullptr; @@ -670,7 +670,7 @@ void Inventory::dropAll() } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr) + if (armor[i] != NULL) { player->drop(armor[i], true); armor[i] = nullptr; @@ -699,8 +699,8 @@ bool Inventory::isSame(shared_ptr copy) bool Inventory::isSame(shared_ptr a, shared_ptr b) { - if (a == nullptr && b == nullptr) return true; - if (a == nullptr || b == nullptr) return false; + if (a == NULL && b == NULL) return true; + if (a == NULL || b == NULL) return false; return a->id == b->id && a->count == b->count && a->getAuxValue() == b->getAuxValue(); } @@ -708,14 +708,14 @@ bool Inventory::isSame(shared_ptr a, shared_ptr b) shared_ptr Inventory::copy() { - shared_ptr copy = std::make_shared(nullptr); + shared_ptr copy = shared_ptr( new Inventory(NULL) ); for (unsigned int i = 0; i < items.length; i++) { - copy->items[i] = items[i] != nullptr ? items[i]->copy() : nullptr; + copy->items[i] = items[i] != NULL ? items[i]->copy() : nullptr; } for (unsigned int i = 0; i < armor.length; i++) { - copy->armor[i] = armor[i] != nullptr ? armor[i]->copy() : nullptr; + copy->armor[i] = armor[i] != NULL ? armor[i]->copy() : nullptr; } return copy; } @@ -742,11 +742,11 @@ bool Inventory::contains(shared_ptr itemInstance) { for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) return true; + if (armor[i] != NULL && armor[i]->sameItem(itemInstance)) return true; } for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->sameItem(itemInstance)) return true; + if (items[i] != NULL && items[i]->sameItem(itemInstance)) return true; } return false; } @@ -782,15 +782,15 @@ void Inventory::replaceWith(shared_ptr other) int Inventory::countMatches(shared_ptr itemInstance) { - if(itemInstance == nullptr) return 0; + if(itemInstance == NULL) return 0; int count = 0; //for (unsigned int i = 0; i < armor.length; i++) //{ - // if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) count += items[i]->count; + // if (armor[i] != NULL && armor[i]->sameItem(itemInstance)) count += items[i]->count; //} for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->sameItemWithTags(itemInstance)) count += items[i]->count; + if (items[i] != NULL && items[i]->sameItemWithTags(itemInstance)) count += items[i]->count; } return count; } diff --git a/Minecraft.World/InventoryMenu.cpp b/Minecraft.World/InventoryMenu.cpp index 9c6c661f..ae5d9269 100644 --- a/Minecraft.World/InventoryMenu.cpp +++ b/Minecraft.World/InventoryMenu.cpp @@ -28,8 +28,8 @@ InventoryMenu::InventoryMenu(shared_ptr inventory, bool active, Playe void InventoryMenu::_init(shared_ptr inventory, bool active) { - craftSlots = std::make_shared(this, 2, 2); - resultSlots = std::make_shared(); + craftSlots = shared_ptr( new CraftingContainer(this, 2, 2) ); + resultSlots = shared_ptr( new ResultContainer() ); this->active = active; addSlot(new ResultSlot( inventory->player, craftSlots, resultSlots, 0, 144, 36)); @@ -77,7 +77,7 @@ void InventoryMenu::removed(shared_ptr player) for (int i = 0; i < 4; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != nullptr) + if (item != NULL) { player->drop(item); craftSlots->setItem(i, nullptr); @@ -102,7 +102,7 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player Slot *BootsSlot = slots.at(ARMOR_SLOT_START+3); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -240,7 +240,7 @@ shared_ptr InventoryMenu::clicked(int slotIndex, int buttonNum, in for (int i = ARMOR_SLOT_START; i < ARMOR_SLOT_END; i++) { Slot *slot = slots.at(i); - if ( (slot==nullptr) || (!slot->hasItem()) || (slot->getItem()->getItem()->id != ironItems[i-ARMOR_SLOT_START]) ) + if ( (slot==NULL) || (!slot->hasItem()) || (slot->getItem()->getItem()->id != ironItems[i-ARMOR_SLOT_START]) ) { return out; } diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index ffb31070..2f23ab8c 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -32,224 +32,224 @@ Random *Item::random = new Random(); ItemArray Item::items = ItemArray( ITEM_NUM_COUNT ); -Item *Item::shovel_iron = nullptr; -Item *Item::pickAxe_iron = nullptr; -Item *Item::hatchet_iron = nullptr; -Item *Item::flintAndSteel = nullptr; -Item *Item::apple = nullptr; -BowItem *Item::bow = nullptr; -Item *Item::arrow = nullptr; -Item *Item::coal = nullptr; -Item *Item::diamond = nullptr; -Item *Item::ironIngot = nullptr; -Item *Item::goldIngot = nullptr; -Item *Item::sword_iron = nullptr; +Item *Item::shovel_iron = NULL; +Item *Item::pickAxe_iron = NULL; +Item *Item::hatchet_iron = NULL; +Item *Item::flintAndSteel = NULL; +Item *Item::apple = NULL; +BowItem *Item::bow = NULL; +Item *Item::arrow = NULL; +Item *Item::coal = NULL; +Item *Item::diamond = NULL; +Item *Item::ironIngot = NULL; +Item *Item::goldIngot = NULL; +Item *Item::sword_iron = NULL; -Item *Item::sword_wood = nullptr; -Item *Item::shovel_wood = nullptr; -Item *Item::pickAxe_wood = nullptr; -Item *Item::hatchet_wood = nullptr; +Item *Item::sword_wood = NULL; +Item *Item::shovel_wood = NULL; +Item *Item::pickAxe_wood = NULL; +Item *Item::hatchet_wood = NULL; -Item *Item::sword_stone = nullptr; -Item *Item::shovel_stone = nullptr; -Item *Item::pickAxe_stone = nullptr; -Item *Item::hatchet_stone = nullptr; +Item *Item::sword_stone = NULL; +Item *Item::shovel_stone = NULL; +Item *Item::pickAxe_stone = NULL; +Item *Item::hatchet_stone = NULL; -Item *Item::sword_diamond = nullptr; -Item *Item::shovel_diamond = nullptr; -Item *Item::pickAxe_diamond = nullptr; -Item *Item::hatchet_diamond = nullptr; +Item *Item::sword_diamond = NULL; +Item *Item::shovel_diamond = NULL; +Item *Item::pickAxe_diamond = NULL; +Item *Item::hatchet_diamond = NULL; -Item *Item::stick = nullptr; -Item *Item::bowl = nullptr; -Item *Item::mushroomStew = nullptr; +Item *Item::stick = NULL; +Item *Item::bowl = NULL; +Item *Item::mushroomStew = NULL; -Item *Item::sword_gold = nullptr; -Item *Item::shovel_gold = nullptr; -Item *Item::pickAxe_gold = nullptr; -Item *Item::hatchet_gold = nullptr; +Item *Item::sword_gold = NULL; +Item *Item::shovel_gold = NULL; +Item *Item::pickAxe_gold = NULL; +Item *Item::hatchet_gold = NULL; -Item *Item::string = nullptr; -Item *Item::feather = nullptr; -Item *Item::gunpowder = nullptr; +Item *Item::string = NULL; +Item *Item::feather = NULL; +Item *Item::gunpowder = NULL; -Item *Item::hoe_wood = nullptr; -Item *Item::hoe_stone = nullptr; -Item *Item::hoe_iron = nullptr; -Item *Item::hoe_diamond = nullptr; -Item *Item::hoe_gold = nullptr; +Item *Item::hoe_wood = NULL; +Item *Item::hoe_stone = NULL; +Item *Item::hoe_iron = NULL; +Item *Item::hoe_diamond = NULL; +Item *Item::hoe_gold = NULL; -Item *Item::seeds_wheat = nullptr; -Item *Item::wheat = nullptr; -Item *Item::bread = nullptr; +Item *Item::seeds_wheat = NULL; +Item *Item::wheat = NULL; +Item *Item::bread = NULL; -ArmorItem *Item::helmet_leather = nullptr; -ArmorItem *Item::chestplate_leather = nullptr; -ArmorItem *Item::leggings_leather = nullptr; -ArmorItem *Item::boots_leather = nullptr; +ArmorItem *Item::helmet_leather = NULL; +ArmorItem *Item::chestplate_leather = NULL; +ArmorItem *Item::leggings_leather = NULL; +ArmorItem *Item::boots_leather = NULL; -ArmorItem *Item::helmet_chain = nullptr; -ArmorItem *Item::chestplate_chain = nullptr; -ArmorItem *Item::leggings_chain = nullptr; -ArmorItem *Item::boots_chain = nullptr; +ArmorItem *Item::helmet_chain = NULL; +ArmorItem *Item::chestplate_chain = NULL; +ArmorItem *Item::leggings_chain = NULL; +ArmorItem *Item::boots_chain = NULL; -ArmorItem *Item::helmet_iron = nullptr; -ArmorItem *Item::chestplate_iron = nullptr; -ArmorItem *Item::leggings_iron = nullptr; -ArmorItem *Item::boots_iron = nullptr; +ArmorItem *Item::helmet_iron = NULL; +ArmorItem *Item::chestplate_iron = NULL; +ArmorItem *Item::leggings_iron = NULL; +ArmorItem *Item::boots_iron = NULL; -ArmorItem *Item::helmet_diamond = nullptr; -ArmorItem *Item::chestplate_diamond = nullptr; -ArmorItem *Item::leggings_diamond = nullptr; -ArmorItem *Item::boots_diamond = nullptr; +ArmorItem *Item::helmet_diamond = NULL; +ArmorItem *Item::chestplate_diamond = NULL; +ArmorItem *Item::leggings_diamond = NULL; +ArmorItem *Item::boots_diamond = NULL; -ArmorItem *Item::helmet_gold = nullptr; -ArmorItem *Item::chestplate_gold = nullptr; -ArmorItem *Item::leggings_gold = nullptr; -ArmorItem *Item::boots_gold = nullptr; +ArmorItem *Item::helmet_gold = NULL; +ArmorItem *Item::chestplate_gold = NULL; +ArmorItem *Item::leggings_gold = NULL; +ArmorItem *Item::boots_gold = NULL; -Item *Item::flint = nullptr; -Item *Item::porkChop_raw = nullptr; -Item *Item::porkChop_cooked = nullptr; -Item *Item::painting = nullptr; +Item *Item::flint = NULL; +Item *Item::porkChop_raw = NULL; +Item *Item::porkChop_cooked = NULL; +Item *Item::painting = NULL; -Item *Item::apple_gold = nullptr; +Item *Item::apple_gold = NULL; -Item *Item::sign = nullptr; -Item *Item::door_wood = nullptr; +Item *Item::sign = NULL; +Item *Item::door_wood = NULL; -Item *Item::bucket_empty = nullptr; -Item *Item::bucket_water = nullptr; -Item *Item::bucket_lava = nullptr; +Item *Item::bucket_empty = NULL; +Item *Item::bucket_water = NULL; +Item *Item::bucket_lava = NULL; -Item *Item::minecart = nullptr; -Item *Item::saddle = nullptr; -Item *Item::door_iron = nullptr; -Item *Item::redStone = nullptr; -Item *Item::snowBall = nullptr; +Item *Item::minecart = NULL; +Item *Item::saddle = NULL; +Item *Item::door_iron = NULL; +Item *Item::redStone = NULL; +Item *Item::snowBall = NULL; -Item *Item::boat = nullptr; +Item *Item::boat = NULL; -Item *Item::leather = nullptr; -Item *Item::bucket_milk = nullptr; -Item *Item::brick = nullptr; -Item *Item::clay = nullptr; -Item *Item::reeds = nullptr; -Item *Item::paper = nullptr; -Item *Item::book = nullptr; -Item *Item::slimeBall = nullptr; -Item *Item::minecart_chest = nullptr; -Item *Item::minecart_furnace = nullptr; -Item *Item::egg = nullptr; -Item *Item::compass = nullptr; -FishingRodItem *Item::fishingRod = nullptr; -Item *Item::clock = nullptr; -Item *Item::yellowDust = nullptr; -Item *Item::fish_raw = nullptr; -Item *Item::fish_cooked = nullptr; +Item *Item::leather = NULL; +Item *Item::bucket_milk = NULL; +Item *Item::brick = NULL; +Item *Item::clay = NULL; +Item *Item::reeds = NULL; +Item *Item::paper = NULL; +Item *Item::book = NULL; +Item *Item::slimeBall = NULL; +Item *Item::minecart_chest = NULL; +Item *Item::minecart_furnace = NULL; +Item *Item::egg = NULL; +Item *Item::compass = NULL; +FishingRodItem *Item::fishingRod = NULL; +Item *Item::clock = NULL; +Item *Item::yellowDust = NULL; +Item *Item::fish_raw = NULL; +Item *Item::fish_cooked = NULL; -Item *Item::dye_powder = nullptr; -Item *Item::bone = nullptr; -Item *Item::sugar = nullptr; -Item *Item::cake = nullptr; +Item *Item::dye_powder = NULL; +Item *Item::bone = NULL; +Item *Item::sugar = NULL; +Item *Item::cake = NULL; -Item *Item::bed = nullptr; +Item *Item::bed = NULL; -Item *Item::repeater = nullptr; -Item *Item::cookie = nullptr; +Item *Item::repeater = NULL; +Item *Item::cookie = NULL; -MapItem *Item::map = nullptr; +MapItem *Item::map = NULL; -Item *Item::record_01 = nullptr; -Item *Item::record_02 = nullptr; -Item *Item::record_03 = nullptr; -Item *Item::record_04 = nullptr; -Item *Item::record_05 = nullptr; -Item *Item::record_06 = nullptr; -Item *Item::record_07 = nullptr; -Item *Item::record_08 = nullptr; -Item *Item::record_09 = nullptr; -Item *Item::record_10 = nullptr; -Item *Item::record_11 = nullptr; -Item *Item::record_12 = nullptr; +Item *Item::record_01 = NULL; +Item *Item::record_02 = NULL; +Item *Item::record_03 = NULL; +Item *Item::record_04 = NULL; +Item *Item::record_05 = NULL; +Item *Item::record_06 = NULL; +Item *Item::record_07 = NULL; +Item *Item::record_08 = NULL; +Item *Item::record_09 = NULL; +Item *Item::record_10 = NULL; +Item *Item::record_11 = NULL; +Item *Item::record_12 = NULL; -ShearsItem *Item::shears = nullptr; +ShearsItem *Item::shears = NULL; -Item *Item::melon = nullptr; +Item *Item::melon = NULL; -Item *Item::seeds_pumpkin = nullptr; -Item *Item::seeds_melon = nullptr; +Item *Item::seeds_pumpkin = NULL; +Item *Item::seeds_melon = NULL; -Item *Item::beef_raw = nullptr; -Item *Item::beef_cooked = nullptr; -Item *Item::chicken_raw = nullptr; -Item *Item::chicken_cooked = nullptr; -Item *Item::rotten_flesh = nullptr; +Item *Item::beef_raw = NULL; +Item *Item::beef_cooked = NULL; +Item *Item::chicken_raw = NULL; +Item *Item::chicken_cooked = NULL; +Item *Item::rotten_flesh = NULL; -Item *Item::enderPearl = nullptr; +Item *Item::enderPearl = NULL; -Item *Item::blazeRod = nullptr; -Item *Item::ghastTear = nullptr; -Item *Item::goldNugget = nullptr; -Item *Item::netherwart_seeds = nullptr; -PotionItem *Item::potion = nullptr; -Item *Item::glassBottle = nullptr; -Item *Item::spiderEye = nullptr; -Item *Item::fermentedSpiderEye = nullptr; -Item *Item::blazePowder = nullptr; -Item *Item::magmaCream = nullptr; -Item *Item::brewingStand = nullptr; -Item *Item::cauldron = nullptr; -Item *Item::eyeOfEnder = nullptr; -Item *Item::speckledMelon = nullptr; +Item *Item::blazeRod = NULL; +Item *Item::ghastTear = NULL; +Item *Item::goldNugget = NULL; +Item *Item::netherwart_seeds = NULL; +PotionItem *Item::potion = NULL; +Item *Item::glassBottle = NULL; +Item *Item::spiderEye = NULL; +Item *Item::fermentedSpiderEye = NULL; +Item *Item::blazePowder = NULL; +Item *Item::magmaCream = NULL; +Item *Item::brewingStand = NULL; +Item *Item::cauldron = NULL; +Item *Item::eyeOfEnder = NULL; +Item *Item::speckledMelon = NULL; -Item *Item::spawnEgg = nullptr; +Item *Item::spawnEgg = NULL; -Item *Item::expBottle = nullptr; +Item *Item::expBottle = NULL; // TU9 -Item *Item::fireball = nullptr; -Item *Item::frame = nullptr; +Item *Item::fireball = NULL; +Item *Item::frame = NULL; -Item *Item::skull = nullptr; +Item *Item::skull = NULL; // TU14 -//Item *Item::writingBook = nullptr; -//Item *Item::writtenBook = nullptr; +//Item *Item::writingBook = NULL; +//Item *Item::writtenBook = NULL; -Item *Item::emerald = nullptr; +Item *Item::emerald = NULL; -Item *Item::flowerPot = nullptr; +Item *Item::flowerPot = NULL; -Item *Item::carrots = nullptr; -Item *Item::potato = nullptr; -Item *Item::potatoBaked = nullptr; -Item *Item::potatoPoisonous = nullptr; +Item *Item::carrots = NULL; +Item *Item::potato = NULL; +Item *Item::potatoBaked = NULL; +Item *Item::potatoPoisonous = NULL; -EmptyMapItem *Item::emptyMap = nullptr; +EmptyMapItem *Item::emptyMap = NULL; -Item *Item::carrotGolden = nullptr; +Item *Item::carrotGolden = NULL; -Item *Item::carrotOnAStick = nullptr; -Item *Item::netherStar = nullptr; -Item *Item::pumpkinPie = nullptr; -Item *Item::fireworks = nullptr; -Item *Item::fireworksCharge = nullptr; +Item *Item::carrotOnAStick = NULL; +Item *Item::netherStar = NULL; +Item *Item::pumpkinPie = NULL; +Item *Item::fireworks = NULL; +Item *Item::fireworksCharge = NULL; -EnchantedBookItem *Item::enchantedBook = nullptr; +EnchantedBookItem *Item::enchantedBook = NULL; -Item *Item::comparator = nullptr; -Item *Item::netherbrick = nullptr; -Item *Item::netherQuartz = nullptr; -Item *Item::minecart_tnt = nullptr; -Item *Item::minecart_hopper = nullptr; +Item *Item::comparator = NULL; +Item *Item::netherbrick = NULL; +Item *Item::netherQuartz = NULL; +Item *Item::minecart_tnt = NULL; +Item *Item::minecart_hopper = NULL; -Item *Item::horseArmorMetal = nullptr; -Item *Item::horseArmorGold = nullptr; -Item *Item::horseArmorDiamond = nullptr; -Item *Item::lead = nullptr; -Item *Item::nameTag = nullptr; +Item *Item::horseArmorMetal = NULL; +Item *Item::horseArmorGold = NULL; +Item *Item::horseArmorDiamond = NULL; +Item *Item::lead = NULL; +Item *Item::nameTag = NULL; void Item::staticCtor() @@ -287,30 +287,30 @@ void Item::staticCtor() Item::door_wood = ( new DoorItem(68, Material::wood) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_wood)->setIconName(L"doorWood")->setDescriptionId(IDS_ITEM_DOOR_WOOD)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); Item::door_iron = ( new DoorItem(74, Material::metal) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_iron)->setIconName(L"doorIron")->setDescriptionId(IDS_ITEM_DOOR_IRON)->setUseDescriptionId(IDS_DESC_DOOR_IRON); - Item::helmet_leather = static_cast((new ArmorItem(42, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_cloth)->setIconName(L"helmetCloth")->setDescriptionId(IDS_ITEM_HELMET_CLOTH)->setUseDescriptionId(IDS_DESC_HELMET_LEATHER)); - Item::helmet_iron = static_cast((new ArmorItem(50, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_iron)->setIconName(L"helmetIron")->setDescriptionId(IDS_ITEM_HELMET_IRON)->setUseDescriptionId(IDS_DESC_HELMET_IRON)); - Item::helmet_diamond = static_cast((new ArmorItem(54, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_diamond)->setIconName(L"helmetDiamond")->setDescriptionId(IDS_ITEM_HELMET_DIAMOND)->setUseDescriptionId(IDS_DESC_HELMET_DIAMOND)); - Item::helmet_gold = static_cast((new ArmorItem(58, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_gold)->setIconName(L"helmetGold")->setDescriptionId(IDS_ITEM_HELMET_GOLD)->setUseDescriptionId(IDS_DESC_HELMET_GOLD)); + Item::helmet_leather = (ArmorItem *) ( ( new ArmorItem(42, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_cloth) ->setIconName(L"helmetCloth")->setDescriptionId(IDS_ITEM_HELMET_CLOTH)->setUseDescriptionId(IDS_DESC_HELMET_LEATHER) ); + Item::helmet_iron = (ArmorItem *) ( ( new ArmorItem(50, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_iron) ->setIconName(L"helmetIron")->setDescriptionId(IDS_ITEM_HELMET_IRON)->setUseDescriptionId(IDS_DESC_HELMET_IRON) ); + Item::helmet_diamond = (ArmorItem *) ( ( new ArmorItem(54, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_diamond) ->setIconName(L"helmetDiamond")->setDescriptionId(IDS_ITEM_HELMET_DIAMOND)->setUseDescriptionId(IDS_DESC_HELMET_DIAMOND) ); + Item::helmet_gold = (ArmorItem *) ( ( new ArmorItem(58, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_gold) ->setIconName(L"helmetGold")->setDescriptionId(IDS_ITEM_HELMET_GOLD)->setUseDescriptionId(IDS_DESC_HELMET_GOLD) ); - Item::chestplate_leather = static_cast((new ArmorItem(43, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_TORSO))->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_cloth)->setIconName(L"chestplateCloth")->setDescriptionId(IDS_ITEM_CHESTPLATE_CLOTH)->setUseDescriptionId(IDS_DESC_CHESTPLATE_LEATHER)); - Item::chestplate_iron = static_cast((new ArmorItem(51, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_TORSO))->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_iron)->setIconName(L"chestplateIron")->setDescriptionId(IDS_ITEM_CHESTPLATE_IRON)->setUseDescriptionId(IDS_DESC_CHESTPLATE_IRON)); - Item::chestplate_diamond = static_cast((new ArmorItem(55, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_TORSO))->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_diamond)->setIconName(L"chestplateDiamond")->setDescriptionId(IDS_ITEM_CHESTPLATE_DIAMOND)->setUseDescriptionId(IDS_DESC_CHESTPLATE_DIAMOND)); - Item::chestplate_gold = static_cast((new ArmorItem(59, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_TORSO))->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_gold)->setIconName(L"chestplateGold")->setDescriptionId(IDS_ITEM_CHESTPLATE_GOLD)->setUseDescriptionId(IDS_DESC_CHESTPLATE_GOLD)); + Item::chestplate_leather = (ArmorItem *) ( ( new ArmorItem(43, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_cloth) ->setIconName(L"chestplateCloth")->setDescriptionId(IDS_ITEM_CHESTPLATE_CLOTH)->setUseDescriptionId(IDS_DESC_CHESTPLATE_LEATHER) ); + Item::chestplate_iron = (ArmorItem *) ( ( new ArmorItem(51, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_iron) ->setIconName(L"chestplateIron")->setDescriptionId(IDS_ITEM_CHESTPLATE_IRON)->setUseDescriptionId(IDS_DESC_CHESTPLATE_IRON) ); + Item::chestplate_diamond = (ArmorItem *) ( ( new ArmorItem(55, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_diamond) ->setIconName(L"chestplateDiamond")->setDescriptionId(IDS_ITEM_CHESTPLATE_DIAMOND)->setUseDescriptionId(IDS_DESC_CHESTPLATE_DIAMOND) ); + Item::chestplate_gold = (ArmorItem *) ( ( new ArmorItem(59, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_gold) ->setIconName(L"chestplateGold")->setDescriptionId(IDS_ITEM_CHESTPLATE_GOLD)->setUseDescriptionId(IDS_DESC_CHESTPLATE_GOLD) ); - Item::leggings_leather = static_cast((new ArmorItem(44, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_LEGS))->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_cloth)->setIconName(L"leggingsCloth")->setDescriptionId(IDS_ITEM_LEGGINGS_CLOTH)->setUseDescriptionId(IDS_DESC_LEGGINGS_LEATHER)); - Item::leggings_iron = static_cast((new ArmorItem(52, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_LEGS))->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_iron)->setIconName(L"leggingsIron")->setDescriptionId(IDS_ITEM_LEGGINGS_IRON)->setUseDescriptionId(IDS_DESC_LEGGINGS_IRON)); - Item::leggings_diamond = static_cast((new ArmorItem(56, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_LEGS))->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_diamond)->setIconName(L"leggingsDiamond")->setDescriptionId(IDS_ITEM_LEGGINGS_DIAMOND)->setUseDescriptionId(IDS_DESC_LEGGINGS_DIAMOND)); - Item::leggings_gold = static_cast((new ArmorItem(60, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_LEGS))->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_gold)->setIconName(L"leggingsGold")->setDescriptionId(IDS_ITEM_LEGGINGS_GOLD)->setUseDescriptionId(IDS_DESC_LEGGINGS_GOLD)); + Item::leggings_leather = (ArmorItem *) ( ( new ArmorItem(44, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_cloth) ->setIconName(L"leggingsCloth")->setDescriptionId(IDS_ITEM_LEGGINGS_CLOTH)->setUseDescriptionId(IDS_DESC_LEGGINGS_LEATHER) ); + Item::leggings_iron = (ArmorItem *) ( ( new ArmorItem(52, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_iron) ->setIconName(L"leggingsIron")->setDescriptionId(IDS_ITEM_LEGGINGS_IRON)->setUseDescriptionId(IDS_DESC_LEGGINGS_IRON) ); + Item::leggings_diamond = (ArmorItem *) ( ( new ArmorItem(56, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_diamond) ->setIconName(L"leggingsDiamond")->setDescriptionId(IDS_ITEM_LEGGINGS_DIAMOND)->setUseDescriptionId(IDS_DESC_LEGGINGS_DIAMOND) ); + Item::leggings_gold = (ArmorItem *) ( ( new ArmorItem(60, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_gold) ->setIconName(L"leggingsGold")->setDescriptionId(IDS_ITEM_LEGGINGS_GOLD)->setUseDescriptionId(IDS_DESC_LEGGINGS_GOLD) ); - Item::helmet_chain = static_cast((new ArmorItem(46, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_chain)->setIconName(L"helmetChain")->setDescriptionId(IDS_ITEM_HELMET_CHAIN)->setUseDescriptionId(IDS_DESC_HELMET_CHAIN)); - Item::chestplate_chain = static_cast((new ArmorItem(47, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_TORSO))->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_chain)->setIconName(L"chestplateChain")->setDescriptionId(IDS_ITEM_CHESTPLATE_CHAIN)->setUseDescriptionId(IDS_DESC_CHESTPLATE_CHAIN)); - Item::leggings_chain = static_cast((new ArmorItem(48, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_LEGS))->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_chain)->setIconName(L"leggingsChain")->setDescriptionId(IDS_ITEM_LEGGINGS_CHAIN)->setUseDescriptionId(IDS_DESC_LEGGINGS_CHAIN)); - Item::boots_chain = static_cast((new ArmorItem(49, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_FEET))->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_chain)->setIconName(L"bootsChain")->setDescriptionId(IDS_ITEM_BOOTS_CHAIN)->setUseDescriptionId(IDS_DESC_BOOTS_CHAIN)); + Item::helmet_chain = (ArmorItem *) ( ( new ArmorItem(46, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_HEAD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_chain) ->setIconName(L"helmetChain")->setDescriptionId(IDS_ITEM_HELMET_CHAIN)->setUseDescriptionId(IDS_DESC_HELMET_CHAIN) ); + Item::chestplate_chain = (ArmorItem *) ( ( new ArmorItem(47, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_TORSO) ) ->setBaseItemTypeAndMaterial(eBaseItemType_chestplate, eMaterial_chain) ->setIconName(L"chestplateChain")->setDescriptionId(IDS_ITEM_CHESTPLATE_CHAIN)->setUseDescriptionId(IDS_DESC_CHESTPLATE_CHAIN) ); + Item::leggings_chain = (ArmorItem *) ( ( new ArmorItem(48, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_LEGS) ) ->setBaseItemTypeAndMaterial(eBaseItemType_leggings, eMaterial_chain) ->setIconName(L"leggingsChain")->setDescriptionId(IDS_ITEM_LEGGINGS_CHAIN)->setUseDescriptionId(IDS_DESC_LEGGINGS_CHAIN) ); + Item::boots_chain = (ArmorItem *) ( ( new ArmorItem(49, ArmorItem::ArmorMaterial::CHAIN, 1, ArmorItem::SLOT_FEET) ) ->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_chain) ->setIconName(L"bootsChain")->setDescriptionId(IDS_ITEM_BOOTS_CHAIN)->setUseDescriptionId(IDS_DESC_BOOTS_CHAIN) ); - Item::boots_leather = static_cast((new ArmorItem(45, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_FEET))->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_cloth)->setIconName(L"bootsCloth")->setDescriptionId(IDS_ITEM_BOOTS_CLOTH)->setUseDescriptionId(IDS_DESC_BOOTS_LEATHER)); - Item::boots_iron = static_cast((new ArmorItem(53, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_FEET))->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_iron)->setIconName(L"bootsIron")->setDescriptionId(IDS_ITEM_BOOTS_IRON)->setUseDescriptionId(IDS_DESC_BOOTS_IRON)); - Item::boots_diamond = static_cast((new ArmorItem(57, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_FEET))->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_diamond)->setIconName(L"bootsDiamond")->setDescriptionId(IDS_ITEM_BOOTS_DIAMOND)->setUseDescriptionId(IDS_DESC_BOOTS_DIAMOND)); - Item::boots_gold = static_cast((new ArmorItem(61, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_FEET))->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_gold)->setIconName(L"bootsGold")->setDescriptionId(IDS_ITEM_BOOTS_GOLD)->setUseDescriptionId(IDS_DESC_BOOTS_GOLD)); + Item::boots_leather = (ArmorItem *) ( ( new ArmorItem(45, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_FEET) ) ->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_cloth) ->setIconName(L"bootsCloth")->setDescriptionId(IDS_ITEM_BOOTS_CLOTH)->setUseDescriptionId(IDS_DESC_BOOTS_LEATHER) ); + Item::boots_iron = (ArmorItem *) ( ( new ArmorItem(53, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_FEET) ) ->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_iron) ->setIconName(L"bootsIron")->setDescriptionId(IDS_ITEM_BOOTS_IRON)->setUseDescriptionId(IDS_DESC_BOOTS_IRON) ); + Item::boots_diamond = (ArmorItem *) ( ( new ArmorItem(57, ArmorItem::ArmorMaterial::DIAMOND, 3, ArmorItem::SLOT_FEET) ) ->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_diamond) ->setIconName(L"bootsDiamond")->setDescriptionId(IDS_ITEM_BOOTS_DIAMOND)->setUseDescriptionId(IDS_DESC_BOOTS_DIAMOND) ); + Item::boots_gold = (ArmorItem *) ( ( new ArmorItem(61, ArmorItem::ArmorMaterial::GOLD, 4, ArmorItem::SLOT_FEET) ) ->setBaseItemTypeAndMaterial(eBaseItemType_boots, eMaterial_gold) ->setIconName(L"bootsGold")->setDescriptionId(IDS_ITEM_BOOTS_GOLD)->setUseDescriptionId(IDS_DESC_BOOTS_GOLD) ); Item::ironIngot = ( new Item(9) )->setIconName(L"ingotIron") ->setBaseItemTypeAndMaterial(eBaseItemType_treasure, eMaterial_iron)->setDescriptionId(IDS_ITEM_INGOT_IRON)->setUseDescriptionId(IDS_DESC_INGOT); Item::goldIngot = ( new Item(10) )->setIconName(L"ingotGold") ->setBaseItemTypeAndMaterial(eBaseItemType_treasure, eMaterial_gold)->setDescriptionId(IDS_ITEM_INGOT_GOLD)->setUseDescriptionId(IDS_DESC_INGOT); @@ -324,12 +324,12 @@ void Item::staticCtor() Item::bucket_lava = ( new BucketItem(71, Tile::lava_Id) ) ->setIconName(L"bucketLava")->setDescriptionId(IDS_ITEM_BUCKET_LAVA)->setCraftingRemainingItem(Item::bucket_empty)->setUseDescriptionId(IDS_DESC_BUCKET_LAVA); Item::bucket_milk = ( new MilkBucketItem(79) )->setIconName(L"milk")->setDescriptionId(IDS_ITEM_BUCKET_MILK)->setCraftingRemainingItem(Item::bucket_empty)->setUseDescriptionId(IDS_DESC_BUCKET_MILK); - Item::bow = static_cast((new BowItem(5))->setIconName(L"bow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_bow)->setDescriptionId(IDS_ITEM_BOW)->setUseDescriptionId(IDS_DESC_BOW)); + Item::bow = (BowItem *)( new BowItem(5) ) ->setIconName(L"bow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_bow) ->setDescriptionId(IDS_ITEM_BOW)->setUseDescriptionId(IDS_DESC_BOW); Item::arrow = ( new Item(6) ) ->setIconName(L"arrow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_arrow) ->setDescriptionId(IDS_ITEM_ARROW)->setUseDescriptionId(IDS_DESC_ARROW); Item::compass = ( new CompassItem(89) ) ->setIconName(L"compass")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_compass) ->setDescriptionId(IDS_ITEM_COMPASS)->setUseDescriptionId(IDS_DESC_COMPASS); Item::clock = ( new ClockItem(91) ) ->setIconName(L"clock")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_clock) ->setDescriptionId(IDS_ITEM_CLOCK)->setUseDescriptionId(IDS_DESC_CLOCK); - Item::map = static_cast((new MapItem(102))->setIconName(L"map")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_map)->setDescriptionId(IDS_ITEM_MAP)->setUseDescriptionId(IDS_DESC_MAP)); + Item::map = (MapItem *) ( new MapItem(102) ) ->setIconName(L"map")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_map) ->setDescriptionId(IDS_ITEM_MAP)->setUseDescriptionId(IDS_DESC_MAP); Item::flintAndSteel = ( new FlintAndSteelItem(3) ) ->setIconName(L"flintAndSteel")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_flintandsteel)->setDescriptionId(IDS_ITEM_FLINT_AND_STEEL)->setUseDescriptionId(IDS_DESC_FLINTANDSTEEL); Item::apple = ( new FoodItem(4, 4, FoodConstants::FOOD_SATURATION_LOW, false) ) ->setIconName(L"apple")->setDescriptionId(IDS_ITEM_APPLE)->setUseDescriptionId(IDS_DESC_APPLE); @@ -377,7 +377,7 @@ void Item::staticCtor() Item::minecart_chest = ( new MinecartItem(86, Minecart::TYPE_CHEST) ) ->setIconName(L"minecart_chest")->setDescriptionId(IDS_ITEM_MINECART_CHEST)->setUseDescriptionId(IDS_DESC_MINECARTWITHCHEST); Item::minecart_furnace = ( new MinecartItem(87, Minecart::TYPE_FURNACE) )->setIconName(L"minecart_furnace")->setDescriptionId(IDS_ITEM_MINECART_FURNACE)->setUseDescriptionId(IDS_DESC_MINECARTWITHFURNACE); Item::egg = ( new EggItem(88) ) ->setIconName(L"egg")->setDescriptionId(IDS_ITEM_EGG)->setUseDescriptionId(IDS_DESC_EGG); - Item::fishingRod = static_cast((new FishingRodItem(90))->setBaseItemTypeAndMaterial(eBaseItemType_rod, eMaterial_wood)->setIconName(L"fishingRod")->setDescriptionId(IDS_ITEM_FISHING_ROD)->setUseDescriptionId(IDS_DESC_FISHINGROD)); + Item::fishingRod = (FishingRodItem *)( new FishingRodItem(90) ) ->setBaseItemTypeAndMaterial(eBaseItemType_rod, eMaterial_wood)->setIconName(L"fishingRod")->setDescriptionId(IDS_ITEM_FISHING_ROD)->setUseDescriptionId(IDS_DESC_FISHINGROD); Item::yellowDust = ( new Item(92) ) ->setIconName(L"yellowDust")->setDescriptionId(IDS_ITEM_YELLOW_DUST)->setUseDescriptionId(IDS_DESC_YELLOW_DUST)->setPotionBrewingFormula(PotionBrewing::MOD_GLOWSTONE); Item::fish_raw = ( new FoodItem(93, 2, FoodConstants::FOOD_SATURATION_LOW, false) ) ->setIconName(L"fishRaw")->setDescriptionId(IDS_ITEM_FISH_RAW)->setUseDescriptionId(IDS_DESC_FISH_RAW); Item::fish_cooked = ( new FoodItem(94, 5, FoodConstants::FOOD_SATURATION_NORMAL, false) ) ->setIconName(L"fishCooked")->setDescriptionId(IDS_ITEM_FISH_COOKED)->setUseDescriptionId(IDS_DESC_FISH_COOKED); @@ -392,11 +392,11 @@ void Item::staticCtor() Item::bed = ( new BedItem(99) ) ->setMaxStackSize(1)->setIconName(L"bed")->setDescriptionId(IDS_ITEM_BED)->setUseDescriptionId(IDS_DESC_BED); - Item::repeater = ( new TilePlanterItem(100, static_cast(Tile::diode_off)) ) ->setIconName(L"diode")->setDescriptionId(IDS_ITEM_DIODE)->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER); + Item::repeater = ( new TilePlanterItem(100, (Tile *)Tile::diode_off) ) ->setIconName(L"diode")->setDescriptionId(IDS_ITEM_DIODE)->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER); Item::cookie = ( new FoodItem(101, 2, FoodConstants::FOOD_SATURATION_POOR, false) ) ->setIconName(L"cookie")->setDescriptionId(IDS_ITEM_COOKIE)->setUseDescriptionId(IDS_DESC_COOKIE); - Item::shears = static_cast((new ShearsItem(103))->setIconName(L"shears")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_shears)->setDescriptionId(IDS_ITEM_SHEARS)->setUseDescriptionId(IDS_DESC_SHEARS)); + Item::shears = (ShearsItem *)( new ShearsItem(103) ) ->setIconName(L"shears")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_shears)->setDescriptionId(IDS_ITEM_SHEARS)->setUseDescriptionId(IDS_DESC_SHEARS); Item::melon = (new FoodItem(104, 2, FoodConstants::FOOD_SATURATION_LOW, false)) ->setIconName(L"melon")->setDescriptionId(IDS_ITEM_MELON_SLICE)->setUseDescriptionId(IDS_DESC_MELON_SLICE); @@ -417,7 +417,7 @@ void Item::staticCtor() Item::netherwart_seeds = (new SeedItem(116, Tile::netherStalk_Id, Tile::soulsand_Id) ) ->setIconName(L"netherStalkSeeds")->setDescriptionId(IDS_ITEM_NETHER_STALK_SEEDS)->setUseDescriptionId(IDS_DESC_NETHER_STALK_SEEDS)->setPotionBrewingFormula(PotionBrewing::MOD_NETHERWART); - Item::potion = static_cast((new PotionItem(117))->setIconName(L"potion")->setDescriptionId(IDS_ITEM_POTION)->setUseDescriptionId(IDS_DESC_POTION)); + Item::potion = (PotionItem *) ( ( new PotionItem(117) ) ->setIconName(L"potion")->setDescriptionId(IDS_ITEM_POTION)->setUseDescriptionId(IDS_DESC_POTION) ); Item::glassBottle = (new BottleItem(118) ) ->setBaseItemTypeAndMaterial(eBaseItemType_utensil, eMaterial_glass)->setIconName(L"glassBottle")->setDescriptionId(IDS_ITEM_GLASS_BOTTLE)->setUseDescriptionId(IDS_DESC_GLASS_BOTTLE); Item::spiderEye = (new FoodItem(119, 2, FoodConstants::FOOD_SATURATION_GOOD, false) ) ->setEatEffect(MobEffect::poison->id, 5, 0, 1.0f)->setIconName(L"spiderEye")->setDescriptionId(IDS_ITEM_SPIDER_EYE)->setUseDescriptionId(IDS_DESC_SPIDER_EYE)->setPotionBrewingFormula(PotionBrewing::MOD_SPIDEREYE); @@ -473,7 +473,7 @@ void Item::staticCtor() Item::potatoBaked = (new FoodItem(137, 6, FoodConstants::FOOD_SATURATION_NORMAL, false)) ->setIconName(L"potatoBaked")->setDescriptionId(IDS_ITEM_POTATO_BAKED)->setUseDescriptionId(IDS_DESC_POTATO_BAKED); Item::potatoPoisonous = (new FoodItem(138, 2, FoodConstants::FOOD_SATURATION_LOW, false)) ->setEatEffect(MobEffect::poison->id, 5, 0, .6f)->setIconName(L"potatoPoisonous")->setDescriptionId(IDS_ITEM_POTATO_POISONOUS)->setUseDescriptionId(IDS_DESC_POTATO_POISONOUS); - Item::emptyMap = static_cast((new EmptyMapItem(139))->setIconName(L"map_empty")->setDescriptionId(IDS_ITEM_MAP_EMPTY)->setUseDescriptionId(IDS_DESC_MAP_EMPTY)); + Item::emptyMap = (EmptyMapItem *) (new EmptyMapItem(139))->setIconName(L"map_empty")->setDescriptionId(IDS_ITEM_MAP_EMPTY)->setUseDescriptionId(IDS_DESC_MAP_EMPTY); Item::carrotGolden = (new FoodItem(140, 6, FoodConstants::FOOD_SATURATION_SUPERNATURAL, false)) ->setBaseItemTypeAndMaterial(eBaseItemType_giltFruit, eMaterial_carrot)->setIconName(L"carrotGolden")->setPotionBrewingFormula(PotionBrewing::MOD_GOLDENCARROT)->setDescriptionId(IDS_ITEM_CARROT_GOLDEN)->setUseDescriptionId(IDS_DESC_CARROT_GOLDEN); @@ -482,7 +482,7 @@ void Item::staticCtor() Item::pumpkinPie = (new FoodItem(144, 8, FoodConstants::FOOD_SATURATION_LOW, false)) ->setIconName(L"pumpkinPie")->setDescriptionId(IDS_ITEM_PUMPKIN_PIE)->setUseDescriptionId(IDS_DESC_PUMPKIN_PIE); Item::fireworks = (new FireworksItem(145)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fireworks, Item::eMaterial_undefined)->setIconName(L"fireworks")->setDescriptionId(IDS_FIREWORKS)->setUseDescriptionId(IDS_DESC_FIREWORKS); Item::fireworksCharge = (new FireworksChargeItem(146)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fireworks, Item::eMaterial_undefined)->setIconName(L"fireworks_charge")->setDescriptionId(IDS_FIREWORKS_CHARGE)->setUseDescriptionId(IDS_DESC_FIREWORKS_CHARGE); - EnchantedBookItem::enchantedBook = static_cast((new EnchantedBookItem(147))->setMaxStackSize(1)->setIconName(L"enchantedBook")->setDescriptionId(IDS_ITEM_ENCHANTED_BOOK)->setUseDescriptionId(IDS_DESC_ENCHANTED_BOOK)); + EnchantedBookItem::enchantedBook = (EnchantedBookItem *)(new EnchantedBookItem(147)) ->setMaxStackSize(1)->setIconName(L"enchantedBook")->setDescriptionId(IDS_ITEM_ENCHANTED_BOOK)->setUseDescriptionId(IDS_DESC_ENCHANTED_BOOK); Item::comparator = (new TilePlanterItem(148, Tile::comparator_off)) ->setIconName(L"comparator")->setDescriptionId(IDS_ITEM_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR); Item::netherbrick = (new Item(149)) ->setIconName(L"netherbrick")->setDescriptionId(IDS_ITEM_NETHERBRICK)->setUseDescriptionId(IDS_DESC_ITEM_NETHERBRICK); Item::netherQuartz = (new Item(150)) ->setIconName(L"netherquartz")->setDescriptionId(IDS_ITEM_NETHER_QUARTZ)->setUseDescriptionId(IDS_DESC_NETHER_QUARTZ); @@ -568,11 +568,11 @@ Item::Item(int id) : id( 256 + id ) { maxStackSize = Item::MAX_STACK_SIZE; maxDamage = 0; - icon = nullptr; + icon = NULL; m_handEquipped = false; m_isStackedByData = false; - craftingRemainingItem = nullptr; + craftingRemainingItem = NULL; potionBrewingFormula = L""; m_iMaterial=eMaterial_undefined; @@ -583,7 +583,7 @@ Item::Item(int id) : id( 256 + id ) //string descriptionId; //this->id = 256 + id; - if (items[256 + id] != nullptr) + if (items[256 + id] != NULL) { app.DebugPrintf("CONFLICT @ %d" , id); } @@ -837,7 +837,7 @@ Item *Item::getCraftingRemainingItem() bool Item::hasCraftingRemainingItem() { - return craftingRemainingItem != nullptr; + return craftingRemainingItem != NULL; } wstring Item::getName() diff --git a/Minecraft.World/ItemDispenseBehaviors.cpp b/Minecraft.World/ItemDispenseBehaviors.cpp index 8758dcfb..08c73a0c 100644 --- a/Minecraft.World/ItemDispenseBehaviors.cpp +++ b/Minecraft.World/ItemDispenseBehaviors.cpp @@ -11,7 +11,7 @@ shared_ptr ArrowDispenseBehavior::getProjectile(Level *world, Position *position) { - shared_ptr arrow = std::make_shared(world, position->getX(), position->getY(), position->getZ()); + shared_ptr arrow = shared_ptr(new Arrow(world, position->getX(), position->getY(), position->getZ())); arrow->pickup = Arrow::PICKUP_ALLOWED; return arrow; @@ -21,7 +21,7 @@ shared_ptr ArrowDispenseBehavior::getProjectile(Level *world, Positi shared_ptr EggDispenseBehavior::getProjectile(Level *world, Position *position) { - return std::make_shared(world, position->getX(), position->getY(), position->getZ()); + return shared_ptr(new ThrownEgg(world, position->getX(), position->getY(), position->getZ())); } @@ -29,7 +29,7 @@ shared_ptr EggDispenseBehavior::getProjectile(Level *world, Position shared_ptr SnowballDispenseBehavior::getProjectile(Level *world, Position *position) { - return std::make_shared(world, position->getX(), position->getY(), position->getZ()); + return shared_ptr(new Snowball(world, position->getX(), position->getY(), position->getZ())); } @@ -37,7 +37,7 @@ shared_ptr SnowballDispenseBehavior::getProjectile(Level *world, Pos shared_ptr ExpBottleDispenseBehavior::getProjectile(Level *world, Position *position) { - return std::make_shared(world, position->getX(), position->getY(), position->getZ()); + return shared_ptr(new ThrownExpBottle(world, position->getX(), position->getY(), position->getZ())); } float ExpBottleDispenseBehavior::getUncertainty() @@ -60,7 +60,7 @@ ThrownPotionDispenseBehavior::ThrownPotionDispenseBehavior(int potionValue) shared_ptr ThrownPotionDispenseBehavior::getProjectile(Level *world, Position *position) { - return std::make_shared(world, position->getX(), position->getY(), position->getZ(), m_potionValue); + return shared_ptr(new ThrownPotion(world, position->getX(), position->getY(), position->getZ(), m_potionValue)); } float ThrownPotionDispenseBehavior::getUncertainty() @@ -104,7 +104,7 @@ shared_ptr SpawnEggDispenseBehavior::execute(BlockSource *source, shared_ptr entity = SpawnEggItem::spawnMobAt(source->getWorld(), dispensed->getAuxValue(), spawnX, spawnY, spawnZ, &iResult); // 4J-JEV: Added in-case spawn limit is encountered. - if (entity == nullptr) + if (entity == NULL) { outcome = LEFT_ITEM; return dispensed; @@ -139,7 +139,7 @@ shared_ptr FireworksDispenseBehavior::execute(BlockSource *source, double spawnY = source->getBlockY() + .2f; double spawnZ = source->getZ() + facing->getStepZ(); - shared_ptr firework = std::make_shared(world, spawnX, spawnY, spawnZ, dispensed); + shared_ptr firework = shared_ptr(new FireworksRocketEntity(world, spawnX, spawnY, spawnZ, dispensed)); source->getWorld()->addEntity(firework); outcome = ACTIVATED_ITEM; @@ -183,7 +183,7 @@ shared_ptr FireballDispenseBehavior::execute(BlockSource *source, double dirY = random->nextGaussian() * .05 + facing->getStepY(); double dirZ = random->nextGaussian() * .05 + facing->getStepZ(); - world->addEntity(std::make_shared(world, spawnX, spawnY, spawnZ, dirX, dirY, dirZ)); + world->addEntity(shared_ptr(new SmallFireball(world, spawnX, spawnY, spawnZ, dirX, dirY, dirZ))); outcome = ACTIVATED_ITEM; @@ -254,7 +254,7 @@ shared_ptr BoatDispenseBehavior::execute(BlockSource *source, shar outcome = ACTIVATED_ITEM; - shared_ptr boat = std::make_shared(world, spawnX, spawnY + yOffset, spawnZ); + shared_ptr boat = shared_ptr(new Boat(world, spawnX, spawnY + yOffset, spawnZ)); world->addEntity(boat); dispensed->remove(1); @@ -273,7 +273,7 @@ void BoatDispenseBehavior::playSound(BlockSource *source, eOUTCOME outcome) shared_ptr FilledBucketDispenseBehavior::execute(BlockSource *source, shared_ptr dispensed, eOUTCOME &outcome) { - BucketItem *bucket = static_cast(dispensed->getItem()); + BucketItem *bucket = (BucketItem *)dispensed->getItem(); int sourceX = source->getBlockX(); int sourceY = source->getBlockY(); int sourceZ = source->getBlockZ(); @@ -326,9 +326,9 @@ shared_ptr EmptyBucketDispenseBehavior::execute(BlockSource *sourc dispensed->id = targetType->id; dispensed->count = 1; } - else if (dynamic_pointer_cast(source->getEntity())->addItem(std::make_shared(targetType)) < 0) + else if (dynamic_pointer_cast(source->getEntity())->addItem(shared_ptr(new ItemInstance(targetType))) < 0) { - DefaultDispenseItemBehavior::dispense(source, std::make_shared(targetType)); + DefaultDispenseItemBehavior::dispense(source, shared_ptr(new ItemInstance(targetType))); } outcome = ACTIVATED_ITEM; @@ -442,7 +442,7 @@ shared_ptr TntDispenseBehavior::execute(BlockSource *source, share int targetY = source->getBlockY() + facing->getStepY(); int targetZ = source->getBlockZ() + facing->getStepZ(); - shared_ptr tnt(new PrimedTnt(world, targetX + 0.5, targetY + 0.5, targetZ + 0.5, nullptr)); + shared_ptr tnt = shared_ptr(new PrimedTnt(world, targetX + 0.5f, targetY + 0.5f, targetZ + 0.5f, nullptr)); world->addEntity(tnt); outcome = ACTIVATED_ITEM; diff --git a/Minecraft.World/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index 5dc1db6e..66d271f7 100644 --- a/Minecraft.World/ItemEntity.cpp +++ b/Minecraft.World/ItemEntity.cpp @@ -20,7 +20,7 @@ void ItemEntity::_init() age = 0; throwTime = 0; health = 5; - bobOffs = static_cast(Math::random() * PI * 2); + bobOffs = (float) (Math::random() * PI * 2); // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that // the derived version of the function is called @@ -36,11 +36,11 @@ void ItemEntity::_init(Level *level, double x, double y, double z) setPos(x, y, z); - yRot = static_cast(Math::random() * 360); + yRot = (float) (Math::random() * 360); - xd = static_cast(Math::random() * 0.2f - 0.1f); + xd = (float) (Math::random() * 0.2f - 0.1f); yd = +0.2f; - zd = static_cast(Math::random() * 0.2f - 0.1f); + zd = (float) (Math::random() * 0.2f - 0.1f); } ItemEntity::ItemEntity(Level *level, double x, double y, double z) : Entity(level) @@ -66,7 +66,7 @@ ItemEntity::ItemEntity(Level *level) : Entity( level ) void ItemEntity::defineSynchedData() { - getEntityData()->defineNULL(DATA_ITEM, nullptr); + getEntityData()->defineNULL(DATA_ITEM, NULL); } void ItemEntity::tick() @@ -84,7 +84,7 @@ void ItemEntity::tick() // 4J - added parameter here so that these don't care about colliding with other entities move(xd, yd, zd, true); - bool moved = static_cast(xo) != static_cast(x) || static_cast(yo) != static_cast(y) || static_cast(zo) != static_cast(z); + bool moved = (int) xo != (int) x || (int) yo != (int) y || (int) zo != (int) z; if (moved || tickCount % 25 == 0) { @@ -192,7 +192,7 @@ bool ItemEntity::hurt(DamageSource *source, float damage) if (level->isClientSide ) return false; if (isInvulnerable()) return false; - if (getItem() != nullptr && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false; + if (getItem() != NULL && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false; markHurt(); health -= damage; if (health <= 0) @@ -204,9 +204,9 @@ bool ItemEntity::hurt(DamageSource *source, float damage) void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", static_cast(health)); - entityTag->putShort(L"Age", static_cast(age)); - if (getItem() != nullptr) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); + entityTag->putShort(L"Health", (byte) health); + entityTag->putShort(L"Age", (short) age); + if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); } void ItemEntity::readAdditionalSaveData(CompoundTag *tag) @@ -215,7 +215,7 @@ void ItemEntity::readAdditionalSaveData(CompoundTag *tag) age = tag->getShort(L"Age"); CompoundTag *itemTag = tag->getCompound(L"Item"); setItem(ItemInstance::fromTag(itemTag)); - if (getItem() == nullptr) remove(); + if (getItem() == NULL) remove(); } void ItemEntity::playerTouch(shared_ptr player) @@ -280,14 +280,14 @@ shared_ptr ItemEntity::getItem() { shared_ptr result = getEntityData()->getItemInstance(DATA_ITEM); - if (result == nullptr) + if (result == NULL) { - if (level != nullptr) + if (level != NULL) { app.DebugPrintf("Item entity %d has no item?!\n", entityId); //level.getLogger().severe("Item entity " + entityId + " has no item?!"); } - return std::make_shared(Tile::stone); + return shared_ptr(new ItemInstance(Tile::stone)); } return result; diff --git a/Minecraft.World/ItemFrame.cpp b/Minecraft.World/ItemFrame.cpp index f5988b9f..0d52b421 100644 --- a/Minecraft.World/ItemFrame.cpp +++ b/Minecraft.World/ItemFrame.cpp @@ -37,8 +37,8 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H void ItemFrame::defineSynchedData() { - getEntityData()->defineNULL(DATA_ITEM, nullptr); - getEntityData()->define(DATA_ROTATION, static_cast(0)); + getEntityData()->defineNULL(DATA_ITEM, NULL); + getEntityData()->define(DATA_ROTATION, (byte) 0); } bool ItemFrame::shouldRenderAtSqrDistance(double distance) @@ -52,7 +52,7 @@ void ItemFrame::dropItem(shared_ptr causedBy) { shared_ptr item = getItem(); - if (causedBy != nullptr && causedBy->instanceof(eTYPE_PLAYER)) + if (causedBy != NULL && causedBy->instanceof(eTYPE_PLAYER)) { if (dynamic_pointer_cast(causedBy)->abilities.instabuild) { @@ -61,8 +61,8 @@ void ItemFrame::dropItem(shared_ptr causedBy) } } - spawnAtLocation(std::make_shared(Item::frame), 0); - if ( (item != nullptr) && (random->nextFloat() < dropChance) ) + spawnAtLocation( shared_ptr(new ItemInstance(Item::frame) ), 0); + if ( (item != NULL) && (random->nextFloat() < dropChance) ) { item = item->copy(); removeFramedMap(item); @@ -72,7 +72,7 @@ void ItemFrame::dropItem(shared_ptr causedBy) void ItemFrame::removeFramedMap(shared_ptr item) { - if (item == nullptr) return; + if (item == NULL) return; if (item->id == Item::map_Id) { shared_ptr mapItemSavedData = Item::map->getSavedData(item, level); @@ -89,7 +89,7 @@ shared_ptr ItemFrame::getItem() void ItemFrame::setItem(shared_ptr item) { - if(item != nullptr) + if(item != NULL) { item = item->copy(); item->count = 1; @@ -107,15 +107,15 @@ int ItemFrame::getRotation() void ItemFrame::setRotation(int rotation) { - getEntityData()->set(DATA_ROTATION, static_cast(rotation % 4)); + getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4)); } void ItemFrame::addAdditonalSaveData(CompoundTag *tag) { - if (getItem() != nullptr) + if (getItem() != NULL) { tag->putCompound(L"Item", getItem()->save(new CompoundTag())); - tag->putByte(L"ItemRotation", static_cast(getRotation())); + tag->putByte(L"ItemRotation", (byte) getRotation()); tag->putFloat(L"ItemDropChance", dropChance); } HangingEntity::addAdditonalSaveData(tag); @@ -124,7 +124,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag) void ItemFrame::readAdditionalSaveData(CompoundTag *tag) { CompoundTag *itemTag = tag->getCompound(L"Item"); - if (itemTag != nullptr && !itemTag->isEmpty()) + if (itemTag != NULL && !itemTag->isEmpty()) { setItem(ItemInstance::fromTag(itemTag)); setRotation(tag->getByte(L"ItemRotation")); @@ -141,11 +141,11 @@ bool ItemFrame::interact(shared_ptr player) return false; } - if (getItem() == nullptr) + if (getItem() == NULL) { shared_ptr item = player->getCarriedItem(); - if (item != nullptr) + if (item != NULL) { if (!level->isClientSide)//isClientSide) { diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index 4906c22e..4dcde7aa 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -25,7 +25,7 @@ void ItemInstance::_init(int id, int count, int auxValue) this->id = id; this->count = count; this->auxValue = auxValue; - this->tag = nullptr; + this->tag = NULL; this->frame = nullptr; // 4J-PB - for trading menu this->m_bForceNumberDisplay=false; @@ -81,18 +81,18 @@ shared_ptr ItemInstance::fromTag(CompoundTag *itemTag) { shared_ptr itemInstance = shared_ptr(new ItemInstance()); itemInstance->load(itemTag); - return itemInstance->getItem() != nullptr ? itemInstance : nullptr; + return itemInstance->getItem() != NULL ? itemInstance : nullptr; } ItemInstance::~ItemInstance() { - if(tag != nullptr) delete tag; + if(tag != NULL) delete tag; } shared_ptr ItemInstance::remove(int count) { - shared_ptr ii = std::make_shared(id, count, auxValue); - if (tag != nullptr) ii->tag = static_cast(tag->copy()); + shared_ptr ii = shared_ptr( new ItemInstance(id, count, auxValue) ); + if (tag != NULL) ii->tag = (CompoundTag *) tag->copy(); this->count -= count; // 4J Stu Fix for duplication glitch, make sure that item count is in range @@ -145,10 +145,10 @@ shared_ptr ItemInstance::useTimeDepleted(Level *level, shared_ptr< CompoundTag *ItemInstance::save(CompoundTag *compoundTag) { - compoundTag->putShort(L"id", static_cast(id)); - compoundTag->putByte(L"Count", static_cast(count)); - compoundTag->putShort(L"Damage", static_cast(auxValue)); - if (tag != nullptr) compoundTag->put(L"tag", tag->copy()); + compoundTag->putShort(L"id", (short) id); + compoundTag->putByte(L"Count", (byte) count); + compoundTag->putShort(L"Damage", (short) auxValue); + if (tag != NULL) compoundTag->put(L"tag", tag->copy()); return compoundTag; } @@ -165,7 +165,7 @@ void ItemInstance::load(CompoundTag *compoundTag) if (compoundTag->contains(L"tag")) { delete tag; - tag = static_cast(compoundTag->getCompound(L"tag")->copy()); + tag = (CompoundTag *)compoundTag->getCompound(L"tag")->copy(); } } @@ -257,7 +257,7 @@ bool ItemInstance::hurt(int dmg, Random *random) void ItemInstance::hurtAndBreak(int dmg, shared_ptr owner) { shared_ptr player = dynamic_pointer_cast(owner); - if (player != nullptr && player->abilities.instabuild) return; + if (player != NULL && player->abilities.instabuild) return; if (!isDamageableItem()) return; if (hurt(dmg, owner->getRandom())) @@ -265,10 +265,10 @@ void ItemInstance::hurtAndBreak(int dmg, shared_ptr owner) owner->breakItem(shared_from_this()); count--; - if (player != nullptr) + if (player != NULL) { //player->awardStat(Stats::itemBroke[id], 1); - if (count == 0 && dynamic_cast( getItem() ) != nullptr) + if (count == 0 && dynamic_cast( getItem() ) != NULL) { player->removeSelectedItem(); } @@ -302,10 +302,10 @@ bool ItemInstance::interactEnemy(shared_ptr player, shared_ptr ItemInstance::copy() const { - shared_ptr copy = std::make_shared(id, count, auxValue); - if (tag != nullptr) + shared_ptr copy = shared_ptr( new ItemInstance(id, count, auxValue) ); + if (tag != NULL) { - copy->tag = static_cast(tag->copy()); + copy->tag = (CompoundTag *) tag->copy(); } return copy; } @@ -314,9 +314,9 @@ shared_ptr ItemInstance::copy() const ItemInstance *ItemInstance::copy_not_shared() const { ItemInstance *copy = new ItemInstance(id, count, auxValue); - if (tag != nullptr) + if (tag != NULL) { - copy->tag = static_cast(tag->copy()); + copy->tag = (CompoundTag *) tag->copy(); if (!copy->tag->equals(tag)) { return copy; @@ -328,14 +328,14 @@ ItemInstance *ItemInstance::copy_not_shared() const // 4J Brought forward from 1.2 bool ItemInstance::tagMatches(shared_ptr a, shared_ptr b) { - if (a == nullptr && b == nullptr) return true; - if (a == nullptr || b == nullptr) return false; + if (a == NULL && b == NULL) return true; + if (a == NULL || b == NULL) return false; - if (a->tag == nullptr && b->tag != nullptr) + if (a->tag == NULL && b->tag != NULL) { return false; } - if (a->tag != nullptr && !a->tag->equals(b->tag)) + if (a->tag != NULL && !a->tag->equals(b->tag)) { return false; } @@ -344,8 +344,8 @@ bool ItemInstance::tagMatches(shared_ptr a, shared_ptr a, shared_ptr b) { - if (a == nullptr && b == nullptr) return true; - if (a == nullptr || b == nullptr) return false; + if (a == NULL && b == NULL) return true; + if (a == NULL || b == NULL) return false; return a->matches(b); } @@ -354,11 +354,11 @@ bool ItemInstance::matches(shared_ptr b) if (count != b->count) return false; if (id != b->id) return false; if (auxValue != b->auxValue) return false; - if (tag == nullptr && b->tag != nullptr) + if (tag == NULL && b->tag != NULL) { return false; } - if (tag != nullptr && !tag->equals(b->tag)) + if (tag != NULL && !tag->equals(b->tag)) { return false; } @@ -381,11 +381,11 @@ bool ItemInstance::sameItemWithTags(shared_ptr b) { if (id != b->id) return false; if (auxValue != b->auxValue) return false; - if (tag == nullptr && b->tag != nullptr) + if (tag == NULL && b->tag != NULL) { return false; } - if (tag != nullptr && !tag->equals(b->tag)) + if (tag != NULL && !tag->equals(b->tag)) { return false; } @@ -417,7 +417,7 @@ ItemInstance *ItemInstance::setDescriptionId(unsigned int id) shared_ptr ItemInstance::clone(shared_ptr item) { - return item == nullptr ? nullptr : item->copy(); + return item == NULL ? nullptr : item->copy(); } wstring ItemInstance::toString() @@ -426,9 +426,9 @@ wstring ItemInstance::toString() std::wostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed - if(Item::items[id]==nullptr) + if(Item::items[id]==NULL) { - oss << std::dec << count << L"x" << L" Item::items[id] is nullptr " << L"@" << auxValue; + oss << std::dec << count << L"x" << L" Item::items[id] is NULL " << L"@" << auxValue; } else { @@ -479,7 +479,7 @@ void ItemInstance::releaseUsing(Level *level, shared_ptr player, int dur // 4J Stu - Brought forward these functions for enchanting/game rules bool ItemInstance::hasTag() { - return tag != nullptr; + return tag != NULL; } CompoundTag *ItemInstance::getTag() @@ -489,11 +489,11 @@ CompoundTag *ItemInstance::getTag() ListTag *ItemInstance::getEnchantmentTags() { - if (tag == nullptr) + if (tag == NULL) { - return nullptr; + return NULL; } - return static_cast *>(tag->get(L"ench")); + return (ListTag *) tag->get(L"ench"); } void ItemInstance::setTag(CompoundTag *tag) @@ -506,7 +506,7 @@ wstring ItemInstance::getHoverName() { wstring title = getItem()->getHoverName(shared_from_this()); - if (tag != nullptr && tag->contains(L"display")) + if (tag != NULL && tag->contains(L"display")) { CompoundTag *display = tag->getCompound(L"display"); @@ -521,14 +521,14 @@ wstring ItemInstance::getHoverName() void ItemInstance::setHoverName(const wstring &name) { - if (tag == nullptr) tag = new CompoundTag(); + if (tag == NULL) tag = new CompoundTag(); if (!tag->contains(L"display")) tag->putCompound(L"display", new CompoundTag()); tag->getCompound(L"display")->putString(L"Name", name); } void ItemInstance::resetHoverName() { - if (tag == nullptr) return; + if (tag == NULL) return; if (!tag->contains(L"display")) return; CompoundTag *display = tag->getCompound(L"display"); display->remove(L"Name"); @@ -539,14 +539,14 @@ void ItemInstance::resetHoverName() if (tag->isEmpty()) { - setTag(nullptr); + setTag(NULL); } } } bool ItemInstance::hasCustomHoverName() { - if (tag == nullptr) return false; + if (tag == NULL) return false; if (!tag->contains(L"display")) return false; return tag->getCompound(L"display")->contains(L"Name"); } @@ -598,14 +598,14 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool a if (hasTag()) { ListTag *list = getEnchantmentTags(); - if (list != nullptr) + if (list != NULL) { for (int i = 0; i < list->size(); i++) { int type = list->get(i)->getShort((wchar_t *)TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != nullptr) + if (Enchantment::enchantments[type] != NULL) { wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level)); @@ -693,14 +693,14 @@ vector *ItemInstance::getHoverTextOnly(shared_ptr player, bo if (hasTag()) { ListTag *list = getEnchantmentTags(); - if (list != nullptr) + if (list != NULL) { for (int i = 0; i < list->size(); i++) { int type = list->get(i)->getShort((wchar_t *)TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != nullptr) + if (Enchantment::enchantments[type] != NULL) { wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level)); @@ -730,25 +730,25 @@ bool ItemInstance::isEnchantable() void ItemInstance::enchant(const Enchantment *enchantment, int level) { - if (tag == nullptr) this->setTag(new CompoundTag()); + if (tag == NULL) this->setTag(new CompoundTag()); if (!tag->contains(L"ench")) tag->put(L"ench", new ListTag(L"ench")); - ListTag *list = static_cast *>(tag->get(L"ench")); + ListTag *list = (ListTag *) tag->get(L"ench"); CompoundTag *ench = new CompoundTag(); - ench->putShort((wchar_t *)TAG_ENCH_ID, static_cast(enchantment->id)); - ench->putShort((wchar_t *)TAG_ENCH_LEVEL, static_cast(level)); + ench->putShort((wchar_t *)TAG_ENCH_ID, (short) enchantment->id); + ench->putShort((wchar_t *)TAG_ENCH_LEVEL, (byte) level); list->add(ench); } bool ItemInstance::isEnchanted() { - if (tag != nullptr && tag->contains(L"ench")) return true; + if (tag != NULL && tag->contains(L"ench")) return true; return false; } void ItemInstance::addTagElement(wstring name, Tag *tag) { - if (this->tag == nullptr) + if (this->tag == NULL) { setTag(new CompoundTag()); } @@ -762,7 +762,7 @@ bool ItemInstance::mayBePlacedInAdventureMode() bool ItemInstance::isFramed() { - return frame != nullptr; + return frame != NULL; } void ItemInstance::setFramed(shared_ptr frame) @@ -795,7 +795,7 @@ void ItemInstance::setRepairCost(int cost) attrAttrModMap *ItemInstance::getAttributeModifiers() { - attrAttrModMap *result = nullptr; + attrAttrModMap *result = NULL; if (hasTag() && tag->contains(L"AttributeModifiers")) { @@ -824,12 +824,12 @@ attrAttrModMap *ItemInstance::getAttributeModifiers() void ItemInstance::set4JData(int data) { - if(tag == nullptr && data == 0) return; - if (tag == nullptr) this->setTag(new CompoundTag()); + if(tag == NULL && data == 0) return; + if (tag == NULL) this->setTag(new CompoundTag()); if (tag->contains(L"4jdata")) { - IntTag *dataTag = static_cast(tag->get(L"4jdata")); + IntTag *dataTag = (IntTag *)tag->get(L"4jdata"); dataTag->data = data; } else if(data != 0) @@ -840,10 +840,10 @@ void ItemInstance::set4JData(int data) int ItemInstance::get4JData() { - if(tag == nullptr || !tag->contains(L"4jdata")) return 0; + if(tag == NULL || !tag->contains(L"4jdata")) return 0; else { - IntTag *dataTag = static_cast(tag->get(L"4jdata")); + IntTag *dataTag = (IntTag *)tag->get(L"4jdata"); return dataTag->data; } } diff --git a/Minecraft.World/JavaIntHash.h b/Minecraft.World/JavaIntHash.h index 8293cb46..fe608469 100644 --- a/Minecraft.World/JavaIntHash.h +++ b/Minecraft.World/JavaIntHash.h @@ -13,9 +13,9 @@ struct IntKeyHash { int h = k; h += ~(h << 9); - h ^= (static_cast(h) >> 14); + h ^= (((unsigned int)h) >> 14); h += (h << 4); - h ^= (static_cast(h) >> 10); + h ^= (((unsigned int)h) >> 10); return h; } }; diff --git a/Minecraft.World/JavaMath.cpp b/Minecraft.World/JavaMath.cpp index cec2eb3a..87778c56 100644 --- a/Minecraft.World/JavaMath.cpp +++ b/Minecraft.World/JavaMath.cpp @@ -36,7 +36,7 @@ double Math::random() //the value of the argument rounded to the nearest long value. int64_t Math::round( double d ) { - return static_cast(floor(d + 0.5)); + return (int64_t)floor( d + 0.5 ); } int Math::_max(int a, int b) diff --git a/Minecraft.World/JukeboxTile.cpp b/Minecraft.World/JukeboxTile.cpp index 74e79e9e..cf53a751 100644 --- a/Minecraft.World/JukeboxTile.cpp +++ b/Minecraft.World/JukeboxTile.cpp @@ -23,7 +23,7 @@ void JukeboxTile::Entity::load(CompoundTag *tag) } else if (tag->getInt(L"Record") > 0) { - setRecord(std::make_shared(tag->getInt(L"Record"), 1, 0)); + setRecord(shared_ptr( new ItemInstance(tag->getInt(L"Record"), 1, 0))); } } @@ -31,7 +31,7 @@ void JukeboxTile::Entity::save(CompoundTag *tag) { TileEntity::save(tag); - if (getRecord() != nullptr) + if (getRecord() != NULL) { tag->putCompound(L"RecordItem", getRecord()->save(new CompoundTag())); @@ -42,7 +42,7 @@ void JukeboxTile::Entity::save(CompoundTag *tag) // 4J Added shared_ptr JukeboxTile::Entity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new JukeboxTile::Entity() ); TileEntity::clone(result); result->record = record; @@ -63,7 +63,7 @@ void JukeboxTile::Entity::setRecord(shared_ptr record) JukeboxTile::JukeboxTile(int id) : BaseEntityTile(id, Material::wood) { - iconTop = nullptr; + iconTop = NULL; } Icon *JukeboxTile::getTexture(int face, int data) @@ -107,10 +107,10 @@ void JukeboxTile::dropRecording(Level *level, int x, int y, int z) if (level->isClientSide) return; shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( rte == nullptr ) return; + if( rte == NULL ) return; shared_ptr oldRecord = rte->getRecord(); - if (oldRecord == nullptr) return; + if (oldRecord == NULL) return; level->levelEvent(LevelEvent::SOUND_PLAY_RECORDING, x, y, z, 0); @@ -127,7 +127,7 @@ void JukeboxTile::dropRecording(Level *level, int x, int y, int z) shared_ptr itemInstance = oldRecord->copy(); - shared_ptr item = std::make_shared(level, x + xo, y + yo, z + zo, itemInstance); + shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); item->throwTime = 10; level->addEntity(item); } @@ -146,7 +146,7 @@ void JukeboxTile::spawnResources(Level *level, int x, int y, int z, int data, fl shared_ptr JukeboxTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new JukeboxTile::Entity() ); } void JukeboxTile::registerIcons(IconRegister *iconRegister) @@ -163,5 +163,5 @@ bool JukeboxTile::hasAnalogOutputSignal() int JukeboxTile::getAnalogOutputSignal(Level *level, int x, int y, int z, int dir) { shared_ptr record = dynamic_pointer_cast( level->getTileEntity(x, y, z))->getRecord(); - return record == nullptr ? Redstone::SIGNAL_NONE : record->id + 1 - Item::record_01_Id; + return record == NULL ? Redstone::SIGNAL_NONE : record->id + 1 - Item::record_01_Id; } \ No newline at end of file diff --git a/Minecraft.World/KeepAlivePacket.h b/Minecraft.World/KeepAlivePacket.h index bbf7b0ab..a44d8745 100644 --- a/Minecraft.World/KeepAlivePacket.h +++ b/Minecraft.World/KeepAlivePacket.h @@ -20,6 +20,6 @@ public: virtual bool isAync(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new KeepAlivePacket()); } virtual int getId() { return 0; } }; \ No newline at end of file diff --git a/Minecraft.World/KickPlayerPacket.h b/Minecraft.World/KickPlayerPacket.h index 67fc66fd..b9a6ce3e 100644 --- a/Minecraft.World/KickPlayerPacket.h +++ b/Minecraft.World/KickPlayerPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new KickPlayerPacket()); } virtual int getId() { return 159; } }; \ No newline at end of file diff --git a/Minecraft.World/LakeFeature.cpp b/Minecraft.World/LakeFeature.cpp index a25a7ece..ac240e61 100644 --- a/Minecraft.World/LakeFeature.cpp +++ b/Minecraft.World/LakeFeature.cpp @@ -24,8 +24,8 @@ bool LakeFeature::place(Level *level, Random *random, int x, int y, int z) bool grid[16*16*8] = {0}; - LevelGenerationOptions *levelGenOptions = nullptr; - if( app.getLevelGenerationOptions() != nullptr ) + LevelGenerationOptions *levelGenOptions = NULL; + if( app.getLevelGenerationOptions() != NULL ) { levelGenOptions = app.getLevelGenerationOptions(); diff --git a/Minecraft.World/LargeCaveFeature.cpp b/Minecraft.World/LargeCaveFeature.cpp index c70f1156..5ca539d5 100644 --- a/Minecraft.World/LargeCaveFeature.cpp +++ b/Minecraft.World/LargeCaveFeature.cpp @@ -144,11 +144,11 @@ void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray b { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = (byte) Tile::lava_Id; } else { - blocks[p] = static_cast(0); + blocks[p] = (byte) 0; if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; } } diff --git a/Minecraft.World/LargeFireball.cpp b/Minecraft.World/LargeFireball.cpp index 48f199d9..9f8da92c 100644 --- a/Minecraft.World/LargeFireball.cpp +++ b/Minecraft.World/LargeFireball.cpp @@ -23,7 +23,7 @@ void LargeFireball::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != nullptr) + if (res->entity != NULL) { DamageSource *damageSource = DamageSource::fireball(dynamic_pointer_cast( shared_from_this() ), owner); res->entity->hurt(damageSource, 6); diff --git a/Minecraft.World/LargeHellCaveFeature.cpp b/Minecraft.World/LargeHellCaveFeature.cpp index 9472c855..6aa1aec5 100644 --- a/Minecraft.World/LargeHellCaveFeature.cpp +++ b/Minecraft.World/LargeHellCaveFeature.cpp @@ -138,7 +138,7 @@ void LargeHellCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArr int block = blocks[p]; if (block == Tile::netherRack_Id || block == Tile::dirt_Id || block == Tile::grass_Id) { - blocks[p] = static_cast(0); + blocks[p] = (byte) 0; } } p--; diff --git a/Minecraft.World/LavaSlime.cpp b/Minecraft.World/LavaSlime.cpp index f60baf09..21982995 100644 --- a/Minecraft.World/LavaSlime.cpp +++ b/Minecraft.World/LavaSlime.cpp @@ -55,7 +55,7 @@ ePARTICLE_TYPE LavaSlime::getParticleName() shared_ptr LavaSlime::createChild() { - return std::make_shared(level); + return shared_ptr( new LavaSlime(level) ); } int LavaSlime::getDeathLoot() diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index a0eda52f..f90f1fa8 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -21,16 +21,16 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) // 4J - Some changes moved here from 1.2.3. Temperature & downfall layers are no longer created & returned, and a debug layer is isn't. // For reference with regard to future merging, things NOT brought forward from the 1.2.3 version are new layer types that we // don't have yet (shores, swamprivers, region hills etc.) - shared_ptrislandLayer = std::make_shared(1); - islandLayer = std::make_shared(2000, islandLayer); - islandLayer = std::make_shared(1, islandLayer); - islandLayer = std::make_shared(2001, islandLayer); - islandLayer = std::make_shared(2, islandLayer); - islandLayer = std::make_shared(2, islandLayer); - islandLayer = std::make_shared(2002, islandLayer); - islandLayer = std::make_shared(3, islandLayer); - islandLayer = std::make_shared(2003, islandLayer); - islandLayer = std::make_shared(4, islandLayer); + shared_ptrislandLayer = shared_ptr(new IslandLayer(1)); + islandLayer = shared_ptr(new FuzzyZoomLayer(2000, islandLayer)); + islandLayer = shared_ptr(new AddIslandLayer(1, islandLayer)); + islandLayer = shared_ptr(new ZoomLayer(2001, islandLayer)); + islandLayer = shared_ptr(new AddIslandLayer(2, islandLayer)); + islandLayer = shared_ptr(new AddSnowLayer(2, islandLayer)); + islandLayer = shared_ptr(new ZoomLayer(2002, islandLayer)); + islandLayer = shared_ptr(new AddIslandLayer(3, islandLayer)); + islandLayer = shared_ptr(new ZoomLayer(2003, islandLayer)); + islandLayer = shared_ptr(new AddIslandLayer(4, islandLayer)); // islandLayer = shared_ptr(new AddMushroomIslandLayer(5, islandLayer)); // 4J - old position of mushroom island layer int zoomLevel = 4; @@ -41,30 +41,30 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) shared_ptr riverLayer = islandLayer; riverLayer = ZoomLayer::zoom(1000, riverLayer, 0); - riverLayer = std::make_shared(100, riverLayer); + riverLayer = shared_ptr(new RiverInitLayer(100, riverLayer)); riverLayer = ZoomLayer::zoom(1000, riverLayer, zoomLevel + 2); - riverLayer = std::make_shared(1, riverLayer); - riverLayer = std::make_shared(1000, riverLayer); + riverLayer = shared_ptr(new RiverLayer(1, riverLayer)); + riverLayer = shared_ptr(new SmoothLayer(1000, riverLayer)); shared_ptr biomeLayer = islandLayer; biomeLayer = ZoomLayer::zoom(1000, biomeLayer, 0); - biomeLayer = std::make_shared(200, biomeLayer, levelType); + biomeLayer = shared_ptr(new BiomeInitLayer(200, biomeLayer, levelType)); biomeLayer = ZoomLayer::zoom(1000, biomeLayer, 2); - biomeLayer = std::make_shared(1000, biomeLayer); + biomeLayer = shared_ptr(new RegionHillsLayer(1000, biomeLayer)); for (int i = 0; i < zoomLevel; i++) { - biomeLayer = std::make_shared(1000 + i, biomeLayer); + biomeLayer = shared_ptr(new ZoomLayer(1000 + i, biomeLayer)); - if (i == 0) biomeLayer = std::make_shared(3, biomeLayer); + if (i == 0) biomeLayer = shared_ptr(new AddIslandLayer(3, biomeLayer)); if (i == 0) { // 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding // them at this scale actually lets us place them near enough other land, if we add them at the same scale as java then they have to be too far out to see for // the scale of our maps - biomeLayer = std::make_shared(5, biomeLayer); + biomeLayer = shared_ptr(new AddMushroomIslandLayer(5, biomeLayer)); } if (i == 1 ) @@ -72,30 +72,30 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType) // 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands. // This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also // helps the shore layer from doing too much damage in shrinking the islands we are making - biomeLayer = std::make_shared(5, biomeLayer); + biomeLayer = shared_ptr(new GrowMushroomIslandLayer(5, biomeLayer)); // Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does - biomeLayer = std::make_shared(1000, biomeLayer); + biomeLayer = shared_ptr(new ShoreLayer(1000, biomeLayer)); - biomeLayer = std::make_shared(1000, biomeLayer); + biomeLayer = shared_ptr(new SwampRiversLayer(1000, biomeLayer)); } } - biomeLayer = std::make_shared(1000, biomeLayer); + biomeLayer = shared_ptr(new SmoothLayer(1000, biomeLayer)); - biomeLayer = std::make_shared(100, biomeLayer, riverLayer); + biomeLayer = shared_ptr(new RiverMixerLayer(100, biomeLayer, riverLayer)); #ifndef _CONTENT_PACKAGE #ifdef _BIOME_OVERRIDE if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<(1); + biomeLayer = shared_ptr(new BiomeOverrideLayer(1)); } #endif #endif shared_ptr debugLayer = biomeLayer; - shared_ptrzoomedLayer = std::make_shared(10, biomeLayer); + shared_ptrzoomedLayer = shared_ptr(new VoronoiZoom(10, biomeLayer)); biomeLayer->init(seed); zoomedLayer->init(seed); @@ -123,7 +123,7 @@ Layer::Layer(int64_t seedMixup) void Layer::init(int64_t seed) { this->seed = seed; - if (parent != nullptr) parent->init(seed); + if (parent != NULL) parent->init(seed); this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l; this->seed += seedMixup; this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l; @@ -189,7 +189,7 @@ int Layer::nextRandom(int max) } #else - int result = static_cast((rval >> 24) % max); + int result = (int) ((rval >> 24) % max); #endif if (result < 0) result += max; diff --git a/Minecraft.World/LeafTile.cpp b/Minecraft.World/LeafTile.cpp index f8f5deae..684618a7 100644 --- a/Minecraft.World/LeafTile.cpp +++ b/Minecraft.World/LeafTile.cpp @@ -17,7 +17,7 @@ const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leave LeafTile::LeafTile(int id) : TransparentTile(id, Material::leaves, false, isSolidRender()) { - checkBuffer = nullptr; + checkBuffer = NULL; fancyTextureSet = 0; setTicking(true); } @@ -123,7 +123,7 @@ void LeafTile::tick(Level *level, int x, int y, int z, Random *random) int W = 32; int WW = W * W; int WO = W / 2; - if (checkBuffer == nullptr) + if (checkBuffer == NULL) { checkBuffer = new int[W * W * W]; } @@ -249,7 +249,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float if (level->random->nextInt(chance) == 0) { int type = getResource(data, level->random,playerBonusLevel); - popResource(level, x, y, z, std::make_shared(type, 1, getSpawnResourcesAuxValue(data))); + popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data)))); } chance = 200; @@ -263,14 +263,14 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float } if ((data & LEAF_TYPE_MASK) == NORMAL_LEAF && level->random->nextInt(chance) == 0) { - popResource(level, x, y, z, std::make_shared(Item::apple_Id, 1, 0)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::apple_Id, 1, 0))); } } } void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), @@ -278,7 +278,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int ); // drop leaf block instead of sapling - popResource(level, x, y, z, std::make_shared(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK))); } else { @@ -324,7 +324,7 @@ void LeafTile::setFancy(bool fancyGraphics) shared_ptr LeafTile::getSilkTouchItemInstance(int data) { - return std::make_shared(id, 1, data & LEAF_TYPE_MASK); + return shared_ptr( new ItemInstance(id, 1, data & LEAF_TYPE_MASK) ); } void LeafTile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) diff --git a/Minecraft.World/LeapAtTargetGoal.cpp b/Minecraft.World/LeapAtTargetGoal.cpp index b559ef7d..6aebc9a8 100644 --- a/Minecraft.World/LeapAtTargetGoal.cpp +++ b/Minecraft.World/LeapAtTargetGoal.cpp @@ -15,7 +15,7 @@ LeapAtTargetGoal::LeapAtTargetGoal(Mob *mob, float yd) bool LeapAtTargetGoal::canUse() { target = weak_ptr(mob->getTarget()); - if (target.lock() == nullptr) return false; + if (target.lock() == NULL) return false; double d = mob->distanceToSqr(target.lock()); if (d < 2 * 2 || d > 4 * 4) return false; if (!mob->onGround) return false; @@ -25,7 +25,7 @@ bool LeapAtTargetGoal::canUse() bool LeapAtTargetGoal::canContinueToUse() { - return target.lock() != nullptr && !mob->onGround; + return target.lock() != NULL && !mob->onGround; } void LeapAtTargetGoal::start() diff --git a/Minecraft.World/LeashFenceKnotEntity.cpp b/Minecraft.World/LeashFenceKnotEntity.cpp index f94bcba7..55947d04 100644 --- a/Minecraft.World/LeashFenceKnotEntity.cpp +++ b/Minecraft.World/LeashFenceKnotEntity.cpp @@ -70,14 +70,14 @@ bool LeashFenceKnotEntity::interact(shared_ptr player) shared_ptr item = player->getCarriedItem(); bool attachedMob = false; - if (item != nullptr && item->id == Item::lead_Id) + if (item != NULL && item->id == Item::lead_Id) { if (!level->isClientSide) { // look for entities that can be attached to the fence double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != nullptr) + if (mobs != NULL) { for(auto& it : *mobs) { @@ -101,7 +101,7 @@ bool LeashFenceKnotEntity::interact(shared_ptr player) // if the player is in creative mode, attempt to remove all leashed mobs without dropping additional items double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != nullptr) + if (mobs != NULL) { for(auto& it : *mobs) { @@ -122,7 +122,7 @@ bool LeashFenceKnotEntity::survives() { // knots are placed on top of fence tiles int tile = level->getTile(xTile, yTile, zTile); - if (Tile::tiles[tile] != nullptr && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) + if (Tile::tiles[tile] != NULL && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) { return true; } @@ -131,7 +131,7 @@ bool LeashFenceKnotEntity::survives() shared_ptr LeashFenceKnotEntity::createAndAddKnot(Level *level, int x, int y, int z) { - shared_ptr knot = std::make_shared(level, x, y, z); + shared_ptr knot = shared_ptr( new LeashFenceKnotEntity(level, x, y, z) ); knot->forcedLoading = true; level->addEntity(knot); return knot; @@ -140,7 +140,7 @@ shared_ptr LeashFenceKnotEntity::createAndAddKnot(Level *l shared_ptr LeashFenceKnotEntity::findKnotAt(Level *level, int x, int y, int z) { vector > *knots = level->getEntitiesOfClass(typeid(LeashFenceKnotEntity), AABB::newTemp(x - 1.0, y - 1.0, z - 1.0, x + 1.0, y + 1.0, z + 1.0)); - if (knots != nullptr) + if (knots != NULL) { for (auto& it : *knots ) { diff --git a/Minecraft.World/LeashItem.cpp b/Minecraft.World/LeashItem.cpp index 4de74a5c..ddb7878b 100644 --- a/Minecraft.World/LeashItem.cpp +++ b/Minecraft.World/LeashItem.cpp @@ -12,7 +12,7 @@ LeashItem::LeashItem(int id) : Item(id) bool LeashItem::useOn(shared_ptr itemInstance, shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { int tile = level->getTile(x, y, z); - if (Tile::tiles[tile] != nullptr && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) + if (Tile::tiles[tile] != NULL && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) { if (bTestUseOnOnly) return bindPlayerMobsTest(player, level, x,y,z); @@ -36,14 +36,14 @@ bool LeashItem::bindPlayerMobs(shared_ptr player, Level *level, int x, i bool foundMobs = false; double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != nullptr) + if (mobs != NULL) { for(auto& it : *mobs) { shared_ptr mob = dynamic_pointer_cast(it); if (mob->isLeashed() && mob->getLeashHolder() == player) { - if (activeKnot == nullptr) + if (activeKnot == NULL) { activeKnot = LeashFenceKnotEntity::createAndAddKnot(level, x, y, z); } @@ -62,7 +62,7 @@ bool LeashItem::bindPlayerMobsTest(shared_ptr player, Level *level, int double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != nullptr) + if (mobs != NULL) { for(auto& it : *mobs) { diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 94e2ecfb..ef79fb39 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -91,13 +91,13 @@ DWORD Level::tlsIdxLightCache = TlsAlloc(); void Level::enableLightingCache() { // Allocate 16K (needs 32K for large worlds) for a 16x16x16x4 byte cache of results, plus 128K required for toCheck array. Rounding up to 256 to keep as multiple of alignement - aligning to 128K boundary for possible cache locking. - void *cache = static_cast(XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES)); + void *cache = (unsigned char *)XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES); TlsSetValue(tlsIdxLightCache,cache); } void Level::destroyLightingCache() { - lightCache_t *cache = static_cast(TlsGetValue(tlsIdxLightCache)); + lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); XPhysicalFree(cache); } @@ -109,7 +109,7 @@ inline int GetIndex(int x, int y, int z) void Level::initCachePartial(lightCache_t *cache, int xc, int yc, int zc) { cachewritten = false; - if( cache == nullptr ) return; + if( cache == NULL ) return; int idx; if( !(yc & 0xffffff00) ) @@ -180,7 +180,7 @@ void Level::initCacheComplete(lightCache_t *cache, int xc, int yc, int zc) // Set a brightness value, going through the cache if enabled for this thread void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness) { - if( cache == nullptr ) + if( cache == NULL ) { setBrightness(layer, x, y, z, brightness, true); return; @@ -195,8 +195,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( static_cast(x) & 0x3FFFC00L) << 38) | - ( ( static_cast(z) & 0x3FFFC00L) << 22); + posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | + ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -243,7 +243,7 @@ void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, // Get a brightness value, going through the cache if enabled for this thread inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety layer, int x, int y, int z) { - if( cache == nullptr ) return getBrightness(layer, x, y, z); + if( cache == NULL ) return getBrightness(layer, x, y, z); if( y & 0xffffff00 ) return getBrightness(layer, x, y, z); // Fall back on original method for out-of-bounds y int idx = ( ( x & 15 ) << 8 ) | @@ -253,8 +253,9 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l ( ( y & 0x0f0 ) << 2 ) | ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS - posbits |= ( ( static_cast(x) & 0x3FFFC00L) << 38) | - ( ( static_cast(z) & 0x3FFFC00L) << 22); + // Add in the higher bits for x and z + posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | + ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -310,7 +311,7 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l // Get a block emission value, going through the cache if enabled for this thread inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, int z) { - if( cache == nullptr ) return Tile::lightEmission[ct]; + if( cache == NULL ) return Tile::lightEmission[ct]; int idx = ( ( x & 15 ) << 8 ) | ( ( y & 15 ) << 4 ) | @@ -320,8 +321,8 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( static_cast(x) & 0x3FFFC00) << 38) | - ( ( static_cast(z) & 0x3FFFC00) << 22); + posbits |= ( ( ((uint64_t)x) & 0x3FFFC00) << 38) | + ( ( ((uint64_t)z) & 0x3FFFC00) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -381,7 +382,7 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i // Get a tile light blocking value, going through cache if enabled for this thread inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety layer, int *ct, int x, int y, int z) { - if( cache == nullptr ) + if( cache == NULL ) { int t = getTile(x,y,z); if(ct) *ct = t; @@ -396,8 +397,8 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( static_cast(x) & 0x3FFFC00L) << 38) | - ( ( static_cast(z) & 0x3FFFC00L) << 22); + posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) | + ( ( ((uint64_t)z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -560,17 +561,17 @@ void Level::_init() random = new Random(); isNew = false; - dimension = nullptr; + dimension = NULL; - chunkSource = nullptr; + chunkSource = NULL; levelStorage = nullptr; - levelData = nullptr; + levelData = NULL; isFindingSpawn = false; - savedDataStorage = nullptr; + savedDataStorage = NULL; spawnEnemies = true; @@ -603,9 +604,9 @@ Biome *Level::getBiome(int x, int z) if (hasChunkAt(x, 0, z)) { LevelChunk *lc = getChunkAt(x, z); - if (lc != nullptr) + if (lc != NULL) { - // Water chunks at the edge of the world return nullptr for their biome as they can't store it, so should fall back on the normal method below + // Water chunks at the edge of the world return NULL for their biome as they can't store it, so should fall back on the normal method below Biome *biome = lc->getBiome(x & 0xf, z & 0xf, dimension->biomeSource); if( biome ) return biome; } @@ -629,9 +630,9 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi savedDataStorage = new SavedDataStorage(levelStorage.get()); shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); - if (savedVillages == nullptr) + if (savedVillages == NULL) { - villages = std::make_shared(this); + villages = shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); } else @@ -641,7 +642,7 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi } dimension->init(this); - chunkSource = nullptr; // 4J - added flag so chunk source can be called from derived class instead + chunkSource = NULL; // 4J - added flag so chunk source can be called from derived class instead updateSkyBrightness(); prepareWeather(); @@ -650,7 +651,7 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi Level::Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings) : seaLevel( constSeaLevel ) { - _init(levelStorage, levelName, levelSettings, nullptr, true); + _init(levelStorage, levelName, levelSettings, NULL, true); } @@ -667,9 +668,9 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName savedDataStorage = new SavedDataStorage(levelStorage.get()); shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); - if (savedVillages == nullptr) + if (savedVillages == NULL) { - villages = std::make_shared(this); + villages = shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); } else @@ -679,14 +680,14 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName } levelData = levelStorage->prepareLevel(); - isNew = levelData == nullptr; + isNew = levelData == NULL; - if (fixedDimension != nullptr) + if (fixedDimension != NULL) { dimension = fixedDimension; } // 4J Remove TU9 as getDimensions was never accurate. This path was never used anyway as we always set fixedDimension - //else if (levelData != nullptr && levelData->getDimension() != 0) + //else if (levelData != NULL && levelData->getDimension() != 0) //{ // dimension = Dimension::getNew(levelData->getDimension()); //} @@ -695,7 +696,7 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName dimension = Dimension::getNew(0); } - if (levelData == nullptr) + if (levelData == NULL) { levelData = new LevelData(levelSettings, levelName); } @@ -707,7 +708,7 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName ((Dimension *) dimension)->init( this ); - chunkSource = doCreateChunkSource ? createChunkSource() : nullptr; // 4J - added flag so chunk source can be called from derived class instead + chunkSource = doCreateChunkSource ? createChunkSource() : NULL; // 4J - added flag so chunk source can be called from derived class instead // 4J Stu- Moved to derived classes //if (!levelData->isInitialized()) @@ -739,7 +740,7 @@ Level::~Level() DeleteCriticalSection(&m_checkLightCS); // 4J-PB - savedDataStorage is shared between overworld and nether levels in the server, so it will already have been deleted on the first level delete - if(savedDataStorage!=nullptr) delete savedDataStorage; + if(savedDataStorage!=NULL) delete savedDataStorage; DeleteCriticalSection(&m_entitiesCS); DeleteCriticalSection(&m_tileEntityListCS); @@ -806,7 +807,7 @@ bool Level::isEmptyTile(int x, int y, int z) bool Level::isEntityTile(int x, int y, int z) { int t = getTile(x, y, z); - if (Tile::tiles[t] != nullptr && Tile::tiles[t]->isEntityTile()) + if (Tile::tiles[t] != NULL && Tile::tiles[t]->isEntityTile()) { return true; } @@ -816,7 +817,7 @@ bool Level::isEntityTile(int x, int y, int z) int Level::getTileRenderShape(int x, int y, int z) { int t = getTile(x, y, z); - if (Tile::tiles[t] != nullptr) + if (Tile::tiles[t] != NULL) { return Tile::tiles[t]->getRenderShape(); } @@ -826,7 +827,7 @@ int Level::getTileRenderShape(int x, int y, int z) // 4J Added to slightly optimise and avoid getTile call if we already know the tile int Level::getTileRenderShape(int t) { - if (Tile::tiles[t] != nullptr) + if (Tile::tiles[t] != NULL) { return Tile::tiles[t]->getRenderShape(); } @@ -953,7 +954,7 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFl { tileUpdated(x, y, z, oldTile); Tile *tobj = Tile::tiles[tile]; - if (tobj != nullptr && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); + if (tobj != NULL && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); } } return result; @@ -1010,7 +1011,7 @@ bool Level::setData(int x, int y, int z, int data, int updateFlags, bool forceUp { tileUpdated(x, y, z, tile); Tile *tobj = Tile::tiles[tile]; - if (tobj != nullptr && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); + if (tobj != NULL && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); } } return result; @@ -1144,7 +1145,7 @@ void Level::neighborChanged(int x, int y, int z, int type) int id = getTile(x, y, z); Tile *tile = Tile::tiles[id]; - if (tile != nullptr) + if (tile != NULL) { tile->neighborChanged(this, x, y, z, type); } @@ -1335,7 +1336,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z) int idx = ix * chunkSourceXZSize + iz; LevelChunk *c = chunkSourceCache[idx]; - if( c == nullptr ) return (int)layer; + if( c == NULL ) return (int)layer; if (y < 0) y = 0; if (y >= maxBuildHeight) y = maxBuildHeight - 1; @@ -1376,7 +1377,7 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye { for( int i = 0; i < 6; i++ ) { - brightnesses[i] = static_cast(layer); + brightnesses[i] = (int)layer; } return; } @@ -1387,11 +1388,11 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye // 4J Stu - The java LightLayer was an enum class type with a member "surrounding" which is what we // were returning here. Surrounding has the same value as the enum value in our C++ code, so just cast // it to an int - if( c == nullptr ) + if( c == NULL ) { for( int i = 0; i < 6; i++ ) { - brightnesses[i] = static_cast(layer); + brightnesses[i] = (int)layer; } return; } @@ -1496,8 +1497,8 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid) HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) { - if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return nullptr; - if (Double::isNaN(b->x) || Double::isNaN(b->y) || Double::isNaN(b->z)) return nullptr; + if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return NULL; + if (Double::isNaN(b->x) || Double::isNaN(b->y) || Double::isNaN(b->z)) return NULL; int xTile1 = Mth::floor(b->x); int yTile1 = Mth::floor(b->y); @@ -1511,7 +1512,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) int t = getTile(xTile0, yTile0, zTile0); int data = getData(xTile0, yTile0, zTile0); Tile *tile = Tile::tiles[t]; - if (solidOnly && tile != nullptr && tile->getAABB(this, xTile0, yTile0, zTile0) == nullptr) + if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) { // No collision @@ -1519,15 +1520,15 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) else if (t > 0 && tile->mayPick(data, liquid)) { HitResult *r = tile->clip(this, xTile0, yTile0, zTile0, a, b); - if (r != nullptr) return r; + if (r != NULL) return r; } } int maxIterations = 200; while (maxIterations-- >= 0) { - if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return nullptr; - if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) return nullptr; + if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return NULL; + if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) return NULL; bool xClipped = true; bool yClipped = true; @@ -1591,19 +1592,19 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) } Vec3 *tPos = Vec3::newTemp(a->x, a->y, a->z); - xTile0 = static_cast(tPos->x = floor(a->x)); + xTile0 = (int) (tPos->x = floor(a->x)); if (face == 5) { xTile0--; tPos->x++; } - yTile0 = static_cast(tPos->y = floor(a->y)); + yTile0 = (int) (tPos->y = floor(a->y)); if (face == 1) { yTile0--; tPos->y++; } - zTile0 = static_cast(tPos->z = floor(a->z)); + zTile0 = (int) (tPos->z = floor(a->z)); if (face == 3) { zTile0--; @@ -1613,7 +1614,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) int t = getTile(xTile0, yTile0, zTile0); int data = getData(xTile0, yTile0, zTile0); Tile *tile = Tile::tiles[t]; - if (solidOnly && tile != nullptr && tile->getAABB(this, xTile0, yTile0, zTile0) == nullptr) + if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) { // No collision @@ -1621,16 +1622,16 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) else if (t > 0 && tile->mayPick(data, liquid)) { HitResult *r = tile->clip(this, xTile0, yTile0, zTile0, a, b); - if (r != nullptr) return r; + if (r != NULL) return r; } } - return nullptr; + return NULL; } void Level::playEntitySound(shared_ptr entity, int iSound, float volume, float pitch) { - if(entity == nullptr) return; + if(entity == NULL) return; for (auto& listener : listeners) { // 4J-PB - if the entity is a local player, don't play the sound @@ -1649,7 +1650,7 @@ void Level::playEntitySound(shared_ptr entity, int iSound, float volume, void Level::playPlayerSound(shared_ptr entity, int iSound, float volume, float pitch) { - if (entity == nullptr) return; + if (entity == NULL) return; for (auto& listener : listeners) { listener->playSoundExceptPlayer(entity, iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); @@ -1702,7 +1703,7 @@ bool Level::addEntity(shared_ptr e) int xc = Mth::floor(e->x / 16); int zc = Mth::floor(e->z / 16); - if(e == nullptr) + if(e == NULL) { return false; } @@ -1891,7 +1892,7 @@ AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities/ for (int y = y0 - 1; y < y1; y++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr) + if (tile != NULL) { tile->addAABBs(this, x, y, z, box, &boxes, source); } @@ -1937,13 +1938,13 @@ AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities/ for (auto& it : *ee) { AABB *collideBox = it->getCollideBox(); - if (collideBox != nullptr && collideBox->intersects(box)) + if (collideBox != NULL && collideBox->intersects(box)) { boxes.push_back(collideBox); } collideBox = source->getCollideAgainstBox(it); - if (collideBox != nullptr && collideBox->intersects(box)) + if (collideBox != NULL && collideBox->intersects(box)) { boxes.push_back(collideBox); } @@ -1974,7 +1975,7 @@ AABBList *Level::getTileCubes(AABB *box, bool blockAtEdge/* = false */) // { // Tile *tile = Tile::tiles[getTile(x, y, z)]; - // if (tile != nullptr) + // if (tile != NULL) // { // tile->addAABBs(this, x, y, z, box, &boxes); // } @@ -2000,7 +2001,7 @@ int Level::getOldSkyDarken(float a) br *= 1 - (getRainLevel(a) * 5 / 16.0f); br *= 1 - (getThunderLevel(a) * 5 / 16.0f); br = 1 - br; - return static_cast(br * 11); + return ((int) (br * 11)); } //4J - change brought forward from 1.8.2 @@ -2086,7 +2087,7 @@ float Level::getTimeOfDay(float a) * getTimeOfDay and changed it before releasing (without * re-committing)... that should be the only difference // jeb */ - /* if (this != nullptr) return 0.5f; */ + /* if (this != NULL) return 0.5f; */ // 4J Added if so we can override timeOfDay without changing the time that affects ticking of things return dimension->getTimeOfDay(levelData->getDayTime(), a);; @@ -2302,7 +2303,7 @@ void Level::tickEntities() { shared_ptr e = entities.at(i); - if (e->riding != nullptr) + if (e->riding != NULL) { if (e->riding->removed || e->riding->rider.lock() != e) { @@ -2380,7 +2381,7 @@ void Level::tickEntities() if (hasChunk(te->x >> 4, te->z >> 4)) { LevelChunk *lc = getChunk(te->x >> 4, te->z >> 4); - if (lc != nullptr) lc->removeTileEntity(te->x & 15, te->y, te->z & 15); + if (lc != NULL) lc->removeTileEntity(te->x & 15, te->y, te->z & 15); } } else @@ -2436,7 +2437,7 @@ void Level::tickEntities() if (hasChunk(e->x >> 4, e->z >> 4)) { LevelChunk *lc = getChunk(e->x >> 4, e->z >> 4); - if (lc != nullptr) lc->setTileEntity(e->x & 15, e->y, e->z & 15, e); + if (lc != NULL) lc->setTileEntity(e->x & 15, e->y, e->z & 15, e); } sendTileUpdated(e->x, e->y, e->z); @@ -2502,7 +2503,7 @@ void Level::tick(shared_ptr e, bool actual) #endif { e->tickCount++; - if (e->riding != nullptr) + if (e->riding != NULL) { e->rideTick(); } @@ -2549,7 +2550,7 @@ void Level::tick(shared_ptr e, bool actual) if (actual && e->inChunk) { - if (e->rider.lock() != nullptr) + if (e->rider.lock() != NULL) { if (e->rider.lock()->removed || e->rider.lock()->riding != e) { @@ -2599,7 +2600,7 @@ bool Level::containsAnyBlocks(AABB *box) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr) + if (tile != NULL) { return true; } @@ -2626,7 +2627,7 @@ bool Level::containsAnyLiquid(AABB *box) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr && tile->material->isLiquid()) + if (tile != NULL && tile->material->isLiquid()) { return true; } @@ -2656,7 +2657,7 @@ bool Level::containsAnyLiquid_NoLoad(AABB *box) { if( !hasChunkAt(x,y,z) ) return true; // If we don't have it, it might be liquid... Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr && tile->material->isLiquid()) + if (tile != NULL && tile->material->isLiquid()) { return true; } @@ -2714,7 +2715,7 @@ bool Level::checkAndHandleWater(AABB *box, Material *material, shared_ptrmaterial == material) + if (tile != NULL && tile->material == material) { double yt0 = y + 1 - LiquidTile::getHeight(getData(x, y, z)); if (y1 >= yt0) @@ -2754,7 +2755,7 @@ bool Level::containsMaterial(AABB *box, Material *material) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr && tile->material == material) + if (tile != NULL && tile->material == material) { return true; } @@ -2781,7 +2782,7 @@ bool Level::containsLiquid(AABB *box, Material *material) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != nullptr && tile->material == material) + if (tile != NULL && tile->material == material) { int data = getData(x, y, z); double yh1 = y + 1; @@ -2809,7 +2810,7 @@ shared_ptr Level::explode(shared_ptr source, double x, double shared_ptr Level::explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks) { - shared_ptr explosion = std::make_shared(this, source, x, y, z, r); + shared_ptr explosion = shared_ptr( new Explosion(this, source, x, y, z, r) ); explosion->fire = fire; explosion->destroyBlocks = destroyBlocks; explosion->explode(); @@ -2833,12 +2834,12 @@ float Level::getSeenPercent(Vec3 *center, AABB *bb) double y = bb->y0 + (bb->y1 - bb->y0) * yy; double z = bb->z0 + (bb->z1 - bb->z0) * zz; HitResult *res = clip(Vec3::newTemp(x, y, z), center); - if ( res == nullptr) hits++; + if ( res == NULL) hits++; delete res; count++; } - return hits / static_cast(count); + return hits / (float) count; } @@ -2895,7 +2896,7 @@ shared_ptr Level::getTileEntity(int x, int y, int z) if (updatingTileEntities) { EnterCriticalSection(&m_tileEntityListCS); - for (size_t i = 0; i < pendingTileEntities.size(); i++) + for (int i = 0; i < pendingTileEntities.size(); i++) { shared_ptr e = pendingTileEntities.at(i); if (!e->isRemoved() && e->x == x && e->y == y && e->z == z) @@ -2907,16 +2908,16 @@ shared_ptr Level::getTileEntity(int x, int y, int z) LeaveCriticalSection(&m_tileEntityListCS); } - if (tileEntity == nullptr) + if (tileEntity == NULL) { LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != nullptr) + if (lc != NULL) { tileEntity = lc->getTileEntity(x & 15, y, z & 15); } } - if (tileEntity == nullptr) + if (tileEntity == NULL) { EnterCriticalSection(&m_tileEntityListCS); for(auto& e : pendingTileEntities) @@ -2935,7 +2936,7 @@ shared_ptr Level::getTileEntity(int x, int y, int z) void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity) { - if (tileEntity != nullptr && !tileEntity->isRemoved()) + if (tileEntity != NULL && !tileEntity->isRemoved()) { EnterCriticalSection(&m_tileEntityListCS); if (updatingTileEntities) @@ -2966,7 +2967,7 @@ void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity tileEntityList.push_back(tileEntity); LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != nullptr) lc->setTileEntity(x & 15, y, z & 15, tileEntity); + if (lc != NULL) lc->setTileEntity(x & 15, y, z & 15, tileEntity); } LeaveCriticalSection(&m_tileEntityListCS); } @@ -2976,7 +2977,7 @@ void Level::removeTileEntity(int x, int y, int z) { EnterCriticalSection(&m_tileEntityListCS); shared_ptr te = getTileEntity(x, y, z); - if (te != nullptr && updatingTileEntities) + if (te != NULL && updatingTileEntities) { te->setRemoved(); auto it = find(pendingTileEntities.begin(), pendingTileEntities.end(), te); @@ -2987,7 +2988,7 @@ void Level::removeTileEntity(int x, int y, int z) } else { - if (te != nullptr) + if (te != NULL) { auto it = find(pendingTileEntities.begin(), pendingTileEntities.end(), te); if( it != pendingTileEntities.end() ) @@ -3001,7 +3002,7 @@ void Level::removeTileEntity(int x, int y, int z) } } LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != nullptr) lc->removeTileEntity(x & 15, y, z & 15); + if (lc != NULL) lc->removeTileEntity(x & 15, y, z & 15); } LeaveCriticalSection(&m_tileEntityListCS); } @@ -3014,7 +3015,7 @@ void Level::markForRemoval(shared_ptr entity) bool Level::isSolidRenderTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == nullptr) return false; + if (tile == NULL) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by @@ -3030,7 +3031,7 @@ bool Level::isSolidRenderTile(int x, int y, int z) for( int i = 0; i < 6; i++ ) { int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) { return false; } @@ -3060,25 +3061,25 @@ bool Level::isSolidBlockingTileInLoadedChunk(int x, int y, int z, bool valueIfNo return valueIfNotLoaded; } LevelChunk *chunk = chunkSource->getChunk(x >> 4, z >> 4); - if (chunk == nullptr || chunk->isEmpty()) + if (chunk == NULL || chunk->isEmpty()) { return valueIfNotLoaded; } Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == nullptr) return false; + if (tile == NULL) return false; return tile->material->isSolidBlocking() && tile->isCubeShaped(); } bool Level::isFullAABBTile(int x, int y, int z) { int tile = getTile(x, y, z); - if (tile == 0 || Tile::tiles[tile] == nullptr) + if (tile == 0 || Tile::tiles[tile] == NULL) { return false; } AABB *aabb = Tile::tiles[tile]->getAABB(this, x, y, z); - return aabb != nullptr && aabb->getSize() >= 1; + return aabb != NULL && aabb->getSize() >= 1; } bool Level::isTopSolidBlocking(int x, int y, int z) @@ -3090,19 +3091,19 @@ bool Level::isTopSolidBlocking(int x, int y, int z) bool Level::isTopSolidBlocking(Tile *tile, int data) { - if (tile == nullptr) return false; + if (tile == NULL) return false; if (tile->material->isSolidBlocking() && tile->isCubeShaped()) return true; - if (dynamic_cast(tile) != nullptr) + if (dynamic_cast(tile) != NULL) { return (data & StairTile::UPSIDEDOWN_BIT) == StairTile::UPSIDEDOWN_BIT; } - if (dynamic_cast(tile) != nullptr) + if (dynamic_cast(tile) != NULL) { return (data & HalfSlabTile::TOP_SLOT_BIT) == HalfSlabTile::TOP_SLOT_BIT; } - if (dynamic_cast(tile) != nullptr) return true; - if (dynamic_cast(tile) != nullptr) return (data & TopSnowTile::HEIGHT_MASK) == TopSnowTile::MAX_HEIGHT + 1; + if (dynamic_cast(tile) != NULL) return true; + if (dynamic_cast(tile) != NULL) return (data & TopSnowTile::HEIGHT_MASK) == TopSnowTile::MAX_HEIGHT + 1; return false; } @@ -3257,7 +3258,7 @@ void Level::buildAndPrepareChunksToPoll() // 4J - rewritten to add chunks interleaved by player, and to add them from the centre outwards. We're going to be // potentially adding less creatures than the original so that our count stays consistent with number of players added, so // we want to make sure as best we can that the ones we do add are near the active players - int playerCount = static_cast(players.size()); + int playerCount = (int)players.size(); int *xx = new int[playerCount]; int *zz = new int[playerCount]; for (size_t i = 0; i < playerCount; i++) @@ -3319,7 +3320,7 @@ void Level::tickClientSideTiles(int xo, int zo, LevelChunk *lc) if (id == 0 && this->getDaytimeRawBrightness(x, y, z) <= random->nextInt(8) && getBrightness(LightLayer::Sky, x, y, z) <= 0) { shared_ptr player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8); - if (player != nullptr && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) + if (player != NULL && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) { // 4J-PB - Fixed issue with cave audio event having 2 sounds at 192k #ifdef _XBOX @@ -3436,7 +3437,7 @@ int Level::getExpectedLight(lightCache_t *cache, int x, int y, int z, LightLayer // 4J - Made changes here so that lighting goes through a cache, if enabled for this thread void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive) { - lightCache_t *cache = static_cast(TlsGetValue(tlsIdxLightCache)); + lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); uint64_t cacheUse = 0; if( force ) @@ -3470,13 +3471,13 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f // If we're in cached mode, then use memory allocated after the cached data itself for the toCheck array, in an attempt to make both that & the other cached data sit on the CPU L2 cache better. int *toCheck; - if( cache == nullptr ) + if( cache == NULL ) { toCheck = toCheckLevel; } else { - toCheck = reinterpret_cast(cache + (16 * 16 * 16)); + toCheck = (int *)(cache + (16*16*16)); } int checkedPosition = 0; @@ -3550,7 +3551,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f if( ( yy < 0 ) || ( yy >= maxBuildHeight ) ) continue; // 4J - some changes here brought forward from 1.2.3 - int block = max(1, getBlockingCached(cache, layer, nullptr, xx, yy, zz) ); + int block = max(1, getBlockingCached(cache, layer, NULL, xx, yy, zz) ); current = getBrightnessCached(cache, layer, xx, yy, zz); if ((current == expected - block) && (toCheckCount < (32 * 32 * 32))) // 4J - 32 * 32 * 32 was toCheck.length { @@ -3669,13 +3670,13 @@ bool Level::tickPendingTicks(bool force) vector *Level::fetchTicksInChunk(LevelChunk *chunk, bool remove) { - return nullptr; + return NULL; } vector > *Level::getEntities(shared_ptr except, AABB *bb) { - return getEntities(except, bb, nullptr); + return getEntities(except, bb, NULL); } vector > *Level::getEntities(shared_ptr except, AABB *bb, const EntitySelector *selector) @@ -3719,7 +3720,7 @@ vector > *Level::getEntities(shared_ptr except, AABB vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb) { - return getEntitiesOfClass(baseClass, bb, nullptr); + return getEntitiesOfClass(baseClass, bb, NULL); } vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb, const EntitySelector *selector) @@ -3813,7 +3814,7 @@ unsigned int Level::countInstanceOf(BaseObject::Class *clas) // 4J - added - more limited (but faster) version of above, used to count water animals, animals, monsters for the mob spawner // singleType flag should be true if we are just trying to match eINSTANCEOF exactly, and false if it is a eINSTANCEOF from a group (eTYPE_WATERANIMAL, eTYPE_ANIMAL, eTYPE_MONSTER) -unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount/* = nullptr*/, unsigned int *couldWanderCount/* = nullptr*/) +unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount/* = NULL*/, unsigned int *couldWanderCount/* = NULL*/) { unsigned int count = 0; if( protectedCount ) *protectedCount = 0; @@ -3931,16 +3932,16 @@ bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int f Tile *tile = Tile::tiles[tileId]; AABB *aabb = tile->getAABB(this, x, y, z); - if (ignoreEntities) aabb = nullptr; - if (aabb != nullptr && !isUnobstructed(aabb, ignoreEntity)) return false; - if (targetTile != nullptr && + if (ignoreEntities) aabb = NULL; + if (aabb != NULL && !isUnobstructed(aabb, ignoreEntity)) return false; + if (targetTile != NULL && (targetTile == Tile::water || targetTile == Tile::calmWater || targetTile == Tile::lava || targetTile == Tile::calmLava || targetTile == Tile::fire || targetTile->material->isReplaceable())) { - targetTile = nullptr; + targetTile = NULL; } - if (targetTile != nullptr && targetTile->material == Material::decoration && tile == Tile::anvil) return true; - if (tileId > 0 && targetTile == nullptr) + if (targetTile != NULL && targetTile->material == Material::decoration && tile == Tile::anvil) return true; + if (tileId > 0 && targetTile == NULL) { if (tile->mayPlace(this, x, y, z, face, item)) { @@ -3963,7 +3964,7 @@ Path *Level::findPath(shared_ptr from, shared_ptr to, float maxD int y = Mth::floor(from->y + 1); int z = Mth::floor(from->z); - int r = static_cast(maxDist + 16); + int r = (int) (maxDist + 16); int x1 = x - r; int y1 = y - r; int z1 = z - r; @@ -3982,7 +3983,7 @@ Path *Level::findPath(shared_ptr from, int xBest, int yBest, int zBest, int y = Mth::floor(from->y); int z = Mth::floor(from->z); - int r = static_cast(maxDist + 8); + int r = (int) (maxDist + 8); int x1 = x - r; int y1 = y - r; int z1 = z - r; @@ -4518,7 +4519,7 @@ int Level::getHeight() Tickable *Level::makeSoundUpdater(shared_ptr minecart) { - return nullptr; + return NULL; } Random *Level::getRandomFor(int x, int z, int blend) diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index eb750aff..946b21e3 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -438,7 +438,7 @@ public: vector > getAllEntities(); void tileEntityChanged(int x, int y, int z, shared_ptr te); // unsigned int countInstanceOf(BaseObject::Class *clas); - unsigned int countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount = nullptr, unsigned int *couldWanderCount = nullptr); // 4J added + unsigned int countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount = NULL, unsigned int *couldWanderCount = NULL); // 4J added unsigned int countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, int z); // 4J Added void addEntities(vector > *list); virtual void removeEntities(vector > *list); diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index 118dbcdd..e4958ecf 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/LevelChunk.cpp @@ -123,7 +123,7 @@ void LevelChunk::init(Level *level, int x, int z) #ifdef _LARGE_WORLDS m_bUnloaded = false; // 4J Added - m_unloadedEntitiesTag = nullptr; + m_unloadedEntitiesTag = NULL; #endif } @@ -132,10 +132,10 @@ LevelChunk::LevelChunk(Level *level, int x, int z) { init(level, x, z); lowerBlocks = new CompressedTileStorage(); - lowerData = nullptr; - lowerSkyLight = nullptr; - lowerBlockLight = nullptr; - serverTerrainPopulated = nullptr; + lowerData = NULL; + lowerSkyLight = NULL; + lowerBlockLight = NULL; + serverTerrainPopulated = NULL; if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { @@ -147,10 +147,10 @@ LevelChunk::LevelChunk(Level *level, int x, int z) } else { - upperBlocks = nullptr; - upperData = nullptr; - upperSkyLight = nullptr; - upperBlockLight = nullptr; + upperBlocks = NULL; + upperData = NULL; + upperSkyLight = NULL; + upperBlockLight = NULL; } #ifdef SHARING_ENABLED @@ -167,7 +167,7 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) // We'll be creating this as "empty" when this ctor is called on the client, as a result of a chunk becoming visible (but we don't have the data yet for it). // In this case, we want to keep memory usage down and so create all data as empty/compressed as possible. On the client we get the full data for the chunk as a single // update in a block region update packet, and so there is a single point where it is good to compress the data. - bool createEmpty = ( blocks.data == nullptr ); + bool createEmpty = ( blocks.data == NULL ); if( createEmpty ) { @@ -199,13 +199,13 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) } else { - upperBlocks = nullptr; - upperData = nullptr; - upperSkyLight = nullptr; - upperBlockLight = nullptr; + upperBlocks = NULL; + upperData = NULL; + upperSkyLight = NULL; + upperBlockLight = NULL; } - serverTerrainPopulated = nullptr; + serverTerrainPopulated = NULL; #ifdef SHARING_ENABLED sharingTilesAndData = false; #endif @@ -237,7 +237,7 @@ LevelChunk::LevelChunk(Level *level, int x, int z, LevelChunk *lc) this->data = new SparseDataStorage(lc->data); this->skyLight = new SparseLightStorage(lc->skyLight); this->blockLight = new SparseLightStorage(lc->blockLight); - serverTerrainPopulated = nullptr; + serverTerrainPopulated = NULL; #endif } @@ -296,8 +296,8 @@ void LevelChunk::stopSharingTilesAndData() } else { - upperBlocks = nullptr; - upperData = nullptr; + upperBlocks = NULL; + upperData = NULL; } /* @@ -531,7 +531,7 @@ void LevelChunk::recalcHeightmapOnly() blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; } #endif - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = (byte) y; if (y < min) min = y; } @@ -588,7 +588,7 @@ void LevelChunk::recalcHeightmap() blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; } #endif - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = (byte) y; if (y < min) min = y; if (y < lowestHeightmap) lowestHeightmap = y; @@ -811,7 +811,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) if (y == yOld) return; // level->lightColumnChanged(x, z, y, yOld); // 4J - this call moved below & corrected - see comment further down - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = (byte) y; if (y < minHeight) { @@ -919,12 +919,12 @@ int LevelChunk::getTile(int x, int y, int z) bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { - byte tile = static_cast(_tile); + byte tile = (byte) _tile; // Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255 int slot = z << 4 | x; - if (y >= static_cast(rainHeights[slot]) - 1) + if (y >= ((int)rainHeights[slot]) - 1) { rainHeights[slot] = 255; } @@ -939,7 +939,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { // 4J Stu - Need to do this here otherwise double chests don't always work correctly shared_ptr te = getTileEntity(x, y, z); - if (te != nullptr) + if (te != NULL) { te->clearCache(); } @@ -1032,17 +1032,17 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) } } // AP - changed the method of EntityTile detection cos it's well slow on Vita mate - // if (_tile > 0 && dynamic_cast(Tile::tiles[_tile]) != nullptr) - if (_tile > 0 && Tile::tiles[_tile] != nullptr && Tile::tiles[_tile]->isEntityTile()) + // if (_tile > 0 && dynamic_cast(Tile::tiles[_tile]) != NULL) + if (_tile > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) { shared_ptr te = getTileEntity(x, y, z); - if (te == nullptr) + if (te == NULL) { te = dynamic_cast(Tile::tiles[_tile])->newTileEntity(level); //app.DebugPrintf("%s: Setting tile id %d, created tileEntity type %d\n", level->isClientSide?"Client":"Server", _tile, te->GetType()); level->setTileEntity(xOffs, y, zOffs, te); } - if (te != nullptr) + if (te != NULL) { //app.DebugPrintf("%s: Setting tile id %d, found tileEntity type %d\n", level->isClientSide?"Client":"Server", _tile, te->GetType()); te->clearCache(); @@ -1050,11 +1050,11 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) } } // AP - changed the method of EntityTile detection cos it's well slow on Vita mate - // else if (old > 0 && dynamic_cast(Tile::tiles[old]) != nullptr) - else if (old > 0 && Tile::tiles[_tile] != nullptr && Tile::tiles[_tile]->isEntityTile()) + // else if (old > 0 && dynamic_cast(Tile::tiles[old]) != NULL) + else if (old > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) { shared_ptr te = getTileEntity(x, y, z); - if (te != nullptr) + if (te != NULL) { te->clearCache(); } @@ -1091,10 +1091,10 @@ bool LevelChunk::setData(int x, int y, int z, int val, int mask, bool *maskedBit data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, val); int _tile = getTile(x, y, z); - if (_tile > 0 && dynamic_cast( Tile::tiles[_tile] ) != nullptr) + if (_tile > 0 && dynamic_cast( Tile::tiles[_tile] ) != NULL) { shared_ptr te = getTileEntity(x, y, z); - if (te != nullptr) + if (te != NULL) { te->clearCache(); te->data = val; @@ -1310,7 +1310,7 @@ shared_ptr LevelChunk::getTileEntity(int x, int y, int z) //EntityTile *et = (EntityTile *) Tile::tiles[t]; //et->onPlace(level, this->x * 16 + x, y, this->z * 16 + z); - //if (tileEntity == nullptr) + //if (tileEntity == NULL) //{ tileEntity = dynamic_cast(Tile::tiles[t])->newTileEntity(level); level->setTileEntity(this->x * 16 + x, y, this->z * 16 + z, tileEntity); @@ -1332,7 +1332,7 @@ shared_ptr LevelChunk::getTileEntity(int x, int y, int z) tileEntity = it->second; LeaveCriticalSection(&m_csTileEntities); } - if (tileEntity != nullptr && tileEntity->isRemoved()) + if (tileEntity != NULL && tileEntity->isRemoved()) { EnterCriticalSection(&m_csTileEntities); tileEntities.erase(pos); @@ -1398,7 +1398,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { shared_ptr te = tileEntities[pos]; tileEntities.erase(pos); - if( te != nullptr ) + if( te != NULL ) { if(level->isClientSide) { @@ -1421,13 +1421,13 @@ void LevelChunk::load() if(m_bUnloaded && m_unloadedEntitiesTag) { ListTag *entityTags = (ListTag *) m_unloadedEntitiesTag->getList(L"Entities"); - if (entityTags != nullptr) + if (entityTags != NULL) { for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); shared_ptr ent = EntityIO::loadStatic(teTag, level); - if (ent != nullptr) + if (ent != NULL) { ent->onLoadedFromSave(); addEntity(ent); @@ -1436,20 +1436,20 @@ void LevelChunk::load() } ListTag *tileEntityTags = (ListTag *) m_unloadedEntitiesTag->getList(L"TileEntities"); - if (tileEntityTags != nullptr) + if (tileEntityTags != NULL) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if (te != nullptr) + if (te != NULL) { addTileEntity(te); } } } delete m_unloadedEntitiesTag; - m_unloadedEntitiesTag = nullptr; + m_unloadedEntitiesTag = NULL; m_bUnloaded = false; } #endif @@ -1628,16 +1628,16 @@ void LevelChunk::getEntities(shared_ptr except, AABB *bb, vectorbb->intersects(bb) && (selector == nullptr || selector->matches(e))) + if ( e && e != except && e->bb->intersects(bb) && (selector == NULL || selector->matches(e))) { es.push_back(e); vector > *subs = e->getSubEntities(); - if (subs != nullptr) + if (subs != NULL) { for (const auto& sub : *subs) { e = sub; - if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e))) + if ( e && e != except && e->bb->intersects(bb) && (selector == NULL || selector->matches(e))) { es.push_back(e); } @@ -1693,10 +1693,10 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vectorinstanceof(eTYPE_MINECART); else if ( ec==typeid(Monster) ) isAssignableFrom = e->instanceof(eTYPE_MONSTER); else if ( ec==typeid(Zombie) ) isAssignableFrom = e->instanceof(eTYPE_ZOMBIE); - else if(e != nullptr && ec == typeid(*(e.get())) ) isAssignableFrom = true; + else if(e != NULL && ec == typeid(*(e.get())) ) isAssignableFrom = true; if (isAssignableFrom && e->bb->intersects(bb)) { - if (selector == nullptr || selector->matches(e)) + if (selector == NULL || selector->matches(e)) { es.push_back(e); } @@ -1719,7 +1719,7 @@ int LevelChunk::countEntities() #endif for (int yc = 0; yc < ENTITY_BLOCKS_LENGTH; yc++) { - entityCount += static_cast(entityBlocks[yc]->size()); + entityCount += (int)entityBlocks[yc]->size(); } #ifdef _ENTITIES_RW_SECTION LeaveCriticalRWSection(&m_csEntities, false); @@ -1813,7 +1813,7 @@ bool LevelChunk::testSetBlocksAndData(byteArray data, int x0, int y0, int z0, in void LevelChunk::tileUpdatedCallback(int x, int y, int z, void *param, int yparam) { - LevelChunk *lc = static_cast(param); + LevelChunk *lc = (LevelChunk *)param; int xx = lc->x * 16 + x; int yy = y + yparam; int zz = lc->z * 16 + z; @@ -1849,8 +1849,8 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; // 4J - replaced block storage as now uses CompressedTileStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); /* for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) @@ -1864,8 +1864,8 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, recalcHeightmapOnly(); // 4J - replaced data storage as now uses SparseDataStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); if( includeLighting ) { @@ -2000,7 +2000,7 @@ void LevelChunk::checkChests(ChunkSource *source, int x, int z ) { int xOffs = x * 16 + xx; int zOffs = z * 16 + zz; - ChestTile *tile = static_cast(Tile::tiles[Tile::chest_Id]); + ChestTile *tile = (ChestTile *)Tile::tiles[Tile::chest_Id]; tile->recalcLockDir( level, xOffs, yy, zOffs ); level->checkLight(xOffs, yy, zOffs, true); } @@ -2047,7 +2047,7 @@ void LevelChunk::reloadBiomes() for(unsigned int z = 0; z < 16; ++z) { Biome *biome = biomeSource->getBiome((this->x << 4) + x, (this->z << 4) + z); - biomes[(z << 4) | x] = static_cast((biome->id) & 0xff); + biomes[(z << 4) | x] = (byte) ( (biome->id) & 0xff); } } } @@ -2059,9 +2059,9 @@ Biome *LevelChunk::getBiome(int x, int z, BiomeSource *biomeSource) { Biome *biome = biomeSource->getBiome((this->x << 4) + x, (this->z << 4) + z); value = biome->id; - biomes[(z << 4) | x] = static_cast(value & 0xff); + biomes[(z << 4) | x] = (byte) (value & 0xff); } - if (Biome::biomes[value] == nullptr) + if (Biome::biomes[value] == NULL) { return Biome::plains; } @@ -2075,7 +2075,7 @@ byteArray LevelChunk::getBiomes() void LevelChunk::setBiomes(byteArray biomes) { - if(this->biomes.data != nullptr) delete[] this->biomes.data; + if(this->biomes.data != NULL) delete[] this->biomes.data; this->biomes = biomes; } @@ -2156,8 +2156,8 @@ void LevelChunk::getDataData(byteArray data) // Set data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setDataData(byteArray data) { - if( lowerData == nullptr ) lowerData = new SparseDataStorage(); - if( upperData == nullptr ) upperData = new SparseDataStorage(true); + if( lowerData == NULL ) lowerData = new SparseDataStorage(); + if( upperData == NULL ) upperData = new SparseDataStorage(true); lowerData->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperData->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2179,8 +2179,8 @@ void LevelChunk::getBlockLightData(byteArray data) // Set sky light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setSkyLightData(byteArray data) { - if( lowerSkyLight == nullptr ) lowerSkyLight = new SparseLightStorage(true); - if( upperSkyLight == nullptr ) upperSkyLight = new SparseLightStorage(true,true); + if( lowerSkyLight == NULL ) lowerSkyLight = new SparseLightStorage(true); + if( upperSkyLight == NULL ) upperSkyLight = new SparseLightStorage(true,true); lowerSkyLight->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperSkyLight->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2188,8 +2188,8 @@ void LevelChunk::setSkyLightData(byteArray data) // Set block light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setBlockLightData(byteArray data) { - if( lowerBlockLight == nullptr ) lowerBlockLight = new SparseLightStorage(false); - if( upperBlockLight == nullptr ) upperBlockLight = new SparseLightStorage(false, true); + if( lowerBlockLight == NULL ) lowerBlockLight = new SparseLightStorage(false); + if( upperBlockLight == NULL ) upperBlockLight = new SparseLightStorage(false, true); lowerBlockLight->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperBlockLight->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2215,8 +2215,8 @@ void LevelChunk::compressLighting() void LevelChunk::compressBlocks() { #ifdef SHARING_ENABLED - CompressedTileStorage *blocksToCompressLower = nullptr; - CompressedTileStorage *blocksToCompressUpper = nullptr; + CompressedTileStorage *blocksToCompressLower = NULL; + CompressedTileStorage *blocksToCompressUpper = NULL; // If we're the host machine, and this is the client level, then we only want to do this if we are sharing data. This means that we will be compressing the data that is shared from the server. // No point trying to compress the local client copy of the data if the data is unshared, since we'll be throwing this data away again anyway once we share with the server again. @@ -2293,24 +2293,24 @@ void LevelChunk::readCompressedBlockData(DataInputStream *dis) void LevelChunk::readCompressedDataData(DataInputStream *dis) { - if( lowerData == nullptr ) lowerData = new SparseDataStorage(); - if( upperData == nullptr ) upperData = new SparseDataStorage(true); + if( lowerData == NULL ) lowerData = new SparseDataStorage(); + if( upperData == NULL ) upperData = new SparseDataStorage(true); lowerData->read(dis); upperData->read(dis); } void LevelChunk::readCompressedSkyLightData(DataInputStream *dis) { - if( lowerSkyLight == nullptr ) lowerSkyLight = new SparseLightStorage(true); - if( upperSkyLight == nullptr ) upperSkyLight = new SparseLightStorage(true,true); + if( lowerSkyLight == NULL ) lowerSkyLight = new SparseLightStorage(true); + if( upperSkyLight == NULL ) upperSkyLight = new SparseLightStorage(true,true); lowerSkyLight->read(dis); upperSkyLight->read(dis); } void LevelChunk::readCompressedBlockLightData(DataInputStream *dis) { - if( lowerBlockLight == nullptr ) lowerBlockLight = new SparseLightStorage(false); - if( upperBlockLight == nullptr ) upperBlockLight = new SparseLightStorage(false, true); + if( lowerBlockLight == NULL ) lowerBlockLight = new SparseLightStorage(false); + if( upperBlockLight == NULL ) upperBlockLight = new SparseLightStorage(false, true); lowerBlockLight->read(dis); upperBlockLight->read(dis); } @@ -2319,8 +2319,8 @@ void LevelChunk::readCompressedBlockLightData(DataInputStream *dis) void LevelChunk::compressData() { #ifdef SHARING_ENABLED - SparseDataStorage *dataToCompressLower = nullptr; - SparseDataStorage *dataToCompressUpper = nullptr; + SparseDataStorage *dataToCompressLower = NULL; + SparseDataStorage *dataToCompressUpper = NULL; // If we're the host machine, and this is the client level, then we only want to do this if we are sharing data. This means that we will be compressing the data that is shared from the server. // No point trying to compress the local client copy of the data if the data is unshared, since we'll be throwing this data away again anyway once we share with the server again. diff --git a/Minecraft.World/LevelData.cpp b/Minecraft.World/LevelData.cpp index fbc10ddb..05bc2060 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/LevelData.cpp @@ -18,7 +18,7 @@ LevelData::LevelData(CompoundTag *tag) { wstring generatorName = tag->getString(L"generatorName"); m_pGenerator = LevelType::getLevelType(generatorName); - if (m_pGenerator == nullptr) + if (m_pGenerator == NULL) { m_pGenerator = LevelType::lvl_normal; } @@ -188,13 +188,8 @@ LevelData::LevelData(CompoundTag *tag) dimension = loadedPlayerTag->getInt(L"Dimension"); } else -<<<<<<< HEAD - { - this->loadedPlayerTag = nullptr; -======= { this->loadedPlayerTag = NULL; ->>>>>>> origin/main } */ dimension = 0; @@ -220,7 +215,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) gameTime = -1; lastPlayed = 0; sizeOnDisk = 0; - // this->loadedPlayerTag = nullptr; // 4J - we don't store this anymore + // this->loadedPlayerTag = NULL; // 4J - we don't store this anymore dimension = 0; version = 0; rainTime = 0; @@ -437,7 +432,7 @@ int64_t LevelData::getSizeOnDisk() CompoundTag *LevelData::getLoadedPlayerTag() { - return nullptr; // 4J - we don't store this anymore + return NULL; // 4J - we don't store this anymore } // 4J Removed TU9 as it's never accurate due to the dimension never being set @@ -717,7 +712,7 @@ void LevelData::getMoatFlags(bool* bClassicEdgeMoat, bool* bSmallEdgeMoat, bool* int LevelData::getXZHellSizeOld() { - int hellXZSizeOld = ceil(static_cast(m_xzSizeOld) / m_hellScaleOld); + int hellXZSizeOld = ceil((float)m_xzSizeOld / m_hellScaleOld); while(hellXZSizeOld > HELL_LEVEL_MAX_WIDTH && m_hellScaleOld < HELL_LEVEL_MAX_SCALE) { diff --git a/Minecraft.World/LevelEventPacket.h b/Minecraft.World/LevelEventPacket.h index 234f127d..1d8c36e2 100644 --- a/Minecraft.World/LevelEventPacket.h +++ b/Minecraft.World/LevelEventPacket.h @@ -21,6 +21,6 @@ public: bool isGlobalEvent(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new LevelEventPacket()); } virtual int getId() { return 61; } }; \ No newline at end of file diff --git a/Minecraft.World/LevelParticlesPacket.h b/Minecraft.World/LevelParticlesPacket.h index c7870a8e..7676f771 100644 --- a/Minecraft.World/LevelParticlesPacket.h +++ b/Minecraft.World/LevelParticlesPacket.h @@ -34,6 +34,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new LevelParticlesPacket()); } virtual int getId() { return 63; } }; \ No newline at end of file diff --git a/Minecraft.World/LevelSettings.cpp b/Minecraft.World/LevelSettings.cpp index 4f0536df..a81a4032 100644 --- a/Minecraft.World/LevelSettings.cpp +++ b/Minecraft.World/LevelSettings.cpp @@ -3,10 +3,10 @@ #include "net.minecraft.world.level.storage.h" #include "LevelType.h" -GameType *GameType::NOT_SET = nullptr; -GameType *GameType::SURVIVAL= nullptr; -GameType *GameType::CREATIVE = nullptr; -GameType *GameType::ADVENTURE = nullptr; +GameType *GameType::NOT_SET = NULL; +GameType *GameType::SURVIVAL= NULL; +GameType *GameType::CREATIVE = NULL; +GameType *GameType::ADVENTURE = NULL; void GameType::staticCtor() { diff --git a/Minecraft.World/LevelSoundPacket.cpp b/Minecraft.World/LevelSoundPacket.cpp index cc2e29c4..cbe31a2d 100644 --- a/Minecraft.World/LevelSoundPacket.cpp +++ b/Minecraft.World/LevelSoundPacket.cpp @@ -20,9 +20,9 @@ LevelSoundPacket::LevelSoundPacket() LevelSoundPacket::LevelSoundPacket(int sound, double x, double y, double z, float volume, float pitch) { this->sound = sound; - this->x = static_cast(x * LOCATION_ACCURACY); - this->y = static_cast(y * LOCATION_ACCURACY); - this->z = static_cast(z * LOCATION_ACCURACY); + this->x = (int) (x * LOCATION_ACCURACY); + this->y = (int) (y * LOCATION_ACCURACY); + this->z = (int) (z * LOCATION_ACCURACY); this->volume = volume; // 4J-PB - Let's make the pitch a float so it doesn't get mangled and make the noteblock people unhappy //this->pitch = (int) (pitch * PITCH_ACCURACY); diff --git a/Minecraft.World/LevelSoundPacket.h b/Minecraft.World/LevelSoundPacket.h index e9ce356d..403ac092 100644 --- a/Minecraft.World/LevelSoundPacket.h +++ b/Minecraft.World/LevelSoundPacket.h @@ -33,6 +33,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new LevelSoundPacket()); } virtual int getId() { return 62; } }; diff --git a/Minecraft.World/LevelStorage.h b/Minecraft.World/LevelStorage.h index f0d2ac78..25d2aba2 100644 --- a/Minecraft.World/LevelStorage.h +++ b/Minecraft.World/LevelStorage.h @@ -29,7 +29,7 @@ public: virtual wstring getLevelId() = 0; public: - virtual ConsoleSaveFile *getSaveFile() { return nullptr; } + virtual ConsoleSaveFile *getSaveFile() { return NULL; } virtual void flushSaveFile(bool autosave) {} // 4J Added diff --git a/Minecraft.World/LevelType.cpp b/Minecraft.World/LevelType.cpp index 924c8ab4..30b08132 100644 --- a/Minecraft.World/LevelType.cpp +++ b/Minecraft.World/LevelType.cpp @@ -14,14 +14,14 @@ // private boolean replacement; LevelType *LevelType::levelTypes[16];// = new LevelType[16]; -LevelType *LevelType::lvl_normal=nullptr;// = new LevelType(0, "default", 1).setHasReplacement(); -LevelType *LevelType::lvl_flat=nullptr;// = new LevelType(1, "flat"); -LevelType *LevelType::lvl_largeBiomes = nullptr;// = new LevelType(2, "largeBiomes"); -LevelType *LevelType::lvl_normal_1_1=nullptr;// = new LevelType(8, "default_1_1", 0).setSelectableByUser(false); +LevelType *LevelType::lvl_normal=NULL;// = new LevelType(0, "default", 1).setHasReplacement(); +LevelType *LevelType::lvl_flat=NULL;// = new LevelType(1, "flat"); +LevelType *LevelType::lvl_largeBiomes = NULL;// = new LevelType(2, "largeBiomes"); +LevelType *LevelType::lvl_normal_1_1=NULL;// = new LevelType(8, "default_1_1", 0).setSelectableByUser(false); void LevelType::staticCtor() { - for(int i=0;i<16;i++) levelTypes[i]=nullptr; + for(int i=0;i<16;i++) levelTypes[i]=NULL; lvl_normal = new LevelType(0, L"default", 1); lvl_normal->setHasReplacement(); lvl_flat = new LevelType(1, L"flat"); @@ -107,13 +107,13 @@ LevelType *LevelType::getLevelType(wstring name) { wstring genname=levelTypes[i]->m_generatorName; - if (levelTypes[i] != nullptr && (genname.compare(name)==0)) + if (levelTypes[i] != NULL && (genname.compare(name)==0)) { return levelTypes[i]; } } } - return nullptr; + return NULL; } int LevelType::getId() diff --git a/Minecraft.World/LeverTile.cpp b/Minecraft.World/LeverTile.cpp index 7a7cdfd5..eea9e3d3 100644 --- a/Minecraft.World/LeverTile.cpp +++ b/Minecraft.World/LeverTile.cpp @@ -10,7 +10,7 @@ LeverTile::LeverTile(int id) : Tile(id, Material::decoration,isSolidRender()) AABB *LeverTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool LeverTile::blocksLight() diff --git a/Minecraft.World/LightningBolt.cpp b/Minecraft.World/LightningBolt.cpp index 68ac77ef..a109d96b 100644 --- a/Minecraft.World/LightningBolt.cpp +++ b/Minecraft.World/LightningBolt.cpp @@ -78,11 +78,11 @@ void LightningBolt::tick() life = 1; seed = random->nextLong(); - if (!level->isClientSide && level->getGameRules()->getBoolean(GameRules::RULE_DOFIRETICK) && level->hasChunksAt( static_cast(floor(x)), static_cast(floor(y)), static_cast(floor(z)), 10)) + if (!level->isClientSide && level->getGameRules()->getBoolean(GameRules::RULE_DOFIRETICK) && level->hasChunksAt( (int) floor(x), (int) floor(y), (int) floor(z), 10)) { - int xt = static_cast(floor(x)); - int yt = static_cast(floor(y)); - int zt = static_cast(floor(z)); + int xt = (int) floor(x); + int yt = (int) floor(y); + int zt = (int) floor(z); // 4J added - don't go setting tiles if we aren't tracking them for network synchronisation if( MinecraftServer::getInstance()->getPlayers()->isTrackingTile(xt, yt, zt, level->dimension->id) ) diff --git a/Minecraft.World/LiquidTile.cpp b/Minecraft.World/LiquidTile.cpp index be6c582d..c31b6466 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -131,7 +131,7 @@ bool LiquidTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int f AABB *LiquidTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } int LiquidTile::getRenderShape() @@ -317,7 +317,7 @@ void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random) { if (random->nextInt(100) == 0) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); double xx = x + random->nextFloat(); double yy = y + tls->yy1; double zz = z + random->nextFloat(); @@ -349,7 +349,7 @@ void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random) double LiquidTile::getSlopeAngle(LevelSource *level, int x, int y, int z, Material *m) { - Vec3 *flow = nullptr; + Vec3 *flow = NULL; if (m == Material::water) flow = ((LiquidTile *) Tile::water)->getFlow(level, x, y, z); if (m == Material::lava) flow = ((LiquidTile *) Tile::lava)->getFlow(level, x, y, z); if (flow->x == 0 && flow->z == 0) return -1000; @@ -425,5 +425,5 @@ Icon *LiquidTile::getTexture(const wstring &name) if (name.compare(TEXTURE_WATER_FLOW)==0) return Tile::water->icons[1]; if (name.compare(TEXTURE_LAVA_STILL)==0) return Tile::lava->icons[0]; if (name.compare(TEXTURE_LAVA_FLOW)==0) return Tile::lava->icons[1]; - return nullptr; + return NULL; } diff --git a/Minecraft.World/ListTag.h b/Minecraft.World/ListTag.h index 2a0fdebc..69e51aee 100644 --- a/Minecraft.World/ListTag.h +++ b/Minecraft.World/ListTag.h @@ -18,7 +18,7 @@ public: else type = 1; dos->writeByte(type); - dos->writeInt(static_cast(list.size())); + dos->writeInt((int)list.size()); for ( auto& it : list ) it->write(dos); @@ -83,12 +83,12 @@ public: T *get(int index) { - return static_cast(list[index]); + return (T *) list[index]; } int size() { - return static_cast(list.size()); + return (int)list.size(); } virtual ~ListTag() @@ -105,7 +105,7 @@ public: res->type = type; for ( auto& it : list ) { - T *copy = static_cast(it->copy()); + T *copy = (T *) it->copy(); res->list.push_back(copy); } return res; @@ -115,7 +115,7 @@ public: { if (Tag::equals(obj)) { - ListTag *o = static_cast(obj); + ListTag *o = (ListTag *) obj; if (type == o->type) { bool equal = false; diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 3ace8806..ce702676 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -39,7 +39,7 @@ AttributeModifier *LivingEntity::SPEED_MODIFIER_SPRINTING = (new AttributeModifi void LivingEntity::_init() { - attributes = nullptr; + attributes = NULL; combatTracker = new CombatTracker(this); lastEquipment = ItemInstanceArray(5); @@ -107,10 +107,10 @@ LivingEntity::LivingEntity( Level* level) : Entity(level) blocksBuilding = true; - rotA = static_cast(Math::random() + 1) * 0.01f; + rotA = (float) (Math::random() + 1) * 0.01f; setPos(x, y, z); - timeOffs = static_cast(Math::random()) * 12398; - yRot = static_cast(Math::random() * PI * 2); + timeOffs = (float) Math::random() * 12398; + yRot = (float) (Math::random() * PI * 2); yHeadRot = yRot; footSize = 0.5f; @@ -126,14 +126,14 @@ LivingEntity::~LivingEntity() delete attributes; delete combatTracker; - if(lastEquipment.data != nullptr) delete [] lastEquipment.data; + if(lastEquipment.data != NULL) delete [] lastEquipment.data; } void LivingEntity::defineSynchedData() { entityData->define(DATA_EFFECT_COLOR_ID, 0); - entityData->define(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); - entityData->define(DATA_ARROW_COUNT_ID, static_cast(0)); + entityData->define(DATA_EFFECT_AMBIENCE_ID, (byte) 0); + entityData->define(DATA_ARROW_COUNT_ID, (byte) 0); entityData->define(DATA_HEALTH_ID, 1.0f); } @@ -198,7 +198,7 @@ void LivingEntity::baseTick() if (isFireImmune() || level->isClientSide) clearFire(); shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); - bool isInvulnerable = (thisPlayer != nullptr && thisPlayer->abilities.invulnerable); + bool isInvulnerable = (thisPlayer != NULL && thisPlayer->abilities.invulnerable); if (isAlive() && isUnderLiquid(Material::water)) { @@ -253,13 +253,13 @@ void LivingEntity::baseTick() lastHurtByPlayer.reset(); } } - if (lastHurtMob != nullptr && !lastHurtMob->isAlive()) + if (lastHurtMob != NULL && !lastHurtMob->isAlive()) { lastHurtMob = nullptr; } // If lastHurtByMob is dead, remove it - if (lastHurtByMob != nullptr && !lastHurtByMob->isAlive()) + if (lastHurtByMob != NULL && !lastHurtByMob->isAlive()) { setLastHurtByMob(nullptr); } @@ -295,7 +295,7 @@ void LivingEntity::tickDeath() { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(std::make_shared(level, x, y, z, newCount)); + level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); } } } @@ -391,17 +391,17 @@ int LivingEntity::getNoActionTime() void LivingEntity::addAdditonalSaveData(CompoundTag *entityTag) { entityTag->putFloat(L"HealF", getHealth()); - entityTag->putShort(L"Health", static_cast(ceil(getHealth()))); - entityTag->putShort(L"HurtTime", static_cast(hurtTime)); - entityTag->putShort(L"DeathTime", static_cast(deathTime)); - entityTag->putShort(L"AttackTime", static_cast(attackTime)); + entityTag->putShort(L"Health", (short) ceil(getHealth())); + entityTag->putShort(L"HurtTime", (short) hurtTime); + entityTag->putShort(L"DeathTime", (short) deathTime); + entityTag->putShort(L"AttackTime", (short) attackTime); entityTag->putFloat(L"AbsorptionAmount", getAbsorptionAmount()); ItemInstanceArray items = getEquipmentSlots(); for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != nullptr) + if (item != NULL) { attributes->removeItemModifiers(item); } @@ -412,7 +412,7 @@ void LivingEntity::addAdditonalSaveData(CompoundTag *entityTag) for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != nullptr) + if (item != NULL) { attributes->addItemModifiers(item); } @@ -435,7 +435,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag *tag) { setAbsorptionAmount(tag->getFloat(L"AbsorptionAmount")); - if (tag->contains(L"Attributes") && level != nullptr && !level->isClientSide) + if (tag->contains(L"Attributes") && level != NULL && !level->isClientSide) { SharedMonsterAttributes::loadAttributes(getAttributes(), (ListTag *) tag->getList(L"Attributes")); } @@ -458,18 +458,18 @@ void LivingEntity::readAdditionalSaveData(CompoundTag *tag) else { Tag *healthTag = tag->get(L"Health"); - if (healthTag == nullptr) + if (healthTag == NULL) { setHealth(getMaxHealth()); } else if (healthTag->getId() == Tag::TAG_Float) { - setHealth(static_cast(healthTag)->data); + setHealth(((FloatTag *) healthTag)->data); } else if (healthTag->getId() == Tag::TAG_Short) { // pre-1.6 health - setHealth((float) static_cast(healthTag)->data); + setHealth((float) ((ShortTag *) healthTag)->data); } } @@ -512,7 +512,7 @@ void LivingEntity::tickEffects() { if (activeEffects.empty()) { - entityData->set(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); + entityData->set(DATA_EFFECT_AMBIENCE_ID, (byte) 0); entityData->set(DATA_EFFECT_COLOR_ID, 0); setInvisible(false); setWeakened(false); @@ -525,7 +525,7 @@ void LivingEntity::tickEffects() values.push_back(it.second); } int colorValue = PotionBrewing::getColorValue(&values); - entityData->set(DATA_EFFECT_AMBIENCE_ID, PotionBrewing::areAllEffectsAmbient(&values) ? static_cast(1) : static_cast(0)); + entityData->set(DATA_EFFECT_AMBIENCE_ID, PotionBrewing::areAllEffectsAmbient(&values) ? (byte) 1 : (byte) 0); values.clear(); entityData->set(DATA_EFFECT_COLOR_ID, colorValue); setInvisible(hasEffect(MobEffect::invisibility->id)); @@ -558,9 +558,9 @@ void LivingEntity::tickEffects() // int colorValue = entityData.getInteger(DATA_EFFECT_COLOR_ID); if (colorValue > 0) { - double red = static_cast((colorValue >> 16) & 0xff) / 255.0; - double green = static_cast((colorValue >> 8) & 0xff) / 255.0; - double blue = static_cast((colorValue >> 0) & 0xff) / 255.0; + double red = (double) ((colorValue >> 16) & 0xff) / 255.0; + double green = (double) ((colorValue >> 8) & 0xff) / 255.0; + double blue = (double) ((colorValue >> 0) & 0xff) / 255.0; level->addParticle(ambient? eParticleType_mobSpellAmbient : eParticleType_mobSpell, x + (random->nextDouble() - 0.5) * bbWidth, y + random->nextDouble() * bbHeight - heightOffset, z + (random->nextDouble() - 0.5) * bbWidth, red, green, blue); } @@ -611,7 +611,7 @@ bool LivingEntity::hasEffect(MobEffect *effect) MobEffectInstance *LivingEntity::getEffect(MobEffect *effect) { - MobEffectInstance *effectInst = nullptr; + MobEffectInstance *effectInst = NULL; auto it = activeEffects.find(effect->id); if(it != activeEffects.end() ) effectInst = it->second; @@ -685,7 +685,7 @@ void LivingEntity::removeEffectNoUpdate(int effectId) if (it != activeEffects.end()) { MobEffectInstance *effect = it->second; - if(effect != nullptr) + if(effect != NULL) { delete effect; } @@ -699,7 +699,7 @@ void LivingEntity::removeEffect(int effectId) if (it != activeEffects.end()) { MobEffectInstance *effect = it->second; - if(effect != nullptr) + if(effect != NULL) { onEffectRemoved(effect); delete effect; @@ -757,8 +757,8 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) // Fix for #8823 - Gameplay: Confirmation that a monster or animal has taken damage from an attack is highly delayed // 4J Stu - Change to the fix to only show damage when attacked, rather than collision damage // Fix for #10299 - When in corners, passive mobs may show that they are taking damage. - // 4J Stu - Change to the fix for TU6, as source is never nullptr due to changes in 1.8.2 to what source actually is - if (level->isClientSide && dynamic_cast(source) == nullptr) return false; + // 4J Stu - Change to the fix for TU6, as source is never NULL due to changes in 1.8.2 to what source actually is + if (level->isClientSide && dynamic_cast(source) == NULL) return false; noActionTime = 0; if (getHealth() <= 0) return false; @@ -773,9 +773,9 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) return false; } - if ((source == DamageSource::anvil || source == DamageSource::fallingBlock) && getCarried(SLOT_HELM) != nullptr) + if ((source == DamageSource::anvil || source == DamageSource::fallingBlock) && getCarried(SLOT_HELM) != NULL) { - getCarried(SLOT_HELM)->hurtAndBreak(static_cast(dmg * 4 + random->nextFloat() * dmg * 2.0f), dynamic_pointer_cast( shared_from_this() )); + getCarried(SLOT_HELM)->hurtAndBreak((int) (dmg * 4 + random->nextFloat() * dmg * 2.0f), dynamic_pointer_cast( shared_from_this() )); dmg *= 0.75f; } @@ -801,7 +801,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) hurtDir = 0; shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr) + if (sourceEntity != NULL) { if ( sourceEntity->instanceof(eTYPE_LIVINGENTITY) ) { @@ -833,7 +833,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) { level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT); if (source != DamageSource::drown) markHurt(); - if (sourceEntity != nullptr) + if (sourceEntity != NULL) { double xd = sourceEntity->x - x; double zd = sourceEntity->z - z; @@ -842,12 +842,12 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) xd = (Math::random() - Math::random()) * 0.01; zd = (Math::random() - Math::random()) * 0.01; } - hurtDir = static_cast(atan2(zd, xd) * 180 / PI) - yRot; + hurtDir = (float) (atan2(zd, xd) * 180 / PI) - yRot; knockback(sourceEntity, dmg, xd, zd); } else { - hurtDir = static_cast((int)((Math::random() * 2) * 180)); // 4J This cast is the same as Java + hurtDir = (float) (int) ((Math::random() * 2) * 180); // 4J This cast is the same as Java } } @@ -888,9 +888,9 @@ void LivingEntity::die(DamageSource *source) { shared_ptr sourceEntity = source->getEntity(); shared_ptr killer = getKillCredit(); - if (deathScore >= 0 && killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore); + if (deathScore >= 0 && killer != NULL) killer->awardKillScore(shared_from_this(), deathScore); - if (sourceEntity != nullptr) sourceEntity->killed( dynamic_pointer_cast( shared_from_this() ) ); + if (sourceEntity != NULL) sourceEntity->killed( dynamic_pointer_cast( shared_from_this() ) ); dead = true; @@ -899,7 +899,7 @@ void LivingEntity::die(DamageSource *source) int playerBonus = 0; shared_ptr player = nullptr; - if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_PLAYER) ) + if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_PLAYER) ) { player = dynamic_pointer_cast(sourceEntity); playerBonus = EnchantmentHelper::getKillingLootBonus(dynamic_pointer_cast(player)); @@ -920,7 +920,7 @@ void LivingEntity::die(DamageSource *source) } // 4J-JEV, hook for Durango mobKill event. - if (player != nullptr) + if (player != NULL) { player->awardStat(GenericStats::killMob(),GenericStats::param_mobKill(player, dynamic_pointer_cast(shared_from_this()), source)); } @@ -1005,9 +1005,9 @@ void LivingEntity::causeFallDamage(float distance) { Entity::causeFallDamage(distance); MobEffectInstance *jumpBoost = getEffect(MobEffect::jump); - float padding = jumpBoost != nullptr ? jumpBoost->getAmplifier() + 1 : 0; + float padding = jumpBoost != NULL ? jumpBoost->getAmplifier() + 1 : 0; - int dmg = static_cast(ceil(distance - 3 - padding)); + int dmg = (int) ceil(distance - 3 - padding); if (dmg > 0) { // 4J - new sounds here brought forward from 1.2.3 @@ -1050,9 +1050,9 @@ int LivingEntity::getArmorValue() for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != nullptr && dynamic_cast(item->getItem()) != nullptr) + if (item != NULL && dynamic_cast(item->getItem()) != NULL) { - int baseProtection = static_cast(item->getItem())->defense; + int baseProtection = ((ArmorItem *) item->getItem())->defense; val += baseProtection; } } @@ -1131,15 +1131,15 @@ CombatTracker *LivingEntity::getCombatTracker() shared_ptr LivingEntity::getKillCredit() { - if (combatTracker->getKiller() != nullptr) return combatTracker->getKiller(); - if (lastHurtByPlayer != nullptr) return lastHurtByPlayer; - if (lastHurtByMob != nullptr) return lastHurtByMob; + if (combatTracker->getKiller() != NULL) return combatTracker->getKiller(); + if (lastHurtByPlayer != NULL) return lastHurtByPlayer; + if (lastHurtByMob != NULL) return lastHurtByMob; return nullptr; } float LivingEntity::getMaxHealth() { - return static_cast(getAttribute(SharedMonsterAttributes::MAX_HEALTH)->getValue()); + return (float) getAttribute(SharedMonsterAttributes::MAX_HEALTH)->getValue(); } int LivingEntity::getArrowCount() @@ -1149,7 +1149,7 @@ int LivingEntity::getArrowCount() void LivingEntity::setArrowCount(int count) { - entityData->set(DATA_ARROW_COUNT_ID, static_cast(count)); + entityData->set(DATA_ARROW_COUNT_ID, (byte) count); } int LivingEntity::getCurrentSwingDuration() @@ -1172,9 +1172,9 @@ void LivingEntity::swing() swingTime = -1; swinging = true; - if (dynamic_cast(level) != nullptr) + if (dynamic_cast(level) != NULL) { - static_cast(level)->getTracker()->broadcast(shared_from_this(), std::make_shared(shared_from_this(), AnimatePacket::SWING)); + ((ServerLevel *) level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING))); } } } @@ -1240,7 +1240,7 @@ void LivingEntity::updateSwingTime() swingTime = 0; } - attackAnim = swingTime / static_cast(currentSwingDuration); + attackAnim = swingTime / (float) currentSwingDuration; } AttributeInstance *LivingEntity::getAttribute(Attribute *attribute) @@ -1250,7 +1250,7 @@ AttributeInstance *LivingEntity::getAttribute(Attribute *attribute) BaseAttributeMap *LivingEntity::getAttributes() { - if (attributes == nullptr) + if (attributes == NULL) { attributes = new ServersideAttributeMap(); } @@ -1268,7 +1268,7 @@ void LivingEntity::setSprinting(bool value) Entity::setSprinting(value); AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); - if (speed->getModifier(eModifierId_MOB_SPRINTING) != nullptr) + if (speed->getModifier(eModifierId_MOB_SPRINTING) != NULL) { speed->removeModifier(eModifierId_MOB_SPRINTING); } @@ -1378,7 +1378,7 @@ void LivingEntity::travel(float xa, float ya) { #ifdef __PSVITA__ // AP - dynamic_pointer_cast is a non-trivial call - Player *thisPlayer = nullptr; + Player *thisPlayer = NULL; if( this->instanceof(eTYPE_PLAYER) ) { thisPlayer = (Player*) this; @@ -1474,7 +1474,7 @@ void LivingEntity::travel(float xa, float ya) yd = 0.2; } - if (!level->isClientSide || (level->hasChunkAt(static_cast(x), 0, static_cast(z)) && level->getChunkAt(static_cast(x), static_cast(z))->loaded)) + if (!level->isClientSide || (level->hasChunkAt((int) x, 0, (int) z) && level->getChunkAt((int) x, (int) z)->loaded)) { yd -= 0.08; } @@ -1517,12 +1517,12 @@ int LivingEntity::getLightColor(float a) for( int yt = ymin; yt <= ymax; yt++ ) for( int zt = zmin; zt <= zmax; zt++ ) { - float tilexmin = static_cast(xt); - float tilexmax = static_cast(xt + 1); - float tileymin = static_cast(yt); - float tileymax = static_cast(yt + 1); - float tilezmin = static_cast(zt); - float tilezmax = static_cast(zt + 1); + float tilexmin = (float)xt; + float tilexmax = (float)(xt+1); + float tileymin = (float)yt; + float tileymax = (float)(yt+1); + float tilezmin = (float)zt; + float tilezmax = (float)(zt+1); if( tilexmin < bb->x0 ) tilexmin = bb->x0; if( tilexmax > bb->x1 ) tilexmax = bb->x1; if( tileymin < bb->y0 ) tileymin = bb->y0; @@ -1532,14 +1532,14 @@ int LivingEntity::getLightColor(float a) float tileVol = ( tilexmax - tilexmin ) * ( tileymax - tileymin ) * ( tilezmax - tilezmin ); float frac = tileVol / totVol; int lc = level->getLightColor(xt, yt, zt, 0); - accum[0] += frac * static_cast(lc & 0xffff); - accum[1] += frac * static_cast(lc >> 16); + accum[0] += frac * (float)( lc & 0xffff ); + accum[1] += frac * (float)( lc >> 16 ); } if( accum[0] > 240.0f ) accum[0] = 240.0f; if( accum[1] > 240.0f ) accum[1] = 240.0f; - return ( static_cast(accum[1])<<16) | static_cast(accum[0]); + return ( ( (int)accum[1])<<16) | ((int)accum[0]); } bool LivingEntity::useNewAi() @@ -1602,10 +1602,10 @@ void LivingEntity::tick() if (!ItemInstance::matches(current, previous)) { - static_cast(level)->getTracker()->broadcast(shared_from_this(), std::make_shared(entityId, i, current)); - if (previous != nullptr) attributes->removeItemModifiers(previous); - if (current != nullptr) attributes->addItemModifiers(current); - lastEquipment[i] = current == nullptr ? nullptr : current->copy(); + ((ServerLevel *) level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEquippedItemPacket(entityId, i, current))); + if (previous != NULL) attributes->removeItemModifiers(previous); + if (current != NULL) attributes->addItemModifiers(current); + lastEquipment[i] = current == NULL ? nullptr : current->copy(); } } } @@ -1626,7 +1626,7 @@ void LivingEntity::tick() { tRun = 1; walkSpeed = sqrt(sideDist) * 3; - yBodyRotT = (static_cast(atan2(zd, xd)) * 180 / (float) PI - 90); + yBodyRotT = ((float) atan2(zd, xd) * 180 / (float) PI - 90); } if (attackAnim > 0) { @@ -1698,8 +1698,8 @@ void LivingEntity::aiStep() double yrd = Mth::wrapDegrees(lyr - yRot); double xrd = Mth::wrapDegrees(lxr - xRot); - yRot += static_cast((yrd) / lSteps); - xRot += static_cast((xrd) / lSteps); + yRot += (float) ( (yrd) / lSteps ); + xRot += (float) ( (xrd) / lSteps ); lSteps--; setPos(xt, yt, zt); @@ -1804,7 +1804,7 @@ void LivingEntity::pushEntities() { vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); - if (entities != nullptr && !entities->empty()) + if (entities != NULL && !entities->empty()) { for (auto& e : *entities) { @@ -1857,18 +1857,18 @@ void LivingEntity::take(shared_ptr e, int orgCount) { if (!e->removed && !level->isClientSide) { - EntityTracker *entityTracker = static_cast(level)->getTracker(); + EntityTracker *entityTracker = ((ServerLevel *) level)->getTracker(); if ( e->instanceof(eTYPE_ITEMENTITY) ) { - entityTracker->broadcast(e, std::make_shared(e->entityId, entityId)); + entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); } else if ( e->instanceof(eTYPE_ARROW) ) { - entityTracker->broadcast(e, std::make_shared(e->entityId, entityId)); + entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); } else if ( e->instanceof(eTYPE_EXPERIENCEORB) ) { - entityTracker->broadcast(e, std::make_shared(e->entityId, entityId)); + entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); } } } @@ -1876,7 +1876,7 @@ void LivingEntity::take(shared_ptr e, int orgCount) bool LivingEntity::canSee(shared_ptr target) { HitResult *hres = level->clip(Vec3::newTemp(x, y + getHeadHeight(), z), Vec3::newTemp(target->x, target->y + target->getHeadHeight(), target->z)); - bool retVal = (hres == nullptr); + bool retVal = (hres == NULL); delete hres; return retVal; } @@ -1984,7 +1984,7 @@ void LivingEntity::setAbsorptionAmount(float absorptionAmount) Team *LivingEntity::getTeam() { - return nullptr; + return NULL; } bool LivingEntity::isAlliedTo(shared_ptr other) @@ -1994,7 +1994,7 @@ bool LivingEntity::isAlliedTo(shared_ptr other) bool LivingEntity::isAlliedTo(Team *other) { - if (getTeam() != nullptr) + if (getTeam() != NULL) { return getTeam()->isAlliedTo(other); } diff --git a/Minecraft.World/LivingEntity.h b/Minecraft.World/LivingEntity.h index ecc819df..5869eeb2 100644 --- a/Minecraft.World/LivingEntity.h +++ b/Minecraft.World/LivingEntity.h @@ -26,7 +26,7 @@ protected: public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts eINSTANCEOF GetType() { return eTYPE_LIVINGENTITY;} - static Entity *create(Level *level) { return nullptr; } + static Entity *create(Level *level) { return NULL; } private: static AttributeModifier *SPEED_MODIFIER_SPRINTING; diff --git a/Minecraft.World/LoginPacket.cpp b/Minecraft.World/LoginPacket.cpp index 79cdfbae..44ed62b3 100644 --- a/Minecraft.World/LoginPacket.cpp +++ b/Minecraft.World/LoginPacket.cpp @@ -30,7 +30,7 @@ LoginPacket::LoginPacket() m_playerCapeId = 0; m_isGuest = false; m_newSeaLevel = false; - m_pLevelType = nullptr; + m_pLevelType = NULL; m_uiGamePrivileges = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -59,7 +59,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o m_playerCapeId = capeId; m_isGuest = isGuest; m_newSeaLevel = false; - m_pLevelType = nullptr; + m_pLevelType = NULL; m_uiGamePrivileges = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -100,7 +100,7 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException userName = readUtf(dis, Player::MAX_NAME_LENGTH); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == nullptr) + if (m_pLevelType == NULL) { m_pLevelType = LevelType::lvl_normal; } @@ -135,7 +135,7 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(clientVersion); writeUtf(userName, dos); - if (m_pLevelType == nullptr) + if (m_pLevelType == NULL) { writeUtf(L"", dos); } @@ -174,10 +174,10 @@ void LoginPacket::handle(PacketListener *listener) int LoginPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != nullptr) + if (m_pLevelType != NULL) { - length = static_cast(m_pLevelType->getGeneratorName().length()); + length = (int)m_pLevelType->getGeneratorName().length(); } - return static_cast(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2 * sizeof(PlayerUID)) + 1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); + return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); } diff --git a/Minecraft.World/LoginPacket.h b/Minecraft.World/LoginPacket.h index 02a62b60..bf7164fa 100644 --- a/Minecraft.World/LoginPacket.h +++ b/Minecraft.World/LoginPacket.h @@ -40,6 +40,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new LoginPacket()); } virtual int getId() { return 1; } }; diff --git a/Minecraft.World/LongTag.h b/Minecraft.World/LongTag.h index 36ed4de9..6a016715 100644 --- a/Minecraft.World/LongTag.h +++ b/Minecraft.World/LongTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - LongTag *o = static_cast(obj); + LongTag *o = (LongTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/LookAtPlayerGoal.cpp b/Minecraft.World/LookAtPlayerGoal.cpp index a2e4786a..dcf1ea4f 100644 --- a/Minecraft.World/LookAtPlayerGoal.cpp +++ b/Minecraft.World/LookAtPlayerGoal.cpp @@ -29,7 +29,7 @@ bool LookAtPlayerGoal::canUse() { if (mob->getRandom()->nextFloat() >= probability) return false; - if (mob->getTarget() != nullptr) + if (mob->getTarget() != NULL) { lookAt = mob->getTarget(); } @@ -41,12 +41,12 @@ bool LookAtPlayerGoal::canUse() { lookAt = weak_ptr(mob->level->getClosestEntityOfClass(lookAtType, mob->bb->grow(lookDistance, 3, lookDistance), mob->shared_from_this())); } - return lookAt.lock() != nullptr; + return lookAt.lock() != NULL; } bool LookAtPlayerGoal::canContinueToUse() { - if (lookAt.lock() == nullptr || !lookAt.lock()->isAlive()) return false; + if (lookAt.lock() == NULL || !lookAt.lock()->isAlive()) return false; if (mob->distanceToSqr(lookAt.lock()) > lookDistance * lookDistance) return false; return lookTime > 0; } diff --git a/Minecraft.World/LookAtTradingPlayerGoal.cpp b/Minecraft.World/LookAtTradingPlayerGoal.cpp index 9b50f0e7..db1e25a2 100644 --- a/Minecraft.World/LookAtTradingPlayerGoal.cpp +++ b/Minecraft.World/LookAtTradingPlayerGoal.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.entity.npc.h" #include "LookAtTradingPlayerGoal.h" -LookAtTradingPlayerGoal::LookAtTradingPlayerGoal(Villager *villager) : LookAtPlayerGoal(static_cast(villager), typeid(Player), 8) +LookAtTradingPlayerGoal::LookAtTradingPlayerGoal(Villager *villager) : LookAtPlayerGoal((Mob *)villager, typeid(Player), 8) { this->villager = villager; } diff --git a/Minecraft.World/LookControl.cpp b/Minecraft.World/LookControl.cpp index 8eff9bca..1e0d5258 100644 --- a/Minecraft.World/LookControl.cpp +++ b/Minecraft.World/LookControl.cpp @@ -47,8 +47,8 @@ void LookControl::tick() double zd = wantedZ - mob->z; double sd = sqrt(xd * xd + zd * zd); - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; - float xRotD = static_cast(-(atan2(yd, sd) * 180 / PI)); + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; + float xRotD = (float) -(atan2(yd, sd) * 180 / PI); mob->xRot = rotlerp(mob->xRot, xRotD, xMax); mob->yHeadRot = rotlerp(mob->yHeadRot, yRotD, yMax); } diff --git a/Minecraft.World/MakeLoveGoal.cpp b/Minecraft.World/MakeLoveGoal.cpp index c308e33c..c399d632 100644 --- a/Minecraft.World/MakeLoveGoal.cpp +++ b/Minecraft.World/MakeLoveGoal.cpp @@ -26,11 +26,11 @@ bool MakeLoveGoal::canUse() if (villager->getRandom()->nextInt(500) != 0) return false; village = level->villages->getClosestVillage(Mth::floor(villager->x), Mth::floor(villager->y), Mth::floor(villager->z), 0); - if (village.lock() == nullptr) return false; + if (village.lock() == NULL) return false; if (!villageNeedsMoreVillagers()) return false; shared_ptr mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this()); - if (mate == nullptr) return false; + if (mate == NULL) return false; partner = weak_ptr(dynamic_pointer_cast(mate)); if (partner.lock()->getAge() != 0) return false; @@ -53,7 +53,7 @@ void MakeLoveGoal::stop() bool MakeLoveGoal::canContinueToUse() { - return partner.lock() != nullptr && loveMakingTime >= 0 && villageNeedsMoreVillagers() && villager->getAge() == 0; + return partner.lock() != NULL && loveMakingTime >= 0 && villageNeedsMoreVillagers() && villager->getAge() == 0; } void MakeLoveGoal::tick() @@ -76,14 +76,14 @@ void MakeLoveGoal::tick() bool MakeLoveGoal::villageNeedsMoreVillagers() { shared_ptr _village = village.lock(); - if( _village == nullptr ) return false; + if( _village == NULL ) return false; if (!_village->isBreedTimerOk()) { return false; } - int idealSize = static_cast((float)_village->getDoorCount() * 0.35); + int idealSize = (int) ((float) _village->getDoorCount() * 0.35); // System.out.println("idealSize: " + idealSize + " pop: " + // village.getPopulationSize()); return _village->getPopulationSize() < idealSize; diff --git a/Minecraft.World/MapItem.cpp b/Minecraft.World/MapItem.cpp index 61c203e3..03529c1a 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -24,7 +24,7 @@ shared_ptr MapItem::getSavedData(short idNum, Level *level) std::wstring id = wstring( L"map_" ) + std::to_wstring(idNum); shared_ptr mapItemSavedData = dynamic_pointer_cast(level->getSavedData(typeid(MapItemSavedData), id)); - if (mapItemSavedData == nullptr) + if (mapItemSavedData == NULL) { // 4J Stu - This call comes from ClientConnection, but i don't see why we should be trying to work out // the id again when it's passed as a param. In any case that won't work with the new map setup @@ -32,7 +32,7 @@ shared_ptr MapItem::getSavedData(short idNum, Level *level) int aux = idNum; id = wstring( L"map_" ) + std::to_wstring(aux); - mapItemSavedData = std::make_shared(id); + mapItemSavedData = shared_ptr( new MapItemSavedData(id) ); level->setSavedData(id, (shared_ptr ) mapItemSavedData); } @@ -48,14 +48,14 @@ shared_ptr MapItem::getSavedData(shared_ptr item shared_ptr mapItemSavedData = dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id ) ); bool newData = false; - if (mapItemSavedData == nullptr) + if (mapItemSavedData == NULL) { // 4J Stu - I don't see why we should be trying to work out the id again when it's passed as a param. // In any case that won't work with the new map setup //itemInstance->setAuxValue(level->getFreeAuxValueFor(L"map")); id = wstring( L"map_" ) + std::to_wstring(itemInstance->getAuxValue() ); - mapItemSavedData = std::make_shared(id); + mapItemSavedData = shared_ptr( new MapItemSavedData(id) ); newData = true; } @@ -71,10 +71,10 @@ shared_ptr MapItem::getSavedData(shared_ptr item { #ifdef _LARGE_WORLDS int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapItemSavedData->scale); - mapItemSavedData->x = Math::round(static_cast(level->getLevelData()->getXSpawn()) / scale) * scale; + mapItemSavedData->x = Math::round((float) level->getLevelData()->getXSpawn() / scale) * scale; mapItemSavedData->z = Math::round(level->getLevelData()->getZSpawn() / scale) * scale; #endif - mapItemSavedData->dimension = static_cast(level->dimension->id); + mapItemSavedData->dimension = (byte) level->dimension->id; mapItemSavedData->setDirty(); @@ -190,7 +190,7 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptr 0 && below != 0 && Tile::tiles[below]->material->isLiquid()); } } - hh += yy / static_cast(scale * scale); + hh += yy / (double) (scale * scale); count[t]++; } @@ -237,7 +237,7 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptrcolors[x + z * w]; - byte newColor = static_cast(col * 4 + br); + byte newColor = (byte) (col * 4 + br); if (oldColor != newColor) { if (yd0 > z) yd0 = z; @@ -295,9 +295,9 @@ shared_ptr MapItem::getUpdatePacket(shared_ptr itemInstanc { charArray data = MapItem::getSavedData(itemInstance, level)->getUpdatePacket(itemInstance, level, player); - if (data.data == nullptr || data.length == 0) return nullptr; + if (data.data == NULL || data.length == 0) return nullptr; - shared_ptr retval = std::make_shared(static_cast(Item::map->id), static_cast(itemInstance->getAuxValue()), data); + shared_ptr retval = shared_ptr(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data)); delete data.data; return retval; } @@ -309,8 +309,8 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s int mapScale = 3; #ifdef _LARGE_WORLDS int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale); - int centreXC = static_cast(Math::round(player->x / scale) * scale); - int centreZC = static_cast(Math::round(player->z / scale) * scale); + int centreXC = (int) (Math::round(player->x / scale) * scale); + int centreZC = (int) (Math::round(player->z / scale) * scale); #else // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map int centreXC = 0; @@ -325,9 +325,9 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s shared_ptr data = getSavedData(itemInstance->getAuxValue(), level); // 4J Stu - We only have one map per player per dimension, so don't reset the one that they have // when a new one is created - if( data == nullptr ) + if( data == NULL ) { - data = std::make_shared(id); + data = shared_ptr( new MapItemSavedData(id) ); } level->setSavedData(id, (shared_ptr ) data); @@ -335,7 +335,7 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map data->x = centreXC; data->z = centreZC; - data->dimension = static_cast(level->dimension->id); + data->dimension = (byte) level->dimension->id; data->setDirty(); } diff --git a/Minecraft.World/MapItemSavedData.cpp b/Minecraft.World/MapItemSavedData.cpp index 0a5eb7c4..c06c3fac 100644 --- a/Minecraft.World/MapItemSavedData.cpp +++ b/Minecraft.World/MapItemSavedData.cpp @@ -65,8 +65,8 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr(parent->decorations.size()); - unsigned int nonPlayerDecorationsSize = static_cast(parent->nonPlayerDecorations.size()); + unsigned int playerDecorationsSize = (int)parent->decorations.size(); + unsigned int nonPlayerDecorationsSize = (int)parent->nonPlayerDecorations.size(); charArray data = charArray( (playerDecorationsSize + nonPlayerDecorationsSize ) * DEC_PACKET_BYTES + 1); data[0] = 1; for (unsigned int i = 0; i < parent->decorations.size(); i++) @@ -74,7 +74,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrdecorations.at(i); #ifdef _LARGE_WORLDS data[i * DEC_PACKET_BYTES + 1] = (char) (md->img); - data[i * DEC_PACKET_BYTES + 8] = static_cast(md->rot & 0xF); + data[i * DEC_PACKET_BYTES + 8] = (char) (md->rot & 0xF); #else data[i * DEC_PACKET_BYTES + 1] = (char) ((md->img << 4) | (md->rot & 0xF)); #endif @@ -92,7 +92,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrimg); - data[dataIndex * DEC_PACKET_BYTES + 8] = static_cast(md->rot & 0xF); + data[dataIndex * DEC_PACKET_BYTES + 8] = (char) (md->rot & 0xF); #else data[dataIndex * DEC_PACKET_BYTES + 1] = (char) ((md->img << 4) | (md->rot & 0xF)); #endif @@ -107,7 +107,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrisFramed(); - if (lastSentDecorations.data == nullptr || lastSentDecorations.length != data.length) + if (lastSentDecorations.data == NULL || lastSentDecorations.length != data.length) { thesame = false; } @@ -125,7 +125,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr(column); - data[2] = static_cast(min); + data[1] = (char) column; + data[2] = (char) min; for (unsigned int y = 0; y < data.length - 3; y++) { data[y + 3] = parent->colors[(y + min) * MapItem::IMAGE_WIDTH + column]; @@ -199,7 +199,7 @@ void MapItemSavedData::load(CompoundTag *tag) { byteArray newColors = tag->getByteArray(L"colors"); //4J - if(colors.data != nullptr) + if(colors.data != NULL) { delete[] colors.data; } @@ -236,7 +236,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr hp = std::make_shared(player, this); + shared_ptr hp = shared_ptr( new HoldingPlayer(player, this ) ); carriedByPlayers.insert( playerHoldingPlayerMapType::value_type(player, hp) ); carriedBy.push_back(hp); } @@ -303,17 +303,17 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr(xd * 2 + 0.5); - char y = static_cast(yd * 2 + 0.5); + char x = (char) (xd * 2 + 0.5); + char y = (char) (yd * 2 + 0.5); int size = MAP_SIZE - 1; #ifdef _LARGE_WORLDS if (xd < -size || yd < -size || xd > size || yd > size) { - if (xd <= -size) x = static_cast(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = (byte) (size * 2 + 2.5); + if (yd <= -size) y = (byte) (size * 2 + 2.5); + if (xd >= size) x = (byte) (size * 2 + 1); + if (yd >= size) y = (byte) (size * 2 + 1); } #endif //decorations.push_back(new MapDecoration(4, x, y, 0)); @@ -332,25 +332,25 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetFrame()->entityId ) == nonPlayerDecorations.end() ) { - float xd = static_cast(item->getFrame()->xTile - x) / (1 << scale); - float yd = static_cast(item->getFrame()->zTile - z) / (1 << scale); - char x = static_cast(xd * 2 + 0.5); - char y = static_cast(yd * 2 + 0.5); + float xd = (float) ( item->getFrame()->xTile - x ) / (1 << scale); + float yd = (float) ( item->getFrame()->zTile - z ) / (1 << scale); + char x = (char) (xd * 2 + 0.5); + char y = (char) (yd * 2 + 0.5); int size = MAP_SIZE - 1; - char rot = static_cast((item->getFrame()->dir * 90) * 16 / 360); + char rot = (char) ( (item->getFrame()->dir * 90) * 16 / 360); if (dimension < 0) { - int s = static_cast(playerLevel->getLevelData()->getDayTime() / 10); - rot = static_cast((s * s * 34187121 + s * 121) >> 15 & 15); + int s = (int) (playerLevel->getLevelData()->getDayTime() / 10); + rot = (char) ((s * s * 34187121 + s * 121) >> 15 & 15); } #ifdef _LARGE_WORLDS if (xd < -size || yd < -size || xd > size || yd > size) { - if (xd <= -size) x = static_cast(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = (byte) (size * 2 + 2.5); + if (yd <= -size) y = (byte) (size * 2 + 2.5); + if (xd >= size) x = (byte) (size * 2 + 1); + if (yd >= size) y = (byte) (size * 2 + 1); } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); @@ -399,12 +399,12 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetPlayerList(); for(auto& decorationPlayer : players->players) { - if(decorationPlayer!=nullptr && decorationPlayer->dimension == this->dimension) + if(decorationPlayer!=NULL && decorationPlayer->dimension == this->dimension) { - float xd = static_cast(decorationPlayer->x - x) / (1 << scale); - float yd = static_cast(decorationPlayer->z - z) / (1 << scale); - char x = static_cast(xd * 2); - char y = static_cast(yd * 2); + float xd = (float) (decorationPlayer->x - x) / (1 << scale); + float yd = (float) (decorationPlayer->z - z) / (1 << scale); + char x = (char) (xd * 2); + char y = (char) (yd * 2); int size = MAP_SIZE; // - 1; char rot; char imgIndex; @@ -414,16 +414,16 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr(decorationPlayer->yRot * 16 / 360 + 0.5); + rot = (char) (decorationPlayer->yRot * 16 / 360 + 0.5); if (dimension < 0) { - int s = static_cast(playerLevel->getLevelData()->getDayTime() / 10); - rot = static_cast((s * s * 34187121 + s * 121) >> 15 & 15); + int s = (int) (playerLevel->getLevelData()->getDayTime() / 10); + rot = (char) ((s * s * 34187121 + s * 121) >> 15 & 15); } // 4J Stu - As we have added new icons for players on a new row below // other icons used in Java we need to move our index to the next row - imgIndex = static_cast(decorationPlayer->getPlayerIndex()); + imgIndex = (int)decorationPlayer->getPlayerIndex(); if(imgIndex>3) imgIndex += 4; } #ifdef _LARGE_WORLDS @@ -431,16 +431,16 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr(decorationPlayer->getPlayerIndex()); + imgIndex = (int)decorationPlayer->getPlayerIndex(); if(imgIndex>3) imgIndex += 4; imgIndex += 16; // Add 16 to indicate that it's on the next texture rot = 0; size--; // Added to match the old adjusted size - if (xd <= -size) x = static_cast(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = (byte) (size * 2 + 2.5); + if (yd <= -size) y = (byte) (size * 2 + 2.5); + if (xd >= size) x = (byte) (size * 2 + 1); + if (yd >= size) y = (byte) (size * 2 + 1); } #endif @@ -527,7 +527,7 @@ void MapItemSavedData::handleComplexItemData(charArray &data) #endif char x = data[i * DEC_PACKET_BYTES + 2]; char y = data[i * DEC_PACKET_BYTES + 3]; - int entityId = (static_cast(data[i * DEC_PACKET_BYTES + 4])&0xFF) | ( (static_cast(data[i * DEC_PACKET_BYTES + 5])&0xFF)<<8) | ((static_cast(data[i * DEC_PACKET_BYTES + 6])&0xFF)<<16) | ((static_cast(data[i * DEC_PACKET_BYTES + 7])&0x7F)<<24); + int entityId = (((int)data[i * DEC_PACKET_BYTES + 4])&0xFF) | ( (((int)data[i * DEC_PACKET_BYTES + 5])&0xFF)<<8) | ((((int)data[i * DEC_PACKET_BYTES + 6])&0xFF)<<16) | ((((int)data[i * DEC_PACKET_BYTES + 7])&0x7F)<<24); bool visible = (data[i * DEC_PACKET_BYTES + 7] & 0x80) != 0; decorations.push_back(new MapDecoration(img, x, y, rot, entityId, visible)); } @@ -545,7 +545,7 @@ shared_ptr MapItemSavedData::getHoldingPlayer(s if (it == carriedByPlayers.end()) { - hp = std::make_shared(player, this); + hp = shared_ptr( new HoldingPlayer(player, this) ); carriedByPlayers[player] = hp; carriedBy.push_back(hp); } diff --git a/Minecraft.World/Material.cpp b/Minecraft.World/Material.cpp index d17965df..9e201ad5 100644 --- a/Minecraft.World/Material.cpp +++ b/Minecraft.World/Material.cpp @@ -6,39 +6,39 @@ #include "PortalMaterial.h" #include "WebMaterial.h"// 4J added, Java version just does a local alteration when instantiating the Material for webs to get the same thing -Material *Material::air = nullptr; -Material *Material::grass = nullptr; -Material *Material::dirt = nullptr; -Material *Material::wood = nullptr; -Material *Material::stone = nullptr; -Material *Material::metal = nullptr; -Material *Material::heavyMetal = nullptr; -Material *Material::water = nullptr; -Material *Material::lava = nullptr; -Material *Material::leaves = nullptr; -Material *Material::plant = nullptr; -Material *Material::replaceable_plant = nullptr; -Material *Material::sponge = nullptr; -Material *Material::cloth = nullptr; -Material *Material::fire = nullptr; -Material *Material::sand = nullptr; -Material *Material::decoration = nullptr; -Material *Material::clothDecoration = nullptr; -Material *Material::glass = nullptr; -Material *Material::buildable_glass = nullptr; -Material *Material::explosive = nullptr; -Material *Material::coral = nullptr; -Material *Material::ice = nullptr; -Material *Material::topSnow = nullptr; -Material *Material::snow = nullptr; -Material *Material::cactus = nullptr; -Material *Material::clay = nullptr; -Material *Material::vegetable = nullptr; -Material *Material::egg = nullptr; -Material *Material::portal = nullptr; -Material *Material::cake = nullptr; -Material *Material::piston = nullptr; -Material *Material::web = nullptr; +Material *Material::air = NULL; +Material *Material::grass = NULL; +Material *Material::dirt = NULL; +Material *Material::wood = NULL; +Material *Material::stone = NULL; +Material *Material::metal = NULL; +Material *Material::heavyMetal = NULL; +Material *Material::water = NULL; +Material *Material::lava = NULL; +Material *Material::leaves = NULL; +Material *Material::plant = NULL; +Material *Material::replaceable_plant = NULL; +Material *Material::sponge = NULL; +Material *Material::cloth = NULL; +Material *Material::fire = NULL; +Material *Material::sand = NULL; +Material *Material::decoration = NULL; +Material *Material::clothDecoration = NULL; +Material *Material::glass = NULL; +Material *Material::buildable_glass = NULL; +Material *Material::explosive = NULL; +Material *Material::coral = NULL; +Material *Material::ice = NULL; +Material *Material::topSnow = NULL; +Material *Material::snow = NULL; +Material *Material::cactus = NULL; +Material *Material::clay = NULL; +Material *Material::vegetable = NULL; +Material *Material::egg = NULL; +Material *Material::portal = NULL; +Material *Material::cake = NULL; +Material *Material::piston = NULL; +Material *Material::web = NULL; void Material::staticCtor() { diff --git a/Minecraft.World/MaterialColor.cpp b/Minecraft.World/MaterialColor.cpp index 5c4fa9d7..d14748b2 100644 --- a/Minecraft.World/MaterialColor.cpp +++ b/Minecraft.World/MaterialColor.cpp @@ -3,20 +3,20 @@ MaterialColor **MaterialColor::colors; -MaterialColor *MaterialColor::none = nullptr; -MaterialColor *MaterialColor::grass = nullptr; -MaterialColor *MaterialColor::sand = nullptr; -MaterialColor *MaterialColor::cloth = nullptr; -MaterialColor *MaterialColor::fire = nullptr; -MaterialColor *MaterialColor::ice = nullptr; -MaterialColor *MaterialColor::metal = nullptr; -MaterialColor *MaterialColor::plant = nullptr; -MaterialColor *MaterialColor::snow = nullptr; -MaterialColor *MaterialColor::clay = nullptr; -MaterialColor *MaterialColor::dirt = nullptr; -MaterialColor *MaterialColor::stone = nullptr; -MaterialColor *MaterialColor::water = nullptr; -MaterialColor *MaterialColor::wood = nullptr; +MaterialColor *MaterialColor::none = NULL; +MaterialColor *MaterialColor::grass = NULL; +MaterialColor *MaterialColor::sand = NULL; +MaterialColor *MaterialColor::cloth = NULL; +MaterialColor *MaterialColor::fire = NULL; +MaterialColor *MaterialColor::ice = NULL; +MaterialColor *MaterialColor::metal = NULL; +MaterialColor *MaterialColor::plant = NULL; +MaterialColor *MaterialColor::snow = NULL; +MaterialColor *MaterialColor::clay = NULL; +MaterialColor *MaterialColor::dirt = NULL; +MaterialColor *MaterialColor::stone = NULL; +MaterialColor *MaterialColor::water = NULL; +MaterialColor *MaterialColor::wood = NULL; void MaterialColor::staticCtor() { diff --git a/Minecraft.World/McRegionChunkStorage.cpp b/Minecraft.World/McRegionChunkStorage.cpp index ad07a66e..87dabf0b 100644 --- a/Minecraft.World/McRegionChunkStorage.cpp +++ b/Minecraft.World/McRegionChunkStorage.cpp @@ -76,7 +76,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) #ifdef SPLIT_SAVES // If we can't find the chunk in the save file, then we should remove any entities we might have for that chunk - if(regionChunkInputStream == nullptr) + if(regionChunkInputStream == NULL) { int64_t index = ((int64_t)(x) << 32) | (((int64_t)(z))&0x00000000FFFFFFFF); @@ -89,11 +89,11 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) } #endif - LevelChunk *levelChunk = nullptr; + LevelChunk *levelChunk = NULL; if(m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - if (regionChunkInputStream != nullptr) + if (regionChunkInputStream != NULL) { MemSect(9); levelChunk = OldChunkStorage::load(level, regionChunkInputStream); @@ -106,14 +106,14 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) else { CompoundTag *chunkData; - if (regionChunkInputStream != nullptr) + if (regionChunkInputStream != NULL) { MemSect(8); chunkData = NbtIo::read((DataInput *)regionChunkInputStream); MemSect(0); } else { - return nullptr; + return NULL; } regionChunkInputStream->deleteChildStream(); @@ -125,7 +125,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; - return nullptr; + return NULL; } if (!chunkData->getCompound(L"Level")->contains(L"Blocks")) { @@ -133,7 +133,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; - return nullptr; + return NULL; } MemSect(9); levelChunk = OldChunkStorage::load(level, chunkData->getCompound(L"Level")); @@ -146,7 +146,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) app.DebugPrintf(buf); delete levelChunk; delete chunkData; - return nullptr; + return NULL; // 4J Stu - We delete the data within OldChunkStorage::load, so we can never reload from it //chunkData->putInt(L"xPos", x); @@ -330,8 +330,8 @@ void McRegionChunkStorage::staticCtor() sprintf(threadName,"McRegion Save thread %d\n",i); SetThreadName(0, threadName); - //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); - s_saveThreads[i] = new C4JThread(runSaveThreadProc,nullptr,threadName); + //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); + s_saveThreads[i] = new C4JThread(runSaveThreadProc,NULL,threadName); //app.DebugPrintf("Created new thread: %s\n",threadName); @@ -359,7 +359,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) bool running = true; size_t lastQueueSize = 0; - DataOutputStream *dos = nullptr; + DataOutputStream *dos = NULL; while(running) { if( TryEnterCriticalSection(&cs_memory) ) @@ -382,7 +382,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) PIXEndNamedEvent(); } delete dos; - dos = nullptr; + dos = NULL; EnterCriticalSection(&cs_memory); s_runningThreadCount--; diff --git a/Minecraft.World/McRegionLevelStorage.cpp b/Minecraft.World/McRegionLevelStorage.cpp index ec472fad..daf6a7ef 100644 --- a/Minecraft.World/McRegionLevelStorage.cpp +++ b/Minecraft.World/McRegionLevelStorage.cpp @@ -24,14 +24,14 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) { //File folder = getFolder(); - if (dynamic_cast(dimension) != nullptr) + if (dynamic_cast(dimension) != NULL) { if(app.GetResetNether()) { #ifdef SPLIT_SAVES vector *netherFiles = m_saveFile->getRegionFilesByDimension(1); - if(netherFiles!=nullptr) + if(netherFiles!=NULL) { DWORD bytesWritten = 0; for(auto& netherFile : *netherFiles) @@ -42,7 +42,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) } #else vector *netherFiles = m_saveFile->getFilesWithPrefix(LevelStorage::NETHER_FOLDER); - if(netherFiles!=nullptr) + if(netherFiles!=NULL) { for(auto& netherFile : *netherFiles) { @@ -74,7 +74,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) vector *endFiles = m_saveFile->getFilesWithPrefix(LevelStorage::ENDER_FOLDER); // 4J-PB - There will be no End in early saves - if(endFiles!=nullptr) + if(endFiles!=NULL) { for(auto& endFile : *endFiles) { diff --git a/Minecraft.World/McRegionLevelStorageSource.cpp b/Minecraft.World/McRegionLevelStorageSource.cpp index bf60ee0c..60904fde 100644 --- a/Minecraft.World/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/McRegionLevelStorageSource.cpp @@ -51,12 +51,12 @@ vector *McRegionLevelStorageSource::getLevelList() wstring levelId = file->getName(); LevelData *levelData = getDataTagFor(levelId); - if (levelData != nullptr) + if (levelData != NULL) { bool requiresConversion = levelData->getVersion() != McRegionLevelStorage::MCREGION_VERSION_ID; wstring levelName = levelData->getLevelName(); - if (levelName.empty()) // 4J Jev TODO: levelName can't be nullptr? if (levelName == nullptr || isEmpty(levelName)) + if (levelName.empty()) // 4J Jev TODO: levelName can't be NULL? if (levelName == NULL || isEmpty(levelName)) { levelName = levelId; } @@ -76,14 +76,14 @@ void McRegionLevelStorageSource::clearAll() shared_ptr McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) { // return new LevelStorageProfilerDecorator(new McRegionLevelStorage(baseDir, levelId, createPlayerDir)); - return std::make_shared(saveFile, baseDir, levelId, createPlayerDir); + return shared_ptr(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir)); } bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId) { // check if there is old file format level data LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData == nullptr || levelData->getVersion() != 0) + if (levelData == NULL || levelData->getVersion() != 0) { delete levelData; return false; @@ -96,7 +96,7 @@ bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const bool McRegionLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId) { LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData == nullptr || levelData->getVersion() != 0) + if (levelData == NULL || levelData->getVersion() != 0) { delete levelData; return false; @@ -275,7 +275,7 @@ void McRegionLevelStorageSource::eraseFolders(vector *folders, int curre folder->_delete(); currentCount++; - int percent = static_cast(Math::round(100.0 * (double)currentCount / (double)totalCount)); + int percent = (int) Math::round(100.0 * (double) currentCount / (double) totalCount); progress->progressStagePercentage(percent); } } diff --git a/Minecraft.World/MegaTreeFeature.cpp b/Minecraft.World/MegaTreeFeature.cpp index db4a336a..09195fb4 100644 --- a/Minecraft.World/MegaTreeFeature.cpp +++ b/Minecraft.World/MegaTreeFeature.cpp @@ -15,7 +15,7 @@ bool MegaTreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::maxBuildHeight) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { PIXBeginNamedEvent(0, "MegaTreeFeature Checking intersects"); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); @@ -69,14 +69,14 @@ bool MegaTreeFeature::place(Level *level, Random *random, int x, int y, int z) while (branchHeight > y + treeHeight / 2) { float angle = random->nextFloat() * PI * 2.0f; - int bx = x + static_cast(0.5f + Mth::cos(angle) * 4.0f); - int bz = z + static_cast(0.5f + Mth::sin(angle) * 4.0f); + int bx = x + (int) (0.5f + Mth::cos(angle) * 4.0f); + int bz = z + (int) (0.5f + Mth::sin(angle) * 4.0f); placeLeaves(level, bx, bz, branchHeight, 0, random); for (int b = 0; b < 5; b++) { - bx = x + static_cast(1.5f + Mth::cos(angle) * b); - bz = z + static_cast(1.5f + Mth::sin(angle) * b); + bx = x + (int) (1.5f + Mth::cos(angle) * b); + bz = z + (int) (1.5f + Mth::sin(angle) * b); placeBlock(level, bx, branchHeight - 3 + b / 2, bz, Tile::treeTrunk_Id, trunkType); } diff --git a/Minecraft.World/MeleeAttackGoal.cpp b/Minecraft.World/MeleeAttackGoal.cpp index 5b7b0179..7003609e 100644 --- a/Minecraft.World/MeleeAttackGoal.cpp +++ b/Minecraft.World/MeleeAttackGoal.cpp @@ -19,7 +19,7 @@ void MeleeAttackGoal::_init(PathfinderMob *mob, double speedModifier, bool track attackTime = 0; - path = nullptr; + path = NULL; timeToRecalcPath = 0; } @@ -36,24 +36,24 @@ MeleeAttackGoal::MeleeAttackGoal(PathfinderMob *mob, double speedModifier, bool MeleeAttackGoal::~MeleeAttackGoal() { - if(path != nullptr) delete path; + if(path != NULL) delete path; } bool MeleeAttackGoal::canUse() { shared_ptr target = mob->getTarget(); - if (target == nullptr) return false; + if (target == NULL) return false; if (!target->isAlive()) return false; - if (attackType != eTYPE_NOTSET && !target->instanceof(attackType)) return false; + if (attackType != NULL && !target->instanceof(attackType)) return false; delete path; path = mob->getNavigation()->createPath(target); - return path != nullptr; + return path != NULL; } bool MeleeAttackGoal::canContinueToUse() { shared_ptr target = mob->getTarget(); - if (target == nullptr) return false; + if (target == NULL) return false; if (!target->isAlive()) return false; if (!trackTarget) return !mob->getNavigation()->isDone(); if (!mob->isWithinRestriction(Mth::floor(target->x), Mth::floor(target->y), Mth::floor(target->z))) return false; @@ -63,7 +63,7 @@ bool MeleeAttackGoal::canContinueToUse() void MeleeAttackGoal::start() { mob->getNavigation()->moveTo(path, speedModifier); - path = nullptr; + path = NULL; timeToRecalcPath = 0; } @@ -91,6 +91,6 @@ void MeleeAttackGoal::tick() if (mob->distanceToSqr(target->x, target->bb->y0, target->z) > meleeRadiusSqr) return; if (attackTime > 0) return; attackTime = 20; - if (mob->getCarriedItem() != nullptr) mob->swing(); + if (mob->getCarriedItem() != NULL) mob->swing(); mob->doHurtTarget(target); } diff --git a/Minecraft.World/MelonTile.cpp b/Minecraft.World/MelonTile.cpp index be7cd98b..298ae61f 100644 --- a/Minecraft.World/MelonTile.cpp +++ b/Minecraft.World/MelonTile.cpp @@ -6,7 +6,7 @@ MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) { - iconTop = nullptr; + iconTop = NULL; } Icon *MelonTile::getTexture(int face, int data) diff --git a/Minecraft.World/MemoryChunkStorage.cpp b/Minecraft.World/MemoryChunkStorage.cpp index 9ce5305d..249efdd9 100644 --- a/Minecraft.World/MemoryChunkStorage.cpp +++ b/Minecraft.World/MemoryChunkStorage.cpp @@ -5,7 +5,7 @@ LevelChunk *MemoryChunkStorage::load(Level *level, int x, int z) //throws IOException { - return nullptr; + return NULL; } void MemoryChunkStorage::save(Level *level, LevelChunk *levelChunk) //throws IOException diff --git a/Minecraft.World/MemoryLevelStorage.cpp b/Minecraft.World/MemoryLevelStorage.cpp index 5c5fe53d..5a1d43bb 100644 --- a/Minecraft.World/MemoryLevelStorage.cpp +++ b/Minecraft.World/MemoryLevelStorage.cpp @@ -14,7 +14,7 @@ MemoryLevelStorage::MemoryLevelStorage() LevelData *MemoryLevelStorage::prepareLevel() { - return nullptr; + return NULL; } void MemoryLevelStorage::checkSession() @@ -54,7 +54,7 @@ bool MemoryLevelStorage::load(shared_ptr player) CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const wstring& playerName) { - return nullptr; + return NULL; } ConsoleSavePath MemoryLevelStorage::getDataFile(const wstring& id) diff --git a/Minecraft.World/MemoryLevelStorageSource.cpp b/Minecraft.World/MemoryLevelStorageSource.cpp index 3028b3b1..db0cfa58 100644 --- a/Minecraft.World/MemoryLevelStorageSource.cpp +++ b/Minecraft.World/MemoryLevelStorageSource.cpp @@ -29,7 +29,7 @@ void MemoryLevelStorageSource::clearAll() LevelData *MemoryLevelStorageSource::getDataTagFor(const wstring& levelId) { - return nullptr; + return NULL; } bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) diff --git a/Minecraft.World/MenuBackup.cpp b/Minecraft.World/MenuBackup.cpp index c811e068..b6d3ba09 100644 --- a/Minecraft.World/MenuBackup.cpp +++ b/Minecraft.World/MenuBackup.cpp @@ -15,7 +15,7 @@ MenuBackup::MenuBackup(shared_ptr inventory, AbstractContainerMenu *m void MenuBackup::save(short changeUid) { - ItemInstanceArray *backup = new ItemInstanceArray( static_cast(menu->slots.size()) + 1 ); + ItemInstanceArray *backup = new ItemInstanceArray( (int)menu->slots.size() + 1 ); (*backup)[0] = ItemInstance::clone(inventory->getCarried()); for (unsigned int i = 0; i < menu->slots.size(); i++) { diff --git a/Minecraft.World/MerchantContainer.cpp b/Minecraft.World/MerchantContainer.cpp index b9c9bb52..7ceb4745 100644 --- a/Minecraft.World/MerchantContainer.cpp +++ b/Minecraft.World/MerchantContainer.cpp @@ -11,7 +11,7 @@ MerchantContainer::MerchantContainer(shared_ptr player, shared_ptr MerchantContainer::getItem(unsigned int slot) shared_ptr MerchantContainer::removeItem(unsigned int slot, int count) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (slot == MerchantMenu::RESULT_SLOT) { @@ -71,7 +71,7 @@ bool MerchantContainer::isPaymentSlot(int slot) shared_ptr MerchantContainer::removeItemNoUpdate(int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -83,7 +83,7 @@ shared_ptr MerchantContainer::removeItemNoUpdate(int slot) void MerchantContainer::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); if (isPaymentSlot(slot)) { updateSellItem(); @@ -135,37 +135,37 @@ void MerchantContainer::setChanged() void MerchantContainer::updateSellItem() { - activeRecipe = nullptr; + activeRecipe = NULL; shared_ptr buyItem1 = items[MerchantMenu::PAYMENT1_SLOT]; shared_ptr buyItem2 = items[MerchantMenu::PAYMENT2_SLOT]; - if (buyItem1 == nullptr) + if (buyItem1 == NULL) { buyItem1 = buyItem2; buyItem2 = nullptr; } - if (buyItem1 == nullptr) + if (buyItem1 == NULL) { setItem(MerchantMenu::RESULT_SLOT, nullptr); } else { MerchantRecipeList *offers = merchant->getOffers(player); - if (offers != nullptr) + if (offers != NULL) { MerchantRecipe *recipeFor = offers->getRecipeFor(buyItem1, buyItem2, selectionHint); - if (recipeFor != nullptr && !recipeFor->isDeprecated()) + if (recipeFor != NULL && !recipeFor->isDeprecated()) { activeRecipe = recipeFor; setItem(MerchantMenu::RESULT_SLOT, recipeFor->getSellItem()->copy()); } - else if (buyItem2 != nullptr) + else if (buyItem2 != NULL) { // try to switch recipeFor = offers->getRecipeFor(buyItem2, buyItem1, selectionHint); - if (recipeFor != nullptr && !recipeFor->isDeprecated()) + if (recipeFor != NULL && !recipeFor->isDeprecated()) { activeRecipe = recipeFor; setItem(MerchantMenu::RESULT_SLOT, recipeFor->getSellItem()->copy()); diff --git a/Minecraft.World/MerchantMenu.cpp b/Minecraft.World/MerchantMenu.cpp index f24d24c9..52ce34f9 100644 --- a/Minecraft.World/MerchantMenu.cpp +++ b/Minecraft.World/MerchantMenu.cpp @@ -10,7 +10,7 @@ MerchantMenu::MerchantMenu(shared_ptr inventory, shared_ptr trader = merchant; this->level = level; - tradeContainer = std::make_shared(dynamic_pointer_cast(inventory->player->shared_from_this()), merchant); + tradeContainer = shared_ptr( new MerchantContainer(dynamic_pointer_cast(inventory->player->shared_from_this()), merchant) ); addSlot(new Slot(tradeContainer, PAYMENT1_SLOT, SELLSLOT1_X, ROW2_Y)); addSlot(new Slot(tradeContainer, PAYMENT2_SLOT, SELLSLOT2_X, ROW2_Y)); addSlot(new MerchantResultSlot(inventory->player, merchant, tradeContainer, RESULT_SLOT, BUYSLOT_X, ROW2_Y)); @@ -67,10 +67,10 @@ bool MerchantMenu::stillValid(shared_ptr player) shared_ptr MerchantMenu::quickMoveStack(shared_ptr player, int slotIndex) { shared_ptr clicked = nullptr; - Slot *slot = nullptr; + Slot *slot = NULL; if(slotIndex < slots.size()) slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -138,7 +138,7 @@ void MerchantMenu::removed(shared_ptr player) player->drop(item); } item = tradeContainer->removeItemNoUpdate(PAYMENT2_SLOT); - if (item != nullptr) + if (item != NULL) { player->drop(item); } diff --git a/Minecraft.World/MerchantRecipe.cpp b/Minecraft.World/MerchantRecipe.cpp index b4eb1b54..b772b0c7 100644 --- a/Minecraft.World/MerchantRecipe.cpp +++ b/Minecraft.World/MerchantRecipe.cpp @@ -34,12 +34,12 @@ MerchantRecipe::MerchantRecipe(shared_ptr buy, shared_ptr buy, Item *sell) { - _init(buy, nullptr, std::make_shared(sell)); + _init(buy, nullptr, shared_ptr(new ItemInstance(sell))); } MerchantRecipe::MerchantRecipe(shared_ptr buy, Tile *sell) { - _init(buy, nullptr, std::make_shared(sell)); + _init(buy, nullptr, shared_ptr(new ItemInstance(sell))); } shared_ptr MerchantRecipe::getBuyAItem() @@ -54,7 +54,7 @@ shared_ptr MerchantRecipe::getBuyBItem() bool MerchantRecipe::hasSecondaryBuyItem() { - return buyB != nullptr; + return buyB != NULL; } shared_ptr MerchantRecipe::getSellItem() @@ -68,13 +68,13 @@ bool MerchantRecipe::isSame(MerchantRecipe *other) { return false; } - return (buyB == nullptr && other->buyB == nullptr) || (buyB != nullptr && other->buyB != nullptr && buyB->id == other->buyB->id); + return (buyB == NULL && other->buyB == NULL) || (buyB != NULL && other->buyB != NULL && buyB->id == other->buyB->id); } bool MerchantRecipe::isSameSameButBetter(MerchantRecipe *other) { // same deal, but cheaper - return isSame(other) && (buyA->count < other->buyA->count || (buyB != nullptr && buyB->count < other->buyB->count)); + return isSame(other) && (buyA->count < other->buyA->count || (buyB != NULL && buyB->count < other->buyB->count)); } int MerchantRecipe::getUses() @@ -136,7 +136,7 @@ CompoundTag *MerchantRecipe::createTag() CompoundTag *tag = new CompoundTag(); tag->putCompound(L"buy", buyA->save(new CompoundTag(L"buy"))); tag->putCompound(L"sell", sell->save(new CompoundTag(L"sell"))); - if (buyB != nullptr) + if (buyB != NULL) { tag->putCompound(L"buyB", buyB->save(new CompoundTag(L"buyB"))); } diff --git a/Minecraft.World/MerchantRecipeList.cpp b/Minecraft.World/MerchantRecipeList.cpp index 4e1684d4..c994081f 100644 --- a/Minecraft.World/MerchantRecipeList.cpp +++ b/Minecraft.World/MerchantRecipeList.cpp @@ -25,31 +25,31 @@ MerchantRecipe *MerchantRecipeList::getRecipeFor(shared_ptr buyA, { // attempt to match vs the hint MerchantRecipe *r = m_recipes.at(selectionHint); - if (buyA->id == r->getBuyAItem()->id && ((buyB == nullptr && !r->hasSecondaryBuyItem()) || (r->hasSecondaryBuyItem() && buyB != nullptr && r->getBuyBItem()->id == buyB->id))) + if (buyA->id == r->getBuyAItem()->id && ((buyB == NULL && !r->hasSecondaryBuyItem()) || (r->hasSecondaryBuyItem() && buyB != NULL && r->getBuyBItem()->id == buyB->id))) { if (buyA->count >= r->getBuyAItem()->count && (!r->hasSecondaryBuyItem() || buyB->count >= r->getBuyBItem()->count)) { return r; } } - return nullptr; + return NULL; } - for (size_t i = 0; i < m_recipes.size(); i++) + for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); if (buyA->id == r->getBuyAItem()->id && buyA->count >= r->getBuyAItem()->count - && ((!r->hasSecondaryBuyItem() && buyB == nullptr) || (r->hasSecondaryBuyItem() && buyB != nullptr && r->getBuyBItem()->id == buyB->id && buyB->count >= r->getBuyBItem()->count))) + && ((!r->hasSecondaryBuyItem() && buyB == NULL) || (r->hasSecondaryBuyItem() && buyB != NULL && r->getBuyBItem()->id == buyB->id && buyB->count >= r->getBuyBItem()->count))) { return r; } } - return nullptr; + return NULL; } bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe) { bool added = false; - for (size_t i = 0; i < m_recipes.size(); i++) + for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); if (recipe->isSame(r)) @@ -69,32 +69,32 @@ bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe) MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr buy, shared_ptr buyB, shared_ptr sell) { - for (size_t i = 0; i < m_recipes.size(); i++) + for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); if (buy->id == r->getBuyAItem()->id && buy->count >= r->getBuyAItem()->count && sell->id == r->getSellItem()->id) { - if (!r->hasSecondaryBuyItem() || (buyB != nullptr && buyB->id == r->getBuyBItem()->id && buyB->count >= r->getBuyBItem()->count)) + if (!r->hasSecondaryBuyItem() || (buyB != NULL && buyB->id == r->getBuyBItem()->id && buyB->count >= r->getBuyBItem()->count)) { return r; } } } - return nullptr; + return NULL; } void MerchantRecipeList::writeToStream(DataOutputStream *stream) { - stream->writeByte(static_cast(m_recipes.size() & 0xff)); - for (size_t i = 0; i < m_recipes.size(); i++) + stream->writeByte((byte) (m_recipes.size() & 0xff)); + for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); Packet::writeItem(r->getBuyAItem(), stream); Packet::writeItem(r->getSellItem(), stream); shared_ptr buyBItem = r->getBuyBItem(); - stream->writeBoolean(buyBItem != nullptr); - if (buyBItem != nullptr) + stream->writeBoolean(buyBItem != NULL); + if (buyBItem != NULL) { Packet::writeItem(buyBItem, stream); } @@ -149,7 +149,7 @@ CompoundTag *MerchantRecipeList::createTag() CompoundTag *tag = new CompoundTag(); ListTag *list = new ListTag(L"Recipes"); - for (size_t i = 0; i < m_recipes.size(); i++) + for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *merchantRecipe = m_recipes.at(i); list->add(merchantRecipe->createTag()); diff --git a/Minecraft.World/MerchantResultSlot.cpp b/Minecraft.World/MerchantResultSlot.cpp index 7a09d069..fedbcc4a 100644 --- a/Minecraft.World/MerchantResultSlot.cpp +++ b/Minecraft.World/MerchantResultSlot.cpp @@ -42,7 +42,7 @@ void MerchantResultSlot::onTake(shared_ptr player, shared_ptrgetActiveRecipe(); - if (activeRecipe != nullptr) + if (activeRecipe != NULL) { shared_ptr item1 = slots->getItem(MerchantMenu::PAYMENT1_SLOT); shared_ptr item2 = slots->getItem(MerchantMenu::PAYMENT2_SLOT); @@ -76,15 +76,15 @@ bool MerchantResultSlot::removePaymentItemsIfMatching(MerchantRecipe *activeReci shared_ptr buyA = activeRecipe->getBuyAItem(); shared_ptr buyB = activeRecipe->getBuyBItem(); - if (a != nullptr && a->id == buyA->id) + if (a != NULL && a->id == buyA->id) { - if (buyB != nullptr && b != nullptr && buyB->id == b->id) + if (buyB != NULL && b != NULL && buyB->id == b->id) { a->count -= buyA->count; b->count -= buyB->count; return true; } - else if (buyB == nullptr && b == nullptr) + else if (buyB == NULL && b == NULL) { a->count -= buyA->count; return true; diff --git a/Minecraft.World/MilkBucketItem.cpp b/Minecraft.World/MilkBucketItem.cpp index 8c8ea674..4a371078 100644 --- a/Minecraft.World/MilkBucketItem.cpp +++ b/Minecraft.World/MilkBucketItem.cpp @@ -19,7 +19,7 @@ shared_ptr MilkBucketItem::useTimeDepleted(shared_ptrcount <= 0) { - return std::make_shared(Item::bucket_empty); + return shared_ptr( new ItemInstance(Item::bucket_empty) ); } return instance; } diff --git a/Minecraft.World/MilkBucketItem.h b/Minecraft.World/MilkBucketItem.h index f2cff3ea..672e3143 100644 --- a/Minecraft.World/MilkBucketItem.h +++ b/Minecraft.World/MilkBucketItem.h @@ -5,7 +5,7 @@ class MilkBucketItem : public Item { private: - static const int DRINK_DURATION = static_cast(20 * 1.6); + static const int DRINK_DURATION = (int) (20 * 1.6); public: MilkBucketItem(int id); diff --git a/Minecraft.World/MineShaftFeature.cpp b/Minecraft.World/MineShaftFeature.cpp index ebf59025..d32af346 100644 --- a/Minecraft.World/MineShaftFeature.cpp +++ b/Minecraft.World/MineShaftFeature.cpp @@ -32,7 +32,7 @@ bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Mineshaft); } diff --git a/Minecraft.World/MineShaftPieces.cpp b/Minecraft.World/MineShaftPieces.cpp index 97caf366..3fda1bfc 100644 --- a/Minecraft.World/MineShaftPieces.cpp +++ b/Minecraft.World/MineShaftPieces.cpp @@ -44,7 +44,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * if (randomSelection >= 80) { BoundingBox *crossingBox = MineShaftCrossing::findCrossing(pieces, random, footX, footY, footZ, direction); - if (crossingBox != nullptr) + if (crossingBox != NULL) { return new MineShaftCrossing(genDepth, random, crossingBox, direction); } @@ -52,7 +52,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * else if (randomSelection >= 70) { BoundingBox *stairsBox = MineShaftStairs::findStairs(pieces, random, footX, footY, footZ, direction); - if (stairsBox != nullptr) + if (stairsBox != NULL) { return new MineShaftPieces::MineShaftStairs(genDepth, random, stairsBox, direction); } @@ -60,28 +60,28 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * else { BoundingBox *corridorBox = MineShaftCorridor::findCorridorSize(pieces, random, footX, footY, footZ, direction); - if (corridorBox != nullptr) + if (corridorBox != NULL) { return new MineShaftCorridor(genDepth, random, corridorBox, direction); } } - return nullptr; + return NULL; } StructurePiece *MineShaftPieces::generateAndAddPiece(StructurePiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return nullptr; + return NULL; } if (abs(footX - startPiece->getBoundingBox()->x0) > 5 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 5 * 16) { - return nullptr; + return NULL; } StructurePiece *newPiece = createRandomShaftPiece(pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != nullptr) + if (newPiece != NULL) { MemSect(50); pieces->push_back(newPiece); @@ -132,7 +132,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 - 1, Direction::NORTH, depth); - if (child != nullptr) + if (child != NULL) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z0, childBox->x1, childBox->y1, boundingBox->z0 + 1)); @@ -149,7 +149,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z1 + 1, Direction::SOUTH, depth); - if (child != nullptr) + if (child != NULL) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z1 - 1, childBox->x1, childBox->y1, boundingBox->z1)); @@ -166,7 +166,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::WEST, depth); - if (child != nullptr) + if (child != NULL) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(boundingBox->x0, childBox->y0, childBox->z0, boundingBox->x0 + 1, childBox->y1, childBox->z1)); @@ -183,7 +183,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::EAST, depth); - if (child != nullptr) + if (child != NULL) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(boundingBox->x1 - 1, childBox->y0, childBox->z0, boundingBox->x1, childBox->y1, childBox->z1)); @@ -304,7 +304,7 @@ BoundingBox *MineShaftPieces::MineShaftCorridor::findCorridorSize(list *pieces, Random *random) @@ -434,7 +434,7 @@ bool MineShaftPieces::MineShaftCorridor::createChest(Level *level, BoundingBox * if (level->getTile(worldX, worldY, worldZ) == 0) { level->setTileAndData(worldX, worldY, worldZ, Tile::rail_Id, getOrientationData(Tile::rail_Id, random->nextBoolean() ? RailTile::DIR_FLAT_X : RailTile::DIR_FLAT_Z), Tile::UPDATE_CLIENTS); - shared_ptr chest = std::make_shared(level, worldX + 0.5f, worldY + 0.5f, worldZ + 0.5f); + shared_ptr chest = shared_ptr( new MinecartChest(level, worldX + 0.5f, worldY + 0.5f, worldZ + 0.5f) ); WeighedTreasure::addChestItems(random, treasure, chest, numRolls); level->addEntity(chest); return true; @@ -515,7 +515,7 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando hasPlacedSpider = true; level->setTileAndData(x, y, newZ, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, newZ) ); - if (entity != nullptr) entity->getSpawner()->setEntityId(L"CaveSpider"); + if (entity != NULL) entity->getSpawner()->setEntityId(L"CaveSpider"); } } } @@ -605,10 +605,10 @@ BoundingBox *MineShaftPieces::MineShaftCrossing::findCrossing(list break; } - if (StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return box; diff --git a/Minecraft.World/Minecart.cpp b/Minecraft.World/Minecart.cpp index f6c4bb76..4e1419cc 100644 --- a/Minecraft.World/Minecart.cpp +++ b/Minecraft.World/Minecart.cpp @@ -44,7 +44,7 @@ void Minecart::_init() blocksBuilding = true; setSize(0.98f, 0.7f); heightOffset = bbHeight / 2.0f; - soundUpdater = nullptr; + soundUpdater = NULL; name = L""; // @@ -56,7 +56,7 @@ Minecart::Minecart(Level *level) : Entity( level ) { _init(); - //soundUpdater = level != nullptr ? level->makeSoundUpdater(this) : nullptr; + //soundUpdater = level != NULL ? level->makeSoundUpdater(this) : NULL; } Minecart::~Minecart() @@ -69,17 +69,17 @@ shared_ptr Minecart::createMinecart(Level *level, double x, double y, switch (type) { case TYPE_CHEST: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartChest(level, x, y, z) ); case TYPE_FURNACE: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartFurnace(level, x, y, z) ); case TYPE_TNT: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartTNT(level, x, y, z) ); case TYPE_SPAWNER: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartSpawner(level, x, y, z) ); case TYPE_HOPPER: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartHopper(level, x, y, z) ); default: - return std::make_shared(level, x, y, z); + return shared_ptr( new MinecartRideable(level, x, y, z) ); } } @@ -95,7 +95,7 @@ void Minecart::defineSynchedData() entityData->define(DATA_ID_DAMAGE, 0.0f); entityData->define(DATA_ID_DISPLAY_TILE, 0); entityData->define(DATA_ID_DISPLAY_OFFSET, 6); - entityData->define(DATA_ID_CUSTOM_DISPLAY, static_cast(0)); + entityData->define(DATA_ID_CUSTOM_DISPLAY, (byte) 0); } @@ -105,12 +105,12 @@ AABB *Minecart::getCollideAgainstBox(shared_ptr entity) { return entity->bb; } - return nullptr; + return NULL; } AABB *Minecart::getCollideBox() { - return nullptr; + return NULL; } bool Minecart::isPushable() @@ -145,7 +145,7 @@ bool Minecart::hurt(DamageSource *source, float hurtDamage) // 4J-JEV: Fix for #88212, // Untrusted players shouldn't be able to damage minecarts or boats. - if (dynamic_cast(source) != nullptr) + if (dynamic_cast(source) != NULL) { shared_ptr attacker = source->getDirectEntity(); @@ -163,14 +163,14 @@ bool Minecart::hurt(DamageSource *source, float hurtDamage) // 4J Stu - If someone is riding in this, then it can tick multiple times which causes the damage to // decrease too quickly. So just make the damage a bit higher to start with for similar behaviour // to an unridden one. Only do this change if the riding player is attacking it. - if( rider.lock() != nullptr && rider.lock() == source->getEntity() ) hurtDamage += 1; + if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1; - bool creativePlayer = source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; + bool creativePlayer = source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { // 4J HEG - Fixed issue with player falling through the ground on destroying a minecart while riding (issue #160607) - if (rider.lock() != nullptr) rider.lock()->ride(nullptr); + if (rider.lock() != NULL) rider.lock()->ride(nullptr); if (!creativePlayer || hasCustomName()) { @@ -187,7 +187,7 @@ bool Minecart::hurt(DamageSource *source, float hurtDamage) void Minecart::destroy(DamageSource *source) { remove(); - shared_ptr item = std::make_shared(Item::minecart, 1); + shared_ptr item = shared_ptr( new ItemInstance(Item::minecart, 1) ); if (!name.empty()) item->setHoverName(name); spawnAtLocation(item, 0); } @@ -207,12 +207,12 @@ bool Minecart::isPickable() void Minecart::remove() { Entity::remove(); - //if (soundUpdater != nullptr) soundUpdater->tick(); + //if (soundUpdater != NULL) soundUpdater->tick(); } void Minecart::tick() { - //if (soundUpdater != nullptr) soundUpdater->tick(); + //if (soundUpdater != NULL) soundUpdater->tick(); // 4J - make minecarts (server-side) tick twice, to put things back to how they were when we were accidently ticking them twice for( int i = 0; i < 2; i++ ) { @@ -223,16 +223,16 @@ void Minecart::tick() outOfWorld(); } - if (!level->isClientSide && dynamic_cast(level) != nullptr) + if (!level->isClientSide && dynamic_cast(level) != NULL) { - MinecraftServer *server = static_cast(level)->getServer(); + MinecraftServer *server = ((ServerLevel *) level)->getServer(); int waitTime = getPortalWaitTime(); if (isInsidePortal) { if (server->isNetherEnabled()) { - if (riding == nullptr) + if (riding == NULL) { if (portalTime++ >= waitTime) { @@ -275,8 +275,8 @@ void Minecart::tick() double yrd = Mth::wrapDegrees(lyr - yRot); - yRot += static_cast((yrd) / lSteps); - xRot += static_cast((lxr - xRot) / lSteps); + yRot += (float) ( (yrd) / lSteps ); + xRot += (float) ( (lxr - xRot) / lSteps ); lSteps--; setPos(xt, yt, zt); @@ -330,7 +330,7 @@ void Minecart::tick() double zDiff = zo - z; if (xDiff * xDiff + zDiff * zDiff > 0.001) { - yRot = static_cast(atan2(zDiff, xDiff) * 180 / PI); + yRot = (float) (atan2(zDiff, xDiff) * 180 / PI); if (flipped) yRot += 180; } @@ -344,7 +344,7 @@ void Minecart::tick() setRot(yRot, xRot); vector > *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, 0, 0.2f)); - if (entities != nullptr && !entities->empty()) + if (entities != NULL && !entities->empty()) { for (auto& e : *entities) { @@ -361,7 +361,7 @@ void Minecart::tick() } } - if (rider.lock() != nullptr) + if (rider.lock() != NULL) { if (rider.lock()->removed) { @@ -415,7 +415,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl powerTrack = (data & BaseRailTile::RAIL_DATA_BIT) != 0; haltTrack = !powerTrack; } - if (static_cast(Tile::tiles[tile])->isUsesDataBit()) + if (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -454,7 +454,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl zd = pow * zD / dd; - if ( rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) + if ( rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(rider.lock()); @@ -530,7 +530,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl double xdd = xd; double zdd = zd; - if (rider.lock() != nullptr) + if (rider.lock() != NULL) { xdd *= 0.75; zdd *= 0.75; @@ -554,7 +554,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl applyNaturalSlowdown(); Vec3 *newPos = getPos(x, y, z); - if (newPos != nullptr && oldPos != nullptr) + if (newPos != NULL && oldPos != NULL) { double speed = (oldPos->y - newPos->y) * 0.05; @@ -619,7 +619,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl void Minecart::applyNaturalSlowdown() { - if (rider.lock() != nullptr) + if (rider.lock() != NULL) { xd *= 0.997f; yd *= 0; @@ -648,7 +648,7 @@ Vec3 *Minecart::getPosOffs(double x, double y, double z, double offs) { int data = level->getData(xt, yt, zt); - if (static_cast(Tile::tiles[tile])->isUsesDataBit()) + if (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -684,7 +684,7 @@ Vec3 *Minecart::getPosOffs(double x, double y, double z, double offs) return getPos(x, y, z); } - return nullptr; + return NULL; } Vec3 *Minecart::getPos(double x, double y, double z) @@ -703,7 +703,7 @@ Vec3 *Minecart::getPos(double x, double y, double z) int data = level->getData(xt, yt, zt); y = yt; - if (static_cast(Tile::tiles[tile])->isUsesDataBit()) + if (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -756,7 +756,7 @@ Vec3 *Minecart::getPos(double x, double y, double z) if (yD > 0) y += 0.5; return Vec3::newTemp(x, y, z); } - return nullptr; + return NULL; } void Minecart::readAdditionalSaveData(CompoundTag *tag) @@ -776,7 +776,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *tag) if (hasCustomDisplay()) { tag->putBoolean(L"CustomDisplayTile", true); - tag->putInt(L"DisplayTile", getDisplayTile() == nullptr ? 0 : getDisplayTile()->id); + tag->putInt(L"DisplayTile", getDisplayTile() == NULL ? 0 : getDisplayTile()->id); tag->putInt(L"DisplayData", getDisplayData()); tag->putInt(L"DisplayOffset", getDisplayOffset()); } @@ -796,7 +796,7 @@ void Minecart::push(shared_ptr e) 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 ( (rider.lock() == nullptr) && (e->riding == nullptr) ) + if ( (rider.lock() == NULL) && (e->riding == NULL) ) { e->ride( shared_from_this() ); } @@ -844,7 +844,7 @@ void Minecart::push(shared_ptr e) double zdd = (e->zd + zd); shared_ptr cart = dynamic_pointer_cast(e); - if (cart != nullptr && cart->getType() == TYPE_FURNACE && getType() != TYPE_FURNACE) + if (cart != NULL && cart->getType() == TYPE_FURNACE && getType() != TYPE_FURNACE) { xd *= 0.2f; zd *= 0.2f; @@ -853,7 +853,7 @@ void Minecart::push(shared_ptr e) e->zd *= 0.95f; m_bHasPushedCartThisTick = true; } - else if (cart != nullptr && cart->getType() != TYPE_FURNACE && getType() == TYPE_FURNACE) + else if (cart != NULL && cart->getType() != TYPE_FURNACE && getType() == TYPE_FURNACE) { e->xd *= 0.2f; e->zd *= 0.2f; @@ -957,12 +957,12 @@ Tile *Minecart::getDisplayTile() { if (!hasCustomDisplay()) return getDefaultDisplayTile(); int id = getEntityData()->getInteger(DATA_ID_DISPLAY_TILE) & 0xFFFF; - return id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; + return id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : NULL; } Tile *Minecart::getDefaultDisplayTile() { - return nullptr; + return NULL; } int Minecart::getDisplayData() @@ -996,7 +996,7 @@ void Minecart::setDisplayTile(int id) void Minecart::setDisplayData(int data) { Tile *tile = getDisplayTile(); - int id = tile == nullptr ? 0 : tile->id; + int id = tile == NULL ? 0 : tile->id; getEntityData()->set(DATA_ID_DISPLAY_TILE, (id & 0xFFFF) | (data << 16)); setCustomDisplay(true); @@ -1015,7 +1015,7 @@ bool Minecart::hasCustomDisplay() void Minecart::setCustomDisplay(bool value) { - getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, static_cast(value ? 1 : 0)); + getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, (byte) (value ? 1 : 0)); } void Minecart::setCustomName(const wstring &name) diff --git a/Minecraft.World/MinecartContainer.cpp b/Minecraft.World/MinecartContainer.cpp index 0e0fd3ac..20bfc4ea 100644 --- a/Minecraft.World/MinecartContainer.cpp +++ b/Minecraft.World/MinecartContainer.cpp @@ -33,7 +33,7 @@ void MinecartContainer::destroy(DamageSource *source) for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -45,11 +45,11 @@ void MinecartContainer::destroy(DamageSource *source) if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, shared_ptr(new ItemInstance(item->id, count, item->getAuxValue()))); + shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue()))) ); float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; level->addEntity(itemEntity); } } @@ -63,7 +63,7 @@ shared_ptr MinecartContainer::getItem(unsigned int slot) shared_ptr MinecartContainer::removeItem(unsigned int slot, int count) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { if (items[slot]->count <= count) { @@ -83,7 +83,7 @@ shared_ptr MinecartContainer::removeItem(unsigned int slot, int co shared_ptr MinecartContainer::removeItemNoUpdate(int slot) { - if (items[slot] != nullptr) + if (items[slot] != NULL) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -95,7 +95,7 @@ shared_ptr MinecartContainer::removeItemNoUpdate(int slot) void MinecartContainer::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } void MinecartContainer::setChanged() @@ -145,7 +145,7 @@ void MinecartContainer::remove() for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != nullptr) + if (item != NULL) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -157,17 +157,17 @@ void MinecartContainer::remove() if (count > item->count) count = item->count; item->count -= count; - shared_ptr itemEntity = std::make_shared(level, x + xo, y + yo, z + zo, shared_ptr(new ItemInstance(item->id, count, item->getAuxValue()))); + shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr( new ItemInstance(item->id, count, item->getAuxValue())))); if (item->hasTag()) { - itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); + itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); } float pow = 0.05f; - itemEntity->xd = static_cast(random->nextGaussian()) * pow; - itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; - itemEntity->zd = static_cast(random->nextGaussian()) * pow; + itemEntity->xd = (float) random->nextGaussian() * pow; + itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; + itemEntity->zd = (float) random->nextGaussian() * pow; level->addEntity(itemEntity); } } @@ -185,10 +185,10 @@ void MinecartContainer::addAdditonalSaveData(CompoundTag *base) for (int i = 0; i < items.length; i++) { - if (items[i] != nullptr) + if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/MinecartFurnace.cpp b/Minecraft.World/MinecartFurnace.cpp index fa005eca..24950d5c 100644 --- a/Minecraft.World/MinecartFurnace.cpp +++ b/Minecraft.World/MinecartFurnace.cpp @@ -37,7 +37,7 @@ int MinecartFurnace::getType() void MinecartFurnace::defineSynchedData() { Minecart::defineSynchedData(); - entityData->define(DATA_ID_FUEL, static_cast(0)); + entityData->define(DATA_ID_FUEL, (byte) 0); } void MinecartFurnace::tick() @@ -66,7 +66,7 @@ void MinecartFurnace::destroy(DamageSource *source) if (!source->isExplosion()) { - spawnAtLocation(std::make_shared(Tile::furnace, 1), 0); + spawnAtLocation(shared_ptr(new ItemInstance(Tile::furnace, 1)), 0); } } @@ -123,7 +123,7 @@ void MinecartFurnace::applyNaturalSlowdown() bool MinecartFurnace::interact(shared_ptr player) { shared_ptr selected = player->inventory->getSelected(); - if (selected != nullptr && selected->id == Item::coal_Id) + if (selected != NULL && selected->id == Item::coal_Id) { if (!player->abilities.instabuild && --selected->count == 0) player->inventory->setItem(player->inventory->selected, nullptr); fuel += SharedConstants::TICKS_PER_SECOND * 180; @@ -140,7 +140,7 @@ void MinecartFurnace::addAdditonalSaveData(CompoundTag *base) Minecart::addAdditonalSaveData(base); base->putDouble(L"PushX", xPush); base->putDouble(L"PushZ", zPush); - base->putShort(L"Fuel", static_cast(fuel)); + base->putShort(L"Fuel", (short) fuel); } void MinecartFurnace::readAdditionalSaveData(CompoundTag *base) @@ -160,11 +160,11 @@ void MinecartFurnace::setHasFuel(bool fuel) { if (fuel) { - entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) | 1)); + entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1)); } else { - entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) & ~1)); + entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1)); } } diff --git a/Minecraft.World/MinecartItem.cpp b/Minecraft.World/MinecartItem.cpp index 3ffe561a..6100be65 100644 --- a/Minecraft.World/MinecartItem.cpp +++ b/Minecraft.World/MinecartItem.cpp @@ -47,7 +47,7 @@ shared_ptr MinecartItem::MinecartDispenseBehavior::execute(BlockSo outcome = ACTIVATED_ITEM; - shared_ptr minecart = Minecart::createMinecart(world, spawnX, spawnY + yOffset, spawnZ, static_cast(dispensed->getItem())->type); + shared_ptr minecart = Minecart::createMinecart(world, spawnX, spawnY + yOffset, spawnZ, ((MinecartItem *) dispensed->getItem())->type); if (dispensed->hasCustomHoverName()) { minecart->setCustomName(dispensed->getHoverName()); diff --git a/Minecraft.World/MinecartRideable.cpp b/Minecraft.World/MinecartRideable.cpp index 5578fe3f..a006a2bc 100644 --- a/Minecraft.World/MinecartRideable.cpp +++ b/Minecraft.World/MinecartRideable.cpp @@ -23,8 +23,8 @@ MinecartRideable::MinecartRideable(Level *level, double x, double y, double z) : bool MinecartRideable::interact(shared_ptr 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 (rider.lock() != NULL && rider.lock()->instanceof(eTYPE_PLAYER) && rider.lock() != player) return true; + if (rider.lock() != NULL && rider.lock() != player) return false; if (!level->isClientSide) { player->ride(shared_from_this()); diff --git a/Minecraft.World/MinecartSpawner.cpp b/Minecraft.World/MinecartSpawner.cpp index 8dd54d01..3fcd4ef0 100644 --- a/Minecraft.World/MinecartSpawner.cpp +++ b/Minecraft.World/MinecartSpawner.cpp @@ -10,7 +10,7 @@ MinecartSpawner::MinecartMobSpawner::MinecartMobSpawner(MinecartSpawner *parent) void MinecartSpawner::MinecartMobSpawner::broadcastEvent(int id) { - m_parent->level->broadcastEntityEvent(m_parent->shared_from_this(), static_cast(id)); + m_parent->level->broadcastEntityEvent(m_parent->shared_from_this(), (byte) id); } Level *MinecartSpawner::MinecartMobSpawner::getLevel() diff --git a/Minecraft.World/MinecartTNT.cpp b/Minecraft.World/MinecartTNT.cpp index 57462e03..26cac5cf 100644 --- a/Minecraft.World/MinecartTNT.cpp +++ b/Minecraft.World/MinecartTNT.cpp @@ -66,7 +66,7 @@ void MinecartTNT::destroy(DamageSource *source) if (!source->isExplosion()) { - spawnAtLocation(std::make_shared(Tile::tnt, 1), 0); + spawnAtLocation( shared_ptr( new ItemInstance(Tile::tnt, 1) ), 0); } if (source->isFire() || source->isExplosion() || speedSqr >= 0.01f) @@ -81,7 +81,7 @@ void MinecartTNT::explode(double speedSqr) { double speed = sqrt(speedSqr); if (speed > 5) speed = 5; - level->explode(shared_from_this(), x, y, z, static_cast(4 + random->nextDouble() * 1.5f * speed), true); + level->explode(shared_from_this(), x, y, z, (float) (4 + random->nextDouble() * 1.5f * speed), true); remove(); } } diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp index 17671112..342400b4 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/Mob.cpp @@ -43,7 +43,7 @@ void Mob::_init() lookingAt = nullptr; lookTime = 0; target = nullptr; - sensing = nullptr; + sensing = NULL; equipment = ItemInstanceArray(5); dropChances = floatArray(5); @@ -58,7 +58,7 @@ void Mob::_init() _isLeashed = false; leashHolder = nullptr; - leashInfoTag = nullptr; + leashInfoTag = NULL; } Mob::Mob( Level* level) : LivingEntity(level) @@ -87,16 +87,16 @@ Mob::Mob( Level* level) : LivingEntity(level) Mob::~Mob() { - if(lookControl != nullptr) delete lookControl; - if(moveControl != nullptr) delete moveControl; - if(jumpControl != nullptr) delete jumpControl; - if(bodyControl != nullptr) delete bodyControl; - if(navigation != nullptr) delete navigation; - if(sensing != nullptr) delete sensing; + if(lookControl != NULL) delete lookControl; + if(moveControl != NULL) delete moveControl; + if(jumpControl != NULL) delete jumpControl; + if(bodyControl != NULL) delete bodyControl; + if(navigation != NULL) delete navigation; + if(sensing != NULL) delete sensing; - if(leashInfoTag != nullptr) delete leashInfoTag; + if(leashInfoTag != NULL) delete leashInfoTag; - if(equipment.data != nullptr) delete [] equipment.data; + if(equipment.data != NULL) delete [] equipment.data; delete [] dropChances.data; } @@ -155,7 +155,7 @@ void Mob::ate() void Mob::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_CUSTOM_NAME_VISIBLE, static_cast(0)); + entityData->define(DATA_CUSTOM_NAME_VISIBLE, (byte) 0); entityData->define(DATA_CUSTOM_NAME, L""); } @@ -196,7 +196,7 @@ int Mob::getExperienceReward(shared_ptr killedBy) ItemInstanceArray slots = getEquipmentSlots(); for (int i = 0; i < slots.length; i++) { - if (slots[i] != nullptr && dropChances[i] <= 1) + if (slots[i] != NULL && dropChances[i] <= 1) { result += 1 + random->nextInt(3); } @@ -280,7 +280,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) for (int i = 0; i < equipment.length; i++) { CompoundTag *tag = new CompoundTag(); - if (equipment[i] != nullptr) equipment[i]->save(tag); + if (equipment[i] != NULL) equipment[i]->save(tag); gear->add(tag); } entityTag->put(L"Equipment", gear); @@ -296,7 +296,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) // leash info entityTag->putBoolean(L"Leashed", _isLeashed); - if (leashHolder != nullptr) + if (leashHolder != NULL) { CompoundTag *leashTag = new CompoundTag(L"Leash"); if ( leashHolder->instanceof(eTYPE_LIVINGENTITY) ) @@ -347,7 +347,7 @@ void Mob::readAdditionalSaveData(CompoundTag *tag) _isLeashed = tag->getBoolean(L"Leashed"); if (_isLeashed && tag->contains(L"Leash")) { - leashInfoTag = static_cast(tag->getCompound(L"Leash")->copy()); + leashInfoTag = (CompoundTag *)tag->getCompound(L"Leash")->copy(); } } @@ -372,7 +372,7 @@ void Mob::aiStep() for (auto& it : *entities) { shared_ptr entity = dynamic_pointer_cast(it); - if (entity->removed || entity->getItem() == nullptr) continue; + if (entity->removed || entity->getItem() == NULL) continue; shared_ptr item = entity->getItem(); int slot = getEquipmentSlotForItem(item); @@ -381,17 +381,17 @@ void Mob::aiStep() bool replace = true; shared_ptr current = getCarried(slot); - if (current != nullptr) + if (current != NULL) { if (slot == SLOT_WEAPON) { WeaponItem *newWeapon = dynamic_cast(item->getItem()); WeaponItem *oldWeapon = dynamic_cast(current->getItem()); - if ( newWeapon != nullptr && oldWeapon == nullptr) + if ( newWeapon != NULL && oldWeapon == NULL) { replace = true; } - else if (newWeapon != nullptr && oldWeapon != nullptr) + else if (newWeapon != NULL && oldWeapon != NULL) { if (newWeapon->getTierDamage() == oldWeapon->getTierDamage()) { @@ -411,11 +411,11 @@ void Mob::aiStep() { ArmorItem *newArmor = dynamic_cast(item->getItem()); ArmorItem *oldArmor = dynamic_cast(current->getItem()); - if (newArmor != nullptr && oldArmor == nullptr) + if (newArmor != NULL && oldArmor == NULL) { replace = true; } - else if (newArmor != nullptr && oldArmor != nullptr) + else if (newArmor != NULL && oldArmor != NULL) { if (newArmor->defense == oldArmor->defense) { @@ -435,7 +435,7 @@ void Mob::aiStep() if (replace) { - if (current != nullptr && random->nextFloat() - 0.1f < dropChances[slot]) + if (current != NULL && random->nextFloat() - 0.1f < dropChances[slot]) { spawnAtLocation(current, 0); } @@ -470,7 +470,7 @@ void Mob::checkDespawn() return; } shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); - if (player != nullptr) + if (player != NULL) { double xd = player->x - x; double yd = player->y - y; @@ -547,7 +547,7 @@ void Mob::serverAiStep() if (random->nextFloat() < 0.02f) { shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); - if (player != nullptr) + if (player != NULL) { lookingAt = player; lookTime = 10 + random->nextInt(20); @@ -558,9 +558,9 @@ void Mob::serverAiStep() } } - if (lookingAt != nullptr) + if (lookingAt != NULL) { - lookAt(lookingAt, 10.0f, static_cast(getMaxHeadXRot())); + lookAt(lookingAt, 10.0f, (float) getMaxHeadXRot()); if (lookTime-- <= 0 || lookingAt->removed || lookingAt->distanceToSqr(shared_from_this()) > lookDistance * lookDistance) { lookingAt = nullptr; @@ -605,15 +605,15 @@ void Mob::lookAt(shared_ptr e, float yMax, float xMax) double sd = Mth::sqrt(xd * xd + zd * zd); - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; - float xRotD = static_cast(-(atan2(yd, sd) * 180 / PI)); + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; + float xRotD = (float) -(atan2(yd, sd) * 180 / PI); xRot = rotlerp(xRot, xRotD, xMax); yRot = rotlerp(yRot, yRotD, yMax); } bool Mob::isLookingAtAnEntity() { - return lookingAt != nullptr; + return lookingAt != NULL; } shared_ptr Mob::getLookingAt() @@ -658,8 +658,8 @@ int Mob::getMaxSpawnClusterSize() int Mob::getMaxFallDistance() { - if (getTarget() == nullptr) return 3; - int sacrifice = static_cast(getHealth() - (getMaxHealth() * 0.33f)); + if (getTarget() == NULL) return 3; + int sacrifice = (int) (getHealth() - (getMaxHealth() * 0.33f)); sacrifice -= (3 - level->difficulty) * 4; if (sacrifice < 0) sacrifice = 0; return sacrifice + 3; @@ -697,7 +697,7 @@ void Mob::dropEquipment(bool byPlayer, int playerBonusLevel) shared_ptr item = getCarried(slot); bool preserve = dropChances[slot] > 1; - if (item != nullptr && (byPlayer || preserve) && random->nextFloat() - playerBonusLevel * 0.01f < dropChances[slot]) + if (item != NULL && (byPlayer || preserve) && random->nextFloat() - playerBonusLevel * 0.01f < dropChances[slot]) { if (!preserve && item->isDamageableItem()) { @@ -726,10 +726,10 @@ void Mob::populateDefaultEquipmentSlots() { shared_ptr item = getArmor(i); if (i < 3 && random->nextFloat() < partialChance) break; - if (item == nullptr) + if (item == NULL) { Item *equip = getEquipmentForSlot(i + 1, armorType); - if (equip != nullptr) setEquippedSlot(i + 1, std::make_shared(equip)); + if (equip != NULL) setEquippedSlot(i + 1, shared_ptr(new ItemInstance(equip))); } } } @@ -743,7 +743,7 @@ int Mob::getEquipmentSlotForItem(shared_ptr item) } ArmorItem *armorItem = dynamic_cast(item->getItem()); - if (armorItem != nullptr) + if (armorItem != NULL) { switch (armorItem->slot) { @@ -791,23 +791,23 @@ Item *Mob::getEquipmentForSlot(int slot, int type) if (type == 4) return Item::boots_diamond; } - return nullptr; + return NULL; } void Mob::populateDefaultEquipmentEnchantments() { float difficulty = level->getDifficulty(x, y, z); - if (getCarriedItem() != nullptr && random->nextFloat() < MAX_ENCHANTED_WEAPON_CHANCE * difficulty) { - EnchantmentHelper::enchantItem(random, getCarriedItem(), static_cast(5 + difficulty * random->nextInt(18))); + if (getCarriedItem() != NULL && random->nextFloat() < MAX_ENCHANTED_WEAPON_CHANCE * difficulty) { + EnchantmentHelper::enchantItem(random, getCarriedItem(), (int) (5 + difficulty * random->nextInt(18))); } for (int i = 0; i < 4; i++) { shared_ptr item = getArmor(i); - if (item != nullptr && random->nextFloat() < MAX_ENCHANTED_ARMOR_CHANCE * difficulty) + if (item != NULL && random->nextFloat() < MAX_ENCHANTED_ARMOR_CHANCE * difficulty) { - EnchantmentHelper::enchantItem(random, item, static_cast(5 + difficulty * random->nextInt(18))); + EnchantmentHelper::enchantItem(random, item, (int) (5 + difficulty * random->nextInt(18))); } } } @@ -865,7 +865,7 @@ bool Mob::hasCustomName() void Mob::setCustomNameVisible(bool visible) { - entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? static_cast(1) : static_cast(0)); + entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? (byte) 1 : (byte) 0); } bool Mob::isCustomNameVisible() @@ -908,7 +908,7 @@ bool Mob::interact(shared_ptr player) } shared_ptr itemstack = player->inventory->getSelected(); - if (itemstack != nullptr) + if (itemstack != NULL) { // it's inconvenient to have the leash code here, but it's because // the mob.interact(player) method has priority over @@ -953,7 +953,7 @@ bool Mob::mobInteract(shared_ptr player) void Mob::tickLeash() { - if (leashInfoTag != nullptr) + if (leashInfoTag != NULL) { restoreLeashFromSave(); } @@ -962,7 +962,7 @@ void Mob::tickLeash() return; } - if (leashHolder == nullptr || leashHolder->removed) + if (leashHolder == NULL || leashHolder->removed) { dropLeash(true, true); return; @@ -981,9 +981,9 @@ void Mob::dropLeash(bool synch, bool createItemDrop) } ServerLevel *serverLevel = dynamic_cast(level); - if (!level->isClientSide && synch && serverLevel != nullptr) + if (!level->isClientSide && synch && serverLevel != NULL) { - serverLevel->getTracker()->broadcast(shared_from_this(), std::make_shared(SetEntityLinkPacket::LEASH, shared_from_this(), nullptr)); + serverLevel->getTracker()->broadcast(shared_from_this(), shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, shared_from_this(), nullptr))); } } } @@ -1011,14 +1011,14 @@ void Mob::setLeashedTo(shared_ptr holder, bool synch) ServerLevel *serverLevel = dynamic_cast(level); if (!level->isClientSide && synch && serverLevel) { - serverLevel->getTracker()->broadcast(shared_from_this(), std::make_shared(SetEntityLinkPacket::LEASH, shared_from_this(), leashHolder)); + serverLevel->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, shared_from_this(), leashHolder))); } } void Mob::restoreLeashFromSave() { // after being added to the world, attempt to recreate leash bond - if (_isLeashed && leashInfoTag != nullptr) + if (_isLeashed && leashInfoTag != NULL) { if (leashInfoTag->contains(L"UUID")) { @@ -1043,7 +1043,7 @@ void Mob::restoreLeashFromSave() int z = leashInfoTag->getInt(L"Z"); shared_ptr activeKnot = LeashFenceKnotEntity::findKnotAt(level, x, y, z); - if (activeKnot == nullptr) + if (activeKnot == NULL) { activeKnot = LeashFenceKnotEntity::createAndAddKnot(level, x, y, z); } @@ -1055,7 +1055,7 @@ void Mob::restoreLeashFromSave() dropLeash(false, true); } } - leashInfoTag = nullptr; + leashInfoTag = NULL; } // 4J added so we can not render mobs before their chunks are loaded - to resolve bug 10327 :Gameplay: NPCs can spawn over chunks that have not yet been streamed and display jitter. diff --git a/Minecraft.World/Mob.h b/Minecraft.World/Mob.h index e070e369..11310509 100644 --- a/Minecraft.World/Mob.h +++ b/Minecraft.World/Mob.h @@ -27,7 +27,7 @@ class Mob : public LivingEntity public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts eINSTANCEOF GetType() { return eTYPE_MOB;} - static Entity *create(Level *level) { return nullptr; } + static Entity *create(Level *level) { return NULL; } public: static const float MAX_WEARING_ARMOR_CHANCE; diff --git a/Minecraft.World/MobCategory.cpp b/Minecraft.World/MobCategory.cpp index 8c6d3b44..507be6ed 100644 --- a/Minecraft.World/MobCategory.cpp +++ b/Minecraft.World/MobCategory.cpp @@ -5,14 +5,14 @@ #include "Material.h" #include "MobCategory.h" -MobCategory *MobCategory::monster = nullptr; -MobCategory *MobCategory::creature = nullptr; -MobCategory *MobCategory::ambient = nullptr; -MobCategory *MobCategory::waterCreature = nullptr; +MobCategory *MobCategory::monster = NULL; +MobCategory *MobCategory::creature = NULL; +MobCategory *MobCategory::ambient = NULL; +MobCategory *MobCategory::waterCreature = NULL; // 4J - added these extra categories -MobCategory *MobCategory::creature_wolf = nullptr; -MobCategory *MobCategory::creature_chicken = nullptr; -MobCategory *MobCategory::creature_mushroomcow = nullptr; +MobCategory *MobCategory::creature_wolf = NULL; +MobCategory *MobCategory::creature_chicken = NULL; +MobCategory *MobCategory::creature_mushroomcow = NULL; MobCategoryArray MobCategory::values = MobCategoryArray(7); diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index 4ded9c41..92f8c9d0 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -46,7 +46,7 @@ MobEffect *MobEffect::reserved_31; void MobEffect::staticCtor() { - voidEffect = nullptr; + voidEffect = NULL; movementSpeed = (new MobEffect(1, false, eMinecraftColour_Effect_MovementSpeed)) ->setDescriptionId(IDS_POTION_MOVESPEED) ->setPostfixDescriptionId(IDS_POTION_MOVESPEED_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Speed)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESPEED, 0.2f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //setIcon(0, 0); movementSlowdown = (new MobEffect(2, true, eMinecraftColour_Effect_MovementSlowDown)) ->setDescriptionId(IDS_POTION_MOVESLOWDOWN) ->setPostfixDescriptionId(IDS_POTION_MOVESLOWDOWN_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Slowness)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESLOWDOWN, -0.15f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //->setIcon(1, 0); digSpeed = (new MobEffect(3, false, eMinecraftColour_Effect_DigSpeed)) ->setDescriptionId(IDS_POTION_DIGSPEED) ->setPostfixDescriptionId(IDS_POTION_DIGSPEED_POSTFIX)->setDurationModifier(1.5)->setIcon(MobEffect::e_MobEffectIcon_Haste); //->setIcon(2, 0); @@ -70,14 +70,14 @@ void MobEffect::staticCtor() healthBoost = (new HealthBoostMobEffect(21, false, eMinecraftColour_Effect_HealthBoost)) ->setDescriptionId(IDS_POTION_HEALTHBOOST) ->setPostfixDescriptionId(IDS_POTION_HEALTHBOOST_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_HealthBoost)->addAttributeModifier(SharedMonsterAttributes::MAX_HEALTH, eModifierId_POTION_HEALTHBOOST, 4, AttributeModifier::OPERATION_ADDITION); absorption = (new AbsoptionMobEffect(22, false, eMinecraftColour_Effect_Absoprtion)) ->setDescriptionId(IDS_POTION_ABSORPTION) ->setPostfixDescriptionId(IDS_POTION_ABSORPTION_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Absorption); saturation = (new InstantenousMobEffect(23, false, eMinecraftColour_Effect_Saturation)) ->setDescriptionId(IDS_POTION_SATURATION) ->setPostfixDescriptionId(IDS_POTION_SATURATION_POSTFIX); - reserved_24 = nullptr; - reserved_25 = nullptr; - reserved_26 = nullptr; - reserved_27 = nullptr; - reserved_28 = nullptr; - reserved_29 = nullptr; - reserved_30 = nullptr; - reserved_31 = nullptr; + reserved_24 = NULL; + reserved_25 = NULL; + reserved_26 = NULL; + reserved_27 = NULL; + reserved_28 = NULL; + reserved_29 = NULL; + reserved_30 = NULL; + reserved_31 = NULL; } MobEffect::MobEffect(int id, bool isHarmful, eMinecraftColour color) : id(id), _isHarmful(isHarmful), color(color) @@ -173,13 +173,13 @@ void MobEffect::applyInstantenousEffect(shared_ptr source, shared_ { if ((id == heal->id && !mob->isInvertedHealAndHarm()) || (id == harm->id && mob->isInvertedHealAndHarm())) { - int amount = static_cast(scale * (double)(4 << amplification) + .5); + int amount = (int) (scale * (double) (4 << amplification) + .5); mob->heal(amount); } else if ((id == harm->id && !mob->isInvertedHealAndHarm()) || (id == heal->id && mob->isInvertedHealAndHarm())) { - int amount = static_cast(scale * (double)(6 << amplification) + .5); - if (source == nullptr) + int amount = (int) (scale * (double) (6 << amplification) + .5); + if (source == NULL) { mob->hurt(DamageSource::magic, amount); } @@ -359,7 +359,7 @@ void MobEffect::removeAttributeModifiers(shared_ptr entity, BaseAt { AttributeInstance *attribute = attributes->getInstance(it.first); - if (attribute != nullptr) + if (attribute != NULL) { attribute->removeModifier(it.second); } @@ -372,7 +372,7 @@ void MobEffect::addAttributeModifiers(shared_ptr entity, BaseAttri { AttributeInstance *attribute = attributes->getInstance(it.first); - if (attribute != nullptr) + if (attribute != NULL) { AttributeModifier *original = it.second; attribute->removeModifier(original); diff --git a/Minecraft.World/MobEffectInstance.cpp b/Minecraft.World/MobEffectInstance.cpp index 117311c3..2ca696f6 100644 --- a/Minecraft.World/MobEffectInstance.cpp +++ b/Minecraft.World/MobEffectInstance.cpp @@ -172,8 +172,8 @@ bool MobEffectInstance::equals(MobEffectInstance *instance) CompoundTag *MobEffectInstance::save(CompoundTag *tag) { - tag->putByte(L"Id", static_cast(getId())); - tag->putByte(L"Amplifier", static_cast(getAmplifier())); + tag->putByte(L"Id", (byte) getId()); + tag->putByte(L"Amplifier", (byte) getAmplifier()); tag->putInt(L"Duration", getDuration()); tag->putBoolean(L"Ambient", isAmbient()); return tag; diff --git a/Minecraft.World/MobSpawner.cpp b/Minecraft.World/MobSpawner.cpp index 35b24721..e593a59f 100644 --- a/Minecraft.World/MobSpawner.cpp +++ b/Minecraft.World/MobSpawner.cpp @@ -118,7 +118,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie // 4J - rewritten to add chunks interleaved by player, and to add them from the centre outwards. We're going to be // potentially adding less creatures than the original so that our count stays consistent with number of players added, so // we want to make sure as best we can that the ones we do add are near the active players - int playerCount = static_cast(level->players.size()); + int playerCount = (int)level->players.size(); int *xx = new int[playerCount]; int *zz = new int[playerCount]; for (int i = 0; i < playerCount; i++) @@ -251,8 +251,8 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie int z = zStart; int ss = 6; - Biome::MobSpawnerData *currentMobType = nullptr; - MobGroupData *groupData = nullptr; + Biome::MobSpawnerData *currentMobType = NULL; + MobGroupData *groupData = NULL; for (int ll = 0; ll < 4; ll++) { @@ -267,9 +267,9 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie if (isSpawnPositionOk(mobCategory, level, x, y, z)) { float xx = x + 0.5f; - float yy = static_cast(y); + float yy = (float) y; float zz = z + 0.5f; - if (level->getNearestPlayer(xx, yy, zz, MIN_SPAWN_DISTANCE) != nullptr) + if (level->getNearestPlayer(xx, yy, zz, MIN_SPAWN_DISTANCE) != NULL) { continue; } @@ -285,10 +285,10 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie } } - if (currentMobType == nullptr) + if (currentMobType == NULL) { currentMobType = level->getRandomMobSpawnAt(mobCategory, x, y, z); - if (currentMobType == nullptr) + if (currentMobType == NULL) { break; } @@ -440,7 +440,7 @@ void MobSpawner::postProcessSpawnMobs(Level *level, Biome *biome, int xo, int zo while (random->nextFloat() < biome->getCreatureProbability()) { Biome::MobSpawnerData *type = (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(level->random, ((vector *)mobs)); - MobGroupData *groupData = nullptr; + MobGroupData *groupData = NULL; int count = type->minCount + random->nextInt(1 + type->maxCount - type->minCount); int x = xo + random->nextInt(cellWidth); diff --git a/Minecraft.World/MobSpawnerTile.cpp b/Minecraft.World/MobSpawnerTile.cpp index 08c1f87d..4665015a 100644 --- a/Minecraft.World/MobSpawnerTile.cpp +++ b/Minecraft.World/MobSpawnerTile.cpp @@ -9,7 +9,7 @@ MobSpawnerTile::MobSpawnerTile(int id) : BaseEntityTile(id, Material::stone, isS shared_ptr MobSpawnerTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new MobSpawnerTileEntity() ); } int MobSpawnerTile::getResource(int data, Random *random, int playerBonusLevel) diff --git a/Minecraft.World/MobSpawnerTileEntity.cpp b/Minecraft.World/MobSpawnerTileEntity.cpp index e3ee57d6..013503b6 100644 --- a/Minecraft.World/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/MobSpawnerTileEntity.cpp @@ -37,7 +37,7 @@ int MobSpawnerTileEntity::TileEntityMobSpawner::getZ() void MobSpawnerTileEntity::TileEntityMobSpawner::setNextSpawnData(BaseMobSpawner::SpawnData *nextSpawnData) { BaseMobSpawner::setNextSpawnData(nextSpawnData); - if (getLevel() != nullptr) getLevel()->sendTileUpdated(m_parent->x, m_parent->y, m_parent->z); + if (getLevel() != NULL) getLevel()->sendTileUpdated(m_parent->x, m_parent->y, m_parent->z); } MobSpawnerTileEntity::MobSpawnerTileEntity() @@ -73,7 +73,7 @@ shared_ptr MobSpawnerTileEntity::getUpdatePacket() CompoundTag *tag = new CompoundTag(); save(tag); tag->remove(L"SpawnPotentials"); - return std::make_shared(x, y, z, TileEntityDataPacket::TYPE_MOB_SPAWNER, tag); + return shared_ptr( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_MOB_SPAWNER, tag) ); } bool MobSpawnerTileEntity::triggerEvent(int b0, int b1) @@ -90,7 +90,7 @@ BaseMobSpawner *MobSpawnerTileEntity::getSpawner() // 4J Added shared_ptr MobSpawnerTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new MobSpawnerTileEntity() ); TileEntity::clone(result); return result; diff --git a/Minecraft.World/MockedLevelStorage.cpp b/Minecraft.World/MockedLevelStorage.cpp index 56910e3e..9a7a63c0 100644 --- a/Minecraft.World/MockedLevelStorage.cpp +++ b/Minecraft.World/MockedLevelStorage.cpp @@ -9,7 +9,7 @@ LevelData *MockedLevelStorage::prepareLevel() { - return nullptr; + return NULL; } void MockedLevelStorage::checkSession() @@ -18,7 +18,7 @@ void MockedLevelStorage::checkSession() ChunkStorage *MockedLevelStorage::createChunkStorage(Dimension *dimension) { - return nullptr; + return NULL; } void MockedLevelStorage::saveLevelData(LevelData *levelData, vector > *players) @@ -31,7 +31,7 @@ void MockedLevelStorage::saveLevelData(LevelData *levelData) PlayerIO *MockedLevelStorage::getPlayerIO() { - return nullptr; + return NULL; } void MockedLevelStorage::closeAll() diff --git a/Minecraft.World/MockedLevelStorage.h b/Minecraft.World/MockedLevelStorage.h index faa50582..6a9eed70 100644 --- a/Minecraft.World/MockedLevelStorage.h +++ b/Minecraft.World/MockedLevelStorage.h @@ -18,5 +18,5 @@ public: virtual ConsoleSavePath getDataFile(const wstring& id); virtual wstring getLevelId(); public: - virtual ConsoleSaveFile *getSaveFile() { return nullptr; } + virtual ConsoleSaveFile *getSaveFile() { return NULL; } }; \ No newline at end of file diff --git a/Minecraft.World/ModifiableAttributeInstance.cpp b/Minecraft.World/ModifiableAttributeInstance.cpp index 216e5719..3108df4d 100644 --- a/Minecraft.World/ModifiableAttributeInstance.cpp +++ b/Minecraft.World/ModifiableAttributeInstance.cpp @@ -62,7 +62,7 @@ void ModifiableAttributeInstance::getModifiers(unordered_setgetId() != eModifierId_ANONYMOUS && getModifier(modifier->getId()) != nullptr) + if (modifier->getId() != eModifierId_ANONYMOUS && getModifier(modifier->getId()) != NULL) { assert(0); // throw new IllegalArgumentException("Modifier is already applied on this attribute!"); @@ -126,7 +126,7 @@ void ModifiableAttributeInstance::removeModifier(AttributeModifier *modifier) void ModifiableAttributeInstance::removeModifier(eMODIFIER_ID id) { AttributeModifier *modifier = getModifier(id); - if (modifier != nullptr) removeModifier(modifier); + if (modifier != NULL) removeModifier(modifier); } void ModifiableAttributeInstance::removeModifiers() diff --git a/Minecraft.World/Monster.cpp b/Minecraft.World/Monster.cpp index 2de45315..174a706c 100644 --- a/Minecraft.World/Monster.cpp +++ b/Minecraft.World/Monster.cpp @@ -46,7 +46,7 @@ shared_ptr Monster::findAttackTarget() #endif shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); - if (player != nullptr && canSee(player) ) return player; + if (player != NULL && canSee(player) ) return player; return shared_ptr(); } @@ -75,7 +75,7 @@ bool Monster::hurt(DamageSource *source, float dmg) */ bool Monster::doHurtTarget(shared_ptr target) { - float dmg = static_cast(getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue()); + float dmg = (float) getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); int knockback = 0; diff --git a/Minecraft.World/Monster.h b/Minecraft.World/Monster.h index 2c21b1d2..33f72b0e 100644 --- a/Minecraft.World/Monster.h +++ b/Minecraft.World/Monster.h @@ -12,7 +12,7 @@ class Monster : public PathfinderMob, public Enemy { public: eINSTANCEOF GetType() { return eTYPE_MONSTER; } - static Entity *create(Level *level) { return nullptr; } + static Entity *create(Level *level) { return NULL; } public: Monster(Level *level); diff --git a/Minecraft.World/MonsterRoomFeature.cpp b/Minecraft.World/MonsterRoomFeature.cpp index e11ebcb2..17ac55ae 100644 --- a/Minecraft.World/MonsterRoomFeature.cpp +++ b/Minecraft.World/MonsterRoomFeature.cpp @@ -110,7 +110,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z WeighedTreasureArray wrapperArray(monsterRoomTreasure, TREASURE_ITEMS_COUNT); WeighedTreasureArray treasure = WeighedTreasure::addToTreasure(wrapperArray, Item::enchantedBook->createForRandomTreasure(random)); shared_ptr chest = dynamic_pointer_cast( level->getTileEntity(xc, yc, zc) ); - if (chest != nullptr ) + if (chest != NULL ) { WeighedTreasure::addChestItems(random, treasure, chest, 8); } @@ -122,7 +122,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( entity != nullptr ) + if( entity != NULL ) { entity->getSpawner()->setEntityId(randomEntityId(random)); } diff --git a/Minecraft.World/MoveControl.cpp b/Minecraft.World/MoveControl.cpp index d2a529a1..02b5a9e0 100644 --- a/Minecraft.World/MoveControl.cpp +++ b/Minecraft.World/MoveControl.cpp @@ -54,10 +54,10 @@ void MoveControl::tick() double dd = xd * xd + yd * yd + zd * zd; if (dd < MIN_SPEED_SQR) return; - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; mob->yRot = rotlerp(mob->yRot, yRotD, MAX_TURN); - mob->setSpeed(static_cast(speedModifier * mob->getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + mob->setSpeed((float) (speedModifier * mob->getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); if (yd > 0 && xd * xd + zd * zd < 1) mob->getJumpControl()->jump(); } diff --git a/Minecraft.World/MoveEntityPacket.cpp b/Minecraft.World/MoveEntityPacket.cpp index cae28e91..b52482f5 100644 --- a/Minecraft.World/MoveEntityPacket.cpp +++ b/Minecraft.World/MoveEntityPacket.cpp @@ -40,7 +40,7 @@ void MoveEntityPacket::write(DataOutputStream *dos) //throws IOException // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); } - dos->writeShort(static_cast(id)); + dos->writeShort((short)id); } void MoveEntityPacket::handle(PacketListener *listener) @@ -61,7 +61,7 @@ bool MoveEntityPacket::canBeInvalidated() bool MoveEntityPacket::isInvalidatedBy(shared_ptr packet) { shared_ptr target = dynamic_pointer_cast(packet); - return target != nullptr && target->id == id; + return target != NULL && target->id == id; } MoveEntityPacket::PosRot::PosRot() diff --git a/Minecraft.World/MoveEntityPacket.h b/Minecraft.World/MoveEntityPacket.h index dc0f44d5..ab16ac3a 100644 --- a/Minecraft.World/MoveEntityPacket.h +++ b/Minecraft.World/MoveEntityPacket.h @@ -27,7 +27,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacket()); } virtual int getId() { return 30; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacket::PosRot()); } virtual int getId() { return 33; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacket::Pos()); } virtual int getId() { return 31; } }; @@ -72,7 +72,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacket::Rot()); } virtual int getId() { return 32; } }; \ No newline at end of file diff --git a/Minecraft.World/MoveEntityPacketSmall.cpp b/Minecraft.World/MoveEntityPacketSmall.cpp index ec67f37f..8216478f 100644 --- a/Minecraft.World/MoveEntityPacketSmall.cpp +++ b/Minecraft.World/MoveEntityPacketSmall.cpp @@ -47,7 +47,7 @@ void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException // We shouln't be tracking an entity that doesn't have a short type of id __debugbreak(); } - dos->writeShort(static_cast(id)); + dos->writeShort((short)id); } void MoveEntityPacketSmall::handle(PacketListener *listener) @@ -68,7 +68,7 @@ bool MoveEntityPacketSmall::canBeInvalidated() bool MoveEntityPacketSmall::isInvalidatedBy(shared_ptr packet) { shared_ptr target = dynamic_pointer_cast(packet); - return target != nullptr && target->id == id; + return target != NULL && target->id == id; } MoveEntityPacketSmall::PosRot::PosRot() @@ -131,7 +131,7 @@ void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException int idAndY = dis->readShort(); this->id = idAndY & 0x07ff; this->ya = idAndY >> 11; - int XandZ = (int)static_cast(dis->readByte()); + int XandZ = (int)((signed char)(dis->readByte())); xa = XandZ >> 4; za = ( XandZ << 28 ) >> 28; } diff --git a/Minecraft.World/MoveEntityPacketSmall.h b/Minecraft.World/MoveEntityPacketSmall.h index c3f357dd..4218f11b 100644 --- a/Minecraft.World/MoveEntityPacketSmall.h +++ b/Minecraft.World/MoveEntityPacketSmall.h @@ -27,7 +27,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall()); } virtual int getId() { return 162; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::PosRot()); } virtual int getId() { return 165; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::Pos()); } virtual int getId() { return 163; } }; @@ -73,7 +73,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MoveEntityPacketSmall::Rot()); } virtual int getId() { return 164; } }; \ No newline at end of file diff --git a/Minecraft.World/MoveIndoorsGoal.cpp b/Minecraft.World/MoveIndoorsGoal.cpp index f329a6bb..395fe578 100644 --- a/Minecraft.World/MoveIndoorsGoal.cpp +++ b/Minecraft.World/MoveIndoorsGoal.cpp @@ -22,10 +22,10 @@ bool MoveIndoorsGoal::canUse() if (mob->getRandom()->nextInt(50) != 0) return false; if (insideX != -1 && mob->distanceToSqr(insideX, mob->y, insideZ) < 2 * 2) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 14); - if (village == nullptr) return false; + if (village == NULL) return false; shared_ptr _doorInfo = village->getBestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); doorInfo = _doorInfo; - return _doorInfo != nullptr; + return _doorInfo != NULL; } bool MoveIndoorsGoal::canContinueToUse() @@ -37,7 +37,7 @@ void MoveIndoorsGoal::start() { insideX = -1; shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == nullptr ) + if( _doorInfo == NULL ) { doorInfo = weak_ptr(); return; @@ -45,7 +45,7 @@ void MoveIndoorsGoal::start() if (mob->distanceToSqr(_doorInfo->getIndoorX(), _doorInfo->y, _doorInfo->getIndoorZ()) > 16 * 16) { Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 14, 3, Vec3::newTemp(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5)); - if (pos != nullptr) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f); + if (pos != NULL) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f); } else mob->getNavigation()->moveTo(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5, 1.0f); } @@ -53,7 +53,7 @@ void MoveIndoorsGoal::start() void MoveIndoorsGoal::stop() { shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == nullptr ) + if( _doorInfo == NULL ) { doorInfo = weak_ptr(); return; diff --git a/Minecraft.World/MovePlayerPacket.h b/Minecraft.World/MovePlayerPacket.h index 1850c9d3..26ae8392 100644 --- a/Minecraft.World/MovePlayerPacket.h +++ b/Minecraft.World/MovePlayerPacket.h @@ -27,7 +27,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MovePlayerPacket()); } virtual int getId() { return 10; } }; @@ -42,7 +42,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::PosRot()); } virtual int getId() { return 13; } }; @@ -57,7 +57,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Pos()); } virtual int getId() { return 11; } }; @@ -72,7 +72,7 @@ public: virtual void write(DataOutputStream *dos); virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new MovePlayerPacket::Rot()); } virtual int getId() { return 12; } }; \ No newline at end of file diff --git a/Minecraft.World/MoveThroughVillageGoal.cpp b/Minecraft.World/MoveThroughVillageGoal.cpp index 81476aec..f112c109 100644 --- a/Minecraft.World/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/MoveThroughVillageGoal.cpp @@ -11,7 +11,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedModifier, bool onlyAtNight) { - path = nullptr; + path = NULL; doorInfo = weak_ptr(); this->mob = mob; @@ -22,7 +22,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedM MoveThroughVillageGoal::~MoveThroughVillageGoal() { - if(path != nullptr) delete path; + if(path != NULL) delete path; } bool MoveThroughVillageGoal::canUse() @@ -32,10 +32,10 @@ bool MoveThroughVillageGoal::canUse() if (onlyAtNight && mob->level->isDay()) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0); - if (village == nullptr) return false; + if (village == NULL) return false; shared_ptr _doorInfo = getNextDoorInfo(village); - if (_doorInfo == nullptr) return false; + if (_doorInfo == NULL) return false; doorInfo = _doorInfo; bool oldCanOpenDoors = mob->getNavigation()->canOpenDoors(); @@ -44,15 +44,15 @@ bool MoveThroughVillageGoal::canUse() path = mob->getNavigation()->createPath(_doorInfo->x, _doorInfo->y, _doorInfo->z); mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors); - if (path != nullptr) return true; + if (path != NULL) return true; Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 10, 7, Vec3::newTemp(_doorInfo->x, _doorInfo->y, _doorInfo->z)); - if (pos == nullptr) return false; + if (pos == NULL) return false; mob->getNavigation()->setCanOpenDoors(false); delete path; path = mob->getNavigation()->createPath(pos->x, pos->y, pos->z); mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors); - return path != nullptr; + return path != NULL; } bool MoveThroughVillageGoal::canContinueToUse() @@ -60,7 +60,7 @@ bool MoveThroughVillageGoal::canContinueToUse() if (mob->getNavigation()->isDone()) return false; float dist = mob->bbWidth + 4.f; shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == nullptr ) return false; + if( _doorInfo == NULL ) return false; return mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) > dist * dist; } @@ -68,13 +68,13 @@ bool MoveThroughVillageGoal::canContinueToUse() void MoveThroughVillageGoal::start() { mob->getNavigation()->moveTo(path, speedModifier); - path = nullptr; + path = NULL; } void MoveThroughVillageGoal::stop() { shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == nullptr ) return; + if( _doorInfo == NULL ) return; if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4) { diff --git a/Minecraft.World/MoveTowardsRestrictionGoal.cpp b/Minecraft.World/MoveTowardsRestrictionGoal.cpp index 1d54f935..2c3900b6 100644 --- a/Minecraft.World/MoveTowardsRestrictionGoal.cpp +++ b/Minecraft.World/MoveTowardsRestrictionGoal.cpp @@ -20,7 +20,7 @@ bool MoveTowardsRestrictionGoal::canUse() if (mob->isWithinRestriction()) return false; Pos *towards = mob->getRestrictCenter(); Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(towards->x, towards->y, towards->z)); - if (pos == nullptr) return false; + if (pos == NULL) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; diff --git a/Minecraft.World/MoveTowardsTargetGoal.cpp b/Minecraft.World/MoveTowardsTargetGoal.cpp index a0e18115..c0537d1f 100644 --- a/Minecraft.World/MoveTowardsTargetGoal.cpp +++ b/Minecraft.World/MoveTowardsTargetGoal.cpp @@ -17,10 +17,10 @@ MoveTowardsTargetGoal::MoveTowardsTargetGoal(PathfinderMob *mob, double speedMod bool MoveTowardsTargetGoal::canUse() { target = weak_ptr(mob->getTarget()); - if (target.lock() == nullptr) return false; + if (target.lock() == NULL) return false; if (target.lock()->distanceToSqr(mob->shared_from_this()) > within * within) return false; Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(target.lock()->x, target.lock()->y, target.lock()->z)); - if (pos == nullptr) return false; + if (pos == NULL) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -29,7 +29,7 @@ bool MoveTowardsTargetGoal::canUse() bool MoveTowardsTargetGoal::canContinueToUse() { - return target.lock() != nullptr && !mob->getNavigation()->isDone() && target.lock()->isAlive() && target.lock()->distanceToSqr(mob->shared_from_this()) < within * within; + return target.lock() != NULL && !mob->getNavigation()->isDone() && target.lock()->isAlive() && target.lock()->distanceToSqr(mob->shared_from_this()) < within * within; } void MoveTowardsTargetGoal::stop() diff --git a/Minecraft.World/Mth.cpp b/Minecraft.World/Mth.cpp index 4ec4f78b..77987917 100644 --- a/Minecraft.World/Mth.cpp +++ b/Minecraft.World/Mth.cpp @@ -9,7 +9,7 @@ const float Mth::DEGRAD = PI / 180.0f; const float Mth::RADDEG = 180.0f / PI; const float Mth::RAD_TO_GRAD = PI / 180.0f; -float *Mth::_sin = nullptr; +float *Mth::_sin = NULL; const float Mth::sinScale = 65536.0f / (float) (PI * 2); @@ -25,14 +25,14 @@ void Mth::init() float Mth::sin(float i) { - if(_sin == nullptr) init(); // 4J - added - return _sin[static_cast(i * sinScale) & 65535]; + if(_sin == NULL) init(); // 4J - added + return _sin[(int) (i * sinScale) & 65535]; } float Mth::cos(float i) { - if(_sin == nullptr) init(); // 4J - added - return _sin[static_cast(i * sinScale + 65536 / 4) & 65535]; + if(_sin == NULL) init(); // 4J - added + return _sin[(int) (i * sinScale + 65536 / 4) & 65535]; } float Mth::sqrt(float x) @@ -42,35 +42,35 @@ float Mth::sqrt(float x) float Mth::sqrt(double x) { - return static_cast(::sqrt(x)); + return (float) ::sqrt(x); } int Mth::floor(float v) { - int i = static_cast(v); + int i = (int) v; return v < i ? i - 1 : i; } int64_t Mth::lfloor(double v) { - int64_t i = static_cast(v); + int64_t i = (int64_t) v; return v < i ? i - 1 : i; } int Mth::fastFloor(double x) { - return static_cast(x + BIG_ENOUGH_FLOAT) - BIG_ENOUGH_INT; + return (int) (x + BIG_ENOUGH_FLOAT) - BIG_ENOUGH_INT; } int Mth::floor(double v) { - int i = static_cast(v); + int i = (int) v; return v < i ? i - 1 : i; } int Mth::absFloor(double v) { - return static_cast(v >= 0 ? v : -v + 1); + return (int) (v >= 0 ? v : -v + 1); } float Mth::abs(float v) @@ -85,7 +85,7 @@ int Mth::abs(int v) int Mth::ceil(float v) { - int i = static_cast(v); + int i = (int) v; return v > i ? i + 1 : i; } diff --git a/Minecraft.World/Mushroom.cpp b/Minecraft.World/Mushroom.cpp index ca8a8554..6b20e0d1 100644 --- a/Minecraft.World/Mushroom.cpp +++ b/Minecraft.World/Mushroom.cpp @@ -77,7 +77,7 @@ bool Mushroom::growTree(Level *level, int x, int y, int z, Random *random) int data = level->getData(x, y, z); level->removeTile(x, y, z); - Feature *f = nullptr; + Feature *f = NULL; if (id == Tile::mushroom_brown_Id) { @@ -88,14 +88,14 @@ bool Mushroom::growTree(Level *level, int x, int y, int z, Random *random) f = new HugeMushroomFeature(1); } - if (f == nullptr || !f->place(level, random, x, y, z)) + if (f == NULL || !f->place(level, random, x, y, z)) { level->setTileAndData(x, y, z, id, data, Tile::UPDATE_ALL); - if( f != nullptr ) + if( f != NULL ) delete f; return false; } - if( f != nullptr ) + if( f != NULL ) delete f; return true; } \ No newline at end of file diff --git a/Minecraft.World/MushroomCow.cpp b/Minecraft.World/MushroomCow.cpp index 2b274215..0f88c843 100644 --- a/Minecraft.World/MushroomCow.cpp +++ b/Minecraft.World/MushroomCow.cpp @@ -24,36 +24,36 @@ MushroomCow::MushroomCow(Level *level) : Cow(level) bool MushroomCow::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != nullptr && item->id == Item::bowl_Id && getAge() >= 0) + if (item != NULL && item->id == Item::bowl_Id && getAge() >= 0) { if (item->count == 1) { - player->inventory->setItem(player->inventory->selected, std::make_shared(Item::mushroomStew)); + player->inventory->setItem(player->inventory->selected, shared_ptr( new ItemInstance(Item::mushroomStew) ) ); return true; } - if (player->inventory->add(std::make_shared(Item::mushroomStew)) && !player->abilities.instabuild) + if (player->inventory->add(shared_ptr(new ItemInstance(Item::mushroomStew))) && !player->abilities.instabuild) { player->inventory->removeItem(player->inventory->selected, 1); return true; } } // 4J: Do not allow shearing if we can't create more cows - if (item != nullptr && item->id == Item::shears_Id && getAge() >= 0 && level->canCreateMore(eTYPE_COW, Level::eSpawnType_Breed)) + if (item != NULL && item->id == Item::shears_Id && getAge() >= 0 && level->canCreateMore(eTYPE_COW, Level::eSpawnType_Breed)) { remove(); level->addParticle(eParticleType_largeexplode, x, y + bbHeight / 2, z, 0, 0, 0); if(!level->isClientSide) { remove(); - shared_ptr cow = std::make_shared(level); + shared_ptr cow = shared_ptr( new Cow(level) ); cow->moveTo(x, y, z, yRot, xRot); cow->setHealth(getHealth()); cow->yBodyRot = yBodyRot; level->addEntity(cow); for (int i = 0; i < 5; i++) { - level->addEntity(std::make_shared(level, x, y + bbHeight, z, shared_ptr(new ItemInstance(Tile::mushroom_red)))); + level->addEntity( shared_ptr( new ItemEntity(level, x, y + bbHeight, z, shared_ptr( new ItemInstance(Tile::mushroom_red))) )); } return true; } @@ -76,7 +76,7 @@ shared_ptr MushroomCow::getBreedOffspring(shared_ptr targe // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return std::make_shared(level); + return shared_ptr( new MushroomCow(level) ); } else { diff --git a/Minecraft.World/MushroomIslandBiome.cpp b/Minecraft.World/MushroomIslandBiome.cpp index 91bd8097..fa7eafdb 100644 --- a/Minecraft.World/MushroomIslandBiome.cpp +++ b/Minecraft.World/MushroomIslandBiome.cpp @@ -13,7 +13,7 @@ MushroomIslandBiome::MushroomIslandBiome(int id) : Biome(id) decorator->mushroomCount = 1; decorator->hugeMushrooms = 1; - topMaterial = static_cast(Tile::mycel_Id); + topMaterial = (byte) Tile::mycel_Id; enemies.clear(); friendlies.clear(); diff --git a/Minecraft.World/MusicTileEntity.cpp b/Minecraft.World/MusicTileEntity.cpp index 7f2f2888..d947cc69 100644 --- a/Minecraft.World/MusicTileEntity.cpp +++ b/Minecraft.World/MusicTileEntity.cpp @@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag) void MusicTileEntity::tune() { - note = static_cast((note + 1) % 25); + note = (byte) ((note + 1) % 25); setChanged(); } @@ -55,7 +55,7 @@ void MusicTileEntity::playNote(Level *level, int x, int y, int z) // 4J Added shared_ptr MusicTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new MusicTileEntity() ); TileEntity::clone(result); result->note = note; diff --git a/Minecraft.World/MycelTile.cpp b/Minecraft.World/MycelTile.cpp index 76b742e3..875a598d 100644 --- a/Minecraft.World/MycelTile.cpp +++ b/Minecraft.World/MycelTile.cpp @@ -6,8 +6,8 @@ MycelTile::MycelTile(int id) : Tile(id, Material::grass) { - iconTop = nullptr; - iconSnowSide = nullptr; + iconTop = NULL; + iconSnowSide = NULL; setTicking(true); } diff --git a/Minecraft.World/NameTagItem.cpp b/Minecraft.World/NameTagItem.cpp index fc9b80b4..9c11f2af 100644 --- a/Minecraft.World/NameTagItem.cpp +++ b/Minecraft.World/NameTagItem.cpp @@ -10,7 +10,7 @@ bool NameTagItem::interactEnemy(shared_ptr itemInstance, shared_pt { if (!itemInstance->hasCustomHoverName()) return false; - if ( (target != nullptr) && target->instanceof(eTYPE_MOB) ) + if ( (target != NULL) && target->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(target); mob->setCustomName(itemInstance->getHoverName()); diff --git a/Minecraft.World/NbtIo.cpp b/Minecraft.World/NbtIo.cpp index 7e566114..b6c63277 100644 --- a/Minecraft.World/NbtIo.cpp +++ b/Minecraft.World/NbtIo.cpp @@ -52,11 +52,11 @@ CompoundTag *NbtIo::read(DataInput *dis) { Tag *tag = Tag::readNamedTag(dis); - if( tag->getId() == Tag::TAG_Compound ) return static_cast(tag); + if( tag->getId() == Tag::TAG_Compound ) return (CompoundTag *)tag; - if(tag!=nullptr) delete tag; + if(tag!=NULL) delete tag; // Root tag must be a named compound tag - return nullptr; + return NULL; } void NbtIo::write(CompoundTag *tag, DataOutput *dos) diff --git a/Minecraft.World/NbtSlotFile.cpp b/Minecraft.World/NbtSlotFile.cpp index 96a27993..bb820ce0 100644 --- a/Minecraft.World/NbtSlotFile.cpp +++ b/Minecraft.World/NbtSlotFile.cpp @@ -14,12 +14,12 @@ NbtSlotFile::NbtSlotFile(File file) if ( !file.exists() || file.length() ) { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); writeHeader(); } else { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); } readHeader(); @@ -34,7 +34,7 @@ NbtSlotFile::NbtSlotFile(File file) { seekSlotHeader(fileSlot); short slot; - ReadFile(raf,&slot,2,&numberofBytesRead,nullptr); + ReadFile(raf,&slot,2,&numberofBytesRead,NULL); if (slot == 0) { freeFileSlots.push_back(fileSlot); @@ -52,12 +52,12 @@ void NbtSlotFile::readHeader() DWORD numberOfBytesRead; SetFilePointer(raf,0,0,FILE_BEGIN); int magic; - ReadFile(raf,&magic,4,&numberOfBytesRead,nullptr); + ReadFile(raf,&magic,4,&numberOfBytesRead,NULL); // if (magic != MAGIC_NUMBER) throw new IOException("Bad magic number: " + magic); // 4J - TODO short version; - ReadFile(raf,&version,2,&numberOfBytesRead,nullptr); + ReadFile(raf,&version,2,&numberOfBytesRead,NULL); // if (version != 0) throw new IOException("Bad version number: " + version); // 4J - TODO - ReadFile(raf,&totalFileSlots,4,&numberOfBytesRead,nullptr); + ReadFile(raf,&totalFileSlots,4,&numberOfBytesRead,NULL); } void NbtSlotFile::writeHeader() @@ -65,9 +65,9 @@ void NbtSlotFile::writeHeader() DWORD numberOfBytesWritten; short version = 0; SetFilePointer(raf,0,0,FILE_BEGIN); - WriteFile(raf,&MAGIC_NUMBER,4,&numberOfBytesWritten,nullptr); - WriteFile(raf,&version,2,&numberOfBytesWritten,nullptr); - WriteFile(raf,&totalFileSlots,4,&numberOfBytesWritten,nullptr); + WriteFile(raf,&MAGIC_NUMBER,4,&numberOfBytesWritten,NULL); + WriteFile(raf,&version,2,&numberOfBytesWritten,NULL); + WriteFile(raf,&totalFileSlots,4,&numberOfBytesWritten,NULL); } void NbtSlotFile::seekSlotHeader(int fileSlot) @@ -98,12 +98,12 @@ vector *NbtSlotFile::readAll(int slot) { seekSlotHeader(c); short oldSlot; - ReadFile(raf,&oldSlot,2,&numberOfBytesRead,nullptr); + ReadFile(raf,&oldSlot,2,&numberOfBytesRead,NULL); short size; - ReadFile(raf,&size,2,&numberOfBytesRead,nullptr); - ReadFile(raf,&continuesAt,4,&numberOfBytesRead,nullptr); + ReadFile(raf,&size,2,&numberOfBytesRead,NULL); + ReadFile(raf,&continuesAt,4,&numberOfBytesRead,NULL); int lastSlot; - ReadFile(raf,&lastSlot,4,&numberOfBytesRead,nullptr); + ReadFile(raf,&lastSlot,4,&numberOfBytesRead,NULL); seekSlot(c); if (expectedSlot > 0 && oldSlot == -expectedSlot) @@ -112,7 +112,7 @@ vector *NbtSlotFile::readAll(int slot) goto fileSlotLoop; // 4J - used to be continue fileSlotLoop, with for loop labelled as fileSlotLoop } - ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,nullptr); + ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,NULL); if (continuesAt >= 0) { @@ -203,13 +203,13 @@ void NbtSlotFile::replaceSlot(int slot, vector *tags) } seekSlotHeader(fileSlot); - WriteFile(raf,¤tSlot,2,&numberOfBytesWritten,nullptr); - WriteFile(raf,&toWrite,2,&numberOfBytesWritten,nullptr); - WriteFile(raf,&nextFileSlot,4,&numberOfBytesWritten,nullptr); - WriteFile(raf,&lastFileSlot,4,&numberOfBytesWritten,nullptr); + WriteFile(raf,¤tSlot,2,&numberOfBytesWritten,NULL); + WriteFile(raf,&toWrite,2,&numberOfBytesWritten,NULL); + WriteFile(raf,&nextFileSlot,4,&numberOfBytesWritten,NULL); + WriteFile(raf,&lastFileSlot,4,&numberOfBytesWritten,NULL); seekSlot(fileSlot); - WriteFile(raf,compressed.data+pos,toWrite,&numberOfBytesWritten,nullptr); + WriteFile(raf,compressed.data+pos,toWrite,&numberOfBytesWritten,NULL); if (remaining > 0) { @@ -227,7 +227,7 @@ void NbtSlotFile::replaceSlot(int slot, vector *tags) seekSlotHeader(c); short zero = 0; - WriteFile(raf,&zero,2,&numberOfBytesWritten,nullptr); + WriteFile(raf,&zero,2,&numberOfBytesWritten,NULL); } toReplace->clear(); diff --git a/Minecraft.World/NearestAttackableTargetGoal.cpp b/Minecraft.World/NearestAttackableTargetGoal.cpp index c6b75481..7ddd8895 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/NearestAttackableTargetGoal.cpp @@ -18,7 +18,7 @@ SubselectEntitySelector::~SubselectEntitySelector() bool SubselectEntitySelector::matches(shared_ptr entity) const { if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; - if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; + if (m_subselector != NULL && !m_subselector->matches(entity)) return false; return m_parent->canAttack(dynamic_pointer_cast(entity), false); } @@ -37,7 +37,7 @@ bool NearestAttackableTargetGoal::DistComp::operator() (shared_ptr e1, s return false; } -NearestAttackableTargetGoal::NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach /*= false*/, EntitySelector *entitySelector /* =nullptr */) +NearestAttackableTargetGoal::NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach /*= false*/, EntitySelector *entitySelector /* =NULL */) : TargetGoal(mob, mustSee, mustReach), targetType(targetType) { this->randomInterval = randomInterval; @@ -61,7 +61,7 @@ bool NearestAttackableTargetGoal::canUse() vector > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within), selector); bool result = false; - if(entities != nullptr && !entities->empty() ) + if(entities != NULL && !entities->empty() ) { std::sort(entities->begin(), entities->end(), *distComp); target = weak_ptr(dynamic_pointer_cast(entities->at(0))); diff --git a/Minecraft.World/NearestAttackableTargetGoal.h b/Minecraft.World/NearestAttackableTargetGoal.h index 2bdb81ec..1ba6c519 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.h +++ b/Minecraft.World/NearestAttackableTargetGoal.h @@ -41,7 +41,7 @@ private: weak_ptr target; public: - NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = nullptr); + NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = NULL); virtual ~NearestAttackableTargetGoal(); diff --git a/Minecraft.World/NetherBridgeFeature.cpp b/Minecraft.World/NetherBridgeFeature.cpp index e78002ec..d661d3b7 100644 --- a/Minecraft.World/NetherBridgeFeature.cpp +++ b/Minecraft.World/NetherBridgeFeature.cpp @@ -15,13 +15,13 @@ NetherBridgeFeature::NetherBridgeFeature() : StructureFeature() bridgeEnemies.push_back(new Biome::MobSpawnerData(eTYPE_SKELETON, 10, 4, 4)); bridgeEnemies.push_back(new Biome::MobSpawnerData(eTYPE_LAVASLIME, 3, 4, 4)); isSpotSelected=false; - netherFortressPos = nullptr; + netherFortressPos = NULL; } NetherBridgeFeature::~NetherBridgeFeature() { - if( netherFortressPos != nullptr ) delete netherFortressPos; + if( netherFortressPos != NULL ) delete netherFortressPos; } wstring NetherBridgeFeature::getFeatureName() @@ -57,7 +57,7 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_NetherBridge); } @@ -118,7 +118,7 @@ NetherBridgeFeature::NetherBridgeStart::NetherBridgeStart(Level *level, Random * vector *pendingChildren = &start->pendingChildren; while (!pendingChildren->empty()) { - int pos = random->nextInt(static_cast(pendingChildren->size())); + int pos = random->nextInt((int)pendingChildren->size()); auto it = pendingChildren->begin() + pos; StructurePiece *structurePiece = *it; pendingChildren->erase(it); diff --git a/Minecraft.World/NetherBridgePieces.cpp b/Minecraft.World/NetherBridgePieces.cpp index d9fbbf35..35baa71a 100644 --- a/Minecraft.World/NetherBridgePieces.cpp +++ b/Minecraft.World/NetherBridgePieces.cpp @@ -79,7 +79,7 @@ NetherBridgePieces::PieceWeight *NetherBridgePieces::castlePieceWeights[NetherBr NetherBridgePieces::NetherBridgePiece *NetherBridgePieces::findAndCreateBridgePieceFactory(NetherBridgePieces::PieceWeight *piece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { EPieceClass pieceClass = piece->pieceClass; - NetherBridgePiece *structurePiece = nullptr; + NetherBridgePiece *structurePiece = NULL; if (pieceClass == EPieceClass_BridgeStraight) { @@ -204,7 +204,7 @@ NetherBridgePieces::NetherBridgePiece *NetherBridgePieces::NetherBridgePiece::ge } NetherBridgePiece *structurePiece = findAndCreateBridgePieceFactory(piece, pieces, random, footX, footY, footZ, direction, depth); - if (structurePiece != nullptr) + if (structurePiece != NULL) { piece->placeCount++; startPiece->previousPiece = piece; @@ -236,7 +236,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateAndAddPiece(Start availablePieces = &startPiece->availableCastlePieces; } StructurePiece *newPiece = generatePiece(startPiece, availablePieces, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != nullptr) + if (newPiece != NULL) { pieces->push_back(newPiece); startPiece->pendingChildren.push_back(newPiece); @@ -257,7 +257,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildForward(Star case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + yOff, boundingBox->z0 + xOff, orientation, getGenDepth(), isCastle); } - return nullptr; + return NULL; } StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff, bool isCastle) @@ -273,7 +273,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildLeft(StartPi case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth(), isCastle); } - return nullptr; + return NULL; } StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff, bool isCastle) @@ -289,14 +289,14 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildRight(StartP case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth(), isCastle); } - return nullptr; + return NULL; } bool NetherBridgePieces::NetherBridgePiece::isOkBox(BoundingBox *box, StartPiece *startPiece) { bool bIsOk = false; - if(box != nullptr) + if(box != NULL) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; int xzSize = (startPiece->m_level->getLevelData()->getXZSize() / startPiece->m_level->getLevelData()->getHellScale()); //HellRandomLevelSource::XZSIZE; @@ -368,20 +368,20 @@ NetherBridgePieces::BridgeStraight::BridgeStraight(int genDepth, Random *random, void NetherBridgePieces::BridgeStraight::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 1, 3, false); + generateChildForward((StartPiece *) startPiece, pieces, random, 1, 3, false); } NetherBridgePieces::BridgeStraight *NetherBridgePieces::BridgeStraight::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new BridgeStraight(genDepth, random, box, direction); @@ -441,13 +441,13 @@ NetherBridgePieces::BridgeEndFiller *NetherBridgePieces::BridgeEndFiller::create { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new BridgeEndFiller(genDepth, random, box, direction); @@ -540,22 +540,22 @@ NetherBridgePieces::BridgeCrossing::BridgeCrossing(Random *random, int west, int void NetherBridgePieces::BridgeCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 8, 3, false); - generateChildLeft(static_cast(startPiece), pieces, random, 3, 8, false); - generateChildRight(static_cast(startPiece), pieces, random, 3, 8, false); + generateChildForward((StartPiece *) startPiece, pieces, random, 8, 3, false); + generateChildLeft((StartPiece *) startPiece, pieces, random, 3, 8, false); + generateChildRight((StartPiece *) startPiece, pieces, random, 3, 8, false); } NetherBridgePieces::BridgeCrossing *NetherBridgePieces::BridgeCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -8, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new BridgeCrossing(genDepth, random, box, direction); @@ -612,12 +612,12 @@ bool NetherBridgePieces::BridgeCrossing::postProcess(Level *level, Random *rando NetherBridgePieces::StartPiece::StartPiece() { // for reflection - previousPiece = nullptr; + previousPiece = NULL; } NetherBridgePieces::StartPiece::StartPiece(Random *random, int west, int north, Level *level) : BridgeCrossing(random, west, north) { - previousPiece = nullptr; + previousPiece = NULL; m_level = level; for( int i = 0; i < BRIDGE_PIECEWEIGHTS_COUNT; i++ ) @@ -659,22 +659,22 @@ NetherBridgePieces::RoomCrossing::RoomCrossing(int genDepth, Random *random, Bou void NetherBridgePieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 2, 0, false); - generateChildLeft(static_cast(startPiece), pieces, random, 0, 2, false); - generateChildRight(static_cast(startPiece), pieces, random, 0, 2, false); + generateChildForward((StartPiece *) startPiece, pieces, random, 2, 0, false); + generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 2, false); + generateChildRight((StartPiece *) startPiece, pieces, random, 0, 2, false); } NetherBridgePieces::RoomCrossing *NetherBridgePieces::RoomCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new RoomCrossing(genDepth, random, box, direction); @@ -731,20 +731,20 @@ NetherBridgePieces::StairsRoom::StairsRoom(int genDepth, Random *random, Boundin void NetherBridgePieces::StairsRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildRight(static_cast(startPiece), pieces, random, 6, 2, false); + generateChildRight((StartPiece *) startPiece, pieces, random, 6, 2, false); } NetherBridgePieces::StairsRoom *NetherBridgePieces::StairsRoom::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new StairsRoom(genDepth, random, box, direction); @@ -812,13 +812,13 @@ NetherBridgePieces::MonsterThrone *NetherBridgePieces::MonsterThrone::createPiec { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new MonsterThrone(genDepth, random, box, direction); @@ -873,7 +873,7 @@ bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (entity != nullptr) entity->getSpawner()->setEntityId(L"Blaze"); + if (entity != NULL) entity->getSpawner()->setEntityId(L"Blaze"); } } @@ -901,20 +901,20 @@ NetherBridgePieces::CastleEntrance::CastleEntrance(int genDepth, Random *random, void NetherBridgePieces::CastleEntrance::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 5, 3, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 5, 3, true); } NetherBridgePieces::CastleEntrance *NetherBridgePieces::CastleEntrance::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleEntrance(genDepth, random, box, direction); @@ -1030,21 +1030,21 @@ NetherBridgePieces::CastleStalkRoom::CastleStalkRoom(int genDepth, Random *rando void NetherBridgePieces::CastleStalkRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 5, 3, true); - generateChildForward(static_cast(startPiece), pieces, random, 5, 11, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 5, 3, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 5, 11, true); } NetherBridgePieces::CastleStalkRoom *NetherBridgePieces::CastleStalkRoom::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleStalkRoom(genDepth, random, box, direction); @@ -1196,7 +1196,7 @@ NetherBridgePieces::CastleSmallCorridorPiece::CastleSmallCorridorPiece(int genDe void NetherBridgePieces::CastleSmallCorridorPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 1, 0, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); } NetherBridgePieces::CastleSmallCorridorPiece *NetherBridgePieces::CastleSmallCorridorPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1204,13 +1204,13 @@ NetherBridgePieces::CastleSmallCorridorPiece *NetherBridgePieces::CastleSmallCor BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleSmallCorridorPiece(genDepth, random, box, direction); @@ -1259,22 +1259,22 @@ NetherBridgePieces::CastleSmallCorridorCrossingPiece::CastleSmallCorridorCrossin void NetherBridgePieces::CastleSmallCorridorCrossingPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 1, 0, true); - generateChildLeft(static_cast(startPiece), pieces, random, 0, 1, true); - generateChildRight(static_cast(startPiece), pieces, random, 0, 1, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); + generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 1, true); + generateChildRight((StartPiece *) startPiece, pieces, random, 0, 1, true); } NetherBridgePieces::CastleSmallCorridorCrossingPiece *NetherBridgePieces::CastleSmallCorridorCrossingPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleSmallCorridorCrossingPiece(genDepth, random, box, direction); @@ -1337,20 +1337,20 @@ void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addAdditonalSaveData void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildRight(static_cast(startPiece), pieces, random, 0, 1, true); + generateChildRight((StartPiece *) startPiece, pieces, random, 0, 1, true); } NetherBridgePieces::CastleSmallCorridorRightTurnPiece *NetherBridgePieces::CastleSmallCorridorRightTurnPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleSmallCorridorRightTurnPiece(genDepth, random, box, direction); @@ -1429,20 +1429,20 @@ void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addAdditonalSaveData( void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildLeft(static_cast(startPiece), pieces, random, 0, 1, true); + generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 1, true); } NetherBridgePieces::CastleSmallCorridorLeftTurnPiece *NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleSmallCorridorLeftTurnPiece(genDepth, random, box, direction); @@ -1505,20 +1505,20 @@ NetherBridgePieces::CastleCorridorStairsPiece::CastleCorridorStairsPiece(int gen void NetherBridgePieces::CastleCorridorStairsPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward(static_cast(startPiece), pieces, random, 1, 0, true); + generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); } NetherBridgePieces::CastleCorridorStairsPiece *NetherBridgePieces::CastleCorridorStairsPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -7, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleCorridorStairsPiece(genDepth, random, box, direction); @@ -1586,21 +1586,21 @@ void NetherBridgePieces::CastleCorridorTBalconyPiece::addChildren(StructurePiece zOff = 5; } - generateChildLeft(static_cast(startPiece), pieces, random, 0, zOff, random->nextInt(8) > 0); - generateChildRight(static_cast(startPiece), pieces, random, 0, zOff, random->nextInt(8) > 0); + generateChildLeft((StartPiece *) startPiece, pieces, random, 0, zOff, random->nextInt(8) > 0); + generateChildRight((StartPiece *) startPiece, pieces, random, 0, zOff, random->nextInt(8) > 0); } NetherBridgePieces::CastleCorridorTBalconyPiece *NetherBridgePieces::CastleCorridorTBalconyPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -3, 0, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new CastleCorridorTBalconyPiece(genDepth, random, box, direction); diff --git a/Minecraft.World/NetherWartTile.cpp b/Minecraft.World/NetherWartTile.cpp index afe45aec..add3eccf 100644 --- a/Minecraft.World/NetherWartTile.cpp +++ b/Minecraft.World/NetherWartTile.cpp @@ -84,7 +84,7 @@ void NetherWartTile::spawnResources(Level *level, int x, int y, int z, int data, } for (int i = 0; i < count; i++) { - popResource(level, x, y, z, std::make_shared(Item::netherwart_seeds)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::netherwart_seeds))); } } diff --git a/Minecraft.World/Node.cpp b/Minecraft.World/Node.cpp index 408370a0..7059c045 100644 --- a/Minecraft.World/Node.cpp +++ b/Minecraft.World/Node.cpp @@ -10,7 +10,7 @@ void Node::_init() closed = false; - cameFrom = nullptr; + cameFrom = NULL; } Node::Node(const int x, const int y, const int z) : @@ -35,9 +35,9 @@ int Node::createHash(const int x, const int y, const int z) float Node::distanceTo(Node *to) { - float xd = static_cast(to->x - x); - float yd = static_cast(to->y - y); - float zd = static_cast(to->z - z); + float xd = (float) ( to->x - x ); + float yd = (float) ( to->y - y ); + float zd = (float) ( to->z - z ); return Mth::sqrt(xd * xd + yd * yd + zd * zd); } @@ -52,7 +52,7 @@ float Node::distanceToSqr(Node *to) bool Node::equals(Node *o) { //4J Jev, never used anything other than a node. - //if (dynamic_cast((Node *) o) != nullptr) + //if (dynamic_cast((Node *) o) != NULL) //{ return hash == o->hash && x == o->x && y == o->y && z == o->z; //} diff --git a/Minecraft.World/NotGateTile.cpp b/Minecraft.World/NotGateTile.cpp index 969778d8..8d41c839 100644 --- a/Minecraft.World/NotGateTile.cpp +++ b/Minecraft.World/NotGateTile.cpp @@ -233,7 +233,7 @@ void NotGateTile::levelTimeChanged(Level *level, int64_t delta, int64_t newTime) { deque *toggles = recentToggles[level]; - if (toggles != nullptr) + if (toggles != NULL) { for (auto& toggle : *toggles) { diff --git a/Minecraft.World/NoteBlockTile.cpp b/Minecraft.World/NoteBlockTile.cpp index cafa0c4d..25ea587a 100644 --- a/Minecraft.World/NoteBlockTile.cpp +++ b/Minecraft.World/NoteBlockTile.cpp @@ -14,7 +14,7 @@ void NoteBlockTile::neighborChanged(Level *level, int x, int y, int z, int type) bool signal = level->hasNeighborSignal(x, y, z); shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); app.DebugPrintf("-------- Signal is %s, tile is currently %s\n",signal?"TRUE":"FALSE", mte->on?"ON":"OFF"); - if (mte != nullptr && mte->on != signal) + if (mte != NULL && mte->on != signal) { if (signal) { @@ -35,7 +35,7 @@ bool NoteBlockTile::use(Level *level, int x, int y, int z, shared_ptr pl if (soundOnly) return false; if (level->isClientSide) return true; shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (mte != nullptr ) + if (mte != NULL ) { mte->tune(); mte->playNote(level, x, y, z); @@ -47,17 +47,17 @@ void NoteBlockTile::attack(Level *level, int x, int y, int z, shared_ptr { if (level->isClientSide) return; shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( mte != nullptr ) mte->playNote(level, x, y, z); + if( mte != NULL ) mte->playNote(level, x, y, z); } shared_ptr NoteBlockTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr( new MusicTileEntity() ); } bool NoteBlockTile::triggerEvent(Level *level, int x, int y, int z, int i, int note) { - float pitch = static_cast(pow(2, (note - 12) / 12.0)); + float pitch = (float) pow(2, (note - 12) / 12.0); int iSound; switch(i) diff --git a/Minecraft.World/Ocelot.cpp b/Minecraft.World/Ocelot.cpp index 75c6e0f0..50285682 100644 --- a/Minecraft.World/Ocelot.cpp +++ b/Minecraft.World/Ocelot.cpp @@ -57,7 +57,7 @@ void Ocelot::defineSynchedData() { TamableAnimal::defineSynchedData(); - entityData->define(DATA_TYPE_ID, static_cast(0)); + entityData->define(DATA_TYPE_ID, (byte) 0); } void Ocelot::serverAiMobStep() @@ -199,7 +199,7 @@ bool Ocelot::mobInteract(shared_ptr player) } else { - if (temptGoal->isRunning() && item != nullptr && item->id == Item::fish_raw_Id && player->distanceToSqr(shared_from_this()) < 3 * 3) + if (temptGoal->isRunning() && item != NULL && item->id == Item::fish_raw_Id && player->distanceToSqr(shared_from_this()) < 3 * 3) { // 4J-PB - don't lose the fish in creative mode if (!player->abilities.instabuild) item->count--; @@ -240,7 +240,7 @@ shared_ptr Ocelot::getBreedOffspring(shared_ptr target) // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - shared_ptr offspring = std::make_shared(level); + shared_ptr offspring = shared_ptr( new Ocelot(level) ); if (isTame()) { offspring->setOwnerUUID(getOwnerUUID()); @@ -257,7 +257,7 @@ shared_ptr Ocelot::getBreedOffspring(shared_ptr target) bool Ocelot::isFood(shared_ptr itemInstance) { - return itemInstance != nullptr && itemInstance->id == Item::fish_raw_Id; + return itemInstance != NULL && itemInstance->id == Item::fish_raw_Id; } bool Ocelot::canMate(shared_ptr animal) @@ -266,7 +266,7 @@ bool Ocelot::canMate(shared_ptr animal) if (!isTame()) return false; shared_ptr partner = dynamic_pointer_cast(animal); - if (partner == nullptr) return false; + if (partner == NULL) return false; if (!partner->isTame()) return false; return isInLove() && partner->isInLove(); @@ -279,7 +279,7 @@ int Ocelot::getCatType() void Ocelot::setCatType(int type) { - entityData->set(DATA_TYPE_ID, static_cast(type)); + entityData->set(DATA_TYPE_ID, (byte) type); } bool Ocelot::canSpawn() @@ -339,7 +339,7 @@ MobGroupData *Ocelot::finalizeMobSpawn(MobGroupData *groupData, int extraData /* { for (int kitten = 0; kitten < 2; kitten++) { - shared_ptr ocelot = std::make_shared(level); + shared_ptr ocelot = shared_ptr( new Ocelot(level) ); ocelot->moveTo(x, y, z, yRot, 0); ocelot->setAge(-20 * 60 * 20); level->addEntity(ocelot); @@ -351,7 +351,7 @@ MobGroupData *Ocelot::finalizeMobSpawn(MobGroupData *groupData, int extraData /* void Ocelot::setSittingOnTile(bool val) { byte current = entityData->getByte(DATA_FLAGS_ID); - entityData->set(DATA_FLAGS_ID, val ? static_cast(current | 0x02) : static_cast(current & ~0x02) ); + entityData->set(DATA_FLAGS_ID, val ? (byte) (current | 0x02) : (byte) (current & ~0x02) ); } bool Ocelot::isSittingOnTile() diff --git a/Minecraft.World/OcelotAttackGoal.cpp b/Minecraft.World/OcelotAttackGoal.cpp index 9871de2f..d9e0f29b 100644 --- a/Minecraft.World/OcelotAttackGoal.cpp +++ b/Minecraft.World/OcelotAttackGoal.cpp @@ -21,14 +21,14 @@ OcelotAttackGoal::OcelotAttackGoal(Mob *mob) bool OcelotAttackGoal::canUse() { shared_ptr bestTarget = mob->getTarget(); - if (bestTarget == nullptr) return false; + if (bestTarget == NULL) return false; target = weak_ptr(bestTarget); return true; } bool OcelotAttackGoal::canContinueToUse() { - if (target.lock() == nullptr || !target.lock()->isAlive()) return false; + if (target.lock() == NULL || !target.lock()->isAlive()) return false; if (mob->distanceToSqr(target.lock()) > 15 * 15) return false; return !mob->getNavigation()->isDone() || canUse(); } diff --git a/Minecraft.World/OcelotSitOnTileGoal.cpp b/Minecraft.World/OcelotSitOnTileGoal.cpp index 09b98650..a35537fb 100644 --- a/Minecraft.World/OcelotSitOnTileGoal.cpp +++ b/Minecraft.World/OcelotSitOnTileGoal.cpp @@ -41,7 +41,7 @@ bool OcelotSitOnTileGoal::canContinueToUse() void OcelotSitOnTileGoal::start() { - ocelot->getNavigation()->moveTo(static_cast(tileX) + 0.5, tileY + 1, static_cast(tileZ) + 0.5, speedModifier); + ocelot->getNavigation()->moveTo((float) tileX + 0.5, tileY + 1, (float) tileZ + 0.5, speedModifier); _tick = 0; tryTicks = 0; maxTicks = ocelot->getRandom()->nextInt(ocelot->getRandom()->nextInt(SIT_TICKS) + SIT_TICKS) + SIT_TICKS; @@ -64,7 +64,7 @@ void OcelotSitOnTileGoal::tick() if (ocelot->distanceToSqr(tileX, tileY + 1, tileZ) > 1) { ocelot->setSitting(false); - ocelot->getNavigation()->moveTo(static_cast(tileX) + 0.5, tileY + 1, static_cast(tileZ) + 0.5, speedModifier); + ocelot->getNavigation()->moveTo((float) tileX + 0.5, tileY + 1, (float) tileZ + 0.5, speedModifier); tryTicks++; } else if (!ocelot->isSitting()) @@ -79,12 +79,12 @@ void OcelotSitOnTileGoal::tick() bool OcelotSitOnTileGoal::findNearestTile() { - int y = static_cast(ocelot->y); + int y = (int) ocelot->y; double distSqr = Integer::MAX_VALUE; - for (int x = static_cast(ocelot->x) - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE; x++) + for (int x = (int) ocelot->x - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE; x++) { - for (int z = static_cast(ocelot->z) - SEARCH_RANGE; z < ocelot->z + SEARCH_RANGE; z++) + for (int z = (int) ocelot->z - SEARCH_RANGE; z < ocelot->z + SEARCH_RANGE; z++) { if (isValidTarget(ocelot->level, x, y, z) && ocelot->level->isEmptyTile(x, y + 1, z)) { diff --git a/Minecraft.World/OfferFlowerGoal.cpp b/Minecraft.World/OfferFlowerGoal.cpp index 2951b5ff..b604ea84 100644 --- a/Minecraft.World/OfferFlowerGoal.cpp +++ b/Minecraft.World/OfferFlowerGoal.cpp @@ -17,12 +17,12 @@ bool OfferFlowerGoal::canUse() if (!golem->level->isDay()) return false; if (golem->getRandom()->nextInt(8000) != 0) return false; villager = weak_ptr(dynamic_pointer_cast( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) )); - return villager.lock() != nullptr; + return villager.lock() != NULL; } bool OfferFlowerGoal::canContinueToUse() { - return _tick > 0 && villager.lock() != nullptr; + return _tick > 0 && villager.lock() != NULL; } void OfferFlowerGoal::start() diff --git a/Minecraft.World/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index 9a8822fa..983c517d 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -9,7 +9,7 @@ #include "FileHeader.h" #include "OldChunkStorage.h" DWORD OldChunkStorage::tlsIdx = 0; -OldChunkStorage::ThreadStorage *OldChunkStorage::tlsDefault = nullptr; +OldChunkStorage::ThreadStorage *OldChunkStorage::tlsDefault = NULL; OldChunkStorage::ThreadStorage::ThreadStorage() { @@ -30,7 +30,7 @@ OldChunkStorage::ThreadStorage::~ThreadStorage() void OldChunkStorage::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == nullptr ) + if(tlsDefault == NULL ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -45,7 +45,7 @@ void OldChunkStorage::UseDefaultThreadStorage() void OldChunkStorage::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if( tls == tlsDefault ) return; delete tls; @@ -126,14 +126,14 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) char buf[256]; sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x,z); app.DebugPrintf(buf); - return nullptr; + return NULL; } if (!tag->getCompound(L"Level")->contains(L"Blocks")) { char buf[256]; sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x,z); app.DebugPrintf(buf); - return nullptr; + return NULL; } LevelChunk *levelChunk = OldChunkStorage::load(level, tag->getCompound(L"Level")); if (!levelChunk->isAt(x, z)) @@ -152,7 +152,7 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) // e.printStackTrace(); // } } - return nullptr; + return NULL; } void OldChunkStorage::save(Level *level, LevelChunk *levelChunk) @@ -277,7 +277,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) PIXBeginNamedEvent(0,"Saving tile tick data"); vector *ticksInChunk = level->fetchTicksInChunk(lc, false); - if (ticksInChunk != nullptr) + if (ticksInChunk != NULL) { int64_t levelTime = level->getGameTime(); @@ -290,7 +290,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) teTag->putInt(L"x", td.x); teTag->putInt(L"y", td.y); teTag->putInt(L"z", td.z); - teTag->putInt(L"t", static_cast(td.m_delay - levelTime)); + teTag->putInt(L"t", (int) (td.m_delay - levelTime)); tickTags->add(teTag); } @@ -318,7 +318,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) // Will be fine so long as we only actually create tags for once chunk at a time. // 4J Stu - As we now save on multiple threads, the static data has been moved to TLS - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); PIXBeginNamedEvent(0,"Getting block data"); //static byteArray blockData = byteArray(32768); @@ -365,7 +365,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) PIXBeginNamedEvent(0,"Saving tile tick data"); vector *ticksInChunk = level->fetchTicksInChunk(lc, false); - if (ticksInChunk != nullptr) + if (ticksInChunk != NULL) { int64_t levelTime = level->getGameTime(); @@ -378,7 +378,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) teTag->putInt(L"x", td.x); teTag->putInt(L"y", td.y); teTag->putInt(L"z", td.z); - teTag->putInt(L"t", static_cast(td.m_delay - levelTime)); + teTag->putInt(L"t", (int) (td.m_delay - levelTime)); teTag->putInt(L"p", td.priorityTilt); tickTags->add(teTag); @@ -393,14 +393,14 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *tag) { ListTag *entityTags = (ListTag *) tag->getList(L"Entities"); - if (entityTags != nullptr) + if (entityTags != NULL) { for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); shared_ptr te = EntityIO::loadStatic(teTag, level); lc->lastSaveHadEntities = true; - if (te != nullptr) + if (te != NULL) { lc->addEntity(te); } @@ -408,13 +408,13 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta } ListTag *tileEntityTags = (ListTag *) tag->getList(L"TileEntities"); - if (tileEntityTags != nullptr) + if (tileEntityTags != NULL) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if (te != nullptr) + if (te != NULL) { lc->addTileEntity(te); } @@ -476,7 +476,7 @@ LevelChunk *OldChunkStorage::load(Level *level, DataInputStream *dis) PIXBeginNamedEvent(0,"Loading TileTicks"); ListTag *tileTicks = (ListTag *) tag->getList(L"TileTicks"); - if (tileTicks != nullptr) + if (tileTicks != NULL) { for (int i = 0; i < tileTicks->size(); i++) { @@ -556,7 +556,7 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) // 4J removed - we shouldn't need this any more #if 0 - if (levelChunk->heightmap.data == nullptr || !levelChunk->skyLight->isValid()) + if (levelChunk->heightmap.data == NULL || !levelChunk->skyLight->isValid()) { static int chunksUpdated = 0; delete [] levelChunk->heightmap.data; @@ -594,7 +594,7 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) { ListTag *tileTicks = (ListTag *) tag->getList(L"TileTicks"); - if (tileTicks != nullptr) + if (tileTicks != NULL) { for (int i = 0; i < tileTicks->size(); i++) { diff --git a/Minecraft.World/OreFeature.cpp b/Minecraft.World/OreFeature.cpp index cea881aa..c057511b 100644 --- a/Minecraft.World/OreFeature.cpp +++ b/Minecraft.World/OreFeature.cpp @@ -35,8 +35,8 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z) bool collisionsExpected = false; - LevelGenerationOptions *levelGenOptions = nullptr; - if( app.getLevelGenerationOptions() != nullptr ) + LevelGenerationOptions *levelGenOptions = NULL; + if( app.getLevelGenerationOptions() != NULL ) { levelGenOptions = app.getLevelGenerationOptions(); @@ -83,7 +83,7 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z) int zt1 = Mth::floor(zz + halfR); // 4J Stu Added to stop ore features generating areas previously place by game rule generation - if(collisionsExpected && levelGenOptions != nullptr) + if(collisionsExpected && levelGenOptions != NULL) { bool intersects = levelGenOptions->checkIntersects(xt0, yt0, zt0, xt1, yt1, zt1); if(intersects) diff --git a/Minecraft.World/OwnerHurtByTargetGoal.cpp b/Minecraft.World/OwnerHurtByTargetGoal.cpp index 787eb2ae..8250dc18 100644 --- a/Minecraft.World/OwnerHurtByTargetGoal.cpp +++ b/Minecraft.World/OwnerHurtByTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtByTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner == nullptr) return false; + if (owner == NULL) return false; ownerLastHurtBy = weak_ptr(owner->getLastHurtByMob()); int ts = owner->getLastHurtByMobTimestamp(); @@ -27,7 +27,7 @@ void OwnerHurtByTargetGoal::start() mob->setTarget(ownerLastHurtBy.lock()); shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner != nullptr) + if (owner != NULL) { timestamp = owner->getLastHurtByMobTimestamp(); } diff --git a/Minecraft.World/OwnerHurtTargetGoal.cpp b/Minecraft.World/OwnerHurtTargetGoal.cpp index a63e1784..b7e74505 100644 --- a/Minecraft.World/OwnerHurtTargetGoal.cpp +++ b/Minecraft.World/OwnerHurtTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner == nullptr) return false; + if (owner == NULL) return false; ownerLastHurt = weak_ptr(owner->getLastHurtMob()); int ts = owner->getLastHurtMobTimestamp(); shared_ptr locked = ownerLastHurt.lock(); @@ -26,7 +26,7 @@ void OwnerHurtTargetGoal::start() mob->setTarget(ownerLastHurt.lock()); shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner != nullptr) + if (owner != NULL) { timestamp = owner->getLastHurtMobTimestamp(); diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index 4125f103..61e3cc63 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -336,7 +336,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th } packet = getPacket(id); - if (packet == nullptr) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id)); + if (packet == NULL) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id)); //app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", packet->getId()); packet->read(dis); @@ -345,7 +345,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th // { // // reached end of stream // OutputDebugString("Reached end of stream"); - // return nullptr; + // return NULL; // } // 4J - Don't bother tracking stats in a content package @@ -386,7 +386,7 @@ void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOE } #endif - dos->writeShort(static_cast(value.length())); + dos->writeShort((short)value.length()); dos->writeChars(value); } @@ -443,7 +443,7 @@ double Packet::PacketStatistics::getAverageSize() { return 0; } - return static_cast(totalSize) / count; + return (double) totalSize / count; } int Packet::PacketStatistics::getTotalSize() @@ -512,7 +512,7 @@ shared_ptr Packet::readItem(DataInputStream *dis) int count = dis->readByte(); int damage = dis->readShort(); - item = std::make_shared(id, count, damage); + item = shared_ptr( new ItemInstance(id, count, damage) ); // 4J Stu - Always read/write the tag //if (Item.items[id].canBeDepleted() || Item.items[id].shouldOverrideMultiplayerNBT()) { @@ -525,7 +525,7 @@ shared_ptr Packet::readItem(DataInputStream *dis) void Packet::writeItem(shared_ptr item, DataOutputStream *dos) { - if (item == nullptr) + if (item == NULL) { dos->writeShort(-1); } @@ -545,7 +545,7 @@ void Packet::writeItem(shared_ptr item, DataOutputStream *dos) CompoundTag *Packet::readNbt(DataInputStream *dis) { int size = dis->readShort(); - if (size < 0) return nullptr; + if (size < 0) return NULL; byteArray buff(size); dis->readFully(buff); CompoundTag *result = (CompoundTag *) NbtIo::decompress(buff); @@ -555,14 +555,14 @@ CompoundTag *Packet::readNbt(DataInputStream *dis) void Packet::writeNbt(CompoundTag *tag, DataOutputStream *dos) { - if (tag == nullptr) + if (tag == NULL) { dos->writeShort(-1); } else { byteArray buff = NbtIo::compress(tag); - dos->writeShort(static_cast(buff.length)); + dos->writeShort((short) buff.length); dos->write(buff); delete [] buff.data; } diff --git a/Minecraft.World/Painting.cpp b/Minecraft.World/Painting.cpp index 5e56b9ca..208beb77 100644 --- a/Minecraft.World/Painting.cpp +++ b/Minecraft.World/Painting.cpp @@ -54,7 +54,7 @@ const int Painting::Motive::MAX_MOTIVE_NAME_LENGTH = 13; //JAVA: "SkullAndRoses // 4J - added for common ctor code void Painting::_init( Level *level ) { - motive = nullptr; + motive = NULL; }; Painting::Painting(Level *level) : HangingEntity( level ) @@ -98,7 +98,7 @@ void Painting::PaintingPostConstructor(int dir, int motive) } if (!survivableMotives->empty()) { - this->motive = survivableMotives->at(random->nextInt(static_cast(survivableMotives->size()))); + this->motive = survivableMotives->at(random->nextInt((int)survivableMotives->size())); } setDir(dir); } @@ -138,7 +138,7 @@ void Painting::readAdditionalSaveData(CompoundTag *tag) this->motive = (Motive *)Motive::values[i]; } } - if (this->motive == nullptr) motive = (Motive *)Motive::values[ Kebab ]; + if (this->motive == NULL) motive = (Motive *)Motive::values[ Kebab ]; HangingEntity::readAdditionalSaveData(tag); } @@ -155,7 +155,7 @@ int Painting::getHeight() void Painting::dropItem(shared_ptr causedBy) { - if ( (causedBy != nullptr) && causedBy->instanceof(eTYPE_PLAYER) ) + if ( (causedBy != NULL) && causedBy->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast(causedBy); if (player->abilities.instabuild) @@ -164,5 +164,5 @@ void Painting::dropItem(shared_ptr causedBy) } } - spawnAtLocation(std::make_shared(Item::painting), 0.0f); + spawnAtLocation(shared_ptr(new ItemInstance(Item::painting)), 0.0f); } \ No newline at end of file diff --git a/Minecraft.World/Path.cpp b/Minecraft.World/Path.cpp index afea4a17..538917f6 100644 --- a/Minecraft.World/Path.cpp +++ b/Minecraft.World/Path.cpp @@ -46,7 +46,7 @@ Node *Path::last() { return nodes[length - 1]; } - return nullptr; + return NULL; } Node *Path::get(int i) @@ -76,9 +76,9 @@ void Path::setIndex(int index) Vec3 *Path::getPos(shared_ptr e, int index) { - double x = nodes[index]->x + static_cast(e->bbWidth + 1) * 0.5; + double x = nodes[index]->x + (int) (e->bbWidth + 1) * 0.5; double y = nodes[index]->y; - double z = nodes[index]->z + static_cast(e->bbWidth + 1) * 0.5; + double z = nodes[index]->z + (int) (e->bbWidth + 1) * 0.5; return Vec3::newTemp(x, y, z); } @@ -94,7 +94,7 @@ Vec3 *Path::currentPos() bool Path::sameAs(Path *path) { - if (path == nullptr) return false; + if (path == NULL) return false; if (path->nodes.length != nodes.length) return false; for (int i = 0; i < nodes.length; ++i) if (nodes[i]->x != path->nodes[i]->x || nodes[i]->y != path->nodes[i]->y || nodes[i]->z != path->nodes[i]->z) return false; @@ -104,13 +104,13 @@ bool Path::sameAs(Path *path) bool Path::endsIn(Vec3 *pos) { Node *lastNode = last(); - if (lastNode == nullptr) return false; - return lastNode->x == static_cast(pos->x) && lastNode->y == static_cast(pos->y) && lastNode->z == static_cast(pos->z); + if (lastNode == NULL) return false; + return lastNode->x == (int) pos->x && lastNode->y == (int) pos->y && lastNode->z == (int) pos->z; } bool Path::endsInXZ(Vec3 *pos) { Node *lastNode = last(); - if (lastNode == nullptr) return false; - return lastNode->x == static_cast(pos->x) && lastNode->z == static_cast(pos->z); + if (lastNode == NULL) return false; + return lastNode->x == (int) pos->x && lastNode->z == (int) pos->z; } \ No newline at end of file diff --git a/Minecraft.World/PathFinder.cpp b/Minecraft.World/PathFinder.cpp index eb3bd45e..2e11648f 100644 --- a/Minecraft.World/PathFinder.cpp +++ b/Minecraft.World/PathFinder.cpp @@ -51,7 +51,7 @@ Path *PathFinder::findPath(Entity *e, double xt, double yt, double zt, float max int startY = Mth::floor(e->bb->y0 + 0.5f); if (canFloat && e->isInWater()) { - startY = static_cast(e->bb->y0); + startY = (int) (e->bb->y0); int tileId = level->getTile((int) Mth::floor(e->x), startY, (int) Mth::floor(e->z)); while (tileId == Tile::water_Id || tileId == Tile::calmWater_Id) { @@ -62,10 +62,10 @@ Path *PathFinder::findPath(Entity *e, double xt, double yt, double zt, float max avoidWater = false; } else startY = Mth::floor(e->bb->y0 + 0.5f); - Node *from = getNode(static_cast(floor(e->bb->x0)), startY, static_cast(floor(e->bb->z0))); - Node *to = getNode(static_cast(floor(xt - e->bbWidth / 2)), static_cast(floor(yt)), static_cast(floor(zt - e->bbWidth / 2))); + Node *from = getNode((int) floor(e->bb->x0), startY, (int) floor(e->bb->z0)); + Node *to = getNode((int) floor(xt - e->bbWidth / 2), (int) floor(yt), (int) floor(zt - e->bbWidth / 2)); - Node *size = new Node(static_cast(floor(e->bbWidth + 1)), static_cast(floor(e->bbHeight + 1)), static_cast(floor(e->bbWidth + 1))); + Node *size = new Node((int) floor(e->bbWidth + 1), (int) floor(e->bbHeight + 1), (int) floor(e->bbWidth + 1)); Path *path = findPath(e, from, to, size, maxDist); delete size; @@ -124,7 +124,7 @@ Path *PathFinder::findPath(Entity *e, Node *from, Node *to, Node *size, float ma } } - if (closest == from) return nullptr; + if (closest == from) return NULL; return reconstruct_path(from, closest); } @@ -140,44 +140,44 @@ int PathFinder::getNeighbors(Entity *entity, Node *pos, Node *size, Node *target Node *e = getNode(entity, pos->x + 1, pos->y, pos->z, size, jumpSize); Node *s = getNode(entity, pos->x, pos->y, pos->z - 1, size, jumpSize); - if (n != nullptr && !n->closed && n->distanceTo(target) < maxDist) neighbors->data[p++] = n; - if (w != nullptr && !w->closed && w->distanceTo(target) < maxDist) neighbors->data[p++] = w; - if (e != nullptr && !e->closed && e->distanceTo(target) < maxDist) neighbors->data[p++] = e; - if (s != nullptr && !s->closed && s->distanceTo(target) < maxDist) neighbors->data[p++] = s; + if (n != NULL && !n->closed && n->distanceTo(target) < maxDist) neighbors->data[p++] = n; + if (w != NULL && !w->closed && w->distanceTo(target) < maxDist) neighbors->data[p++] = w; + if (e != NULL && !e->closed && e->distanceTo(target) < maxDist) neighbors->data[p++] = e; + if (s != NULL && !s->closed && s->distanceTo(target) < maxDist) neighbors->data[p++] = s; return p; } Node *PathFinder::getNode(Entity *entity, int x, int y, int z, Node *size, int jumpSize) { - Node *best = nullptr; + Node *best = NULL; int pathType = isFree(entity, x, y, z, size); if (pathType == TYPE_WALKABLE) return getNode(x, y, z); if (pathType == TYPE_OPEN) best = getNode(x, y, z); - if (best == nullptr && jumpSize > 0 && pathType != TYPE_FENCE && pathType != TYPE_TRAP && isFree(entity, x, y + jumpSize, z, size) == TYPE_OPEN) + if (best == NULL && jumpSize > 0 && pathType != TYPE_FENCE && pathType != TYPE_TRAP && isFree(entity, x, y + jumpSize, z, size) == TYPE_OPEN) { best = getNode(x, y + jumpSize, z); y += jumpSize; } - if (best != nullptr) + if (best != NULL) { int drop = 0; int cost = 0; while (y > 0) { cost = isFree(entity, x, y - 1, z, size); - if (avoidWater && cost == TYPE_WATER) return nullptr; + if (avoidWater && cost == TYPE_WATER) return NULL; if (cost != TYPE_OPEN) break; // fell too far? - if (++drop >= 4) return nullptr; // 4J - rolling this back to pre-java 1.6.4 version as we're suspicious of the performance implications of this -// if (drop++ >= entity->getMaxFallDistance()) return nullptr; + if (++drop >= 4) return NULL; // 4J - rolling this back to pre-java 1.6.4 version as we're suspicious of the performance implications of this +// if (drop++ >= entity->getMaxFallDistance()) return NULL; y--; if (y > 0) best = getNode(x, y, z); } // fell into lava? - if (cost == TYPE_LAVA) return nullptr; + if (cost == TYPE_LAVA) return NULL; } return best; @@ -269,7 +269,7 @@ Path *PathFinder::reconstruct_path(Node *from, Node *to) { int count = 1; Node *n = to; - while (n->cameFrom != nullptr) + while (n->cameFrom != NULL) { count++; n = n->cameFrom; @@ -278,7 +278,7 @@ Path *PathFinder::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != nullptr) + while (n->cameFrom != NULL) { n = n->cameFrom; nodes.data[--count] = n; diff --git a/Minecraft.World/PathNavigation.cpp b/Minecraft.World/PathNavigation.cpp index 51d08d1e..7cac052e 100644 --- a/Minecraft.World/PathNavigation.cpp +++ b/Minecraft.World/PathNavigation.cpp @@ -16,7 +16,7 @@ PathNavigation::PathNavigation(Mob *mob, Level *level) this->level = level; dist = mob->getAttribute(SharedMonsterAttributes::FOLLOW_RANGE); - path = nullptr; + path = NULL; speedModifier = 0.0; avoidSun = false; _tick = 0; @@ -30,7 +30,7 @@ PathNavigation::PathNavigation(Mob *mob, Level *level) PathNavigation::~PathNavigation() { - if(path != nullptr) delete path; + if(path != NULL) delete path; delete lastStuckCheckPos; } @@ -81,19 +81,19 @@ void PathNavigation::setCanFloat(bool canFloat) float PathNavigation::getMaxDist() { - return static_cast(dist->getValue()); + return (float) dist->getValue(); } Path *PathNavigation::createPath(double x, double y, double z) { - if (!canUpdatePath()) return nullptr; - return level->findPath(mob->shared_from_this(), Mth::floor(x), static_cast(y), Mth::floor(z), getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); + if (!canUpdatePath()) return NULL; + return level->findPath(mob->shared_from_this(), Mth::floor(x), (int) y, Mth::floor(z), getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); } bool PathNavigation::moveTo(double x, double y, double z, double speedModifier) { MemSect(52); - Path *newPath = createPath(Mth::floor(x), static_cast(y), Mth::floor(z)); + Path *newPath = createPath(Mth::floor(x), (int) y, Mth::floor(z)); MemSect(0); // No need to delete newPath here as this will be copied into the member variable path and the class can assume responsibility for it return moveTo(newPath, speedModifier); @@ -101,7 +101,7 @@ bool PathNavigation::moveTo(double x, double y, double z, double speedModifier) Path *PathNavigation::createPath(shared_ptr target) { - if (!canUpdatePath()) return nullptr; + if (!canUpdatePath()) return NULL; return level->findPath(mob->shared_from_this(), target, getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); } @@ -111,21 +111,21 @@ bool PathNavigation::moveTo(shared_ptr target, double speedModifier) Path *newPath = createPath(target); MemSect(0); // No need to delete newPath here as this will be copied into the member variable path and the class can assume responsibility for it - if (newPath != nullptr) return moveTo(newPath, speedModifier); + if (newPath != NULL) return moveTo(newPath, speedModifier); else return false; } bool PathNavigation::moveTo(Path *newPath, double speedModifier) { - if(newPath == nullptr) + if(newPath == NULL) { - if(path != nullptr) delete path; - path = nullptr; + if(path != NULL) delete path; + path = NULL; return false; } if(!newPath->sameAs(path)) { - if(path != nullptr) delete path; + if(path != NULL) delete path; path = newPath; } else @@ -158,7 +158,7 @@ void PathNavigation::tick() if (isDone()) return; Vec3 *target = path->currentPos(mob->shared_from_this()); - if (target == nullptr) return; + if (target == NULL) return; mob->getMoveControl()->setWantedPosition(target->x, target->y, target->z, speedModifier); } @@ -169,9 +169,9 @@ void PathNavigation::updatePath() // find first elevations in path int firstElevation = path->getSize(); - for (int i = path->getIndex(); path != nullptr && i < path->getSize(); ++i) + for (int i = path->getIndex(); path != NULL && i < path->getSize(); ++i) { - if (static_cast(path->get(i)->y) != static_cast(mobPos->y)) + if ((int) path->get(i)->y != (int) mobPos->y) { firstElevation = i; break; @@ -191,8 +191,8 @@ void PathNavigation::updatePath() } // smooth remaining on same elevation - int sx = static_cast(ceil(mob->bbWidth)); - int sy = static_cast(mob->bbHeight) + 1; + int sx = (int) ceil(mob->bbWidth); + int sy = (int) mob->bbHeight + 1; int sz = sx; for (int i = firstElevation - 1; i >= path->getIndex(); --i) { @@ -216,13 +216,13 @@ void PathNavigation::updatePath() bool PathNavigation::isDone() { - return path == nullptr || path->isDone(); + return path == NULL || path->isDone(); } void PathNavigation::stop() { - if(path != nullptr) delete path; - path = nullptr; + if(path != NULL) delete path; + path = NULL; } Vec3 *PathNavigation::getTempMobPos() @@ -232,16 +232,16 @@ Vec3 *PathNavigation::getTempMobPos() int PathNavigation::getSurfaceY() { - if (!mob->isInWater() || !canFloat) return static_cast(mob->bb->y0 + 0.5); + if (!mob->isInWater() || !canFloat) return (int) (mob->bb->y0 + 0.5); - int surface = static_cast(mob->bb->y0); + int surface = (int) (mob->bb->y0); int tileId = level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z)); int steps = 0; while (tileId == Tile::water_Id || tileId == Tile::calmWater_Id) { ++surface; tileId = level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z)); - if (++steps > 16) return static_cast(mob->bb->y0); + if (++steps > 16) return (int) (mob->bb->y0); } return surface; } @@ -258,7 +258,7 @@ bool PathNavigation::isInLiquid() void PathNavigation::trimPathFromSun() { - if (level->canSeeSky(Mth::floor(mob->x), static_cast(mob->bb->y0 + 0.5), Mth::floor(mob->z))) return; + if (level->canSeeSky(Mth::floor(mob->x), (int) (mob->bb->y0 + 0.5), Mth::floor(mob->z))) return; for (int i = 0; i < path->getSize(); ++i) { @@ -288,7 +288,7 @@ bool PathNavigation::canMoveDirectly(Vec3 *startPos, Vec3 *stopPos, int sx, int sx += 2; sz += 2; - if (!canWalkOn(gridPosX, static_cast(startPos->y), gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; + if (!canWalkOn(gridPosX, (int) startPos->y, gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; sx -= 2; sz -= 2; @@ -323,7 +323,7 @@ bool PathNavigation::canMoveDirectly(Vec3 *startPos, Vec3 *stopPos, int sx, int currentDirZ = gridGoalZ - gridPosZ; } - if (!canWalkOn(gridPosX, static_cast(startPos->y), gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; + if (!canWalkOn(gridPosX, (int) startPos->y, gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; } return true; } diff --git a/Minecraft.World/PathfinderMob.cpp b/Minecraft.World/PathfinderMob.cpp index 840a6020..c01790e7 100644 --- a/Minecraft.World/PathfinderMob.cpp +++ b/Minecraft.World/PathfinderMob.cpp @@ -15,7 +15,7 @@ AttributeModifier *PathfinderMob::SPEED_MODIFIER_FLEEING = (new AttributeModifie PathfinderMob::PathfinderMob(Level *level) : Mob( level ) { - path = nullptr; + path = NULL; attackTarget = nullptr; holdGround = false; fleeTime = 0; @@ -51,10 +51,10 @@ void PathfinderMob::serverAiStep() holdGround = shouldHoldGround(); float maxDist = 16; - if (attackTarget == nullptr) + if (attackTarget == NULL) { attackTarget = findAttackTarget(); - if (attackTarget != nullptr) + if (attackTarget != NULL) { setPath(level->findPath(shared_from_this(), attackTarget, maxDist, true, false, false, true)); // 4J - changed to setPath from path = } @@ -84,18 +84,18 @@ void PathfinderMob::serverAiStep() // they aren't enclosed. We don't want the extra network overhead of just having Everything wandering round all the time, so have put a management system in place // that selects a subset of entities which have had their flag set through the considerForExtraWandering method so that these can keep doing random strolling. - if (!holdGround && (attackTarget != nullptr && (path == nullptr || random->nextInt(20) == 0))) + if (!holdGround && (attackTarget != NULL && (path == NULL || random->nextInt(20) == 0))) { setPath(level->findPath(shared_from_this(), attackTarget, maxDist, true, false, false, true));// 4J - changed to setPath from path = } - else if (!holdGround && ((path == nullptr && (random->nextInt(180) == 0) || fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) + else if (!holdGround && ((path == NULL && (random->nextInt(180) == 0) || fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) { if(noActionTime < SharedConstants::TICKS_PER_SECOND * 5) { findRandomStrollLocation(); } } - else if (!holdGround && (path == nullptr ) ) + else if (!holdGround && (path == NULL ) ) { if( ( noActionTime >= SharedConstants::TICKS_PER_SECOND * 5 ) && isExtraWanderingEnabled() ) { @@ -115,35 +115,35 @@ void PathfinderMob::serverAiStep() bool inWater = isInWater(); bool inLava = isInLava(); xRot = 0; - if (path == nullptr || random->nextInt(100) == 0) + if (path == NULL || random->nextInt(100) == 0) { this->Mob::serverAiStep(); - setPath(nullptr);// 4J - changed to setPath from path = + setPath(NULL);// 4J - changed to setPath from path = return; } Vec3 *target = path->currentPos(shared_from_this()); double r = bbWidth * 2; - while (target != nullptr && target->distanceToSqr(x, target->y, z) < r * r) + while (target != NULL && target->distanceToSqr(x, target->y, z) < r * r) { path->next(); if (path->isDone()) { - target = nullptr; - setPath(nullptr); // 4J - changed to setPath from path = + target = NULL; + setPath(NULL); // 4J - changed to setPath from path = } else target = path->currentPos(shared_from_this()); } jumping = false; - if (target != nullptr) + if (target != NULL) { double xd = target->x - x; double zd = target->z - z; double yd = target->y - yFloor; - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; float rotDiff = Mth::wrapDegrees(yRotD - yRot); - yya = static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue()); + yya = (float) getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue(); if (rotDiff > MAX_TURN) { rotDiff = MAX_TURN; @@ -156,13 +156,13 @@ void PathfinderMob::serverAiStep() if (holdGround) { - if (attackTarget != nullptr) + if (attackTarget != NULL) { double xd2 = attackTarget->x - x; double zd2 = attackTarget->z - z; float oldyRot = yRot; - yRot = static_cast(atan2(zd2, xd2) * 180 / PI) - 90; + yRot = (float) (atan2(zd2, xd2) * 180 / PI) - 90; rotDiff = ((oldyRot - yRot) + 90) * PI / 180; xxa = -Mth::sin(rotDiff) * yya * 1.0f; @@ -175,7 +175,7 @@ void PathfinderMob::serverAiStep() } } - if (attackTarget != nullptr) + if (attackTarget != NULL) { lookAt(attackTarget, 30, 30); } @@ -250,7 +250,7 @@ bool PathfinderMob::canSpawn() bool PathfinderMob::isPathFinding() { - return path != nullptr; + return path != NULL; } void PathfinderMob::setPath(Path *path) @@ -311,16 +311,16 @@ void PathfinderMob::tickLeash() { Mob::tickLeash(); - if (isLeashed() && getLeashHolder() != nullptr && getLeashHolder()->level == this->level) + if (isLeashed() && getLeashHolder() != NULL && getLeashHolder()->level == this->level) { // soft restriction shared_ptr leashHolder = getLeashHolder(); - restrictTo(static_cast(leashHolder->x), static_cast(leashHolder->y), static_cast(leashHolder->z), 5); + restrictTo((int) leashHolder->x, (int) leashHolder->y, (int) leashHolder->z, 5); float _distanceTo = distanceTo(leashHolder); shared_ptr tamabaleAnimal = shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) ? dynamic_pointer_cast(shared_from_this()) : nullptr; - if ( (tamabaleAnimal != nullptr) && tamabaleAnimal->isSitting() ) + if ( (tamabaleAnimal != NULL) && tamabaleAnimal->isSitting() ) { if (_distanceTo > 10) { diff --git a/Minecraft.World/PerformanceTimer.cpp b/Minecraft.World/PerformanceTimer.cpp index 1e01a404..5ed7ee0c 100644 --- a/Minecraft.World/PerformanceTimer.cpp +++ b/Minecraft.World/PerformanceTimer.cpp @@ -7,7 +7,7 @@ PerformanceTimer::PerformanceTimer() // Get the frequency of the timer LARGE_INTEGER qwTicksPerSec; QueryPerformanceFrequency( &qwTicksPerSec ); - m_fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); + m_fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; Reset(); #endif @@ -28,7 +28,7 @@ void PerformanceTimer::PrintElapsedTime(const wstring &description) QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - m_qwStartTime.QuadPart; - float fElapsedTime = m_fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + float fElapsedTime = m_fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); app.DebugPrintf("TIMER: %ls: Elapsed time %f\n", description.c_str(), fElapsedTime); #endif diff --git a/Minecraft.World/PerlinNoise.cpp b/Minecraft.World/PerlinNoise.cpp index 21f92a6b..b4c65e55 100644 --- a/Minecraft.World/PerlinNoise.cpp +++ b/Minecraft.World/PerlinNoise.cpp @@ -64,7 +64,7 @@ double PerlinNoise::getValue(double x, double y, double z) doubleArray PerlinNoise::getRegion(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale) { - if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; diff --git a/Minecraft.World/PerlinSimplexNoise.cpp b/Minecraft.World/PerlinSimplexNoise.cpp index 97d11448..dbc570a4 100644 --- a/Minecraft.World/PerlinSimplexNoise.cpp +++ b/Minecraft.World/PerlinSimplexNoise.cpp @@ -72,7 +72,7 @@ doubleArray PerlinSimplexNoise::getRegion(doubleArray buffer, double x, double y xScale/=1.5; yScale/=1.5; - if (buffer.data == nullptr || static_cast(buffer.length) < xSize * ySize) + if (buffer.data == NULL || (int) buffer.length < xSize * ySize) { if( buffer.data ) delete [] buffer.data; buffer = doubleArray(xSize * ySize); @@ -98,7 +98,7 @@ doubleArray PerlinSimplexNoise::getRegion(doubleArray buffer, double x, double y xScale/=1.5; yScale/=1.5; - if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; diff --git a/Minecraft.World/PickaxeItem.cpp b/Minecraft.World/PickaxeItem.cpp index 1bcee6e0..05177e7b 100644 --- a/Minecraft.World/PickaxeItem.cpp +++ b/Minecraft.World/PickaxeItem.cpp @@ -54,7 +54,7 @@ bool PickaxeItem::canDestroySpecial(Tile *tile) // 4J - brought forward from 1.2.3 float PickaxeItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) { - if (tile != nullptr && (tile->material == Material::metal || tile->material == Material::heavyMetal || tile->material == Material::stone)) + if (tile != NULL && (tile->material == Material::metal || tile->material == Material::heavyMetal || tile->material == Material::stone)) { return speed; } diff --git a/Minecraft.World/Pig.cpp b/Minecraft.World/Pig.cpp index a99af826..cc042f58 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -64,13 +64,13 @@ bool Pig::canBeControlledByRider() { shared_ptr item = dynamic_pointer_cast(rider.lock())->getCarriedItem(); - return item != nullptr && item->id == Item::carrotOnAStick_Id; + return item != NULL && item->id == Item::carrotOnAStick_Id; } void Pig::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_SADDLE_ID, static_cast(0)); + entityData->define(DATA_SADDLE_ID, (byte) 0); } void Pig::addAdditonalSaveData(CompoundTag *tag) @@ -109,7 +109,7 @@ bool Pig::mobInteract(shared_ptr player) { if(!Animal::mobInteract(player)) { - if (hasSaddle() && !level->isClientSide && (rider.lock() == nullptr || rider.lock() == player)) + if (hasSaddle() && !level->isClientSide && (rider.lock() == NULL || rider.lock() == player)) { // 4J HEG - Fixed issue with player not being able to dismount pig (issue #4479) player->ride( rider.lock() == player ? nullptr : shared_from_this() ); @@ -153,18 +153,18 @@ void Pig::setSaddle(bool value) { if (value) { - entityData->set(DATA_SADDLE_ID, static_cast(1)); + entityData->set(DATA_SADDLE_ID, (byte) 1); } else { - entityData->set(DATA_SADDLE_ID, static_cast(0)); + entityData->set(DATA_SADDLE_ID, (byte) 0); } } void Pig::thunderHit(const LightningBolt *lightningBolt) { if (level->isClientSide) return; - shared_ptr pz = std::make_shared(level); + shared_ptr pz = shared_ptr( new PigZombie(level) ); pz->moveTo(x, y, z, yRot, xRot); level->addEntity(pz); remove(); @@ -173,7 +173,7 @@ 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() != NULL && rider.lock()->instanceof(eTYPE_PLAYER) ) { (dynamic_pointer_cast(rider.lock()))->awardStat(GenericStats::flyPig(),GenericStats::param_flyPig()); } @@ -184,7 +184,7 @@ shared_ptr Pig::getBreedOffspring(shared_ptr target) // 4J - added limit to number of animals that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - return std::make_shared(level); + return shared_ptr( new Pig(level) ); } else { @@ -194,7 +194,7 @@ shared_ptr Pig::getBreedOffspring(shared_ptr target) bool Pig::isFood(shared_ptr itemInstance) { - return itemInstance != nullptr && itemInstance->id == Item::carrots_Id; + return itemInstance != NULL && itemInstance->id == Item::carrots_Id; } ControlledByPlayerGoal *Pig::getControlGoal() diff --git a/Minecraft.World/PigZombie.cpp b/Minecraft.World/PigZombie.cpp index 1be123d7..c284c323 100644 --- a/Minecraft.World/PigZombie.cpp +++ b/Minecraft.World/PigZombie.cpp @@ -53,7 +53,7 @@ void PigZombie::tick() AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_ATTACKING); - if (attackTarget != nullptr) + if (attackTarget != NULL) { speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING)); } @@ -78,7 +78,7 @@ bool PigZombie::canSpawn() void PigZombie::addAdditonalSaveData(CompoundTag *tag) { Zombie::addAdditonalSaveData(tag); - tag->putShort(L"Anger", static_cast(angerTime)); + tag->putShort(L"Anger", (short) angerTime); } void PigZombie::readAdditionalSaveData(CompoundTag *tag) @@ -105,7 +105,7 @@ shared_ptr PigZombie::findAttackTarget() bool PigZombie::hurt(DamageSource *source, float dmg) { shared_ptr sourceEntity = source->getEntity(); - if ( sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER) ) + if ( sourceEntity != NULL && sourceEntity->instanceof(eTYPE_PLAYER) ) { vector > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32)); for (auto& e : *nearby) @@ -174,7 +174,7 @@ int PigZombie::getDeathLoot() void PigZombie::populateDefaultEquipmentSlots() { - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::sword_gold)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::sword_gold)) ); } MobGroupData *PigZombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /*= 0*/) // 4J Added extraData param diff --git a/Minecraft.World/PineFeature.cpp b/Minecraft.World/PineFeature.cpp index bbe424aa..685f1e48 100644 --- a/Minecraft.World/PineFeature.cpp +++ b/Minecraft.World/PineFeature.cpp @@ -19,7 +19,7 @@ bool PineFeature::place(Level *level, Random *random, int x, int y, int z) } // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - topRadius, y - 1, z - topRadius, x + topRadius, y + treeHeight, z + topRadius); diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index e8e2a713..c71bbf95 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -28,7 +28,7 @@ DWORD PistonBaseTile::tlsIdx = TlsAlloc(); // 4J - ignoreUpdate is a static in java, implementing as TLS here to make thread safe bool PistonBaseTile::ignoreUpdate() { - return (TlsGetValue(tlsIdx) != nullptr); + return (TlsGetValue(tlsIdx) != NULL); } void PistonBaseTile::ignoreUpdate(bool set) @@ -45,9 +45,9 @@ PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::pisto setSoundType(SOUND_STONE); setDestroyTime(0.5f); - iconInside = nullptr; - iconBack = nullptr; - iconPlatform = nullptr; + iconInside = NULL; + iconBack = NULL; + iconPlatform = NULL; } Icon *PistonBaseTile::getPlatformTexture() @@ -75,7 +75,7 @@ Icon *PistonBaseTile::getTexture(int face, int data) // when the piston is extended, either normally // or because a piston arm animation, the top // texture is the furnace bottom - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); if (isExtended(data) || tls->xx0 > 0 || tls->yy0 > 0 || tls->zz0 > 0 || tls->xx1 < 1 || tls->yy1 < 1 || tls->zz1 < 1) { return iconInside; @@ -97,7 +97,7 @@ Icon *PistonBaseTile::getTexture(const wstring &name) if (name.compare(PLATFORM_STICKY_TEX) == 0) return Tile::pistonStickyBase->iconPlatform; if (name.compare(INSIDE_TEX) == 0) return Tile::pistonBase->iconInside; - return nullptr; + return NULL; } //@Override @@ -144,7 +144,7 @@ void PistonBaseTile::neighborChanged(Level *level, int x, int y, int z, int type void PistonBaseTile::onPlace(Level *level, int x, int y, int z) { - if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr && !ignoreUpdate()) + if (!level->isClientSide && level->getTileEntity(x, y, z) == NULL && !ignoreUpdate()) { checkIfExtend(level, x, y, z); } @@ -255,7 +255,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, { PIXBeginNamedEvent(0,"Contract phase A\n"); shared_ptr prevTileEntity = level->getTileEntity(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); - if (prevTileEntity != nullptr && dynamic_pointer_cast(prevTileEntity) != nullptr) + if (prevTileEntity != NULL && dynamic_pointer_cast(prevTileEntity) != NULL) { dynamic_pointer_cast(prevTileEntity)->finalTick(); } @@ -285,7 +285,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, // the block two steps away is a moving piston block piece, so replace it with the real data, // since it's probably this piston which is changing too fast shared_ptr tileEntity = level->getTileEntity(twoX, twoY, twoZ); - if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr ) + if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL ) { shared_ptr ppe = dynamic_pointer_cast(tileEntity); @@ -412,7 +412,7 @@ bool PistonBaseTile::isExtended(int data) int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, shared_ptr player) { - if (Mth::abs(static_cast(player->x) - x) < 2 && Mth::abs(static_cast(player->z) - z) < 2) + if (Mth::abs((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) { // If the player is above the block, the slot is on the top double py = player->y + 1.82 - player->heightOffset; diff --git a/Minecraft.World/PistonExtensionTile.cpp b/Minecraft.World/PistonExtensionTile.cpp index bf5e6e60..25c5adb9 100644 --- a/Minecraft.World/PistonExtensionTile.cpp +++ b/Minecraft.World/PistonExtensionTile.cpp @@ -7,7 +7,7 @@ PistonExtensionTile::PistonExtensionTile(int id) : Tile(id, Material::piston,isSolidRender() ) { // 4J added initialiser - overrideTopTexture = nullptr; + overrideTopTexture = NULL; setSoundType(SOUND_STONE); setDestroyTime(0.5f); @@ -20,7 +20,7 @@ void PistonExtensionTile::setOverrideTopTexture(Icon *overrideTopTexture) void PistonExtensionTile::clearOverrideTopTexture() { - this->overrideTopTexture = nullptr; + this->overrideTopTexture = NULL; } void PistonExtensionTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) @@ -65,7 +65,7 @@ Icon *PistonExtensionTile::getTexture(int face, int data) if (face == facing) { - if (overrideTopTexture != nullptr) + if (overrideTopTexture != NULL) { return overrideTopTexture; } diff --git a/Minecraft.World/PistonMovingPiece.cpp b/Minecraft.World/PistonMovingPiece.cpp index 5ae01007..5fa9a475 100644 --- a/Minecraft.World/PistonMovingPiece.cpp +++ b/Minecraft.World/PistonMovingPiece.cpp @@ -23,7 +23,7 @@ void PistonMovingPiece::onPlace(Level *level, int x, int y, int z) void PistonMovingPiece::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr) + if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) { dynamic_pointer_cast(tileEntity)->finalTick(); } @@ -62,7 +62,7 @@ bool PistonMovingPiece::use(Level *level, int x, int y, int z, shared_ptrisClientSide && level->getTileEntity(x, y, z) == nullptr) + if (!level->isClientSide && level->getTileEntity(x, y, z) == NULL) { // this block is no longer valid level->removeTile(x, y, z); @@ -81,7 +81,7 @@ void PistonMovingPiece::spawnResources(Level *level, int x, int y, int z, int da if (level->isClientSide) return; shared_ptr entity = getEntity(level, x, y, z); - if (entity == nullptr) + if (entity == NULL) { return; } @@ -93,21 +93,21 @@ void PistonMovingPiece::neighborChanged(Level *level, int x, int y, int z, int t { if (!level->isClientSide) { - level->getTileEntity(x, y, z) == nullptr; + level->getTileEntity(x, y, z) == NULL; } } shared_ptr PistonMovingPiece::newMovingPieceEntity(int block, int data, int facing, bool extending, bool isSourcePiston) { - return std::make_shared(block, data, facing, extending, isSourcePiston); + return shared_ptr(new PistonPieceEntity(block, data, facing, extending, isSourcePiston)); } AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) { shared_ptr entity = getEntity(level, x, y, z); - if (entity == nullptr) + if (entity == NULL) { - return nullptr; + return NULL; } // move the aabb depending on the animation @@ -122,11 +122,11 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param { shared_ptr entity = dynamic_pointer_cast(forceEntity); - if( entity == nullptr ) entity = getEntity(level, x, y, z); - if (entity != nullptr) + if( entity == NULL ) entity = getEntity(level, x, y, z); + if (entity != NULL) { Tile *tile = Tile::tiles[entity->getId()]; - if (tile == nullptr || tile == this) + if (tile == NULL || tile == this) { return; } @@ -138,7 +138,7 @@ void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int progress = 1.0f - progress; } int facing = entity->getFacing(); - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); tls->xx0 = tile->getShapeX0() - Facing::STEP_X[facing] * progress; tls->yy0 = tile->getShapeY0() - Facing::STEP_Y[facing] * progress; tls->zz0 = tile->getShapeZ0() - Facing::STEP_Z[facing] * progress; @@ -152,13 +152,13 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl { if (tile == 0 || tile == id) { - return nullptr; + return NULL; } AABB *aabb = Tile::tiles[tile]->getAABB(level, x, y, z); - if (aabb == nullptr) + if (aabb == NULL) { - return nullptr; + return NULL; } // move the aabb depending on the animation @@ -192,7 +192,7 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl shared_ptr PistonMovingPiece::getEntity(LevelSource *level, int x, int y, int z) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr) + if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) { return dynamic_pointer_cast(tileEntity); } diff --git a/Minecraft.World/PistonPieceEntity.cpp b/Minecraft.World/PistonPieceEntity.cpp index 08e18cbb..a915c2ff 100644 --- a/Minecraft.World/PistonPieceEntity.cpp +++ b/Minecraft.World/PistonPieceEntity.cpp @@ -117,7 +117,7 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) } AABB *aabb = Tile::pistonMovingPiece->getAABB(level, x, y, z, id, progress, facing); - if (aabb != nullptr) + if (aabb != NULL) { vector > *entities = level->getEntities(nullptr, aabb); if (!entities->empty()) @@ -140,7 +140,7 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) void PistonPieceEntity::finalTick() { - if (progressO < 1 && level != nullptr) + if (progressO < 1 && level != NULL) { progressO = progress = 1; level->removeTileEntity(x, y, z); @@ -207,7 +207,7 @@ void PistonPieceEntity::save(CompoundTag *tag) // 4J Added shared_ptr PistonPieceEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new PistonPieceEntity() ); TileEntity::clone(result); result->id = id; diff --git a/Minecraft.World/PlayGoal.cpp b/Minecraft.World/PlayGoal.cpp index 6ce3af23..72ee69d4 100644 --- a/Minecraft.World/PlayGoal.cpp +++ b/Minecraft.World/PlayGoal.cpp @@ -40,22 +40,22 @@ bool PlayGoal::canUse() } delete children; - if (followFriend.lock() == nullptr) + if (followFriend.lock() == NULL) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 16, 3); - if (pos == nullptr) return false; + if (pos == NULL) return false; } return true; } bool PlayGoal::canContinueToUse() { - return playTime > 0 && followFriend.lock() != nullptr; + return playTime > 0 && followFriend.lock() != NULL; } void PlayGoal::start() { - if (followFriend.lock() != nullptr) mob->setChasing(true); + if (followFriend.lock() != NULL) mob->setChasing(true); playTime = 1000; } @@ -68,7 +68,7 @@ void PlayGoal::stop() void PlayGoal::tick() { --playTime; - if (followFriend.lock() != nullptr) + if (followFriend.lock() != NULL) { if (mob->distanceToSqr(followFriend.lock()) > 2 * 2) mob->getNavigation()->moveTo(followFriend.lock(), speedModifier); } @@ -77,7 +77,7 @@ void PlayGoal::tick() if (mob->getNavigation()->isDone()) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 16, 3); - if (pos == nullptr) return; + if (pos == NULL) return; mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, speedModifier); } } diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 00c7148e..bd6b68a8 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -50,7 +50,7 @@ void Player::_init() registerAttributes(); setHealth(getMaxHealth()); - inventory = std::make_shared(this); + inventory = shared_ptr( new Inventory( this ) ); userType = 0; oBob = bob = 0.0f; @@ -64,17 +64,17 @@ void Player::_init() customTextureUrl2 = L""; m_uiPlayerCurrentSkin=0; - bedPosition = nullptr; + bedPosition = NULL; sleepCounter = 0; deathFadeCounter=0; bedOffsetX = bedOffsetY = bedOffsetZ = 0.0f; - stats = nullptr; + stats = NULL; - respawnPosition = nullptr; + respawnPosition = NULL; respawnForced = false; - minecartAchievementPos = nullptr; + minecartAchievementPos = NULL; fishing = nullptr; @@ -97,7 +97,7 @@ void Player::_init() m_uiGamePrivileges = 0; - m_ppAdditionalModelParts=nullptr; + m_ppAdditionalModelParts=NULL; m_bCheckedForModelParts=false; m_bCheckedDLCForModelParts=false; @@ -105,7 +105,7 @@ void Player::_init() m_ePlayerNameValidState=ePlayerNameValid_NotSet; #endif - enderChestInventory = std::make_shared(); + enderChestInventory = shared_ptr(new PlayerEnderChestContainer()); m_bAwardedOnARail=false; } @@ -175,8 +175,8 @@ void Player::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_PLAYER_FLAGS_ID, static_cast(0)); - entityData->define(DATA_PLAYER_ABSORPTION_ID, static_cast(0)); + entityData->define(DATA_PLAYER_FLAGS_ID, (byte) 0); + entityData->define(DATA_PLAYER_ABSORPTION_ID, (float) 0); entityData->define(DATA_SCORE_ID, (int) 0); } @@ -192,7 +192,7 @@ int Player::getUseItemDuration() bool Player::isUsingItem() { - return useItem != nullptr; + return useItem != NULL; } int Player::getTicksUsingItem() @@ -206,7 +206,7 @@ int Player::getTicksUsingItem() void Player::releaseUsingItem() { - if (useItem != nullptr) + if (useItem != NULL) { useItem->releaseUsing(level, dynamic_pointer_cast( shared_from_this() ), useItemDuration); @@ -237,13 +237,13 @@ bool Player::isBlocking() // 4J Stu - Added for things that should only be ticked once per simulation frame void Player::updateFrameTick() { - if (useItem != nullptr) + if (useItem != NULL) { shared_ptr item = inventory->getSelected(); // 4J Stu - Fix for #45508 - TU5: Gameplay: Eating one piece of food will result in a second piece being eaten as well - // Original code was item != useItem. Changed this now to use the equals function, and add the nullptr check as well for the other possible not equals (useItem is not nullptr if we are here) + // Original code was item != useItem. Changed this now to use the equals function, and add the NULL check as well for the other possible not equals (useItem is not NULL if we are here) // This is because the useItem and item could be different objects due to an inventory update from the server, but still be the same item (with the same id,count and auxvalue) - if (item == nullptr || !item->equals(useItem) ) + if (item == NULL || !item->equals(useItem) ) { stopUsingItem(); } @@ -316,7 +316,7 @@ void Player::tick() if (!level->isClientSide) { - if (containerMenu != nullptr && !containerMenu->stillValid( dynamic_pointer_cast( shared_from_this() ) )) + if (containerMenu != NULL && !containerMenu->stillValid( dynamic_pointer_cast( shared_from_this() ) )) { closeContainer(); containerMenu = inventoryMenu; @@ -348,12 +348,12 @@ void Player::tick() zCloak += zca * 0.25; yCloak += yca * 0.25; - if (riding == nullptr) + if (riding == NULL) { - if( minecartAchievementPos != nullptr ) + if( minecartAchievementPos != NULL ) { delete minecartAchievementPos; - minecartAchievementPos = nullptr; + minecartAchievementPos = NULL; } } @@ -573,13 +573,13 @@ void Player::spawnEatParticles(shared_ptr useItem, int count) void Player::completeUsingItem() { - if (useItem != nullptr) + if (useItem != NULL) { spawnEatParticles(useItem, 16); int oldCount = useItem->count; shared_ptr itemInstance = useItem->useTimeDepleted(level, dynamic_pointer_cast(shared_from_this())); - if (itemInstance != useItem || (itemInstance != nullptr && itemInstance->count != oldCount)) + if (itemInstance != useItem || (itemInstance != NULL && itemInstance->count != oldCount)) { inventory->items[inventory->selected] = itemInstance; if (itemInstance->count == 0) @@ -615,11 +615,11 @@ void Player::closeContainer() void Player::ride(shared_ptr e) { - if (riding != nullptr && e == nullptr) + if (riding != NULL && e == NULL) { if (!level->isClientSide) findStandUpPosition(riding); - if (riding != nullptr) + if (riding != NULL) { riding->rider = weak_ptr(); } @@ -657,13 +657,13 @@ void Player::setCustomSkin(DWORD skinId) DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 && defaultSkinIndex > 0 ) { - playerSkin = static_cast(defaultSkinIndex); + playerSkin = (EDefaultSkins) defaultSkinIndex; } } if( playerSkin == eDefaultSkins_ServerSelected) { - playerSkin = static_cast(m_playerIndex + 1); + playerSkin = (EDefaultSkins)(m_playerIndex + 1); } // We always set a default skin, since we may be waiting for the player's custom skin to be transmitted @@ -675,7 +675,7 @@ void Player::setCustomSkin(DWORD skinId) // set the new player additional boxes /*vector *pvModelParts=app.GetAdditionalModelParts(m_dwSkinId); - if(pvModelParts==nullptr) + if(pvModelParts==NULL) { // we don't have the data from the dlc skin yet app.DebugPrintf("Couldn't get model parts for skin %X\n",m_dwSkinId); @@ -683,7 +683,7 @@ void Player::setCustomSkin(DWORD skinId) // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(this->customTextureUrl); - if(pDLCSkinFile!=nullptr) + if(pDLCSkinFile!=NULL) { DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); if(dwBoxC!=0) @@ -694,13 +694,13 @@ void Player::setCustomSkin(DWORD skinId) } else { - this->SetAdditionalModelParts(nullptr); + this->SetAdditionalModelParts(NULL); } app.SetAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); } else { - this->SetAdditionalModelParts(nullptr); + this->SetAdditionalModelParts(NULL); } } else @@ -713,7 +713,7 @@ void Player::setCustomSkin(DWORD skinId) // reset the check for model parts m_bCheckedForModelParts=false; m_bCheckedDLCForModelParts=false; - this->SetAdditionalModelParts(nullptr); + this->SetAdditionalModelParts(NULL); } @@ -964,7 +964,7 @@ void Player::rideTick() checkRidingStatistiscs(x - preX, y - preY, z - preZ); // riding can be set to null inside 'Entity::rideTick()'. - if ( riding != nullptr && (riding->GetType() & eTYPE_PIG) == eTYPE_PIG ) + if ( riding != NULL && (riding->GetType() & eTYPE_PIG) == eTYPE_PIG ) { // 4J Stu - I don't know why we would want to do this, but it means that the players head is locked in position and can't move around //xRot = preXRot; @@ -1018,9 +1018,9 @@ void Player::aiStep() flyingSpeed += defaultFlySpeed * 0.3f; } - setSpeed(static_cast(speed->getValue())); + setSpeed((float) speed->getValue()); - float tBob = static_cast(sqrt(xd * xd + zd * zd)); + float tBob = (float) sqrt(xd * xd + zd * zd); // 4J added - we were getting a NaN with zero xd & zd if(( xd * xd + zd * zd ) < 0.00001f ) @@ -1028,7 +1028,7 @@ void Player::aiStep() tBob = 0.0f; } - float tTilt = static_cast(atan(-yd * 0.2f)) * 15.0f; + float tTilt = (float) atan(-yd * 0.2f) * 15.0f; if (tBob > 0.1f) tBob = 0.1f; if (!onGround || getHealth() <= 0) tBob = 0; if (onGround || getHealth() <= 0) tTilt = 0; @@ -1039,8 +1039,8 @@ void Player::aiStep() if (getHealth() > 0) { - AABB *pickupArea = nullptr; - if (riding != nullptr && !riding->removed) + AABB *pickupArea = NULL; + if (riding != NULL && !riding->removed) { // if the player is riding, also touch entities under the // pig/horse @@ -1052,7 +1052,7 @@ void Player::aiStep() } vector > *entities = level->getEntities(shared_from_this(), pickupArea); - if (entities != nullptr) + if (entities != NULL) { for (auto& e : *entities) { @@ -1097,14 +1097,14 @@ void Player::die(DamageSource *source) // 4J - TODO need to use a xuid if ( app.isXuidNotch( m_xuid ) ) { - drop(std::make_shared(Item::apple, 1), true); + drop(shared_ptr( new ItemInstance(Item::apple, 1) ), true); } if (!level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) { inventory->dropAll(); } - if (source != nullptr) + if (source != NULL) { xd = -Mth::cos((hurtDir + yRot) * PI / 180) * 0.1f; zd = -Mth::sin((hurtDir + yRot) * PI / 180) * 0.1f; @@ -1157,7 +1157,7 @@ bool Player::isCreativeModeAllowed() shared_ptr Player::drop(bool all) { - return drop(inventory->removeItem(inventory->selected, all && inventory->getSelected() != nullptr ? inventory->getSelected()->count : 1), false); + return drop(inventory->removeItem(inventory->selected, all && inventory->getSelected() != NULL ? inventory->getSelected()->count : 1), false); } shared_ptr Player::drop(shared_ptr item) @@ -1167,10 +1167,10 @@ shared_ptr Player::drop(shared_ptr item) shared_ptr Player::drop(shared_ptr item, bool randomly) { - if (item == nullptr) return nullptr; + if (item == NULL) return nullptr; if (item->count == 0) return nullptr; - shared_ptr thrownItem = std::make_shared(level, x, y - 0.3f + getHeadHeight(), z, item); + shared_ptr thrownItem = shared_ptr( new ItemEntity(level, x, y - 0.3f + getHeadHeight(), z, item) ); thrownItem->throwTime = 20 * 2; thrownItem->setThrower(getName()); @@ -1221,7 +1221,7 @@ float Player::getDestroySpeed(Tile *tile, bool hasProperTool) int efficiency = EnchantmentHelper::getDiggingBonus(dynamic_pointer_cast(shared_from_this())); shared_ptr item = inventory->getSelected(); - if (efficiency > 0 && item != nullptr) + if (efficiency > 0 && item != NULL) { float boost = efficiency * efficiency + 1; @@ -1305,14 +1305,14 @@ void Player::addAdditonalSaveData(CompoundTag *entityTag) entityTag->put(L"Inventory", inventory->save(new ListTag())); entityTag->putInt(L"SelectedItemSlot", inventory->selected); entityTag->putBoolean(L"Sleeping", m_isSleeping); - entityTag->putShort(L"SleepTimer", static_cast(sleepCounter)); + entityTag->putShort(L"SleepTimer", (short) sleepCounter); entityTag->putFloat(L"XpP", experienceProgress); entityTag->putInt(L"XpLevel", experienceLevel); entityTag->putInt(L"XpTotal", totalExperience); entityTag->putInt(L"Score", getScore()); - if (respawnPosition != nullptr) + if (respawnPosition != NULL) { entityTag->putInt(L"SpawnX", respawnPosition->x); entityTag->putInt(L"SpawnY", respawnPosition->y); @@ -1407,10 +1407,10 @@ bool Player::hurt(DamageSource *source, float dmg) if (dmg == 0) return false; shared_ptr attacker = source->getEntity(); - if ( attacker != nullptr && attacker->instanceof(eTYPE_ARROW) ) + if ( attacker != NULL && attacker->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = dynamic_pointer_cast(attacker); - if ( arrow->owner != nullptr) + if ( arrow->owner != NULL) { attacker = arrow->owner; } @@ -1424,7 +1424,7 @@ bool Player::canHarmPlayer(shared_ptr target) Team *team = getTeam(); Team *otherTeam = target->getTeam(); - if (team == nullptr) + if (team == NULL) { return true; } @@ -1455,11 +1455,11 @@ float Player::getArmorCoverPercentage() int count = 0; for (int i = 0; i < inventory->armor.length; i++) { - if (inventory->armor[i] != nullptr) { + if (inventory->armor[i] != NULL) { count++; } } - return static_cast(count) / static_cast(inventory->armor.length); + return (float) count / (float) inventory->armor.length; } void Player::actuallyHurt(DamageSource *source, float dmg) @@ -1526,13 +1526,13 @@ bool Player::interact(shared_ptr entity) shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); shared_ptr item = getSelectedItem(); - shared_ptr itemClone = (item != nullptr) ? item->copy() : nullptr; + shared_ptr itemClone = (item != NULL) ? item->copy() : nullptr; if ( entity->interact(thisPlayer) ) { // [EB]: Added rude check to see if we're still talking about the // same item; this code caused bucket->milkbucket to be deleted because // the milkbuckets' stack got decremented to 0. - if (item != nullptr && item == getSelectedItem()) + if (item != NULL && item == getSelectedItem()) { if (item->count <= 0 && !abilities.instabuild) { @@ -1546,7 +1546,7 @@ bool Player::interact(shared_ptr entity) return true; } - if ( (item != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) ) + if ( (item != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) ) { // 4J - PC Comments // Hack to prevent item stacks from decrementing if the player has @@ -1594,7 +1594,7 @@ void Player::attack(shared_ptr entity) return; } - float dmg = static_cast(getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue()); + float dmg = (float) getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); int knockback = 0; float magicBoost = 0; @@ -1613,7 +1613,7 @@ void Player::attack(shared_ptr entity) if (dmg > 0 || magicBoost > 0) { - bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && (riding == nullptr) && entity->instanceof(eTYPE_LIVINGENTITY); + bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && (riding == NULL) && entity->instanceof(eTYPE_LIVINGENTITY); if (bCrit && dmg > 0) { dmg *= 1.5f; @@ -1671,12 +1671,12 @@ void Player::attack(shared_ptr entity) if ( entity->instanceof(eTYPE_MULTIENTITY_MOB_PART) ) { shared_ptr multiMob = dynamic_pointer_cast((dynamic_pointer_cast(entity))->parentMob.lock()); - if ( (multiMob != nullptr) && multiMob->instanceof(eTYPE_LIVINGENTITY) ) + if ( (multiMob != NULL) && multiMob->instanceof(eTYPE_LIVINGENTITY) ) { hurtTarget = dynamic_pointer_cast( multiMob ); } } - if ( (item != nullptr) && hurtTarget->instanceof(eTYPE_LIVINGENTITY) ) + if ( (item != NULL) && hurtTarget->instanceof(eTYPE_LIVINGENTITY) ) { item->hurtEnemy(dynamic_pointer_cast(hurtTarget), dynamic_pointer_cast( shared_from_this() ) ); if (item->count <= 0) @@ -1737,14 +1737,14 @@ void Player::animateRespawn(shared_ptr player, Level *level) Slot *Player::getInventorySlot(int slotId) { - return nullptr; + return NULL; } void Player::remove() { LivingEntity::remove(); inventoryMenu->removed( dynamic_pointer_cast( shared_from_this() ) ); - if (containerMenu != nullptr) + if (containerMenu != NULL) { containerMenu->removed( dynamic_pointer_cast( shared_from_this() ) ); } @@ -1909,12 +1909,12 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save Pos *pos = bedPosition; Pos *standUp = bedPosition; - if (pos != nullptr && level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) + if (pos != NULL && level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) { BedTile::setOccupied(level, pos->x, pos->y, pos->z, false); standUp = BedTile::findStandUpPosition(level, pos->x, pos->y, pos->z, 0); - if (standUp == nullptr) + if (standUp == NULL) { standUp = new Pos(pos->x, pos->y + 1, pos->z); } @@ -1968,7 +1968,7 @@ Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) { return pos; } - return nullptr; + return NULL; } // make sure the bed still has a stand-up position Pos *standUp = BedTile::findStandUpPosition(level, pos->x, pos->y, pos->z, 0); @@ -1977,7 +1977,7 @@ Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) float Player::getSleepRotation() { - if (bedPosition != nullptr) + if (bedPosition != NULL) { int data = level->getData(bedPosition->x, bedPosition->y, bedPosition->z); int direction = BedTile::getDirection(data); @@ -2028,11 +2028,11 @@ void Player::setPlayerFlag(int flag, bool value) byte currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); if (value) { - entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue | (1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, (byte) (currentValue | (1 << flag))); } else { - entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, (byte) (currentValue & ~(1 << flag))); } } @@ -2059,21 +2059,21 @@ bool Player::isRespawnForced() void Player::setRespawnPosition(Pos *respawnPosition, bool forced) { - if (respawnPosition != nullptr) + if (respawnPosition != NULL) { this->respawnPosition = new Pos(*respawnPosition); respawnForced = forced; } else { - this->respawnPosition = nullptr; + this->respawnPosition = NULL; respawnForced = false; } } void Player::awardStat(Stat *stat, byteArray paramBlob) { - if (paramBlob.data != nullptr) + if (paramBlob.data != NULL) { delete [] paramBlob.data; } @@ -2102,7 +2102,7 @@ void Player::travel(float xa, float ya) { double preX = x, preY = y, preZ = z; - if (abilities.flying && riding == nullptr) + if (abilities.flying && riding == NULL) { double ydo = yd; float ofs = flyingSpeed; @@ -2121,19 +2121,19 @@ void Player::travel(float xa, float ya) float Player::getSpeed() { - return static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue()); + return (float) getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue(); } void Player::checkMovementStatistiscs(double dx, double dy, double dz) { - if (riding != nullptr) + if (riding != NULL) { return; } if (isUnderLiquid(Material::water)) { - int distance = static_cast(Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f)); + int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); if (distance > 0) { //awardStat(Stats::diveOneCm, distance); @@ -2142,7 +2142,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) } else if (isInWater()) { - int horizontalDistance = static_cast(Math::round(sqrt(dx * dx + dz * dz) * 100.0f)); + int horizontalDistance = (int) Math::round(sqrt(dx * dx + dz * dz) * 100.0f); if (horizontalDistance > 0) { distanceSwim += horizontalDistance; @@ -2159,7 +2159,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) { if (dy > 0) { - distanceClimb += static_cast(Math::round(dy * 100.0f)); + distanceClimb += (int) Math::round(dy * 100.0f); if( distanceClimb >= 100 ) { int newDistance = distanceClimb - (distanceClimb % 100); @@ -2170,7 +2170,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) } else if (onGround) { - int horizontalDistance = static_cast(Math::round(sqrt(dx * dx + dz * dz) * 100.0f)); + int horizontalDistance = (int) Math::round(sqrt(dx * dx + dz * dz) * 100.0f); if (horizontalDistance > 0) { distanceWalk += horizontalDistance; @@ -2195,9 +2195,9 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) void Player::checkRidingStatistiscs(double dx, double dy, double dz) { - if (riding != nullptr) + if (riding != NULL) { - int distance = static_cast(Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f)); + int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); if (distance > 0) { if ( riding->instanceof(eTYPE_MINECART) ) @@ -2211,7 +2211,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) } int dist = 0; - if (minecartAchievementPos == nullptr) + if (minecartAchievementPos == NULL) { minecartAchievementPos = new Pos(Mth::floor(x), Mth::floor(y), Mth::floor(z)); } @@ -2278,7 +2278,7 @@ void Player::causeFallDamage(float distance) if (distance >= 2) { - distanceFall += static_cast(Math::round(distance * 100.0)); + distanceFall += (int) Math::round(distance * 100.0); if( distanceFall >= 100 ) { int newDistance = distanceFall - (distanceFall % 100); @@ -2309,7 +2309,7 @@ void Player::killed(shared_ptr mob) awardStat(GenericStats::killsSkeleton(), GenericStats::param_noArgs()); break; case eTYPE_SPIDER: - if( mob->rider.lock() != nullptr && mob->rider.lock()->GetType() == eTYPE_SKELETON ) + if( mob->rider.lock() != NULL && mob->rider.lock()->GetType() == eTYPE_SKELETON ) awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); else awardStat(GenericStats::killsSpider(), GenericStats::param_noArgs()); @@ -2348,7 +2348,7 @@ void Player::makeStuckInWeb() Icon *Player::getItemInHandIcon(shared_ptr item, int layer) { Icon *icon = LivingEntity::getItemInHandIcon(item, layer); - if (item->id == Item::fishingRod->id && fishing != nullptr) + if (item->id == Item::fishingRod->id && fishing != NULL) { icon = Item::fishingRod->getEmptyIcon(); } @@ -2356,7 +2356,7 @@ Icon *Player::getItemInHandIcon(shared_ptr item, int layer) { return item->getItem()->getLayerIcon(item->getAuxValue(), layer); } - else if (useItem != nullptr && item->id == Item::bow_Id) + else if (useItem != NULL && item->id == Item::bow_Id) { int ticksHeld = (item->getUseDuration() - useItemDuration); if (ticksHeld >= BowItem::MAX_DRAW_DURATION - 2) @@ -2388,7 +2388,7 @@ void Player::increaseXp(int i) { i = max; } - experienceProgress += static_cast(i) / getXpNeededForNextLevel(); + experienceProgress += (float) i / getXpNeededForNextLevel(); totalExperience += i; while (experienceProgress >= 1) { @@ -2502,7 +2502,7 @@ bool Player::mayDestroyBlockAt(int x, int y, int z) { return true; } - else if (getSelectedItem() != nullptr) + else if (getSelectedItem() != NULL) { shared_ptr carried = getSelectedItem(); @@ -2521,7 +2521,7 @@ bool Player::mayUseItemAt(int x, int y, int z, int face, shared_ptrmayBePlacedInAdventureMode(); } @@ -2714,7 +2714,7 @@ int Player::hash_fnct(const shared_ptr k) #ifdef __PS3__ return (int)boost::hash_value( k->name ); // 4J Stu - Names are completely unique? #else - return static_cast(std::hash{}(k->name)); // 4J Stu - Names are completely unique? + return (int)std::hash{}(k->name); // 4J Stu - Names are completely unique? #endif //__PS3__ } @@ -2806,7 +2806,7 @@ void Player::setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGameP bool Player::isAllowedToUse(Tile *tile) { bool allowed = true; - if(tile != nullptr && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) + if(tile != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { allowed = false; @@ -2877,7 +2877,7 @@ bool Player::isAllowedToUse(Tile *tile) bool Player::isAllowedToUse(shared_ptr item) { bool allowed = true; - if(item != nullptr && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) + if(item != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) { @@ -3085,7 +3085,7 @@ bool Player::canCreateParticles() vector *Player::GetAdditionalModelParts() { - if(m_ppAdditionalModelParts==nullptr && !m_bCheckedForModelParts) + if(m_ppAdditionalModelParts==NULL && !m_bCheckedForModelParts) { bool hasCustomTexture = !customTextureUrl.empty(); bool customTextureIsDefaultSkin = customTextureUrl.substr(0,3).compare(L"def") == 0; @@ -3094,11 +3094,11 @@ vector *Player::GetAdditionalModelParts() m_ppAdditionalModelParts=app.GetAdditionalModelParts(m_dwSkinId); // If it's a default texture (which has no parts), we have the parts, or we already have the texture (in which case we should have parts if there are any) then we are done - if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != nullptr || app.IsFileInMemoryTextures(customTextureUrl)) + if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != NULL || app.IsFileInMemoryTextures(customTextureUrl)) { m_bCheckedForModelParts=true; } - if(m_ppAdditionalModelParts == nullptr && !m_bCheckedDLCForModelParts) + if(m_ppAdditionalModelParts == NULL && !m_bCheckedDLCForModelParts) { m_bCheckedDLCForModelParts = true; @@ -3108,7 +3108,7 @@ vector *Player::GetAdditionalModelParts() // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(this->customTextureUrl); - if(pDLCSkinFile!=nullptr) + if(pDLCSkinFile!=NULL) { DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); if(dwBoxC!=0) diff --git a/Minecraft.World/PlayerAbilitiesPacket.h b/Minecraft.World/PlayerAbilitiesPacket.h index 3998c66b..8cd82bf5 100644 --- a/Minecraft.World/PlayerAbilitiesPacket.h +++ b/Minecraft.World/PlayerAbilitiesPacket.h @@ -44,6 +44,6 @@ public: bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PlayerAbilitiesPacket()); } virtual int getId() { return 202; } }; \ No newline at end of file diff --git a/Minecraft.World/PlayerActionPacket.h b/Minecraft.World/PlayerActionPacket.h index 647777cd..45c077d2 100644 --- a/Minecraft.World/PlayerActionPacket.h +++ b/Minecraft.World/PlayerActionPacket.h @@ -24,7 +24,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PlayerActionPacket()); } virtual int getId() { return 14; } }; diff --git a/Minecraft.World/PlayerCommandPacket.h b/Minecraft.World/PlayerCommandPacket.h index 042b32ca..92ee57eb 100644 --- a/Minecraft.World/PlayerCommandPacket.h +++ b/Minecraft.World/PlayerCommandPacket.h @@ -36,6 +36,6 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PlayerCommandPacket()); } virtual int getId() { return 19; } }; \ No newline at end of file diff --git a/Minecraft.World/PlayerEnderChestContainer.cpp b/Minecraft.World/PlayerEnderChestContainer.cpp index 33ebcbd4..f0a1aaa3 100644 --- a/Minecraft.World/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/PlayerEnderChestContainer.cpp @@ -38,10 +38,10 @@ ListTag *PlayerEnderChestContainer::createTag() for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != nullptr) + if (item != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", (byte) i); item->save(tag); items->add(tag); } @@ -51,7 +51,7 @@ ListTag *PlayerEnderChestContainer::createTag() bool PlayerEnderChestContainer::stillValid(shared_ptr player) { - if (activeChest != nullptr && !activeChest->stillValid(player)) + if (activeChest != NULL && !activeChest->stillValid(player)) { return false; } @@ -60,7 +60,7 @@ bool PlayerEnderChestContainer::stillValid(shared_ptr player) void PlayerEnderChestContainer::startOpen() { - if (activeChest != nullptr) + if (activeChest != NULL) { activeChest->startOpen(); } diff --git a/Minecraft.World/PlayerInfoPacket.cpp b/Minecraft.World/PlayerInfoPacket.cpp index d0ad8d2a..9cbe5f7c 100644 --- a/Minecraft.World/PlayerInfoPacket.cpp +++ b/Minecraft.World/PlayerInfoPacket.cpp @@ -28,7 +28,7 @@ PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, PlayerInfoPacket::PlayerInfoPacket(shared_ptr player) { m_networkSmallId = 0; - if(player->connection != nullptr && player->connection->getNetworkPlayer() != nullptr) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); + if(player->connection != NULL && player->connection->getNetworkPlayer() != NULL) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); m_playerColourIndex = player->getPlayerIndex(); m_playerPrivileges = player->getAllPlayerGamePrivileges(); m_entityId = player->entityId; diff --git a/Minecraft.World/PlayerInfoPacket.h b/Minecraft.World/PlayerInfoPacket.h index 7044ffbd..85e2ed64 100644 --- a/Minecraft.World/PlayerInfoPacket.h +++ b/Minecraft.World/PlayerInfoPacket.h @@ -27,6 +27,6 @@ class PlayerInfoPacket : public Packet, public enable_shared_from_this create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PlayerInfoPacket()); } virtual int getId() { return 201; } }; \ No newline at end of file diff --git a/Minecraft.World/PlayerInputPacket.h b/Minecraft.World/PlayerInputPacket.h index 6f1dce47..bc2d3985 100644 --- a/Minecraft.World/PlayerInputPacket.h +++ b/Minecraft.World/PlayerInputPacket.h @@ -27,6 +27,6 @@ public: bool isSneaking(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PlayerInputPacket()); } virtual int getId() { return 27; } }; \ No newline at end of file diff --git a/Minecraft.World/PlayerTeam.cpp b/Minecraft.World/PlayerTeam.cpp index 608cb36b..3e159af4 100644 --- a/Minecraft.World/PlayerTeam.cpp +++ b/Minecraft.World/PlayerTeam.cpp @@ -77,7 +77,7 @@ wstring PlayerTeam::formatNameForTeam(PlayerTeam *team) wstring PlayerTeam::formatNameForTeam(Team *team, const wstring &name) { - if (team == nullptr) return name; + if (team == NULL) return name; return team->getFormattedName(name); } diff --git a/Minecraft.World/PortalForcer.cpp b/Minecraft.World/PortalForcer.cpp index 9695afdf..d0a12988 100644 --- a/Minecraft.World/PortalForcer.cpp +++ b/Minecraft.World/PortalForcer.cpp @@ -513,7 +513,7 @@ void PortalForcer::tick(int64_t time) int64_t key = *it; PortalPosition *pos = cachedPortals[key]; - if (pos == nullptr || pos->lastUsed < cutoff) + if (pos == NULL || pos->lastUsed < cutoff) { delete pos; it = cachedPortalKeys.erase(it); diff --git a/Minecraft.World/PortalTile.cpp b/Minecraft.World/PortalTile.cpp index 5e664e65..5e891e53 100644 --- a/Minecraft.World/PortalTile.cpp +++ b/Minecraft.World/PortalTile.cpp @@ -28,7 +28,7 @@ void PortalTile::tick(Level *level, int x, int y, int z, Random *random) // spawn a pig man here int iResult = 0; shared_ptr entity = SpawnEggItem::spawnMobAt(level, 57, x + .5, y0 + 1.1, z + .5, &iResult); - if (entity != nullptr) + if (entity != NULL) { entity->changingDimensionDelay = entity->getDimensionChangingDelay(); } @@ -38,7 +38,7 @@ void PortalTile::tick(Level *level, int x, int y, int z, Random *random) AABB *PortalTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } void PortalTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param @@ -201,7 +201,7 @@ void PortalTile::entityInside(Level *level, int x, int y, int z, shared_ptrGetType() == eTYPE_EXPERIENCEORB ) return; // 4J added - if (entity->riding == nullptr && entity->rider.lock() == nullptr) entity->handleInsidePortal(); + if (entity->riding == NULL && entity->rider.lock() == NULL) entity->handleInsidePortal(); } void PortalTile::animateTick(Level *level, int xt, int yt, int zt, Random *random) diff --git a/Minecraft.World/Pos.cpp b/Minecraft.World/Pos.cpp index d2f25def..e673ecc3 100644 --- a/Minecraft.World/Pos.cpp +++ b/Minecraft.World/Pos.cpp @@ -28,13 +28,13 @@ Pos::Pos(Pos *position) bool Pos::equals(void *other) { // TODO 4J Stu I cannot do a dynamic_cast from a void pointer - // If I cast it to a Pos then do a dynamic_cast will it still return nullptr if it wasn't originally a Pos? - if (!( dynamic_cast( static_cast(other) ) != nullptr )) + // If I cast it to a Pos then do a dynamic_cast will it still return NULL if it wasn't originally a Pos? + if (!( dynamic_cast( (Pos *)other ) != NULL )) { return false; } - Pos *p = static_cast(other); + Pos *p = (Pos *) other; return x == p->x && y == p->y && z == p->z; } diff --git a/Minecraft.World/PotatoTile.cpp b/Minecraft.World/PotatoTile.cpp index 351c8c98..872622ba 100644 --- a/Minecraft.World/PotatoTile.cpp +++ b/Minecraft.World/PotatoTile.cpp @@ -46,7 +46,7 @@ void PotatoTile::spawnResources(Level *level, int x, int y, int z, int data, flo { if (level->random->nextInt(50) == 0) { - popResource(level, x, y, z, std::make_shared(Item::potatoPoisonous)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Item::potatoPoisonous))); } } } diff --git a/Minecraft.World/PotionBrewing.cpp b/Minecraft.World/PotionBrewing.cpp index bc5fd8c7..8e27a601 100644 --- a/Minecraft.World/PotionBrewing.cpp +++ b/Minecraft.World/PotionBrewing.cpp @@ -186,7 +186,7 @@ int PotionBrewing::getColorValue(vector *effects) int baseColor = colourTable->getColor( eMinecraftColour_Potion_BaseColour ); - if (effects == nullptr || effects->empty()) + if (effects == NULL || effects->empty()) { return baseColor; } @@ -203,9 +203,9 @@ int PotionBrewing::getColorValue(vector *effects) for (int potency = 0; potency <= effect->getAmplifier(); potency++) { - red += static_cast((potionColor >> 16) & 0xff) / 255.0f; - green += static_cast((potionColor >> 8) & 0xff) / 255.0f; - blue += static_cast((potionColor >> 0) & 0xff) / 255.0f; + red += (float) ((potionColor >> 16) & 0xff) / 255.0f; + green += (float) ((potionColor >> 8) & 0xff) / 255.0f; + blue += (float) ((potionColor >> 0) & 0xff) / 255.0f; count++; } } @@ -214,7 +214,7 @@ int PotionBrewing::getColorValue(vector *effects) green = (green / count) * 255.0f; blue = (blue / count) * 255.0f; - return static_cast(red) << 16 | static_cast(green) << 8 | static_cast(blue); + return ((int) red) << 16 | ((int) green) << 8 | ((int) blue); } bool PotionBrewing::areAllEffectsAmbient(vector *effects) @@ -238,7 +238,7 @@ int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects) } vector *effects = getEffects(brew, false); int color = getColorValue(effects); - if(effects != nullptr) + if(effects != NULL) { for(auto& effect : *effects) { @@ -325,16 +325,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, } // split by and - size_t andIndex = definition.find_first_of(L'&', start); - if (andIndex != wstring::npos && andIndex < static_cast(end)) + int andIndex = (int)definition.find_first_of(L'&', start); + if (andIndex >= 0 && andIndex < end) { - int leftSide = parseEffectFormulaValue(definition, start, static_cast(andIndex) - 1, brew); + int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew); if (leftSide <= 0) { return 0; } - int rightSide = parseEffectFormulaValue(definition, static_cast(andIndex) + 1, end, brew); + int rightSide = parseEffectFormulaValue(definition, andIndex + 1, end, brew); if (rightSide <= 0) { return 0; @@ -413,16 +413,16 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, } // split by or - size_t orIndex = definition.find_first_of(L'|', start); - if (orIndex != wstring::npos && orIndex < static_cast(end)) + int orIndex = definition.find_first_of(L'|', start); + if (orIndex >= 0 && orIndex < end) { - int leftSide = parseEffectFormulaValue(definition, start, static_cast(orIndex) - 1, brew); + int leftSide = parseEffectFormulaValue(definition, start, orIndex - 1, brew); if (leftSide > 0) { return leftSide; } - int rightSide = parseEffectFormulaValue(definition, static_cast(orIndex) + 1, end, brew); + int rightSide = parseEffectFormulaValue(definition, orIndex + 1, end, brew); if (rightSide > 0) { return rightSide; @@ -430,10 +430,10 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, return 0; } // split by and - size_t andIndex = definition.find_first_of(L'&', start); - if (andIndex != wstring::npos && andIndex < static_cast(end)) + int andIndex = definition.find_first_of(L'&', start); + if (andIndex >= 0 && andIndex < end) { - int leftSide = parseEffectFormulaValue(definition, start, static_cast(andIndex) - 1, brew); + int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew); if (leftSide <= 0) { return 0; @@ -552,13 +552,13 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, vector *PotionBrewing::getEffects(int brew, bool includeDisabledEffects) { - vector *list = nullptr; + vector *list = NULL; //for (MobEffect effect : MobEffect.effects) for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i) { MobEffect *effect = MobEffect::effects[i]; - if (effect == nullptr || (effect->isDisabled() && !includeDisabledEffects)) + if (effect == NULL || (effect->isDisabled() && !includeDisabledEffects)) { continue; } @@ -570,7 +570,7 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis } wstring durationString = effIt->second; - int duration = parseEffectFormulaValue(durationString, 0, static_cast(durationString.length()), brew); + int duration = parseEffectFormulaValue(durationString, 0, (int)durationString.length(), brew); if (duration > 0) { int amplifier = 0; @@ -578,7 +578,7 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis if (ampIt != potionEffectAmplifier.end()) { wstring amplifierString = ampIt->second; - amplifier = parseEffectFormulaValue(amplifierString, 0, static_cast(amplifierString.length()), brew); + amplifier = parseEffectFormulaValue(amplifierString, 0, (int)amplifierString.length(), brew); if (amplifier < 0) { amplifier = 0; @@ -594,15 +594,15 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis // 3, 8, 13, 18.. minutes duration = (SharedConstants::TICKS_PER_SECOND * 60) * (duration * 3 + (duration - 1) * 2); duration >>= amplifier; - duration = static_cast(Math::round((double)duration * effect->getDurationModifier())); + duration = (int) Math::round((double) duration * effect->getDurationModifier()); if ((brew & THROWABLE_MASK) != 0) { - duration = static_cast(Math::round((double)duration * .75 + .5)); + duration = (int) Math::round((double) duration * .75 + .5); } } - if (list == nullptr) + if (list == NULL) { list = new vector(); } @@ -756,7 +756,7 @@ int PotionBrewing::applyBrew(int currentBrew, const wstring &formula) { int start = 0; - int end = static_cast(formula.length()); + int end = (int)formula.length(); bool hasValue = false; bool isNot = false; diff --git a/Minecraft.World/PotionItem.cpp b/Minecraft.World/PotionItem.cpp index fd156883..fd8937bf 100644 --- a/Minecraft.World/PotionItem.cpp +++ b/Minecraft.World/PotionItem.cpp @@ -26,26 +26,26 @@ PotionItem::PotionItem(int id) : Item(id) setStackedByData(true); setMaxDamage(0); - iconThrowable = nullptr; - iconDrinkable = nullptr; - iconOverlay = nullptr; + iconThrowable = NULL; + iconDrinkable = NULL; + iconOverlay = NULL; } vector *PotionItem::getMobEffects(shared_ptr potion) { if (!potion->hasTag() || !potion->getTag()->contains(L"CustomPotionEffects")) { - vector *effects = nullptr; + vector *effects = NULL; auto it = cachedMobEffects.find(potion->getAuxValue()); if(it != cachedMobEffects.end()) effects = it->second; - if (effects == nullptr) + if (effects == NULL) { effects = PotionBrewing::getEffects(potion->getAuxValue(), false); cachedMobEffects[potion->getAuxValue()] = effects; } // Result should be a new (unmanaged) vector, so create a new one - return effects == nullptr ? nullptr : new vector(*effects); + return effects == NULL ? NULL : new vector(*effects); } else { @@ -64,13 +64,13 @@ vector *PotionItem::getMobEffects(shared_ptr vector *PotionItem::getMobEffects(int auxValue) { - vector *effects = nullptr; + vector *effects = NULL; auto it = cachedMobEffects.find(auxValue); if(it != cachedMobEffects.end()) effects = it->second; - if (effects == nullptr) + if (effects == NULL) { effects = PotionBrewing::getEffects(auxValue, false); - if(effects != nullptr) cachedMobEffects.insert( std::pair *>(auxValue, effects) ); + if(effects != NULL) cachedMobEffects.insert( std::pair *>(auxValue, effects) ); } return effects; } @@ -82,7 +82,7 @@ shared_ptr PotionItem::useTimeDepleted(shared_ptr in if (!level->isClientSide) { vector *effects = getMobEffects(instance); - if (effects != nullptr) + if (effects != NULL) { for(auto& effect : *effects) { @@ -94,11 +94,11 @@ shared_ptr PotionItem::useTimeDepleted(shared_ptr in { if (instance->count <= 0) { - return std::make_shared(Item::glassBottle); + return shared_ptr( new ItemInstance(Item::glassBottle) ); } else { - player->inventory->add(std::make_shared(Item::glassBottle)); + player->inventory->add( shared_ptr( new ItemInstance(Item::glassBottle) ) ); } } @@ -126,7 +126,7 @@ shared_ptr PotionItem::use(shared_ptr instance, Leve { if (!player->abilities.instabuild) instance->count--; level->playEntitySound(player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity(std::make_shared(level, player, instance->getAuxValue())); + if (!level->isClientSide) level->addEntity(shared_ptr( new ThrownPotion(level, player, instance->getAuxValue()) )); return instance; } player->startUsingItem(instance, getUseDuration(instance)); @@ -183,7 +183,7 @@ bool PotionItem::hasMultipleSpriteLayers() bool PotionItem::hasInstantenousEffects(int itemAuxValue) { vector *mobEffects = getMobEffects(itemAuxValue); - if (mobEffects == nullptr || mobEffects->empty()) + if (mobEffects == NULL || mobEffects->empty()) { return false; } @@ -216,7 +216,7 @@ wstring PotionItem::getHoverName(shared_ptr itemInstance) } vector *effects = ((PotionItem *) Item::potion)->getMobEffects(itemInstance); - if (effects != nullptr && !effects->empty()) + if (effects != NULL && !effects->empty()) { //String postfixString = effects.get(0).getDescriptionId(); //postfixString += ".postfix"; @@ -244,7 +244,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p } vector *effects = ((PotionItem *) Item::potion)->getMobEffects(itemInstance); attrAttrModMap modifiers; - if (effects != nullptr && !effects->empty()) + if (effects != NULL && !effects->empty()) { //for (MobEffectInstance effect : effects) for(auto& effect : *effects) @@ -254,7 +254,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p MobEffect *mobEffect = MobEffect::effects[effect->getId()]; unordered_map *effectModifiers = mobEffect->getAttributeModifiers(); - if (effectModifiers != nullptr && effectModifiers->size() > 0) + if (effectModifiers != NULL && effectModifiers->size() > 0) { for(auto& it : *effectModifiers) { @@ -335,7 +335,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p bool PotionItem::isFoil(shared_ptr itemInstance) { vector *mobEffects = getMobEffects(itemInstance); - return mobEffects != nullptr && !mobEffects->empty(); + return mobEffects != NULL && !mobEffects->empty(); } unsigned int PotionItem::getUseDescriptionId(shared_ptr instance) @@ -368,7 +368,7 @@ Icon *PotionItem::getTexture(const wstring &name) if (name.compare(DEFAULT_ICON) == 0) return Item::potion->iconDrinkable; if (name.compare(THROWABLE_ICON) == 0) return Item::potion->iconThrowable; if (name.compare(CONTENTS_ICON) == 0) return Item::potion->iconOverlay; - return nullptr; + return NULL; } @@ -381,7 +381,7 @@ vector > *PotionItem::getUniquePotionValues() { vector *effects = PotionBrewing::getEffects(brew, false); - if (effects != nullptr) + if (effects != NULL) { if(!effects->empty()) { diff --git a/Minecraft.World/PotionItem.h b/Minecraft.World/PotionItem.h index 4a43505f..9fa158c2 100644 --- a/Minecraft.World/PotionItem.h +++ b/Minecraft.World/PotionItem.h @@ -7,7 +7,7 @@ class MobEffectInstance; class PotionItem : public Item { private: - static const int DRINK_DURATION = static_cast(20 * 1.6); + static const int DRINK_DURATION = (int) (20 * 1.6); public: static const wstring DEFAULT_ICON; diff --git a/Minecraft.World/PreLoginPacket.cpp b/Minecraft.World/PreLoginPacket.cpp index aa6832ca..4b474214 100644 --- a/Minecraft.World/PreLoginPacket.cpp +++ b/Minecraft.World/PreLoginPacket.cpp @@ -9,7 +9,7 @@ PreLoginPacket::PreLoginPacket() { loginKey = L""; - m_playerXuids = nullptr; + m_playerXuids = NULL; m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; @@ -23,7 +23,7 @@ PreLoginPacket::PreLoginPacket() PreLoginPacket::PreLoginPacket(wstring userName) { this->loginKey = userName; - m_playerXuids = nullptr; + m_playerXuids = NULL; m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; @@ -50,7 +50,7 @@ PreLoginPacket::PreLoginPacket(wstring userName, PlayerUID *playerXuids, DWORD p PreLoginPacket::~PreLoginPacket() { - if( m_playerXuids != nullptr ) delete [] m_playerXuids; + if( m_playerXuids != NULL ) delete [] m_playerXuids; } void PreLoginPacket::read(DataInputStream *dis) //throws IOException @@ -92,7 +92,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(m_friendsOnlyBits); dos->writeInt(m_ugcPlayersVersion); - dos->writeByte(static_cast(m_dwPlayerCount)); + dos->writeByte((byte)m_dwPlayerCount); for(DWORD i = 0; i < m_dwPlayerCount; ++i) { dos->writePlayerUID( m_playerXuids[i] ); @@ -115,5 +115,5 @@ void PreLoginPacket::handle(PacketListener *listener) int PreLoginPacket::getEstimatedSize() { - return 4 + 4 + static_cast(loginKey.length()) + 4 +14 + 4 + 1 + 4; + return 4 + 4 + (int)loginKey.length() + 4 +14 + 4 + 1 + 4; } diff --git a/Minecraft.World/PreLoginPacket.h b/Minecraft.World/PreLoginPacket.h index b0935d0a..243f2f36 100644 --- a/Minecraft.World/PreLoginPacket.h +++ b/Minecraft.World/PreLoginPacket.h @@ -34,6 +34,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new PreLoginPacket()); } virtual int getId() { return 2; } }; \ No newline at end of file diff --git a/Minecraft.World/PressurePlateTile.cpp b/Minecraft.World/PressurePlateTile.cpp index 650fbf9f..beed308a 100644 --- a/Minecraft.World/PressurePlateTile.cpp +++ b/Minecraft.World/PressurePlateTile.cpp @@ -23,14 +23,14 @@ int PressurePlateTile::getSignalForData(int data) int PressurePlateTile::getSignalStrength(Level *level, int x, int y, int z) { - vector< shared_ptr > *entities = nullptr; + vector< shared_ptr > *entities = NULL; if (sensitivity == everything) entities = level->getEntities(nullptr, getSensitiveAABB(x, y, z)); else if (sensitivity == mobs) entities = level->getEntitiesOfClass(typeid(LivingEntity), getSensitiveAABB(x, y, z)); else if (sensitivity == players) entities = level->getEntitiesOfClass(typeid(Player), getSensitiveAABB(x, y, z)); else __debugbreak(); // 4J-JEV: We're going to delete something at a random location. - if (entities != nullptr && !entities->empty()) + if (entities != NULL && !entities->empty()) { for (auto& e : *entities) { diff --git a/Minecraft.World/PrimedTnt.cpp b/Minecraft.World/PrimedTnt.cpp index 39b3ea73..79fd760f 100644 --- a/Minecraft.World/PrimedTnt.cpp +++ b/Minecraft.World/PrimedTnt.cpp @@ -33,7 +33,7 @@ PrimedTnt::PrimedTnt(Level *level, double x, double y, double z, shared_ptr(Math::random() * PI * 2); + float rot = (float) (Math::random() * PI * 2); xd = -sin(rot) * 0.02f; yd = +0.2f; zd = -cos(rot) * 0.02f; @@ -105,7 +105,7 @@ void PrimedTnt::explode() void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putByte(L"Fuse", static_cast(life)); + entityTag->putByte(L"Fuse", (byte) life); } void PrimedTnt::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/ProtectionEnchantment.cpp b/Minecraft.World/ProtectionEnchantment.cpp index 13a6836c..8304529b 100644 --- a/Minecraft.World/ProtectionEnchantment.cpp +++ b/Minecraft.World/ProtectionEnchantment.cpp @@ -54,7 +54,7 @@ int ProtectionEnchantment::getDescriptionId() bool ProtectionEnchantment::isCompatibleWith(Enchantment *other) const { ProtectionEnchantment *pe = dynamic_cast( other ); - if (pe != nullptr) + if (pe != NULL) { if (pe->type == type) { diff --git a/Minecraft.World/PumpkinTile.cpp b/Minecraft.World/PumpkinTile.cpp index da11001d..2bc36972 100644 --- a/Minecraft.World/PumpkinTile.cpp +++ b/Minecraft.World/PumpkinTile.cpp @@ -13,8 +13,8 @@ const wstring PumpkinTile::TEXTURE_LANTERN = L"pumpkin_jack"; PumpkinTile::PumpkinTile(int id, bool lit) : DirectionalTile(id, Material::vegetable, isSolidRender() ) { - iconTop = nullptr; - iconFace = nullptr; + iconTop = NULL; + iconFace = NULL; setTicking(true); this->lit = lit; } @@ -45,7 +45,7 @@ void PumpkinTile::onPlace(Level *level, int x, int y, int z) level->setTileAndData(x, y, z, 0, 0, Tile::UPDATE_CLIENTS); level->setTileAndData(x, y - 1, z, 0, 0, Tile::UPDATE_CLIENTS); level->setTileAndData(x, y - 2, z, 0, 0, Tile::UPDATE_CLIENTS); - shared_ptr snowMan = std::make_shared(level); + shared_ptr snowMan = shared_ptr(new SnowMan(level)); snowMan->moveTo(x + 0.5, y - 1.95, z + 0.5, 0, 0); level->addEntity(snowMan); @@ -94,7 +94,7 @@ void PumpkinTile::onPlace(Level *level, int x, int y, int z) level->setTileAndData(x, y - 1, z + 1, 0, 0, Tile::UPDATE_CLIENTS); } - shared_ptr villagerGolem = std::make_shared(level); + shared_ptr villagerGolem = shared_ptr(new VillagerGolem(level)); villagerGolem->setPlayerCreated(true); villagerGolem->moveTo(x + 0.5, y - 1.95, z + 0.5, 0, 0); level->addEntity(villagerGolem); diff --git a/Minecraft.World/QuartzBlockTile.cpp b/Minecraft.World/QuartzBlockTile.cpp index d0ab02d2..709e0c1e 100644 --- a/Minecraft.World/QuartzBlockTile.cpp +++ b/Minecraft.World/QuartzBlockTile.cpp @@ -91,7 +91,7 @@ int QuartzBlockTile::getSpawnResourcesAuxValue(int data) shared_ptr QuartzBlockTile::getSilkTouchItemInstance(int data) { - if (data == TYPE_LINES_X || data == TYPE_LINES_Z) return std::make_shared(id, 1, TYPE_LINES_Y); + if (data == TYPE_LINES_X || data == TYPE_LINES_Z) return shared_ptr(new ItemInstance(id, 1, TYPE_LINES_Y)); return Tile::getSilkTouchItemInstance(data); } diff --git a/Minecraft.World/Random.cpp b/Minecraft.World/Random.cpp index 89903da8..d4e3a545 100644 --- a/Minecraft.World/Random.cpp +++ b/Minecraft.World/Random.cpp @@ -27,22 +27,22 @@ void Random::setSeed(int64_t s) int Random::next(int bits) { seed = (seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1); - return static_cast(seed >> (48 - bits)); + return (int)(seed >> (48 - bits)); } void Random::nextBytes(byte *bytes, unsigned int count) { for(unsigned int i = 0; i < count; i++ ) { - bytes[i] = static_cast(next(8)); + bytes[i] = (byte)next(8); } } double Random::nextDouble() { - return ((static_cast(next(26)) << 27) + next(27)) - / static_cast(1LL << 53); + return (((int64_t)next(26) << 27) + next(27)) + / (double)(1LL << 53); } double Random::nextGaussian() @@ -79,7 +79,7 @@ int Random::nextInt(int n) if ((n & -n) == n) // i.e., n is a power of 2 - return static_cast((static_cast(next(31)) * n) >> 31); // 4J Stu - Made int64_t instead of long + return (int)(((int64_t)next(31) * n) >> 31); // 4J Stu - Made int64_t instead of long int bits, val; do @@ -92,12 +92,12 @@ int Random::nextInt(int n) float Random::nextFloat() { - return next(24) / static_cast(1 << 24); + return next(24) / ((float)(1 << 24)); } int64_t Random::nextLong() { - return (static_cast(next(32)) << 32) + next(32); + return ((int64_t)next(32) << 32) + next(32); } bool Random::nextBoolean() diff --git a/Minecraft.World/RandomLevelSource.cpp b/Minecraft.World/RandomLevelSource.cpp index a0e7a94b..ae06c1f8 100644 --- a/Minecraft.World/RandomLevelSource.cpp +++ b/Minecraft.World/RandomLevelSource.cpp @@ -58,8 +58,8 @@ RandomLevelSource::RandomLevelSource(Level *level, int64_t seed, bool generateSt } else { - floatingIslandScale = nullptr; - floatingIslandNoise = nullptr; + floatingIslandScale = NULL; + floatingIslandNoise = NULL; } forestNoise = new PerlinNoise(random, 8); @@ -93,7 +93,7 @@ RandomLevelSource::~RandomLevelSource() delete forestNoise; - if( pows.data != nullptr ) delete [] pows.data; + if( pows.data != NULL ) delete [] pows.data; } @@ -187,7 +187,7 @@ float RandomLevelSource::getHeightFalloff(int xxx, int zzz, int* pEMin) if( emin < falloffStart ) { int falloff = falloffStart - emin; - comp = (static_cast(falloff) / static_cast(falloffStart) ) * falloffMax; + comp = ((float)falloff / (float)falloffStart ) * falloffMax; } *pEMin = emin; return comp; @@ -267,7 +267,7 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) { for (int yc = 0; yc < yChunks; yc++) { - double yStep = 1 / static_cast(CHUNK_HEIGHT); + double yStep = 1 / (double) CHUNK_HEIGHT; double s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; double s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; double s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; @@ -280,7 +280,7 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) for (int y = 0; y < CHUNK_HEIGHT; y++) { - double xStep = 1 / static_cast(CHUNK_WIDTH); + double xStep = 1 / (double) CHUNK_WIDTH; double _s0 = s0; double _s1 = s1; @@ -292,7 +292,7 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) int offs = (x + xc * CHUNK_WIDTH) << Level::genDepthBitsPlusFour | (0 + zc * CHUNK_WIDTH) << Level::genDepthBits | (yc * CHUNK_HEIGHT + y); int step = 1 << Level::genDepthBits; offs -= step; - double zStep = 1 / static_cast(CHUNK_WIDTH); + double zStep = 1 / (double) CHUNK_WIDTH; double val = _s0; double vala = (_s1 - _s0) * zStep; @@ -315,11 +315,11 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) // 4J - this comparison used to just be with 0.0f but is now varied by block above if ((val += vala) > comp) { - tileId = static_cast(Tile::stone_Id); + tileId = (byte) Tile::stone_Id; } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = static_cast(Tile::calmWater_Id); + tileId = (byte) Tile::calmWater_Id; } // 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that @@ -377,7 +377,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi { Biome *b = biomes[z + x * 16]; float temp = b->getTemperature(); - int runDepth = static_cast(depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); int run = -1; @@ -385,7 +385,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi byte material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); - if(lgo != nullptr) + if(lgo != NULL) { lgo->getBiomeOverride(b->id,material,top); } @@ -397,7 +397,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in // if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = (byte) Tile::unbreakable_Id; } else { @@ -414,13 +414,13 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = static_cast(Tile::stone_Id); + material = (byte) Tile::stone_Id; } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { top = b->topMaterial; material = b->material; - if(lgo != nullptr) + if(lgo != NULL) { lgo->getBiomeOverride(b->id,material,top); } @@ -428,8 +428,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = static_cast(Tile::ice_Id); - else top = static_cast(Tile::calmWater_Id); + if (temp < 0.15f) top = (byte) Tile::ice_Id; + else top = (byte) Tile::calmWater_Id; } run = runDepth; @@ -445,7 +445,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (run == 0 && material == Tile::sand_Id) { run = random->nextInt(4); - material = static_cast(Tile::sandStone_Id); + material = (byte) Tile::sandStone_Id; } } } @@ -469,7 +469,7 @@ LevelChunk *RandomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -525,11 +525,11 @@ void RandomLevelSource::lightChunk(LevelChunk *lc) doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize, BiomeArray& biomes) { - if (buffer.data == nullptr) + if (buffer.data == NULL) { buffer = doubleArray(xSize * ySize * zSize); } - if (pows.data == nullptr) + if (pows.data == NULL) { pows = floatArray(5 * 5); for (int xb = -2; xb <= 2; xb++) @@ -882,9 +882,9 @@ wstring RandomLevelSource::gatherStats() vector *RandomLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == nullptr) + if (biome == NULL) { - return nullptr; + return NULL; } if (mobCategory == MobCategory::monster && scatteredFeature->isSwamphut(x, y, z)) { @@ -895,20 +895,20 @@ vector *RandomLevelSource::getMobsAt(MobCategory *mobCa TilePos *RandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) + if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } - return nullptr; + return NULL; } void RandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) { if (generateStructures) { - mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray()); - villageFeature->apply(this, level, chunkX, chunkZ, byteArray()); - strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray()); - scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray()); + mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL); + villageFeature->apply(this, level, chunkX, chunkZ, NULL); + strongholdFeature->apply(this, level, chunkX, chunkZ, NULL); + scatteredFeature->apply(this, level, chunkX, chunkZ, NULL); } } \ No newline at end of file diff --git a/Minecraft.World/RandomPos.cpp b/Minecraft.World/RandomPos.cpp index 1a86800e..c2cfd908 100644 --- a/Minecraft.World/RandomPos.cpp +++ b/Minecraft.World/RandomPos.cpp @@ -7,7 +7,7 @@ Vec3 *RandomPos::tempDir = Vec3::newPermanent(0, 0, 0); Vec3 *RandomPos::getPos(shared_ptr mob, int xzDist, int yDist, int quadrant/*=-1*/) // 4J - added quadrant { - return generateRandomPos(mob, xzDist, yDist, nullptr, quadrant); + return generateRandomPos(mob, xzDist, yDist, NULL, quadrant); } Vec3 *RandomPos::getPosTowards(shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos) @@ -62,7 +62,7 @@ Vec3 *RandomPos::generateRandomPos(shared_ptr mob, int xzDist, in } yt = random->nextInt(2 * yDist) - yDist; - if (dir != nullptr && xt * dir->x + zt * dir->z < 0) continue; + if (dir != NULL && xt * dir->x + zt * dir->z < 0) continue; xt += Mth::floor(mob->x); yt += Mth::floor(mob->y); @@ -84,5 +84,5 @@ Vec3 *RandomPos::generateRandomPos(shared_ptr mob, int xzDist, in return Vec3::newTemp(xBest, yBest, zBest); } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.World/RandomScatteredLargeFeature.cpp b/Minecraft.World/RandomScatteredLargeFeature.cpp index 3b03dba6..bd0b70bb 100644 --- a/Minecraft.World/RandomScatteredLargeFeature.cpp +++ b/Minecraft.World/RandomScatteredLargeFeature.cpp @@ -67,7 +67,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Temples); } @@ -123,14 +123,14 @@ RandomScatteredLargeFeature::ScatteredFeatureStart::ScatteredFeatureStart(Level bool RandomScatteredLargeFeature::isSwamphut(int cellX, int cellY, int cellZ) { StructureStart *structureAt = getStructureAt(cellX, cellY, cellZ); - if (structureAt == nullptr || !( dynamic_cast( structureAt ) ) || structureAt->pieces.empty()) + if (structureAt == NULL || !( dynamic_cast( structureAt ) ) || structureAt->pieces.empty()) { return false; } - StructurePiece *first = nullptr; + StructurePiece *first = NULL; auto it = structureAt->pieces.begin(); if(it != structureAt->pieces.end() ) first = *it; - return dynamic_cast(first) != nullptr; + return dynamic_cast(first) != NULL; } vector *RandomScatteredLargeFeature::getSwamphutEnemies() diff --git a/Minecraft.World/RandomStrollGoal.cpp b/Minecraft.World/RandomStrollGoal.cpp index 4eb5815d..15957ab3 100644 --- a/Minecraft.World/RandomStrollGoal.cpp +++ b/Minecraft.World/RandomStrollGoal.cpp @@ -22,7 +22,7 @@ bool RandomStrollGoal::canUse() if (mob->getRandom()->nextInt(120) == 0) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 10, 7); - if (pos == nullptr) return false; + if (pos == NULL) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -38,7 +38,7 @@ bool RandomStrollGoal::canUse() if( mob->isExtraWanderingEnabled() ) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 10, 7,mob->getWanderingQuadrant()); - if (pos == nullptr) return false; + if (pos == NULL) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; diff --git a/Minecraft.World/RangedAttackGoal.cpp b/Minecraft.World/RangedAttackGoal.cpp index 72178d9d..2923e011 100644 --- a/Minecraft.World/RangedAttackGoal.cpp +++ b/Minecraft.World/RangedAttackGoal.cpp @@ -40,7 +40,7 @@ RangedAttackGoal::RangedAttackGoal(RangedAttackMob *rangedMob, Mob *mob, double bool RangedAttackGoal::canUse() { shared_ptr bestTarget = mob->getTarget(); - if (bestTarget == nullptr) return false; + if (bestTarget == NULL) return false; target = weak_ptr(bestTarget); return true; } @@ -60,7 +60,7 @@ void RangedAttackGoal::stop() void RangedAttackGoal::tick() { // 4J: It's possible the target has gone since canUse selected it, don't do tick if target is null - if (target.lock() == nullptr) return; + if (target.lock() == NULL) return; double targetDistSqr = mob->distanceToSqr(target.lock()->x, target.lock()->bb->y0, target.lock()->z); bool canSee = mob->getSensing()->canSee(target.lock()); diff --git a/Minecraft.World/ReadOnlyChunkCache.cpp b/Minecraft.World/ReadOnlyChunkCache.cpp index dfafdf2d..fdab13dc 100644 --- a/Minecraft.World/ReadOnlyChunkCache.cpp +++ b/Minecraft.World/ReadOnlyChunkCache.cpp @@ -25,7 +25,7 @@ ReadOnlyChunkCache::~ReadOnlyChunkCache() bool ReadOnlyChunkCache::hasChunk(int x, int z) { int slot = (x & LEN_MASK) | ((z & LEN_MASK) * LEN); - return chunks[slot] != nullptr && (chunks[slot]->isAt(x, z)); + return chunks[slot] != NULL && (chunks[slot]->isAt(x, z)); } LevelChunk *ReadOnlyChunkCache::create(int x, int z) @@ -41,7 +41,7 @@ LevelChunk *ReadOnlyChunkCache::getChunk(int x, int z) if (!hasChunk(x, z)) { LevelChunk *newChunk = load(x, z); - if (newChunk == nullptr) + if (newChunk == NULL) { newChunk = new EmptyLevelChunk(level, emptyPixels, x, z); } @@ -91,10 +91,10 @@ wstring ReadOnlyChunkCache::gatherStats() vector *ReadOnlyChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { - return nullptr; + return NULL; } TilePos *ReadOnlyChunkCache::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return nullptr; + return NULL; } diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index 24faaebe..ce026359 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -8,15 +8,15 @@ #include "net.minecraft.world.level.tile.h" #include "net.minecraft.world.item.crafting.h" -Recipes *Recipes::instance = nullptr; -ArmorRecipes *Recipes::pArmorRecipes=nullptr; -ClothDyeRecipes *Recipes::pClothDyeRecipes=nullptr; -FoodRecipies *Recipes::pFoodRecipies=nullptr; -OreRecipies *Recipes::pOreRecipies=nullptr; -StructureRecipies *Recipes::pStructureRecipies=nullptr; -ToolRecipies *Recipes::pToolRecipies=nullptr; -WeaponRecipies *Recipes::pWeaponRecipies=nullptr; -FireworksRecipe *Recipes::pFireworksRecipes=nullptr; +Recipes *Recipes::instance = NULL; +ArmorRecipes *Recipes::pArmorRecipes=NULL; +ClothDyeRecipes *Recipes::pClothDyeRecipes=NULL; +FoodRecipies *Recipes::pFoodRecipies=NULL; +OreRecipies *Recipes::pOreRecipies=NULL; +StructureRecipies *Recipes::pStructureRecipies=NULL; +ToolRecipies *Recipes::pToolRecipies=NULL; +WeaponRecipies *Recipes::pWeaponRecipies=NULL; +FireworksRecipe *Recipes::pFireworksRecipes=NULL; void Recipes::staticCtor() { @@ -950,7 +950,7 @@ Recipes::Recipes() L'D'); // 4J - TODO - put these new 1.7.3 items in required place within recipes - addShapedRecipy(new ItemInstance(static_cast(Tile::pistonBase), 1), // + addShapedRecipy(new ItemInstance((Tile *)Tile::pistonBase, 1), // L"sssctcicictg", L"TTT", // L"#X#", // @@ -959,7 +959,7 @@ Recipes::Recipes() L'#', Tile::cobblestone, L'X', Item::ironIngot, L'R', Item::redStone, L'T', Tile::wood, L'M'); - addShapedRecipy(new ItemInstance(static_cast(Tile::pistonStickyBase), 1), // + addShapedRecipy(new ItemInstance((Tile *)Tile::pistonStickyBase, 1), // L"sscictg", L"S", // L"P", // @@ -1042,7 +1042,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) Item *pItem; wchar_t wchFrom; int iCount; - ItemInstance **ids = nullptr; + ItemInstance **ids = NULL; myMap *mappings = new unordered_map(); @@ -1072,14 +1072,14 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) pwchString=va_arg(vl,wchar_t *); wString=pwchString; height++; - width = static_cast(wString.length()); + width = (int)wString.length(); map += wString; break; case L's': pwchString=va_arg(vl,wchar_t *); wString=pwchString; height++; - width = static_cast(wString.length()); + width = (int)wString.length(); map += wString; break; case L'w': @@ -1091,7 +1091,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) if(!wString.empty()) { height++; - width = static_cast(wString.length()); + width = (int)wString.length(); map += wString; } } @@ -1163,7 +1163,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) } else { - ids[j] = nullptr; + ids[j] = NULL; } } } @@ -1248,7 +1248,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) recipies->push_back(new ShapelessRecipy(result, ingredients, group)); } -shared_ptr Recipes::getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass /*= nullptr*/) +shared_ptr Recipes::getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass /*= NULL*/) { int count = 0; shared_ptr first = nullptr; @@ -1256,7 +1256,7 @@ shared_ptr Recipes::getItemFor(shared_ptr craft for (int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != nullptr) + if (item != NULL) { if (count == 0) first = item; if (count == 1) second = item; @@ -1272,10 +1272,10 @@ shared_ptr Recipes::getItemFor(shared_ptr craft int remaining = (remaining1 + remaining2) + item->getMaxDamage() * 5 / 100; int resultDamage = item->getMaxDamage() - remaining; if (resultDamage < 0) resultDamage = 0; - return std::make_shared(first->id, 1, resultDamage); + return shared_ptr( new ItemInstance(first->id, 1, resultDamage) ); } - if(recipesClass != nullptr) + if(recipesClass != NULL) { if (recipesClass->matches(craftSlots, level)) return recipesClass->assemble(craftSlots); } @@ -1305,7 +1305,7 @@ void Recipes::buildRecipeIngredientsArray(void) { //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - int iRecipeC=static_cast(recipies->size()); + int iRecipeC=(int)recipies->size(); m_pRecipeIngredientsRequired= new Recipy::INGREDIENTS_REQUIRED [iRecipeC]; diff --git a/Minecraft.World/Recipes.h b/Minecraft.World/Recipes.h index d6e508a8..aacdac30 100644 --- a/Minecraft.World/Recipes.h +++ b/Minecraft.World/Recipes.h @@ -90,7 +90,7 @@ public: ShapedRecipy *addShapedRecipy(ItemInstance *, ... ); void addShapelessRecipy(ItemInstance *result,... ); - shared_ptr getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass = nullptr); // 4J Added recipesClass param + shared_ptr getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass = NULL); // 4J Added recipesClass param vector *getRecipies(); // 4J-PB - Added all below for new Xbox 'crafting' diff --git a/Minecraft.World/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 3475263f..455323c2 100644 --- a/Minecraft.World/RecordingItem.cpp +++ b/Minecraft.World/RecordingItem.cpp @@ -30,7 +30,7 @@ bool RecordingItem::useOn(shared_ptr itemInstance, shared_ptrisClientSide) return true; - static_cast(Tile::jukebox)->setRecord(level, x, y, z, itemInstance); + ((JukeboxTile *) Tile::jukebox)->setRecord(level, x, y, z, itemInstance); level->levelEvent(nullptr, LevelEvent::SOUND_PLAY_RECORDING, x, y, z, id); itemInstance->count--; @@ -73,6 +73,6 @@ RecordingItem *RecordingItem::getByName(const wstring &name) } else { - return nullptr; + return NULL; } } \ No newline at end of file diff --git a/Minecraft.World/RedStoneDustTile.cpp b/Minecraft.World/RedStoneDustTile.cpp index e348406b..a4577bd3 100644 --- a/Minecraft.World/RedStoneDustTile.cpp +++ b/Minecraft.World/RedStoneDustTile.cpp @@ -25,10 +25,10 @@ RedStoneDustTile::RedStoneDustTile(int id) : Tile(id, Material::decoration,isSol updateDefaultShape(); - iconCross = nullptr; - iconLine = nullptr; - iconCrossOver = nullptr; - iconLineOver = nullptr; + iconCross = NULL; + iconLine = NULL; + iconCrossOver = NULL; + iconLineOver = NULL; } // 4J Added override @@ -39,7 +39,7 @@ void RedStoneDustTile::updateDefaultShape() AABB *RedStoneDustTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool RedStoneDustTile::isSolidRender(bool isServerLevel) @@ -409,5 +409,5 @@ Icon *RedStoneDustTile::getTexture(const wstring &name) if (name.compare(TEXTURE_LINE) == 0) return Tile::redStoneDust->iconLine; if (name.compare(TEXTURE_CROSS_OVERLAY) == 0) return Tile::redStoneDust->iconCrossOver; if (name.compare(TEXTURE_LINE_OVERLAY) == 0) return Tile::redStoneDust->iconLineOver; - return nullptr; + return NULL; } diff --git a/Minecraft.World/RedStoneOreTile.cpp b/Minecraft.World/RedStoneOreTile.cpp index 407da2cc..b7551932 100644 --- a/Minecraft.World/RedStoneOreTile.cpp +++ b/Minecraft.World/RedStoneOreTile.cpp @@ -124,5 +124,5 @@ bool RedStoneOreTile::shouldTileTick(Level *level, int x,int y,int z) shared_ptr RedStoneOreTile::getSilkTouchItemInstance(int data) { - return std::make_shared(Tile::redStoneOre); + return shared_ptr(new ItemInstance(Tile::redStoneOre)); } \ No newline at end of file diff --git a/Minecraft.World/ReedTile.cpp b/Minecraft.World/ReedTile.cpp index dc60bfba..c01eb764 100644 --- a/Minecraft.World/ReedTile.cpp +++ b/Minecraft.World/ReedTile.cpp @@ -78,7 +78,7 @@ bool ReedTile::canSurvive(Level *level, int x, int y, int z) AABB *ReedTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } int ReedTile::getResource(int data, Random *random, int playerBonusLevel) diff --git a/Minecraft.World/ReedsFeature.cpp b/Minecraft.World/ReedsFeature.cpp index ec46f053..2792b21b 100644 --- a/Minecraft.World/ReedsFeature.cpp +++ b/Minecraft.World/ReedsFeature.cpp @@ -12,7 +12,7 @@ bool ReedsFeature::place(Level *level, Random *random, int x, int y, int z) int z2 = z + random->nextInt(4) - random->nextInt(4); // 4J Stu Added to stop reed features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x2, y2, z2, x2, y2, z2); diff --git a/Minecraft.World/Region.cpp b/Minecraft.World/Region.cpp index 1e8acaf3..e3e91bf0 100644 --- a/Minecraft.World/Region.cpp +++ b/Minecraft.World/Region.cpp @@ -45,7 +45,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int for (int zc = zc1; zc <= zc2; zc++) { LevelChunk *chunk = level->getChunk(xc, zc); - if(chunk != nullptr) + if(chunk != NULL) { LevelChunkArray *lca = (*chunks)[xc - xc1]; lca->data[zc - zc1] = chunk; @@ -58,7 +58,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int { LevelChunkArray *lca = (*chunks)[xc - xc1]; LevelChunk *chunk = lca->data[zc - zc1]; - if (chunk != nullptr) + if (chunk != NULL) { if (!chunk->isYSpaceEmpty(y1, y2)) { @@ -71,7 +71,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int // AP - added a caching system for Chunk::rebuild to take advantage of xcCached = -1; zcCached = -1; - CachedTiles = nullptr; + CachedTiles = NULL; } bool Region::isAllEmpty() @@ -105,13 +105,13 @@ int Region::getTile(int x, int y, int z) xc -= xc1; zc -= zc1; - if (xc < 0 || xc >= static_cast(chunks->length) || zc < 0 || zc >= static_cast((*chunks)[xc]->length)) + if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length) { return 0; } LevelChunk *lc = (*chunks)[xc]->data[zc]; - if (lc == nullptr) return 0; + if (lc == NULL) return 0; return lc->getTile(x & 15, y, z & 15); } @@ -122,9 +122,9 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc) xcCached = xc; zcCached = zc; int size = 16 * 16 * Level::maxBuildHeight; - if( CachedTiles == nullptr ) + if( CachedTiles == NULL ) { - CachedTiles = static_cast(malloc(size)); + CachedTiles = (unsigned char *) malloc(size); } memcpy(CachedTiles, tiles, size); } @@ -132,14 +132,14 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc) LevelChunk* Region::getLevelChunk(int x, int y, int z) { if (y < 0) return 0; - if (y >= Level::maxBuildHeight) return nullptr; + if (y >= Level::maxBuildHeight) return NULL; int xc = (x >> 4) - xc1; int zc = (z >> 4) - zc1; - if (xc < 0 || xc >= static_cast(chunks->length) || zc < 0 || zc >= static_cast((*chunks)[xc]->length)) + if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length) { - return nullptr; + return NULL; } LevelChunk *lc = (*chunks)[xc]->data[zc]; @@ -263,7 +263,7 @@ Biome *Region::getBiome(int x, int z) bool Region::isSolidRenderTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == nullptr) return false; + if (tile == NULL) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by @@ -278,7 +278,7 @@ bool Region::isSolidRenderTile(int x, int y, int z) for( int i = 0; i < 6; i++ ) { int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) { return false; } @@ -294,7 +294,7 @@ bool Region::isSolidRenderTile(int x, int y, int z) bool Region::isSolidBlockingTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == nullptr) return false; + if (tile == NULL) return false; return tile->material->blocksMotion() && tile->isCubeShaped(); } @@ -307,7 +307,7 @@ bool Region::isTopSolidBlocking(int x, int y, int z) bool Region::isEmptyTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - return (tile == nullptr); + return (tile == NULL); } diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 175ea6c1..5c29f94e 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -39,7 +39,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) */ fileEntry = m_saveFile->createFile( fileName->getName() ); - m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); if ( fileEntry->getFileSize() < SECTOR_BYTES) { @@ -54,7 +54,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) m_bIsEmpty = false; } - //if ((GetFileSize(file,nullptr) & 0xfff) != 0) + //if ((GetFileSize(file,NULL) & 0xfff) != 0) if ((fileEntry->getFileSize() & 0xfff) != 0) { //byte zero = 0; @@ -78,7 +78,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) } else { - nSectors = static_cast(fileEntry->getFileSize()) / SECTOR_BYTES; + nSectors = (int) fileEntry->getFileSize() / SECTOR_BYTES; } sectorFree = new vector; sectorFree->reserve(nSectors); @@ -91,7 +91,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) sectorFree->at(0) = false; // chunk offset table sectorFree->at(1) = false; // for the last modified info - m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); for (int i = 0; i < SECTOR_INTS; ++i) { unsigned int offset = 0; @@ -139,11 +139,11 @@ void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversi m_saveFile->LockSaveAccess(); DWORD numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,offsets, SECTOR_BYTES ,&numberOfBytesWritten); numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->writeFile(fileEntry, chunkTimestamps, SECTOR_BYTES, &numberOfBytesWritten); m_saveFile->ReleaseSaveAccess(); @@ -175,7 +175,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (outOfBounds(x, z)) { // debugln("READ", x, z, "out of bounds"); - return nullptr; + return NULL; } // 4J - removed try/catch @@ -184,7 +184,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (offset == 0) { // debugln("READ", x, z, "miss"); - return nullptr; + return NULL; } unsigned int sectorNumber = offset >> 8; @@ -193,13 +193,13 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (sectorNumber + numSectors > sectorFree->size()) { // debugln("READ", x, z, "invalid sector"); - return nullptr; + return NULL; } m_saveFile->LockSaveAccess(); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN); unsigned int length; unsigned int decompLength; @@ -229,7 +229,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was // debugln("READ", x, z, "invalid length: " + length + " > 4096 * " + numSectors); m_saveFile->ReleaseSaveAccess(); - return nullptr; + return NULL; } MemSect(50); @@ -326,7 +326,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync PIXBeginNamedEvent(0,"Scanning for free space\n"); /* scan for a free space large enough to store this chunk */ - int runStart = static_cast(find(sectorFree->begin(), sectorFree->end(), true) - sectorFree->begin()); // 4J - was sectorFree.indexOf(true) + int runStart = (int)(find(sectorFree->begin(),sectorFree->end(),true) - sectorFree->begin()); // 4J - was sectorFree.indexOf(true) int runLength = 0; if (runStart != -1) { @@ -373,16 +373,16 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync */ // debug("SAVE", x, z, length, "grow"); //SetFilePointer(file,0,0,FILE_END); - m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); - sectorNumber = static_cast(sectorFree->size()); + sectorNumber = (int)sectorFree->size(); #ifndef _CONTENT_PACAKGE //wprintf(L"Writing chunk (%d,%d) in %ls from new sector %d to %d\n", x,z, fileEntry->data.filename, sectorNumber, sectorNumber + sectorsNeeded - 1); #endif DWORD numberOfBytesWritten = 0; for (int i = 0; i < sectorsNeeded; ++i) { - //WriteFile(file,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten,nullptr); + //WriteFile(file,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten,NULL); m_saveFile->writeFile(fileEntry,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten); sectorFree->push_back(false); } @@ -393,7 +393,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync PIXEndNamedEvent(); } } - setTimestamp(x, z, static_cast(System::currentTimeMillis() / 1000L)); + setTimestamp(x, z, (int) (System::currentTimeMillis() / 1000L)); } m_saveFile->ReleaseSaveAccess(); @@ -407,7 +407,7 @@ void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int co { DWORD numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data @@ -426,7 +426,7 @@ void RegionFile::zero(int sectorNumber, int length) { DWORD numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); } @@ -449,7 +449,7 @@ bool RegionFile::hasChunk(int x, int z) // 4J added - write the initial two sectors that used to be written in the ctor when the file was empty void RegionFile::insertInitialSectors() { - m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); DWORD numberOfBytesWritten = 0; byte zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); @@ -472,8 +472,7 @@ void RegionFile::setOffset(int x, int z, int offset) DWORD numberOfBytesWritten = 0; offsets[x + z * 32] = offset; - - m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten); } @@ -487,7 +486,7 @@ void RegionFile::setTimestamp(int x, int z, int value) DWORD numberOfBytesWritten = 0; chunkTimestamps[x + z * 32] = value; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, nullptr, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten); } diff --git a/Minecraft.World/RegionFileCache.cpp b/Minecraft.World/RegionFileCache.cpp index ab0492b4..2bb370a8 100644 --- a/Minecraft.World/RegionFileCache.cpp +++ b/Minecraft.World/RegionFileCache.cpp @@ -38,13 +38,13 @@ RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const wst } MemSect(0); - RegionFile *ref = nullptr; + RegionFile *ref = NULL; auto it = cache.find(file); if( it != cache.end() ) ref = it->second; // 4J Jev, put back in. - if (ref != nullptr) + if (ref != NULL) { return ref; } @@ -72,7 +72,7 @@ void RegionFileCache::_clear() // 4J - TODO was synchronized for(auto& it : cache) { RegionFile *regionFile = it.second; - if (regionFile != nullptr) + if (regionFile != NULL) { regionFile->close(); } diff --git a/Minecraft.World/RemoveEntitiesPacket.h b/Minecraft.World/RemoveEntitiesPacket.h index b400b861..2e734e71 100644 --- a/Minecraft.World/RemoveEntitiesPacket.h +++ b/Minecraft.World/RemoveEntitiesPacket.h @@ -21,7 +21,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new RemoveEntitiesPacket()); } virtual int getId() { return 29; } }; diff --git a/Minecraft.World/RemoveMobEffectPacket.cpp b/Minecraft.World/RemoveMobEffectPacket.cpp index 7e2d7c84..fcda6911 100644 --- a/Minecraft.World/RemoveMobEffectPacket.cpp +++ b/Minecraft.World/RemoveMobEffectPacket.cpp @@ -13,7 +13,7 @@ RemoveMobEffectPacket::RemoveMobEffectPacket() RemoveMobEffectPacket::RemoveMobEffectPacket(int entityId, MobEffectInstance *effect) { this->entityId = entityId; - this->effectId = static_cast(effect->getId() & 0xff); + this->effectId = (byte) (effect->getId() & 0xff); } void RemoveMobEffectPacket::read(DataInputStream *dis) diff --git a/Minecraft.World/RemoveMobEffectPacket.h b/Minecraft.World/RemoveMobEffectPacket.h index 140b0a7e..d69a4ed4 100644 --- a/Minecraft.World/RemoveMobEffectPacket.h +++ b/Minecraft.World/RemoveMobEffectPacket.h @@ -18,6 +18,6 @@ class RemoveMobEffectPacket : public Packet, public enable_shared_from_this create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new RemoveMobEffectPacket()); } virtual int getId() { return 42; } }; \ No newline at end of file diff --git a/Minecraft.World/RepairResultSlot.cpp b/Minecraft.World/RepairResultSlot.cpp index 87d2aab6..51e95b42 100644 --- a/Minecraft.World/RepairResultSlot.cpp +++ b/Minecraft.World/RepairResultSlot.cpp @@ -30,7 +30,7 @@ void RepairResultSlot::onTake(shared_ptr player, shared_ptrrepairItemCountCost > 0) { shared_ptr addition = m_menu->repairSlots->getItem(AnvilMenu::ADDITIONAL_SLOT); - if (addition != nullptr && addition->count > m_menu->repairItemCountCost) + if (addition != NULL && addition->count > m_menu->repairItemCountCost) { addition->count -= m_menu->repairItemCountCost; m_menu->repairSlots->setItem(AnvilMenu::ADDITIONAL_SLOT, addition); diff --git a/Minecraft.World/RespawnPacket.cpp b/Minecraft.World/RespawnPacket.cpp index 6dbebfac..ecc0b7f0 100644 --- a/Minecraft.World/RespawnPacket.cpp +++ b/Minecraft.World/RespawnPacket.cpp @@ -11,9 +11,9 @@ RespawnPacket::RespawnPacket() this->difficulty = 1; this->mapSeed = 0; this->mapHeight = 0; - this->playerGameType = nullptr; + this->playerGameType = NULL; this->m_newSeaLevel = false; - m_pLevelType = nullptr; + m_pLevelType = NULL; m_newEntityId = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -47,7 +47,7 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException mapHeight = dis->readShort(); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == nullptr) + if (m_pLevelType == NULL) { m_pLevelType = LevelType::lvl_normal; } @@ -68,7 +68,7 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(dimension); dos->writeByte(playerGameType->getId()); dos->writeShort(mapHeight); - if (m_pLevelType == nullptr) + if (m_pLevelType == NULL) { writeUtf(L"", dos); } @@ -89,9 +89,9 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException int RespawnPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != nullptr) + if (m_pLevelType != NULL) { - length = static_cast(m_pLevelType->getGeneratorName().length()); + length = (int)m_pLevelType->getGeneratorName().length(); } return 13+length; } diff --git a/Minecraft.World/RespawnPacket.h b/Minecraft.World/RespawnPacket.h index dc815994..3caf1ee3 100644 --- a/Minecraft.World/RespawnPacket.h +++ b/Minecraft.World/RespawnPacket.h @@ -29,6 +29,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new RespawnPacket()); } virtual int getId() { return 9; } }; diff --git a/Minecraft.World/RestrictOpenDoorGoal.cpp b/Minecraft.World/RestrictOpenDoorGoal.cpp index 3f7e2ed9..e8620a71 100644 --- a/Minecraft.World/RestrictOpenDoorGoal.cpp +++ b/Minecraft.World/RestrictOpenDoorGoal.cpp @@ -14,9 +14,9 @@ bool RestrictOpenDoorGoal::canUse() { if (mob->level->isDay()) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 16); - if (village == nullptr) return false; + if (village == NULL) return false; shared_ptr _doorInfo = village->getClosestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); - if (_doorInfo == nullptr) return false; + if (_doorInfo == NULL) return false; doorInfo = _doorInfo; return _doorInfo->distanceToInsideSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)) < 1.5 * 1.5; } @@ -25,7 +25,7 @@ bool RestrictOpenDoorGoal::canContinueToUse() { if (mob->level->isDay()) return false; shared_ptr _doorInfo = doorInfo.lock(); - if ( _doorInfo == nullptr ) return false; + if ( _doorInfo == NULL ) return false; return !_doorInfo->removed && _doorInfo->isInsideSide(Mth::floor(mob->x), Mth::floor(mob->z)); } diff --git a/Minecraft.World/ResultContainer.cpp b/Minecraft.World/ResultContainer.cpp index 7c8dd1c1..8c85d0c3 100644 --- a/Minecraft.World/ResultContainer.cpp +++ b/Minecraft.World/ResultContainer.cpp @@ -33,7 +33,7 @@ bool ResultContainer::hasCustomName() shared_ptr ResultContainer::removeItem(unsigned int slot, int count) { - if (items[0] != nullptr) + if (items[0] != NULL) { shared_ptr item = items[0]; items[0] = nullptr; @@ -44,7 +44,7 @@ shared_ptr ResultContainer::removeItem(unsigned int slot, int coun shared_ptr ResultContainer::removeItemNoUpdate(int slot) { - if (items[0] != nullptr) + if (items[0] != NULL) { shared_ptr item = items[0]; items[0] = nullptr; diff --git a/Minecraft.World/ResultSlot.cpp b/Minecraft.World/ResultSlot.cpp index 89a07ed1..08ffe714 100644 --- a/Minecraft.World/ResultSlot.cpp +++ b/Minecraft.World/ResultSlot.cpp @@ -60,13 +60,13 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr for (unsigned int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != nullptr) + if (item != NULL) { craftSlots->removeItem(i, 1); if (item->getItem()->hasCraftingRemainingItem()) { - shared_ptr craftResult = std::make_shared(item->getItem()->getCraftingRemainingItem()); + shared_ptr craftResult = shared_ptr(new ItemInstance(item->getItem()->getCraftingRemainingItem())); /* * Try to place this in the player's inventory (See we.java for new method) @@ -77,7 +77,7 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr } // If this slot is now empty, place it there (current behavior) - if (craftSlots->getItem(i) == nullptr) + if (craftSlots->getItem(i) == NULL) { craftSlots->setItem(i, craftResult); } diff --git a/Minecraft.World/RotateHeadPacket.h b/Minecraft.World/RotateHeadPacket.h index 884f4844..19ccf97f 100644 --- a/Minecraft.World/RotateHeadPacket.h +++ b/Minecraft.World/RotateHeadPacket.h @@ -22,6 +22,6 @@ public: virtual bool isAync(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new RotateHeadPacket()); } virtual int getId() { return 35; } }; \ No newline at end of file diff --git a/Minecraft.World/RotatedPillarTile.cpp b/Minecraft.World/RotatedPillarTile.cpp index 6475cd72..a4b7d931 100644 --- a/Minecraft.World/RotatedPillarTile.cpp +++ b/Minecraft.World/RotatedPillarTile.cpp @@ -73,5 +73,5 @@ int RotatedPillarTile::getType(int data) shared_ptr RotatedPillarTile::getSilkTouchItemInstance(int data) { - return std::make_shared(id, 1, getType(data)); + return shared_ptr( new ItemInstance(id, 1, getType(data)) ); } \ No newline at end of file diff --git a/Minecraft.World/RunAroundLikeCrazyGoal.cpp b/Minecraft.World/RunAroundLikeCrazyGoal.cpp index 40138d73..118b09f9 100644 --- a/Minecraft.World/RunAroundLikeCrazyGoal.cpp +++ b/Minecraft.World/RunAroundLikeCrazyGoal.cpp @@ -17,9 +17,9 @@ RunAroundLikeCrazyGoal::RunAroundLikeCrazyGoal(EntityHorse *mob, double speedMod bool RunAroundLikeCrazyGoal::canUse() { - if (horse->isTamed() || horse->rider.lock() == nullptr) return false; + if (horse->isTamed() || horse->rider.lock() == NULL) return false; Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(horse->shared_from_this()), 5, 4); - if (pos == nullptr) return false; + if (pos == NULL) return false; posX = pos->x; posY = pos->y; posZ = pos->z; @@ -33,7 +33,7 @@ void RunAroundLikeCrazyGoal::start() bool RunAroundLikeCrazyGoal::canContinueToUse() { - return !horse->getNavigation()->isDone() && horse->rider.lock() != nullptr; + return !horse->getNavigation()->isDone() && horse->rider.lock() != NULL; } void RunAroundLikeCrazyGoal::tick() diff --git a/Minecraft.World/SaddleItem.cpp b/Minecraft.World/SaddleItem.cpp index 63873060..f982b751 100644 --- a/Minecraft.World/SaddleItem.cpp +++ b/Minecraft.World/SaddleItem.cpp @@ -11,7 +11,7 @@ SaddleItem::SaddleItem(int id) : Item(id) bool SaddleItem::interactEnemy(shared_ptr itemInstance, shared_ptr player, shared_ptr mob) { - if ( (mob != nullptr) && mob->instanceof(eTYPE_PIG) ) + if ( (mob != NULL) && mob->instanceof(eTYPE_PIG) ) { shared_ptr pig = dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) diff --git a/Minecraft.World/SandFeature.cpp b/Minecraft.World/SandFeature.cpp index 9c0dc67c..122264ff 100644 --- a/Minecraft.World/SandFeature.cpp +++ b/Minecraft.World/SandFeature.cpp @@ -22,7 +22,7 @@ bool SandFeature::place(Level *level, Random *random, int x, int y, int z) int yr = 2; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - r, y - yr, z - r, x + r, y + yr, z + r); diff --git a/Minecraft.World/SandStoneTile.cpp b/Minecraft.World/SandStoneTile.cpp index bd7309b9..daf42db8 100644 --- a/Minecraft.World/SandStoneTile.cpp +++ b/Minecraft.World/SandStoneTile.cpp @@ -14,9 +14,9 @@ int SandStoneTile::SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES] = { SandStoneTile::SandStoneTile(int id) : Tile(id, Material::stone) { - icons = nullptr; - iconTop = nullptr; - iconBottom = nullptr; + icons = NULL; + iconTop = NULL; + iconBottom = NULL; } Icon *SandStoneTile::getTexture(int face, int data) diff --git a/Minecraft.World/Sapling.cpp b/Minecraft.World/Sapling.cpp index c169a608..85fcea98 100644 --- a/Minecraft.World/Sapling.cpp +++ b/Minecraft.World/Sapling.cpp @@ -17,7 +17,7 @@ const wstring Sapling::TEXTURE_NAMES[] = {L"sapling", L"sapling_spruce", L"sapli Sapling::Sapling(int id) : Bush( id ) { this->updateDefaultShape(); - icons = nullptr; + icons = NULL; } // 4J Added override @@ -65,7 +65,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) { int data = level->getData(x, y, z) & TYPE_MASK; - Feature *f = nullptr; + Feature *f = NULL; int ox = 0, oz = 0; bool multiblock = false; @@ -93,12 +93,12 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) break; } } - if (f != nullptr) + if (f != NULL) { break; } } - if (f == nullptr) + if (f == NULL) { ox = oz = 0; f = new TreeFeature(true, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false); @@ -138,7 +138,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) level->setTileAndData(x, y, z, id, data, Tile::UPDATE_NONE); } } - if( f != nullptr ) + if( f != NULL ) delete f; } diff --git a/Minecraft.World/SavedDataStorage.cpp b/Minecraft.World/SavedDataStorage.cpp index 049a19fc..422b66dc 100644 --- a/Minecraft.World/SavedDataStorage.cpp +++ b/Minecraft.World/SavedDataStorage.cpp @@ -26,7 +26,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin if (it != cache.end()) return (*it).second; shared_ptr data = nullptr; - if (levelStorage != nullptr) + if (levelStorage != NULL) { //File file = levelStorage->getDataFile(id); ConsoleSavePath file = levelStorage->getDataFile(id); @@ -37,15 +37,15 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin if( clazz == typeid(MapItemSavedData) ) { - data = dynamic_pointer_cast(std::make_shared(id)); + data = dynamic_pointer_cast( shared_ptr(new MapItemSavedData(id)) ); } else if( clazz == typeid(Villages) ) { - data = dynamic_pointer_cast(std::make_shared(id)); + data = dynamic_pointer_cast( shared_ptr(new Villages(id) ) ); } else if( clazz == typeid(StructureFeatureSavedData) ) { - data = dynamic_pointer_cast(std::make_shared(id)); + data = dynamic_pointer_cast( shared_ptr( new StructureFeatureSavedData(id) ) ); } else { @@ -61,7 +61,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin } } - if (data != nullptr) + if (data != NULL) { cache.insert( unordered_map >::value_type( id , data ) ); savedDatas.push_back(data); @@ -71,7 +71,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin void SavedDataStorage::set(const wstring& id, shared_ptr data) { - if (data == nullptr) + if (data == NULL) { // TODO 4J Stu - throw new RuntimeException("Can't set null data"); assert( false ); @@ -104,7 +104,7 @@ void SavedDataStorage::save() void SavedDataStorage::save(shared_ptr data) { - if (levelStorage == nullptr) return; + if (levelStorage == NULL) return; //File file = levelStorage->getDataFile(data->id); ConsoleSavePath file = levelStorage->getDataFile(data->id); if (!file.getName().empty()) @@ -127,7 +127,7 @@ void SavedDataStorage::loadAuxValues() { usedAuxIds.clear(); - if (levelStorage == nullptr) return; + if (levelStorage == NULL) return; //File file = levelStorage->getDataFile(L"idcounts"); ConsoleSavePath file = levelStorage->getDataFile(L"idcounts"); if (!file.getName().empty() && levelStorage->getSaveFile()->doesFileExist( file ) ) @@ -163,7 +163,7 @@ int SavedDataStorage::getFreeAuxValueFor(const wstring& id) } usedAuxIds[id] = val; - if (levelStorage == nullptr) return val; + if (levelStorage == NULL) return val; //File file = levelStorage->getDataFile(L"idcounts"); ConsoleSavePath file = levelStorage->getDataFile(L"idcounts"); if (!file.getName().empty()) @@ -188,7 +188,7 @@ int SavedDataStorage::getFreeAuxValueFor(const wstring& id) // 4J Added int SavedDataStorage::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale) { - if( levelStorage == nullptr ) + if( levelStorage == NULL ) { switch(dimension) { diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp index 07630ef7..317d6d9e 100644 --- a/Minecraft.World/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/ScatteredFeaturePieces.cpp @@ -35,7 +35,7 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *ran orientation = random->nextInt(4); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { int tempOrientation = 0; if(levelGenOptions->isFeatureChunk(west>>4,north>>4,StructureFeature::eFeature_Temples, &tempOrientation) ) @@ -737,9 +737,9 @@ bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *ran { spawnedWitch = true; - shared_ptr witch = std::make_shared(level); + shared_ptr witch = shared_ptr( new Witch(level) ); witch->moveTo(wx + .5, wy, wz + .5, 0, 0); - witch->finalizeMobSpawn(nullptr); + witch->finalizeMobSpawn(NULL); level->addEntity(witch); } } diff --git a/Minecraft.World/Scoreboard.cpp b/Minecraft.World/Scoreboard.cpp index bab0b213..5c6f2ebd 100644 --- a/Minecraft.World/Scoreboard.cpp +++ b/Minecraft.World/Scoreboard.cpp @@ -4,15 +4,15 @@ Objective *Scoreboard::getObjective(const wstring &name) { - return nullptr; + return NULL; //return objectivesByName.find(name)->second; } Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *criteria) { - return nullptr; + return NULL; // Objective *objective = getObjective(name); -// if (objective != nullptr) +// if (objective != NULL) // { //#indef _CONTENT_PACKAGE // __debugbreak(); @@ -24,7 +24,7 @@ Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *crit // // vector *criteriaList = objectivesByCriteria.find(criteria)->second; // -// if (criteriaList == nullptr) +// if (criteriaList == NULL) // { // criteriaList = new vector(); // objectivesByCriteria[criteria] = criteriaList; @@ -39,18 +39,18 @@ Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *crit vector *Scoreboard::findObjectiveFor(ObjectiveCriteria *criteria) { - return nullptr; + return NULL; //vector *objectives = objectivesByCriteria.find(criteria)->second; - //return objectives == nullptr ? new vector() : new vector(objectives); + //return objectives == NULL ? new vector() : new vector(objectives); } Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) { - return nullptr; + return NULL; //unordered_map *scores = playerScores.find(name)->it; - //if (scores == nullptr) + //if (scores == NULL) //{ // scores = new unordered_map(); // playerScores.put(name, scores); @@ -58,7 +58,7 @@ Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) //Score *score = scores->get(objective); - //if (score == nullptr) + //if (score == NULL) //{ // score = new Score(this, objective, name); // scores->put(objective, score); @@ -69,7 +69,7 @@ Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) vector *Scoreboard::getPlayerScores(Objective *objective) { - return nullptr; + return NULL; //vector *result = new vector(); //for (Map scores : playerScores.values()) @@ -85,13 +85,13 @@ vector *Scoreboard::getPlayerScores(Objective *objective) vector *Scoreboard::getObjectives() { - return nullptr; + return NULL; //return objectivesByName.values(); } vector *Scoreboard::getTrackedPlayers() { - return nullptr; + return NULL; //return playerScores.keySet(); } @@ -99,7 +99,7 @@ void Scoreboard::resetPlayerScore(const wstring &player) { //unordered_map *removed = playerScores.remove(player); - //if (removed != nullptr) + //if (removed != NULL) //{ // onPlayerRemoved(player); //} @@ -107,7 +107,7 @@ void Scoreboard::resetPlayerScore(const wstring &player) vector *Scoreboard::getScores() { - return nullptr; + return NULL; //Collection> values = playerScores.values(); //List result = new ArrayList(); @@ -121,7 +121,7 @@ vector *Scoreboard::getScores() vector *Scoreboard::getScores(Objective *objective) { - return nullptr; + return NULL; //Collection> values = playerScores.values(); //List result = new ArrayList(); @@ -135,7 +135,7 @@ vector *Scoreboard::getScores(Objective *objective) unordered_map *Scoreboard::getPlayerScores(const wstring &player) { - return nullptr; + return NULL; //Map result = playerScores.get(player); //if (result == null) result = new HashMap(); //return result; @@ -166,19 +166,19 @@ void Scoreboard::setDisplayObjective(int slot, Objective *objective) Objective *Scoreboard::getDisplayObjective(int slot) { - return nullptr; + return NULL; //return displayObjectives[slot]; } PlayerTeam *Scoreboard::getPlayerTeam(const wstring &name) { - return nullptr; + return NULL; //return teamsByName.get(name); } PlayerTeam *Scoreboard::addPlayerTeam(const wstring &name) { - return nullptr; + return NULL; //PlayerTeam team = getPlayerTeam(name); //if (team != null) throw new IllegalArgumentException("An objective with the name '" + name + "' already exists!"); @@ -237,13 +237,13 @@ void Scoreboard::removePlayerFromTeam(const wstring &player, PlayerTeam *team) vector *Scoreboard::getTeamNames() { - return nullptr; + return NULL; //return teamsByName.keySet(); } vector *Scoreboard::getPlayerTeams() { - return nullptr; + return NULL; //return teamsByName.values(); } @@ -255,7 +255,7 @@ shared_ptr Scoreboard::getPlayer(const wstring &name) PlayerTeam *Scoreboard::getPlayersTeam(const wstring &name) { - return nullptr; + return NULL; //return teamsByPlayer.get(name); } diff --git a/Minecraft.World/ServerSettingsChangedPacket.h b/Minecraft.World/ServerSettingsChangedPacket.h index c537eca9..e6ab7356 100644 --- a/Minecraft.World/ServerSettingsChangedPacket.h +++ b/Minecraft.World/ServerSettingsChangedPacket.h @@ -26,6 +26,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new ServerSettingsChangedPacket()); } virtual int getId() { return 153; } }; \ No newline at end of file diff --git a/Minecraft.World/ServersideAttributeMap.cpp b/Minecraft.World/ServersideAttributeMap.cpp index 07544e76..901854cc 100644 --- a/Minecraft.World/ServersideAttributeMap.cpp +++ b/Minecraft.World/ServersideAttributeMap.cpp @@ -17,7 +17,7 @@ AttributeInstance *ServersideAttributeMap::getInstance(eATTRIBUTE_ID id) // 4J: Removed legacy name // If we didn't find it, search by legacy name - /*if (result == nullptr) + /*if (result == NULL) { auto it = attributesByLegacy.find(name); if(it != attributesByLegacy.end()) @@ -43,7 +43,7 @@ AttributeInstance *ServersideAttributeMap::registerAttribute(Attribute *attribut // 4J: Removed legacy name // If this is a ranged attribute also add to legacy name map /*RangedAttribute *rangedAttribute = dynamic_cast(attribute); - if (rangedAttribute != nullptr && rangedAttribute->getImportLegacyName() != L"") + if (rangedAttribute != NULL && rangedAttribute->getImportLegacyName() != L"") { attributesByLegacy.insert(std::pair(rangedAttribute->getImportLegacyName(), instance)); }*/ @@ -69,7 +69,7 @@ unordered_set *ServersideAttributeMap::getSyncableAttribute unordered_set *result = new unordered_set(); vector atts; getAttributes(atts); - for (size_t i = 0; i < atts.size(); i++) + for (int i = 0; i < atts.size(); i++) { AttributeInstance *instance = atts.at(i); diff --git a/Minecraft.World/SetCarriedItemPacket.h b/Minecraft.World/SetCarriedItemPacket.h index 017314dc..06fb3c30 100644 --- a/Minecraft.World/SetCarriedItemPacket.h +++ b/Minecraft.World/SetCarriedItemPacket.h @@ -19,6 +19,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetCarriedItemPacket()); } virtual int getId() { return 16; } }; \ No newline at end of file diff --git a/Minecraft.World/SetCreativeModeSlotPacket.h b/Minecraft.World/SetCreativeModeSlotPacket.h index 3724714e..94ae7807 100644 --- a/Minecraft.World/SetCreativeModeSlotPacket.h +++ b/Minecraft.World/SetCreativeModeSlotPacket.h @@ -18,6 +18,6 @@ class SetCreativeModeSlotPacket : public Packet, public enable_shared_from_this< public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetCreativeModeSlotPacket()); } virtual int getId() { return 107; } }; \ No newline at end of file diff --git a/Minecraft.World/SetDisplayObjectivePacket.cpp b/Minecraft.World/SetDisplayObjectivePacket.cpp index 9908d15e..f1cffa4b 100644 --- a/Minecraft.World/SetDisplayObjectivePacket.cpp +++ b/Minecraft.World/SetDisplayObjectivePacket.cpp @@ -13,7 +13,7 @@ SetDisplayObjectivePacket::SetDisplayObjectivePacket(int slot, Objective *object { this->slot = slot; - if (objective == nullptr) + if (objective == NULL) { objectiveName = L""; } diff --git a/Minecraft.World/SetDisplayObjectivePacket.h b/Minecraft.World/SetDisplayObjectivePacket.h index 5404eab7..f32f6386 100644 --- a/Minecraft.World/SetDisplayObjectivePacket.h +++ b/Minecraft.World/SetDisplayObjectivePacket.h @@ -19,6 +19,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetDisplayObjectivePacket()); } virtual int getId() { return 208; } }; \ No newline at end of file diff --git a/Minecraft.World/SetEntityDataPacket.cpp b/Minecraft.World/SetEntityDataPacket.cpp index a49ba9d9..9947c163 100644 --- a/Minecraft.World/SetEntityDataPacket.cpp +++ b/Minecraft.World/SetEntityDataPacket.cpp @@ -10,7 +10,7 @@ SetEntityDataPacket::SetEntityDataPacket() { id = -1; - packedItems = nullptr; + packedItems = NULL; } SetEntityDataPacket::~SetEntityDataPacket() diff --git a/Minecraft.World/SetEntityDataPacket.h b/Minecraft.World/SetEntityDataPacket.h index cd3371dd..a3bb0860 100644 --- a/Minecraft.World/SetEntityDataPacket.h +++ b/Minecraft.World/SetEntityDataPacket.h @@ -25,6 +25,6 @@ public: vector > *getUnpackedData(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetEntityDataPacket()); } virtual int getId() { return 40; } }; \ No newline at end of file diff --git a/Minecraft.World/SetEntityLinkPacket.cpp b/Minecraft.World/SetEntityLinkPacket.cpp index 3ad0f45b..cae35e48 100644 --- a/Minecraft.World/SetEntityLinkPacket.cpp +++ b/Minecraft.World/SetEntityLinkPacket.cpp @@ -18,7 +18,7 @@ SetEntityLinkPacket::SetEntityLinkPacket(int linkType, shared_ptr source { type = linkType; this->sourceId = sourceEntity->entityId; - this->destId = destEntity != nullptr ? destEntity->entityId : -1; + this->destId = destEntity != NULL ? destEntity->entityId : -1; } int SetEntityLinkPacket::getEstimatedSize() diff --git a/Minecraft.World/SetEntityLinkPacket.h b/Minecraft.World/SetEntityLinkPacket.h index 04ee0e97..aa92206d 100644 --- a/Minecraft.World/SetEntityLinkPacket.h +++ b/Minecraft.World/SetEntityLinkPacket.h @@ -23,7 +23,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetEntityLinkPacket()); } virtual int getId() { return 39; } }; \ No newline at end of file diff --git a/Minecraft.World/SetEntityMotionPacket.cpp b/Minecraft.World/SetEntityMotionPacket.cpp index 20d841f1..a0749b74 100644 --- a/Minecraft.World/SetEntityMotionPacket.cpp +++ b/Minecraft.World/SetEntityMotionPacket.cpp @@ -17,9 +17,9 @@ void SetEntityMotionPacket::_init(int id, double xd, double yd, double zd) if (xd > m) xd = m; if (yd > m) yd = m; if (zd > m) zd = m; - xa = static_cast(xd * 8000.0); - ya = static_cast(yd * 8000.0); - za = static_cast(zd * 8000.0); + xa = (int) (xd * 8000.0); + ya = (int) (yd * 8000.0); + za = (int) (zd * 8000.0); // 4J - if we could transmit this as bytes (in 1/16 accuracy) then flag to do so if( ( xa >= (-128 * 16 ) ) && ( ya >= (-128 * 16 ) ) && ( za >= (-128 * 16 ) ) && ( xa < (128 * 16 ) ) && ( ya < (128 * 16 ) ) && ( za < (128 * 16 ) ) ) @@ -53,9 +53,9 @@ void SetEntityMotionPacket::read(DataInputStream *dis) //throws IOException id = idAndFlag & 0x07ff; if( idAndFlag & 0x0800 ) { - xa = static_cast(dis->readByte()); - ya = static_cast(dis->readByte()); - za = static_cast(dis->readByte()); + xa = (int)dis->readByte(); + ya = (int)dis->readByte(); + za = (int)dis->readByte(); xa = ( xa << 24 ) >> 24; ya = ( ya << 24 ) >> 24; za = ( za << 24 ) >> 24; diff --git a/Minecraft.World/SetEntityMotionPacket.h b/Minecraft.World/SetEntityMotionPacket.h index e71240c5..00c019da 100644 --- a/Minecraft.World/SetEntityMotionPacket.h +++ b/Minecraft.World/SetEntityMotionPacket.h @@ -26,6 +26,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetEntityMotionPacket()); } virtual int getId() { return 28; } }; \ No newline at end of file diff --git a/Minecraft.World/SetEquippedItemPacket.cpp b/Minecraft.World/SetEquippedItemPacket.cpp index ac9d22b2..1da93b84 100644 --- a/Minecraft.World/SetEquippedItemPacket.cpp +++ b/Minecraft.World/SetEquippedItemPacket.cpp @@ -20,7 +20,7 @@ SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, shared_ptrslot = slot; // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game - this->item = item == nullptr ? nullptr : item->copy(); + this->item = item == NULL ? nullptr : item->copy(); } void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException diff --git a/Minecraft.World/SetEquippedItemPacket.h b/Minecraft.World/SetEquippedItemPacket.h index 29df2b02..def39120 100644 --- a/Minecraft.World/SetEquippedItemPacket.h +++ b/Minecraft.World/SetEquippedItemPacket.h @@ -28,6 +28,6 @@ public: shared_ptr getItem(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetEquippedItemPacket()); } virtual int getId() { return 5; } }; \ No newline at end of file diff --git a/Minecraft.World/SetExperiencePacket.h b/Minecraft.World/SetExperiencePacket.h index 668f4416..01c0ed46 100644 --- a/Minecraft.World/SetExperiencePacket.h +++ b/Minecraft.World/SetExperiencePacket.h @@ -20,6 +20,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetExperiencePacket()); } virtual int getId() { return 43; } }; \ No newline at end of file diff --git a/Minecraft.World/SetHealthPacket.cpp b/Minecraft.World/SetHealthPacket.cpp index 4557f7bb..639cacd8 100644 --- a/Minecraft.World/SetHealthPacket.cpp +++ b/Minecraft.World/SetHealthPacket.cpp @@ -32,7 +32,7 @@ void SetHealthPacket::read(DataInputStream *dis) //throws IOException saturation = dis->readFloat(); // exhaustion = dis.readFloat(); - damageSource = static_cast(dis->readByte()); + damageSource = (ETelemetryChallenges)dis->readByte(); } void SetHealthPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/SetHealthPacket.h b/Minecraft.World/SetHealthPacket.h index cc85c4c6..4704f220 100644 --- a/Minecraft.World/SetHealthPacket.h +++ b/Minecraft.World/SetHealthPacket.h @@ -23,7 +23,7 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetHealthPacket()); } virtual int getId() { return 8; } }; diff --git a/Minecraft.World/SetObjectivePacket.h b/Minecraft.World/SetObjectivePacket.h index 52b67ee0..5b5dfc6f 100644 --- a/Minecraft.World/SetObjectivePacket.h +++ b/Minecraft.World/SetObjectivePacket.h @@ -23,6 +23,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetObjectivePacket()); } virtual int getId() { return 206; } }; \ No newline at end of file diff --git a/Minecraft.World/SetPlayerTeamPacket.cpp b/Minecraft.World/SetPlayerTeamPacket.cpp index a574067d..fe36bfff 100644 --- a/Minecraft.World/SetPlayerTeamPacket.cpp +++ b/Minecraft.World/SetPlayerTeamPacket.cpp @@ -42,7 +42,7 @@ SetPlayerTeamPacket::SetPlayerTeamPacket(PlayerTeam *team, vector *play __debugbreak(); #endif } - if (playerNames == nullptr || playerNames->empty()) + if (playerNames == NULL || playerNames->empty()) { app.DebugPrintf("Players cannot be null/empty"); #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.World/SetPlayerTeamPacket.h b/Minecraft.World/SetPlayerTeamPacket.h index 60364db5..f6df9da2 100644 --- a/Minecraft.World/SetPlayerTeamPacket.h +++ b/Minecraft.World/SetPlayerTeamPacket.h @@ -30,6 +30,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetPlayerTeamPacket()); } virtual int getId() { return 209; } }; \ No newline at end of file diff --git a/Minecraft.World/SetScorePacket.h b/Minecraft.World/SetScorePacket.h index 24555973..5f800be6 100644 --- a/Minecraft.World/SetScorePacket.h +++ b/Minecraft.World/SetScorePacket.h @@ -25,6 +25,6 @@ public: int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetScorePacket()); } virtual int getId() { return 207; } }; \ No newline at end of file diff --git a/Minecraft.World/SetSpawnPositionPacket.h b/Minecraft.World/SetSpawnPositionPacket.h index f90d3f5c..3ba66af8 100644 --- a/Minecraft.World/SetSpawnPositionPacket.h +++ b/Minecraft.World/SetSpawnPositionPacket.h @@ -20,6 +20,6 @@ public: virtual bool isAync(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetSpawnPositionPacket()); } virtual int getId() { return 6; } }; \ No newline at end of file diff --git a/Minecraft.World/SetTimePacket.h b/Minecraft.World/SetTimePacket.h index 2e876388..a0fa2ad9 100644 --- a/Minecraft.World/SetTimePacket.h +++ b/Minecraft.World/SetTimePacket.h @@ -21,6 +21,6 @@ public: virtual bool isAync(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SetTimePacket()); } virtual int getId() { return 4; } }; \ No newline at end of file diff --git a/Minecraft.World/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp index 7a0e85b0..ee737321 100644 --- a/Minecraft.World/ShapedRecipy.cpp +++ b/Minecraft.World/ShapedRecipy.cpp @@ -52,18 +52,18 @@ bool ShapedRecipy::matches(shared_ptr craftSlots, int xOffs, for (int y = 0; y < 3; y++) { int xs = x - xOffs; int ys = y - yOffs; - ItemInstance *expected = nullptr; + ItemInstance *expected = NULL; if (xs >= 0 && ys >= 0 && xs < width && ys < height) { if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width]; else expected = recipeItems[xs + ys * width]; } shared_ptr item = craftSlots->getItem(x, y); - if (item == nullptr && expected == nullptr) + if (item == NULL && expected == NULL) { continue; } - if ((item == nullptr && expected != nullptr) || (item != nullptr && expected == nullptr)) + if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL)) { return false; } @@ -84,15 +84,15 @@ shared_ptr ShapedRecipy::assemble(shared_ptr cr { shared_ptr result = getResultItem()->copy(); - if (_keepTag && craftSlots != nullptr) + if (_keepTag && craftSlots != NULL) { for (int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != nullptr && item->hasTag()) + if (item != NULL && item->hasTag()) { - result->setTag(static_cast(item->tag->copy())); + result->setTag((CompoundTag *) item->tag->copy()); } } } @@ -117,7 +117,7 @@ bool ShapedRecipy::reqs(int iRecipe) if (x < width && y < height) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=nullptr) + if (expected!=NULL) { //printf("\tIngredient %d is %d\n",iCount++,expected->id); } @@ -159,7 +159,7 @@ void ShapedRecipy::reqs(INGREDIENTS_REQUIRED *pIngReq) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=nullptr) + if (expected!=NULL) { int iAuxVal = expected->getAuxValue(); TempIngReq.uiGridA[x+y*3]=expected->id | iAuxVal<<24; diff --git a/Minecraft.World/ShapelessRecipy.cpp b/Minecraft.World/ShapelessRecipy.cpp index 8fab1b7e..0fee321c 100644 --- a/Minecraft.World/ShapelessRecipy.cpp +++ b/Minecraft.World/ShapelessRecipy.cpp @@ -73,7 +73,7 @@ shared_ptr ShapelessRecipy::assemble(shared_ptr int ShapelessRecipy::size() { - return static_cast(ingredients->size()); + return (int)ingredients->size(); } // 4J-PB diff --git a/Minecraft.World/SharedMonsterAttributes.cpp b/Minecraft.World/SharedMonsterAttributes.cpp index 53c05008..3ff84197 100644 --- a/Minecraft.World/SharedMonsterAttributes.cpp +++ b/Minecraft.World/SharedMonsterAttributes.cpp @@ -70,7 +70,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap *attributes, ListT CompoundTag *tag = list->get(i); AttributeInstance *instance = attributes->getInstance(static_cast(tag->getInt(L"ID"))); - if (instance != nullptr) + if (instance != NULL) { loadAttribute(instance, tag); } @@ -93,7 +93,7 @@ void SharedMonsterAttributes::loadAttribute(AttributeInstance *instance, Compoun { AttributeModifier *modifier = loadAttributeModifier(list->get(i)); AttributeModifier *old = instance->getModifier(modifier->getId()); - if (old != nullptr) instance->removeModifier(old); + if (old != NULL) instance->removeModifier(old); instance->addModifier(modifier); } } @@ -101,6 +101,6 @@ void SharedMonsterAttributes::loadAttribute(AttributeInstance *instance, Compoun AttributeModifier *SharedMonsterAttributes::loadAttributeModifier(CompoundTag *tag) { - eMODIFIER_ID id = static_cast(tag->getInt(L"UUID")); + eMODIFIER_ID id = (eMODIFIER_ID)tag->getInt(L"UUID"); return new AttributeModifier(id, tag->getDouble(L"Amount"), tag->getInt(L"Operation")); } \ No newline at end of file diff --git a/Minecraft.World/Sheep.cpp b/Minecraft.World/Sheep.cpp index f06308f4..32379c2a 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/Sheep.cpp @@ -65,9 +65,9 @@ Sheep::Sheep(Level *level) : Animal( level ) goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 6)); goalSelector.addGoal(8, new RandomLookAroundGoal(this)); - container = std::make_shared(new SheepContainer(), 2, 1); - container->setItem(0, std::make_shared(Item::dye_powder, 1, 0)); - container->setItem(1, std::make_shared(Item::dye_powder, 1, 0)); + container = shared_ptr(new CraftingContainer(new SheepContainer(), 2, 1)); + container->setItem(0, shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); + container->setItem(1, shared_ptr( new ItemInstance(Item::dye_powder, 1, 0))); } bool Sheep::useNewAi() @@ -100,7 +100,7 @@ void Sheep::defineSynchedData() Animal::defineSynchedData(); // sheared and color share a byte - entityData->define(DATA_WOOL_ID, static_cast(0)); //was new Byte((byte), 0) + entityData->define(DATA_WOOL_ID, ((byte) 0)); //was new Byte((byte), 0) } void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) @@ -108,7 +108,7 @@ void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) if(!isSheared()) { // killing a non-sheared sheep will drop a single block of cloth - spawnAtLocation(std::make_shared(Tile::wool_Id, 1, getColor()), 0.0f); + spawnAtLocation(shared_ptr( new ItemInstance(Tile::wool_Id, 1, getColor()) ), 0.0f); } } @@ -141,16 +141,16 @@ float Sheep::getHeadEatPositionScale(float a) } if (eatAnimationTick < 4) { - return (static_cast(eatAnimationTick) - a) / 4.0f; + return ((float) eatAnimationTick - a) / 4.0f; } - return -(static_cast(eatAnimationTick - EAT_ANIMATION_TICKS) - a) / 4.0f; + return -((float) (eatAnimationTick - EAT_ANIMATION_TICKS) - a) / 4.0f; } float Sheep::getHeadEatAngleScale(float a) { if (eatAnimationTick > 4 && eatAnimationTick <= (EAT_ANIMATION_TICKS - 4)) { - float scale = (static_cast(eatAnimationTick - 4) - a) / static_cast(EAT_ANIMATION_TICKS - 8); + float scale = ((float) (eatAnimationTick - 4) - a) / (float) (EAT_ANIMATION_TICKS - 8); return PI * .20f + PI * .07f * Mth::sin(scale * 28.7f); } if (eatAnimationTick > 0) @@ -169,7 +169,7 @@ bool Sheep::mobInteract(shared_ptr player) if (!player->isAllowedToInteract( shared_from_this() )) return false; //Animal::interact(player); - if (item != nullptr && item->id == Item::shears->id && !isSheared() && !isBaby()) + if (item != NULL && item->id == Item::shears->id && !isSheared() && !isBaby()) { if (!level->isClientSide) { @@ -177,7 +177,7 @@ bool Sheep::mobInteract(shared_ptr player) int count = 1 + random->nextInt(3); for (int i = 0; i < count; i++) { - shared_ptr ie = spawnAtLocation(std::make_shared(Tile::wool_Id, 1, getColor()), 1.0f); + shared_ptr ie = spawnAtLocation(shared_ptr( new ItemInstance(Tile::wool_Id, 1, getColor()) ), 1.0f); ie->yd += random->nextFloat() * 0.05f; ie->xd += (random->nextFloat() - random->nextFloat()) * 0.1f; ie->zd += (random->nextFloat() - random->nextFloat()) * 0.1f; @@ -196,7 +196,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag) { Animal::addAdditonalSaveData(tag); tag->putBoolean(L"Sheared", isSheared()); - tag->putByte(L"Color", static_cast(getColor())); + tag->putByte(L"Color", (byte) getColor()); } void Sheep::readAdditionalSaveData(CompoundTag *tag) @@ -234,7 +234,7 @@ int Sheep::getColor() void Sheep::setColor(int color) { byte current = entityData->getByte(DATA_WOOL_ID); - entityData->set(DATA_WOOL_ID, static_cast((current & 0xf0) | (color & 0x0f))); + entityData->set(DATA_WOOL_ID, (byte) ((current & 0xf0) | (color & 0x0f))); } bool Sheep::isSheared() @@ -247,11 +247,11 @@ void Sheep::setSheared(bool value) byte current = entityData->getByte(DATA_WOOL_ID); if (value) { - entityData->set(DATA_WOOL_ID, static_cast(current | 0x10)); + entityData->set(DATA_WOOL_ID, (byte) (current | 0x10)); } else { - entityData->set(DATA_WOOL_ID, static_cast(current & ~0x10)); + entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10)); } } @@ -284,7 +284,7 @@ shared_ptr Sheep::getBreedOffspring(shared_ptr target) if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { shared_ptr otherSheep = dynamic_pointer_cast( target ); - shared_ptr sheep = std::make_shared(level); + shared_ptr sheep = shared_ptr( new Sheep(level) ); int color = getOffspringColor(dynamic_pointer_cast(shared_from_this()), otherSheep); sheep->setColor(15 - color); return sheep; @@ -324,7 +324,7 @@ int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partn shared_ptr instance = Recipes::getInstance()->getItemFor(container, animal->level); int color = 0; - if (instance != nullptr && instance->getItem()->id == Item::dye_powder_Id) + if (instance != NULL && instance->getItem()->id == Item::dye_powder_Id) { color = instance->getAuxValue(); } diff --git a/Minecraft.World/ShortTag.h b/Minecraft.World/ShortTag.h index cbe0b55f..989e1fb1 100644 --- a/Minecraft.World/ShortTag.h +++ b/Minecraft.World/ShortTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - ShortTag *o = static_cast(obj); + ShortTag *o = (ShortTag *) obj; return data == o->data; } return false; diff --git a/Minecraft.World/ShovelItem.cpp b/Minecraft.World/ShovelItem.cpp index 4b75cd85..8064cbe3 100644 --- a/Minecraft.World/ShovelItem.cpp +++ b/Minecraft.World/ShovelItem.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.tile.h" #include "ShovelItem.h" -TileArray *ShovelItem::diggables = nullptr; +TileArray *ShovelItem::diggables = NULL; void ShovelItem::staticCtor() { diff --git a/Minecraft.World/SignItem.cpp b/Minecraft.World/SignItem.cpp index a418fd34..c9cb627e 100644 --- a/Minecraft.World/SignItem.cpp +++ b/Minecraft.World/SignItem.cpp @@ -49,7 +49,7 @@ bool SignItem::useOn(shared_ptr instance, shared_ptr playe instance->count--; shared_ptr ste = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (ste != nullptr) player->openTextEdit(ste); + if (ste != NULL) player->openTextEdit(ste); // 4J-JEV: Hook for durango 'BlockPlaced' event. player->awardStat( diff --git a/Minecraft.World/SignTile.cpp b/Minecraft.World/SignTile.cpp index 15be23db..52d62a60 100644 --- a/Minecraft.World/SignTile.cpp +++ b/Minecraft.World/SignTile.cpp @@ -26,7 +26,7 @@ void SignTile::updateDefaultShape() AABB *SignTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } AABB *SignTile::getTileAABB(Level *level, int x, int y, int z) @@ -79,7 +79,7 @@ shared_ptr SignTile::newTileEntity(Level *level) { //try { // 4J Stu - For some reason the newInstance wasn't working right, but doing it like the other TileEntities is fine - return std::make_shared(); + return shared_ptr( new SignTileEntity() ); //return dynamic_pointer_cast( clas->newInstance() ); //} catch (Exception e) { // TODO 4J Stu - Exception handling diff --git a/Minecraft.World/SignTileEntity.cpp b/Minecraft.World/SignTileEntity.cpp index 598621eb..dc189102 100644 --- a/Minecraft.World/SignTileEntity.cpp +++ b/Minecraft.World/SignTileEntity.cpp @@ -93,7 +93,7 @@ shared_ptr SignTileEntity::getUpdatePacket() { copy[i] = m_wsmessages[i]; } - return std::make_shared(x, y, z, m_bVerified, m_bCensored, copy); + return shared_ptr( new SignUpdatePacket(x, y, z, m_bVerified, m_bCensored, copy) ); } bool SignTileEntity::isEditable() @@ -181,7 +181,7 @@ void SignTileEntity::SetMessage(int iIndex,wstring &wsText) int SignTileEntity::StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE *pResults) { // results will be in m_pStringVerifyResponse - SignTileEntity *pClass=static_cast(lpParam); + SignTileEntity *pClass=(SignTileEntity *)lpParam; pClass->m_bVerified=true; pClass->m_bCensored=false; @@ -195,7 +195,7 @@ int SignTileEntity::StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE * if(!pClass->level->isClientSide) { - ServerLevel *serverLevel = static_cast(pClass->level); + ServerLevel *serverLevel = (ServerLevel *)pClass->level; // 4J Stu - This callback gets called on the main thread, but tried to access things on the server thread. Change to go through the protected method. //pClass->level->sendTileUpdated(pClass->x, pClass->y, pClass->z); serverLevel->queueSendTileUpdate(pClass->x, pClass->y, pClass->z); @@ -207,7 +207,7 @@ int SignTileEntity::StringVerifyCallback(LPVOID lpParam,STRING_VERIFY_RESPONSE * // 4J Added shared_ptr SignTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new SignTileEntity() ); TileEntity::clone(result); result->m_wsmessages[0] = m_wsmessages[0]; diff --git a/Minecraft.World/SignUpdatePacket.cpp b/Minecraft.World/SignUpdatePacket.cpp index 10cc223e..7b3a3217 100644 --- a/Minecraft.World/SignUpdatePacket.cpp +++ b/Minecraft.World/SignUpdatePacket.cpp @@ -66,6 +66,6 @@ int SignUpdatePacket::getEstimatedSize() l+=sizeof(byte); for (int i = 0; i < MAX_SIGN_LINES; i++) - l += static_cast(lines[i].length()); + l += (int)lines[i].length(); return l; } diff --git a/Minecraft.World/SignUpdatePacket.h b/Minecraft.World/SignUpdatePacket.h index f44f4dde..80cc2968 100644 --- a/Minecraft.World/SignUpdatePacket.h +++ b/Minecraft.World/SignUpdatePacket.h @@ -21,6 +21,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new SignUpdatePacket()); } virtual int getId() { return 130; } }; \ No newline at end of file diff --git a/Minecraft.World/Silverfish.cpp b/Minecraft.World/Silverfish.cpp index 98f559c9..5cd4c77e 100644 --- a/Minecraft.World/Silverfish.cpp +++ b/Minecraft.World/Silverfish.cpp @@ -72,7 +72,7 @@ int Silverfish::getDeathSound() bool Silverfish::hurt(DamageSource *source, float dmg) { if (isInvulnerable()) return false; - if (lookForFriends <= 0 && (dynamic_cast(source) != nullptr || source == DamageSource::magic)) + if (lookForFriends <= 0 && (dynamic_cast(source) != NULL || source == DamageSource::magic)) { // look for friends lookForFriends = 20; @@ -173,7 +173,7 @@ void Silverfish::serverAiStep() } } - if (attackTarget == nullptr && !isPathFinding()) + if (attackTarget == NULL && !isPathFinding()) { // if the silverfish isn't doing anything special, it will merge // with any rock tile it is nearby @@ -193,7 +193,7 @@ void Silverfish::serverAiStep() } } - else if (attackTarget != nullptr && !isPathFinding()) + else if (attackTarget != NULL && !isPathFinding()) { attackTarget = nullptr; } @@ -216,7 +216,7 @@ bool Silverfish::canSpawn() if (Monster::canSpawn()) { shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0); - return nearestPlayer == nullptr; + return nearestPlayer == NULL; } return false; } diff --git a/Minecraft.World/SimpleContainer.cpp b/Minecraft.World/SimpleContainer.cpp index 87d11a70..a5f551e2 100644 --- a/Minecraft.World/SimpleContainer.cpp +++ b/Minecraft.World/SimpleContainer.cpp @@ -13,12 +13,12 @@ SimpleContainer::SimpleContainer(int name, wstring stringName, bool customName, this->size = size; items = new ItemInstanceArray( size ); - listeners = nullptr; + listeners = NULL; } void SimpleContainer::addListener(net_minecraft_world::ContainerListener *listener) { - if (listeners == nullptr) listeners = new vector(); + if (listeners == NULL) listeners = new vector(); listeners->push_back(listener); } @@ -43,7 +43,7 @@ shared_ptr SimpleContainer::getItem(unsigned int slot) shared_ptr SimpleContainer::removeItem(unsigned int slot, int count) { - if ((*items)[slot] != nullptr) { + if ((*items)[slot] != NULL) { if ((*items)[slot]->count <= count) { shared_ptr item = (*items)[slot]; @@ -64,7 +64,7 @@ shared_ptr SimpleContainer::removeItem(unsigned int slot, int coun shared_ptr SimpleContainer::removeItemNoUpdate(int slot) { - if ((*items)[slot] != nullptr) + if ((*items)[slot] != NULL) { shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; @@ -76,7 +76,7 @@ shared_ptr SimpleContainer::removeItemNoUpdate(int slot) void SimpleContainer::setItem(unsigned int slot, shared_ptr item) { (*items)[slot] = item; - if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } @@ -113,7 +113,7 @@ int SimpleContainer::getMaxStackSize() const void SimpleContainer::setChanged() { - if (listeners != nullptr) for (unsigned int i = 0; i < listeners->size(); i++) + if (listeners != NULL) for (unsigned int i = 0; i < listeners->size(); i++) { listeners->at(i)->containerChanged();//shared_from_this()); } diff --git a/Minecraft.World/SimplexNoise.cpp b/Minecraft.World/SimplexNoise.cpp index 35b86add..469e0b41 100644 --- a/Minecraft.World/SimplexNoise.cpp +++ b/Minecraft.World/SimplexNoise.cpp @@ -49,7 +49,7 @@ SimplexNoise::~SimplexNoise() int SimplexNoise::fastfloor(double x) { - return x > 0 ? static_cast(x) : static_cast(x) - 1; + return x > 0 ? (int) x : (int) x - 1; } double SimplexNoise::dot(int *g, double x, double y) diff --git a/Minecraft.World/SitGoal.cpp b/Minecraft.World/SitGoal.cpp index 7b04a5f6..b79b2df7 100644 --- a/Minecraft.World/SitGoal.cpp +++ b/Minecraft.World/SitGoal.cpp @@ -21,9 +21,9 @@ bool SitGoal::canUse() if (!mob->onGround) return false; shared_ptr owner = dynamic_pointer_cast( mob->getOwner() ); - if (owner == nullptr) return true; // owner not on level + if (owner == NULL) return true; // owner not on level - if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != nullptr) return false; + if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != NULL) return false; return _wantToSit; } diff --git a/Minecraft.World/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index cc325b97..9afb95c6 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -43,7 +43,7 @@ Skeleton::Skeleton(Level *level) : Monster( level ) targetSelector.addGoal(1, new HurtByTargetGoal(this, false)); targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, typeid(Player), 0, true)); - if (level != nullptr && !level->isClientSide) reassessWeaponGoal(); + if (level != NULL && !level->isClientSide) reassessWeaponGoal(); } Skeleton::~Skeleton() @@ -63,7 +63,7 @@ void Skeleton::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_TYPE_ID, static_cast(TYPE_DEFAULT)); + entityData->define(DATA_TYPE_ID, (byte) TYPE_DEFAULT); } bool Skeleton::useNewAi() @@ -114,12 +114,12 @@ void Skeleton::aiStep() if (level->isDay() && !level->isClientSide) { float br = getBrightness(1); - if (br > 0.5f && random->nextFloat() * 30 < (br - 0.4f) * 2 && level->canSeeSky(Mth::floor(x), static_cast(floor(y + 0.5)), Mth::floor(z))) + if (br > 0.5f && random->nextFloat() * 30 < (br - 0.4f) * 2 && level->canSeeSky(Mth::floor(x), (int)floor( y + 0.5 ), Mth::floor(z))) { bool burn = true; shared_ptr helmet = getCarried(SLOT_HELM); - if (helmet != nullptr) + if (helmet != NULL) { if (helmet->isDamageableItem()) { @@ -155,7 +155,7 @@ void Skeleton::rideTick() { Monster::rideTick(); - if ( riding != nullptr && riding->instanceof(eTYPE_PATHFINDER_MOB) ) + if ( riding != NULL && riding->instanceof(eTYPE_PATHFINDER_MOB) ) { yBodyRot = dynamic_pointer_cast(riding)->yBodyRot; } @@ -166,7 +166,7 @@ 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) ) + if ( source->getDirectEntity() != NULL && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast( source->getEntity() ); @@ -217,7 +217,7 @@ void Skeleton::dropRareDeathLoot(int rareLootLevel) { if (getSkeletonType() == TYPE_WITHER) { - spawnAtLocation(std::make_shared(Item::skull_Id, 1, SkullTileEntity::TYPE_WITHER), 0); + spawnAtLocation( shared_ptr( new ItemInstance(Item::skull_Id, 1, SkullTileEntity::TYPE_WITHER) ), 0); } } @@ -225,19 +225,19 @@ void Skeleton::populateDefaultEquipmentSlots() { Monster::populateDefaultEquipmentSlots(); - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::bow)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::bow))); } MobGroupData *Skeleton::finalizeMobSpawn(MobGroupData *groupData, int extraData /*= 0*/) // 4J Added extraData param { groupData = Monster::finalizeMobSpawn(groupData); - if ( dynamic_cast(level->dimension) != nullptr && getRandom()->nextInt(5) > 0) + if ( dynamic_cast(level->dimension) != NULL && getRandom()->nextInt(5) > 0) { goalSelector.addGoal(4, meleeGoal, false); setSkeletonType(TYPE_WITHER); - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::sword_stone)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::sword_stone))); getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->setBaseValue(4); } else @@ -250,12 +250,12 @@ MobGroupData *Skeleton::finalizeMobSpawn(MobGroupData *groupData, int extraData setCanPickUpLoot(random->nextFloat() < MAX_PICKUP_LOOT_CHANCE * level->getDifficulty(x, y, z)); - if (getCarried(SLOT_HELM) == nullptr) + if (getCarried(SLOT_HELM) == NULL) { if (Calendar::GetMonth() + 1 == 10 && Calendar::GetDayOfMonth() == 31 && random->nextFloat() < 0.25f) { // Halloween! OooOOo! 25% of all skeletons/zombies can wear pumpkins on their heads. - setEquippedSlot(SLOT_HELM, std::make_shared(random->nextFloat() < 0.1f ? Tile::litPumpkin : Tile::pumpkin)); + setEquippedSlot(SLOT_HELM, shared_ptr( new ItemInstance(random->nextFloat() < 0.1f ? Tile::litPumpkin : Tile::pumpkin))); dropChances[SLOT_HELM] = 0; } } @@ -269,7 +269,7 @@ void Skeleton::reassessWeaponGoal() shared_ptr carried = getCarriedItem(); - if (carried != nullptr && carried->id == Item::bow_Id) + if (carried != NULL && carried->id == Item::bow_Id) { goalSelector.addGoal(4, bowGoal, false); } @@ -281,7 +281,7 @@ void Skeleton::reassessWeaponGoal() void Skeleton::performRangedAttack(shared_ptr target, float power) { - shared_ptr arrow = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), target, 1.60f, 14 - (level->difficulty * 4)); + shared_ptr arrow = shared_ptr( new Arrow(level, dynamic_pointer_cast(shared_from_this()), target, 1.60f, 14 - (level->difficulty * 4)) ); int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, getCarriedItem()); int knockbackBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowKnockback->id, getCarriedItem()); @@ -289,7 +289,7 @@ void Skeleton::performRangedAttack(shared_ptr target, float power) if (damageBonus > 0) { - arrow->setBaseDamage(arrow->getBaseDamage() + static_cast(damageBonus) * .5 + .5); + arrow->setBaseDamage(arrow->getBaseDamage() + (double) damageBonus * .5 + .5); } if (knockbackBonus > 0) { @@ -311,7 +311,7 @@ int Skeleton::getSkeletonType() void Skeleton::setSkeletonType(int type) { - entityData->set(DATA_TYPE_ID, static_cast(type)); + entityData->set(DATA_TYPE_ID, (byte) type); fireImmune = type == TYPE_WITHER; if (type == TYPE_WITHER) @@ -340,7 +340,7 @@ void Skeleton::readAdditionalSaveData(CompoundTag *tag) void Skeleton::addAdditonalSaveData(CompoundTag *entityTag) { Monster::addAdditonalSaveData(entityTag); - entityTag->putByte(L"SkeletonType", static_cast(getSkeletonType())); + entityTag->putByte(L"SkeletonType", (byte) getSkeletonType()); } void Skeleton::setEquippedSlot(int slot, shared_ptr item) diff --git a/Minecraft.World/SkullItem.cpp b/Minecraft.World/SkullItem.cpp index 383f226f..8fabc3cd 100644 --- a/Minecraft.World/SkullItem.cpp +++ b/Minecraft.World/SkullItem.cpp @@ -48,7 +48,7 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play shared_ptr skullTE = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(skullTE); - if (skull != nullptr) + if (skull != NULL) { wstring extra = L""; if (instance->hasTag() && instance->getTag()->contains(L"SkullOwner")) @@ -57,7 +57,7 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play } skull->setSkullType(instance->getAuxValue(), extra); skull->setRotation(rot); - static_cast(Tile::skull)->checkMobSpawn(level, x, y, z, skull); + ((SkullTile *) Tile::skull)->checkMobSpawn(level, x, y, z, skull); } instance->count--; diff --git a/Minecraft.World/SkullTile.cpp b/Minecraft.World/SkullTile.cpp index b5eca373..92ce7807 100644 --- a/Minecraft.World/SkullTile.cpp +++ b/Minecraft.World/SkullTile.cpp @@ -67,7 +67,7 @@ void SkullTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr SkullTile::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr(new SkullTileEntity()); } int SkullTile::cloneTileId(Level *level, int x, int y, int z) @@ -79,7 +79,7 @@ int SkullTile::cloneTileData(Level *level, int x, int y, int z) { shared_ptr tileEntity = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(tileEntity); - if (skull != nullptr) + if (skull != NULL) { return skull->getSkullType(); } @@ -113,7 +113,7 @@ void SkullTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (level->isClientSide) return; if ((data & NO_DROP_BIT) == 0) { - shared_ptr item = std::make_shared(Item::skull_Id, 1, cloneTileData(level, x, y, z)); + shared_ptr item = shared_ptr(new ItemInstance(Item::skull_Id, 1, cloneTileData(level, x, y, z))); shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); if (entity->getSkullType() == SkullTileEntity::TYPE_CHAR && !entity->getExtraType().empty()) @@ -166,7 +166,7 @@ void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, shared_ptrcanCreateMore(eTYPE_WITHERBOSS, Level::eSpawnType_Egg)) { // 4J: Removed !isClientSide check because there's one earlier on - shared_ptr witherBoss = std::make_shared(level); + shared_ptr witherBoss = shared_ptr( new WitherBoss(level) ); witherBoss->moveTo(x + 0.5, y - 1.45, z + zo + 1.5, 90, 0); witherBoss->yBodyRot = 90; witherBoss->makeInvulnerable(); @@ -180,8 +180,8 @@ void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, shared_ptrspawnResources(level, x, y - 2, z + zo + 1, 0, 0); Tile::tiles[Tile::soulsand_Id]->spawnResources(level, x, y - 1, z + zo + 2, 0, 0); - shared_ptr itemInstance = std::make_shared(Item::skull_Id, 3, SkullTileEntity::TYPE_WITHER); - shared_ptr itemEntity = std::make_shared(level, x, y, z + zo + 1, itemInstance); + shared_ptr itemInstance = shared_ptr(new ItemInstance(Item::skull_Id, 3, SkullTileEntity::TYPE_WITHER)); + shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x, y, z + zo + 1, itemInstance) ); level->addEntity(itemEntity); } @@ -229,7 +229,7 @@ void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, shared_ptrcanCreateMore(eTYPE_WITHERBOSS, Level::eSpawnType_Egg)) { // 4J: Removed !isClientSide check because there's one earlier on - shared_ptr witherBoss = std::make_shared(level); + shared_ptr witherBoss = shared_ptr( new WitherBoss(level) ); witherBoss->moveTo(x + xo + 1.5, y - 1.45, z + .5, 0, 0); witherBoss->makeInvulnerable(); level->addEntity(witherBoss); @@ -242,8 +242,8 @@ void SkullTile::checkMobSpawn(Level *level, int x, int y, int z, shared_ptrspawnResources(level, x + xo + 1, y - 2, z, 0, 0); Tile::tiles[Tile::soulsand_Id]->spawnResources(level, x + xo + 2, y - 1, z, 0, 0); - shared_ptr itemInstance = std::make_shared(Item::skull_Id, 3, SkullTileEntity::TYPE_WITHER); - shared_ptr itemEntity = std::make_shared(level, x + xo + 1, y, z, itemInstance); + shared_ptr itemInstance = shared_ptr(new ItemInstance(Item::skull_Id, 3, SkullTileEntity::TYPE_WITHER)); + shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo + 1, y, z, itemInstance) ); level->addEntity(itemEntity); } @@ -274,7 +274,7 @@ bool SkullTile::isSkullAt(Level *level, int x, int y, int z, int skullType) } shared_ptr te = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(te); - if (skull == nullptr) + if (skull == NULL) { return false; } diff --git a/Minecraft.World/SkullTileEntity.cpp b/Minecraft.World/SkullTileEntity.cpp index 3937bec4..ea19b446 100644 --- a/Minecraft.World/SkullTileEntity.cpp +++ b/Minecraft.World/SkullTileEntity.cpp @@ -13,8 +13,8 @@ SkullTileEntity::SkullTileEntity() void SkullTileEntity::save(CompoundTag *tag) { TileEntity::save(tag); - tag->putByte(L"SkullType", static_cast(skullType & 0xff)); - tag->putByte(L"Rot", static_cast(rotation & 0xff)); + tag->putByte(L"SkullType", (BYTE) (skullType & 0xff)); + tag->putByte(L"Rot", (BYTE) (rotation & 0xff)); tag->putString(L"ExtraType", extraType); } @@ -30,7 +30,7 @@ shared_ptr SkullTileEntity::getUpdatePacket() { CompoundTag *tag = new CompoundTag(); save(tag); - return std::make_shared(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag); + return shared_ptr(new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag)); } void SkullTileEntity::setSkullType(int skullType, const wstring &extra) @@ -62,7 +62,7 @@ wstring SkullTileEntity::getExtraType() // 4J Added shared_ptr SkullTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new SkullTileEntity() ); TileEntity::clone(result); result->skullType = skullType; diff --git a/Minecraft.World/SkyIslandDimension.cpp b/Minecraft.World/SkyIslandDimension.cpp index 354630eb..aa68bd5e 100644 --- a/Minecraft.World/SkyIslandDimension.cpp +++ b/Minecraft.World/SkyIslandDimension.cpp @@ -23,7 +23,7 @@ float SkyIslandDimension::getTimeOfDay(int64_t time, float a) const float *SkyIslandDimension::getSunriseColor(float td, float a) { - return nullptr; + return NULL; } Vec3 *SkyIslandDimension::getFogColor(float td, float a) const diff --git a/Minecraft.World/Slime.cpp b/Minecraft.World/Slime.cpp index de76ef06..eaeea25a 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -47,12 +47,12 @@ void Slime::defineSynchedData() { Mob::defineSynchedData(); - entityData->define(ID_SIZE, static_cast(1)); + entityData->define(ID_SIZE, (byte) 1); } void Slime::setSize(int size) { - entityData->set(ID_SIZE, static_cast(size)); + entityData->set(ID_SIZE, (byte) size); setSize(0.6f * size, 0.6f * size); setPos(x, y, z); getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(size * size); @@ -135,14 +135,14 @@ void Slime::serverAiStep() { checkDespawn(); shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); - if (player != nullptr) + if (player != NULL) { lookAt(player, 10, 20); } if (onGround && jumpDelay-- <= 0) { jumpDelay = getJumpDelay(); - if (player != nullptr) + if (player != NULL) { jumpDelay /= 3; } @@ -155,7 +155,7 @@ void Slime::serverAiStep() // 4J Removed TU7 to bring forward change to fix lava slime render in MP //targetSquish = 1; xxa = 1 - random->nextFloat() * 2; - yya = static_cast(1) * getSize(); + yya = (float) 1 * getSize(); } else { @@ -179,7 +179,7 @@ int Slime::getJumpDelay() shared_ptr Slime::createChild() { - return std::make_shared(level); + return shared_ptr( new Slime(level) ); } void Slime::remove() diff --git a/Minecraft.World/Slot.cpp b/Minecraft.World/Slot.cpp index 2f42a27d..a5a53a48 100644 --- a/Minecraft.World/Slot.cpp +++ b/Minecraft.World/Slot.cpp @@ -15,7 +15,7 @@ Slot::Slot(shared_ptr container, int slot, int x, int y) : container( void Slot::onQuickCraft(shared_ptr picked, shared_ptr original) { - if (picked == nullptr || original == nullptr) + if (picked == NULL || original == NULL) { return; } @@ -44,14 +44,14 @@ void Slot::swap(Slot *other) shared_ptr item1 = container->getItem(slot); shared_ptr item2 = other->container->getItem(other->slot); - if (item1 != nullptr && item1->count > other->getMaxStackSize()) + if (item1 != NULL && item1->count > other->getMaxStackSize()) { - if (item2 != nullptr) return; + if (item2 != NULL) return; item2 = item1->remove(item1->count - other->getMaxStackSize()); } - if (item2 != nullptr && item2->count > getMaxStackSize()) + if (item2 != NULL && item2->count > getMaxStackSize()) { - if (item1 != nullptr) return; + if (item1 != NULL) return; item1 = item2->remove(item2->count - getMaxStackSize()); } other->container->setItem(other->slot, item1); @@ -77,7 +77,7 @@ shared_ptr Slot::getItem() bool Slot::hasItem() { - return getItem() != nullptr; + return getItem() != NULL; } void Slot::set(shared_ptr item) @@ -98,7 +98,7 @@ int Slot::getMaxStackSize() const Icon *Slot::getNoItemIcon() { - return nullptr; + return NULL; } shared_ptr Slot::remove(int c) @@ -125,7 +125,7 @@ bool Slot::mayCombine(shared_ptr second) { shared_ptr first = getItem(); - if(first == nullptr || second == nullptr) return false; + if(first == NULL || second == NULL) return false; ArmorItem *thisItem = dynamic_cast(first->getItem()); if(thisItem) @@ -135,7 +135,7 @@ bool Slot::mayCombine(shared_ptr second) return thisIsDyableArmor && itemIsDye; } // 4J Stu - This condition taken from Recipes::getItemFor to repair items, but added the damaged check to skip when the result is pointless - else if (first != nullptr && second != nullptr && first->id == second->id && first->count == 1 && second->count == 1 && Item::items[first->id]->canBeDepleted() && (first->isDamaged() || second->isDamaged()) ) + else if (first != NULL && second != NULL && first->id == second->id && first->count == 1 && second->count == 1 && Item::items[first->id]->canBeDepleted() && (first->isDamaged() || second->isDamaged()) ) { // 4J Stu - Don't allow combinining enchanted items, the enchantment will be lost. They can use the anvil for this return !first->isEnchanted() && !second->isEnchanted(); @@ -148,7 +148,7 @@ shared_ptr Slot::combine(shared_ptr item) shared_ptr result = nullptr; shared_ptr first = getItem(); - shared_ptr craftSlots = std::make_shared(nullptr, 2, 2); + shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); craftSlots->setItem(0, item); craftSlots->setItem(1, first); @@ -159,7 +159,7 @@ shared_ptr Slot::combine(shared_ptr item) } else { - result = Recipes::getInstance()->getItemFor(craftSlots, nullptr); + result = Recipes::getInstance()->getItemFor(craftSlots, NULL); } craftSlots->setItem(0, nullptr); diff --git a/Minecraft.World/SmallFireball.cpp b/Minecraft.World/SmallFireball.cpp index 2475f5dc..30f7a0b2 100644 --- a/Minecraft.World/SmallFireball.cpp +++ b/Minecraft.World/SmallFireball.cpp @@ -25,7 +25,7 @@ void SmallFireball::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != nullptr) + if (res->entity != NULL) { DamageSource *damageSource = DamageSource::fireball(dynamic_pointer_cast(shared_from_this()),owner); if (!res->entity->isFireImmune() && res->entity->hurt(damageSource, 5)) diff --git a/Minecraft.World/SmoothStoneBrickTile.cpp b/Minecraft.World/SmoothStoneBrickTile.cpp index a42af97b..22fb6df5 100644 --- a/Minecraft.World/SmoothStoneBrickTile.cpp +++ b/Minecraft.World/SmoothStoneBrickTile.cpp @@ -12,7 +12,7 @@ const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES[SMOOTH_STONE_B SmoothStoneBrickTile::SmoothStoneBrickTile(int id) : Tile(id, Material::stone) { - icons = nullptr; + icons = NULL; } Icon *SmoothStoneBrickTile::getTexture(int face, int data) diff --git a/Minecraft.World/SmoothZoomLayer.cpp b/Minecraft.World/SmoothZoomLayer.cpp index 60fd2664..2df34a3b 100644 --- a/Minecraft.World/SmoothZoomLayer.cpp +++ b/Minecraft.World/SmoothZoomLayer.cpp @@ -55,7 +55,7 @@ shared_ptrSmoothZoomLayer::zoom(int64_t seed, shared_ptrsup, int c shared_ptrresult = sup; for (int i = 0; i < count; i++) { - result = std::make_shared(seed + i, result); + result = shared_ptr(new SmoothZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/SnowMan.cpp b/Minecraft.World/SnowMan.cpp index 05ead6a6..6c78b56f 100644 --- a/Minecraft.World/SnowMan.cpp +++ b/Minecraft.World/SnowMan.cpp @@ -100,7 +100,7 @@ void SnowMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) void SnowMan::performRangedAttack(shared_ptr target, float power) { - shared_ptr snowball = std::make_shared(level, dynamic_pointer_cast(shared_from_this())); + shared_ptr snowball = shared_ptr(new Snowball(level, dynamic_pointer_cast(shared_from_this()))); double xd = target->x - x; double yd = (target->y + target->getHeadHeight() - 1.1f) - snowball->y; double zd = target->z - z; diff --git a/Minecraft.World/Snowball.cpp b/Minecraft.World/Snowball.cpp index bb873b20..6588ac96 100644 --- a/Minecraft.World/Snowball.cpp +++ b/Minecraft.World/Snowball.cpp @@ -31,7 +31,7 @@ Snowball::Snowball(Level *level, double x, double y, double z) : Throwable(level void Snowball::onHit(HitResult *res) { - if (res->entity != nullptr) + if (res->entity != NULL) { int damage = 0; if ( res->entity->instanceof(eTYPE_BLAZE) ) diff --git a/Minecraft.World/SnowballItem.cpp b/Minecraft.World/SnowballItem.cpp index afb190d8..0149e68d 100644 --- a/Minecraft.World/SnowballItem.cpp +++ b/Minecraft.World/SnowballItem.cpp @@ -18,6 +18,6 @@ shared_ptr SnowballItem::use(shared_ptr instance, Le instance->count--; } level->playEntitySound((shared_ptr ) player, eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f)); - if (!level->isClientSide) level->addEntity(std::make_shared(level, player)); + if (!level->isClientSide) level->addEntity( shared_ptr( new Snowball(level, player) ) ); return instance; } \ No newline at end of file diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index 290b39dc..bd0c2032 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -14,7 +14,7 @@ CRITICAL_SECTION Socket::s_hostQueueLock[2]; std::queue Socket::s_hostQueue[2]; Socket::SocketOutputStreamLocal *Socket::s_hostOutStream[2]; Socket::SocketInputStreamLocal *Socket::s_hostInStream[2]; -ServerConnection *Socket::s_serverConnection = nullptr; +ServerConnection *Socket::s_serverConnection = NULL; void Socket::Initialise(ServerConnection *serverConnection) { @@ -67,7 +67,7 @@ Socket::Socket(bool response) { m_endClosed[i] = false; } - m_socketClosedEvent = nullptr; + m_socketClosedEvent = NULL; createdOk = true; networkPlayerSmallId = g_NetworkManager.GetHostPlayer()->GetSmallId(); } @@ -80,8 +80,8 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca for( int i = 0; i < 2; i++ ) { InitializeCriticalSection(&m_queueLockNetwork[i]); - m_inputStream[i] = nullptr; - m_outputStream[i] = nullptr; + m_inputStream[i] = NULL; + m_outputStream[i] = NULL; m_endClosed[i] = false; } @@ -105,7 +105,7 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca SocketAddress *Socket::getRemoteSocketAddress() { - return nullptr; + return NULL; } INetworkPlayer *Socket::getPlayer() @@ -115,7 +115,7 @@ INetworkPlayer *Socket::getPlayer() void Socket::setPlayer(INetworkPlayer *player) { - if(player!=nullptr) + if(player!=NULL) { networkPlayerSmallId = player->GetSmallId(); } @@ -147,7 +147,7 @@ void Socket::pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHos void Socket::addIncomingSocket(Socket *socket) { - if( s_serverConnection != nullptr ) + if( s_serverConnection != NULL ) { s_serverConnection->NewIncomingSocket(socket); } @@ -240,7 +240,7 @@ bool Socket::close(bool isServerConnection) allClosed = true; m_endClosed[m_end] = true; } - if( allClosed && m_socketClosedEvent != nullptr ) + if( allClosed && m_socketClosedEvent != NULL ) { m_socketClosedEvent->Set(); } @@ -330,7 +330,7 @@ void Socket::SocketOutputStreamLocal::write(unsigned int b) return; } EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - s_hostQueue[m_queueIdx].push(static_cast(b)); + s_hostQueue[m_queueIdx].push((byte)b); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -442,7 +442,7 @@ void Socket::SocketOutputStreamNetwork::write(unsigned int b) if( m_streamOpen != true ) return; byteArray barray; byte bb; - bb = static_cast(b); + bb = (byte)b; barray.data = &bb; barray.length = 1; write(barray, 0, 1); @@ -488,15 +488,15 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int buffer.dwDataSize = length; INetworkPlayer *hostPlayer = g_NetworkManager.GetHostPlayer(); - if(hostPlayer == nullptr) + if(hostPlayer == NULL) { - app.DebugPrintf("Trying to write to network, but the hostPlayer is nullptr\n"); + app.DebugPrintf("Trying to write to network, but the hostPlayer is NULL\n"); return; } INetworkPlayer *socketPlayer = m_socket->getPlayer(); - if(socketPlayer == nullptr) + if(socketPlayer == NULL) { - app.DebugPrintf("Trying to write to network, but the socketPlayer is nullptr\n"); + app.DebugPrintf("Trying to write to network, but the socketPlayer is NULL\n"); return; } @@ -517,7 +517,7 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int hostPlayer->SendData(socketPlayer, buffer.pbyData, buffer.dwDataSize, lowPriority, requireAck); - // DWORD queueSize = hostPlayer->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ); + // DWORD queueSize = hostPlayer->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ); // if( queueSize > 24000 ) // { // //printf("Queue size is: %d, forcing doWork()\n",queueSize); diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index 556000fd..780c9819 100644 --- a/Minecraft.World/SparseDataStorage.cpp +++ b/Minecraft.World/SparseDataStorage.cpp @@ -28,7 +28,7 @@ SparseDataStorage::SparseDataStorage() #ifdef _XBOX unsigned char *planeIndices = (unsigned char *)XPhysicalAlloc(128 * 128, MAXULONG_PTR, 4096, PAGE_READWRITE); #else - unsigned char *planeIndices = static_cast(malloc(128 * 128)); + unsigned char *planeIndices = (unsigned char *)malloc(128 * 128); #endif unsigned char *data = planeIndices + 128; planeIndices[0] = ALL_0_INDEX; @@ -51,7 +51,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper) { // Allocate using physical alloc. As this will (by default) return memory from the pool of 4KB pages, the address will in the range of MM_PHYSICAL_4KB_BASE upwards. We can use // this fact to identify the allocation later, and so free it with the corresponding call to XPhysicalFree. - unsigned char *planeIndices = static_cast(malloc(128)); + unsigned char *planeIndices = (unsigned char *)malloc(128); for( int i = 0; i < 128; i++ ) { planeIndices[i] = ALL_0_INDEX; @@ -87,12 +87,12 @@ SparseDataStorage::~SparseDataStorage() SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) { // Extra details of source storage - const int64_t sourceDataAndCount = copyFrom->dataAndCount; - const unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff); + int64_t sourceDataAndCount = copyFrom->dataAndCount; + unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff); int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; // Allocate & copy indices ( 128 bytes ) and any allocated planes (128 * count) - unsigned char *destIndicesAndData = static_cast(malloc(sourceCount * 128 + 128)); + unsigned char *destIndicesAndData = (unsigned char *)malloc( sourceCount * 128 + 128 ); // AP - I've moved this to be before the memcpy because of a very strange bug on vita. Sometimes dataAndCount wasn't valid in time when ::get was called. // This should never happen and this isn't a proper solution but fixes it for now. @@ -129,10 +129,10 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked { - const int pos = ( xz << 7 ) | y; - const int slot = pos >> 1; - const int part = pos & 1; - const unsigned char value = ( dataIn[slot + inOffset] >> (part * 4) ) & 15; + int pos = ( xz << 7 ) | y; + int slot = pos >> 1; + int part = pos & 1; + unsigned char value = ( dataIn[slot + inOffset] >> (part * 4) ) & 15; if( value != 0 ) all0 = false; } if( all0 ) @@ -146,7 +146,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) } // Allocate required storage - unsigned char *planeIndices = static_cast(malloc(128 * allocatedPlaneCount + 128)); + unsigned char *planeIndices = (unsigned char *)malloc(128 * allocatedPlaneCount + 128); unsigned char *data = planeIndices + 128; XMemCpy(planeIndices, _planeIndices, 128); @@ -158,9 +158,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) // we know they were sequentially allocated above. if( planeIndices[y] < 128 ) { - const int part = y & 1; + int part = y & 1; //int shift = 4 * part; - const unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset]; + unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset]; for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte { @@ -176,9 +176,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = reinterpret_cast(planeIndices) & 0x0000ffffffffffffL; + int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(allocatedPlaneCount) << 48; + newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48; updateDataAndCount( newDataAndCount ); } @@ -205,10 +205,10 @@ void SparseDataStorage::getData(byteArray retArray, unsigned int retOffset) } else { - const int part = y & 1; - const int shift = 4 * part; + int part = y & 1; + int shift = 4 * part; unsigned char *pucOut = &retArray.data[ (y >> 1) + + retOffset]; - const unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ]; + unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ]; for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte { unsigned char value = (*pucIn) & 15; @@ -237,10 +237,10 @@ int SparseDataStorage::get(int x, int y, int z) } else { - const int planeIndex = x * 16 + z; // Index within this xz plane - const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte - const int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15; + int planeIndex = x * 16 + z; // Index within this xz plane + int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) + int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15; return retval; } @@ -270,12 +270,12 @@ void SparseDataStorage::set(int x, int y, int z, int val) // Either data was already allocated, or we've just done that. Now store our value into the right place. - const int planeIndex = x * 16 + z; // Index within this xz plane - const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte - const int mask = 0xf0 >> shift; + int planeIndex = x * 16 + z; // Index within this xz plane + int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) + int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + int mask = 0xf0 >> shift; - const int idx = planeIndices[y] * 128 + byteIndex; + int idx = planeIndices[y] * 128 + byteIndex; data[idx] = ( data[idx] & mask ) | ( val << shift ); } @@ -288,7 +288,7 @@ void SparseDataStorage::set(int x, int y, int z, int val) int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, int x1, int y1, int z1, int offset, tileUpdatedCallback callback, void *param, int yparam) { // Actual setting of data happens when calling set method so no need to lock here - const unsigned char *pucIn = &dataIn.data[offset]; + unsigned char *pucIn = &dataIn.data[offset]; if( callback ) { for( int x = x0; x < x1; x++ ) @@ -296,11 +296,11 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i for( int z = z0; z < z1; z++ ) { // Emulate how data was extracted from DataLayer... see comment above - const int yy0 = y0 & 0xfffffffe; - const int len = ( y1 - y0 ) / 2; + int yy0 = y0 & 0xfffffffe; + int len = ( y1 - y0 ) / 2; for( int i = 0; i < len; i++ ) { - const int y = yy0 + ( i * 2 ); + int y = yy0 + ( i * 2 ); int toSet = (*pucIn) & 15; if( get(x, y, z) != toSet ) @@ -326,11 +326,11 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i for( int z = z0; z < z1; z++ ) { // Emulate how data was extracted from DataLayer... see comment above - const int yy0 = y0 & 0xfffffffe; - const int len = ( y1 - y0 ) / 2; + int yy0 = y0 & 0xfffffffe; + int len = ( y1 - y0 ) / 2; for( int i = 0; i < len; i++ ) { - const int y = yy0 + ( i * 2 ); + int y = yy0 + ( i * 2 ); set(x, y, z, (*pucIn) & 15 ); set(x, y + 1, z, ((*pucIn) >> 4 ) & 15 ); @@ -339,9 +339,9 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i } } } - const ptrdiff_t count = pucIn - &dataIn.data[offset]; + ptrdiff_t count = pucIn - &dataIn.data[offset]; - return static_cast(count); + return (int)count; } // Updates the data at offset position dataInOut with a region of data information - external ordering compatible with java DataLayer @@ -357,11 +357,11 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0 for( int z = z0; z < z1; z++ ) { // Emulate how data was extracted from DataLayer... see comment above - const int yy0 = y0 & 0xfffffffe; - const int len = ( y1 - y0 ) / 2; + int yy0 = y0 & 0xfffffffe; + int len = ( y1 - y0 ) / 2; for( int i = 0; i < len; i++ ) { - const int y = yy0 + ( i * 2 ); + int y = yy0 + ( i * 2 ); *pucOut = get( x, y, z); *pucOut |= get( x, y + 1, z) << 4; @@ -369,9 +369,9 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0 } } } - const ptrdiff_t count = pucOut - &dataInOut.data[offset]; + ptrdiff_t count = pucOut - &dataInOut.data[offset]; - return static_cast(count); + return (int)count; } void SparseDataStorage::addNewPlane(int y) @@ -380,34 +380,34 @@ void SparseDataStorage::addNewPlane(int y) do { // Get last packed data pointer & count - const int64_t lastDataAndCount = dataAndCount; + int64_t lastDataAndCount = dataAndCount; // Unpack count & data pointer - const int lastLinesUsed = static_cast((lastDataAndCount >> 48) & 0xffff); + int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Find out what to prefill the newly allocated line with - const unsigned char planeIndex = lastDataPointer[y]; + unsigned char planeIndex = lastDataPointer[y]; if( planeIndex < ALL_0_INDEX ) return; // Something has already allocated this line - we're done int linesUsed = lastLinesUsed + 1; // Allocate new memory storage, copy over anything from old storage, and initialise remainder - auto dataPointer = static_cast(malloc(linesUsed * 128 + 128)); + unsigned char *dataPointer = (unsigned char *)malloc(linesUsed * 128 + 128); XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 ); dataPointer[y] = lastLinesUsed; // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = reinterpret_cast(dataPointer) & 0x0000ffffffffffffL; + int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(linesUsed) << 48; + newDataAndCount |= ((int64_t)linesUsed) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); if( lastDataAndCount2 == lastDataAndCount ) { @@ -430,7 +430,7 @@ void SparseDataStorage::addNewPlane(int y) void SparseDataStorage::getPlaneIndicesAndData(unsigned char **planeIndices, unsigned char **data) { - unsigned char *indicesAndData = reinterpret_cast(dataAndCount & 0x0000ffffffffffff); + unsigned char *indicesAndData = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); *planeIndices = indicesAndData; *data = indicesAndData + 128; @@ -448,10 +448,10 @@ void SparseDataStorage::tick() { // We have 3 queues for deleting. Always delete from the next one after where we are writing to, so it should take 2 ticks // before we ever delete something, from when the request to delete it came in - const int freeIndex = ( deleteQueueIndex + 1 ) % 3; + int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = nullptr; + unsigned char *toFree = NULL; do { toFree = deleteQueue[freeIndex].Pop(); @@ -480,12 +480,12 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) bool success = false; do { - const int64_t lastDataAndCount = dataAndCount; - unsigned char *lastDataPointer = reinterpret_cast(lastDataAndCount & 0x0000ffffffffffff); + int64_t lastDataAndCount = dataAndCount; + unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); if( lastDataAndCount2 == lastDataAndCount ) { @@ -508,7 +508,7 @@ int SparseDataStorage::compress() unsigned char _planeIndices[128]; bool needsCompressed = false; - const int64_t lastDataAndCount = dataAndCount; + int64_t lastDataAndCount = dataAndCount; unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *data = planeIndices + 128; @@ -522,7 +522,7 @@ int SparseDataStorage::compress() } else { - const unsigned char *pucData = &data[ 128 * planeIndices[i] ]; + unsigned char *pucData = &data[ 128 * planeIndices[i] ]; bool all0 = true; for( int j = 0; j < 128; j++ ) // 16 x 16 x 4-bits { @@ -543,7 +543,7 @@ int SparseDataStorage::compress() if( needsCompressed ) { - unsigned char *newIndicesAndData = static_cast(malloc(128 + 128 * planesToAlloc)); + unsigned char *newIndicesAndData = (unsigned char *)malloc( 128 + 128 * planesToAlloc ); unsigned char *pucData = newIndicesAndData + 128; XMemCpy( newIndicesAndData, _planeIndices, 128 ); @@ -560,11 +560,11 @@ int SparseDataStorage::compress() #pragma warning ( disable : 4826 ) int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(planesToAlloc) << 48; + newDataAndCount |= ((int64_t)planesToAlloc) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place - const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); + int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); if( lastDataAndCount2 != lastDataAndCount ) { @@ -586,7 +586,7 @@ int SparseDataStorage::compress() } else { - return static_cast((lastDataAndCount >> 48) & 0xffff); + return (int)((lastDataAndCount >> 48 ) & 0xffff); } } @@ -594,7 +594,7 @@ int SparseDataStorage::compress() bool SparseDataStorage::isCompressed() { - const int count = ( dataAndCount >> 48 ) & 0xffff; + int count = ( dataAndCount >> 48 ) & 0xffff; return (count < 127); @@ -602,24 +602,24 @@ bool SparseDataStorage::isCompressed() void SparseDataStorage::write(DataOutputStream *dos) { - const int count = ( dataAndCount >> 48 ) & 0xffff; + int count = ( dataAndCount >> 48 ) & 0xffff; dos->writeInt(count); unsigned char *dataPointer = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); - const byteArray wrapper(dataPointer, count * 128 + 128); + byteArray wrapper(dataPointer, count * 128 + 128); dos->write(wrapper); } void SparseDataStorage::read(DataInputStream *dis) { - const int count = dis->readInt(); - unsigned char *dataPointer = static_cast(malloc(count * 128 + 128)); - const byteArray wrapper(dataPointer, count * 128 + 128); + int count = dis->readInt(); + unsigned char *dataPointer = (unsigned char *)malloc(count * 128 + 128); + byteArray wrapper(dataPointer, count * 128 + 128); dis->readFully(wrapper); #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = reinterpret_cast(dataPointer) & 0x0000ffffffffffffL; + int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(count) << 48; + newDataAndCount |= ((int64_t)count) << 48; updateDataAndCount(newDataAndCount); } diff --git a/Minecraft.World/SparseLightStorage.cpp b/Minecraft.World/SparseLightStorage.cpp index a80f9c97..a0ba41b1 100644 --- a/Minecraft.World/SparseLightStorage.cpp +++ b/Minecraft.World/SparseLightStorage.cpp @@ -28,7 +28,7 @@ SparseLightStorage::SparseLightStorage(bool sky) #ifdef _XBOX unsigned char *planeIndices = (unsigned char *)XPhysicalAlloc(128 * 128, MAXULONG_PTR, 4096, PAGE_READWRITE); #else - unsigned char *planeIndices = static_cast(malloc(128 * 128)); + unsigned char *planeIndices = (unsigned char *)malloc(128 * 128); #endif unsigned char *data = planeIndices + 128; planeIndices[127] = sky ? ALL_15_INDEX : ALL_0_INDEX; @@ -51,7 +51,7 @@ SparseLightStorage::SparseLightStorage(bool sky, bool isUpper) { // Allocate using physical alloc. As this will (by default) return memory from the pool of 4KB pages, the address will in the range of MM_PHYSICAL_4KB_BASE upwards. We can use // this fact to identify the allocation later, and so free it with the corresponding call to XPhysicalFree. - unsigned char *planeIndices = static_cast(malloc(128)); + unsigned char *planeIndices = (unsigned char *)malloc(128); for( int i = 0; i < 128; i++ ) { planeIndices[i] = sky ? ALL_15_INDEX : ALL_0_INDEX; @@ -92,7 +92,7 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage *copyFrom) int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; // Allocate & copy indices ( 128 bytes ) and any allocated planes (128 * count) - unsigned char *destIndicesAndData = static_cast(malloc(sourceCount * 128 + 128)); + unsigned char *destIndicesAndData = (unsigned char *)malloc( sourceCount * 128 + 128 ); // AP - I've moved this to be before the memcpy because of a very strange bug on vita. Sometimes dataAndCount wasn't valid in time when ::get was called. // This should never happen and this isn't a proper solution but fixes it for now. @@ -150,7 +150,7 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) } // Allocate required storage - unsigned char *planeIndices = static_cast(malloc(128 * allocatedPlaneCount + 128)); + unsigned char *planeIndices = (unsigned char *)malloc(128 * allocatedPlaneCount + 128); unsigned char *data = planeIndices + 128; XMemCpy(planeIndices, _planeIndices, 128); @@ -180,9 +180,9 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) // Get new data and count packed info #pragma warning ( disable : 4826 ) - int64_t newDataAndCount = reinterpret_cast(planeIndices) & 0x0000ffffffffffffL; + int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(allocatedPlaneCount) << 48; + newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48; updateDataAndCount( newDataAndCount ); } @@ -305,7 +305,7 @@ void SparseLightStorage::set(int x, int y, int z, int val) void SparseLightStorage::setAllBright() { - unsigned char *planeIndices = static_cast(malloc(128)); + unsigned char *planeIndices = (unsigned char *)malloc(128); for( int i = 0; i < 128; i++ ) { planeIndices[i] = ALL_15_INDEX; @@ -346,7 +346,7 @@ int SparseLightStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, } ptrdiff_t count = pucIn - &dataIn.data[offset]; - return static_cast(count); + return (int)count; } // Updates the data at offset position dataInOut with a region of lighting information - external ordering compatible with java DataLayer @@ -376,7 +376,7 @@ int SparseLightStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z } ptrdiff_t count = pucOut - &dataInOut.data[offset]; - return static_cast(count); + return (int)count; } void SparseLightStorage::addNewPlane(int y) @@ -388,7 +388,7 @@ void SparseLightStorage::addNewPlane(int y) int64_t lastDataAndCount = dataAndCount; // Unpack count & data pointer - int lastLinesUsed = static_cast((lastDataAndCount >> 48) & 0xffff); + int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Find out what to prefill the newly allocated line with @@ -400,7 +400,7 @@ void SparseLightStorage::addNewPlane(int y) int linesUsed = lastLinesUsed + 1; // Allocate new memory storage, copy over anything from old storage, and initialise remainder - unsigned char *dataPointer = static_cast(malloc(linesUsed * 128 + 128)); + unsigned char *dataPointer = (unsigned char *)malloc(linesUsed * 128 + 128); XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, prefill, 128 ); dataPointer[y] = lastLinesUsed; @@ -409,7 +409,7 @@ void SparseLightStorage::addNewPlane(int y) #pragma warning ( disable : 4826 ) int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(linesUsed) << 48; + newDataAndCount |= ((int64_t)linesUsed) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place @@ -457,7 +457,7 @@ void SparseLightStorage::tick() int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = nullptr; + unsigned char *toFree = NULL; do { toFree = deleteQueue[freeIndex].Pop(); @@ -560,7 +560,7 @@ int SparseLightStorage::compress() if( needsCompressed ) { - unsigned char *newIndicesAndData = static_cast(malloc(128 + 128 * planesToAlloc)); + unsigned char *newIndicesAndData = (unsigned char *)malloc( 128 + 128 * planesToAlloc ); unsigned char *pucData = newIndicesAndData + 128; XMemCpy( newIndicesAndData, _planeIndices, 128 ); @@ -577,7 +577,7 @@ int SparseLightStorage::compress() #pragma warning ( disable : 4826 ) int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(planesToAlloc) << 48; + newDataAndCount |= ((int64_t)planesToAlloc) << 48; // Attempt to update the data & count atomically. This command will Only succeed if the data stored at // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place @@ -603,7 +603,7 @@ int SparseLightStorage::compress() } else { - return static_cast((lastDataAndCount >> 48) & 0xffff); + return (int)((lastDataAndCount >> 48 ) & 0xffff); } } @@ -629,14 +629,14 @@ void SparseLightStorage::write(DataOutputStream *dos) void SparseLightStorage::read(DataInputStream *dis) { int count = dis->readInt(); - unsigned char *dataPointer = static_cast(malloc(count * 128 + 128)); + unsigned char *dataPointer = (unsigned char *)malloc(count * 128 + 128); byteArray wrapper(dataPointer, count * 128 + 128); dis->readFully(wrapper); #pragma warning ( disable : 4826 ) int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= static_cast(count) << 48; + newDataAndCount |= ((int64_t)count) << 48; updateDataAndCount( newDataAndCount ); } diff --git a/Minecraft.World/SpawnEggItem.cpp b/Minecraft.World/SpawnEggItem.cpp index 5124f668..9c059126 100644 --- a/Minecraft.World/SpawnEggItem.cpp +++ b/Minecraft.World/SpawnEggItem.cpp @@ -16,7 +16,7 @@ SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll never be able to place that many setStackedByData(true); - overlay = nullptr; + overlay = NULL; } wstring SpawnEggItem::getHoverName(shared_ptr itemInstance) @@ -69,7 +69,7 @@ Icon *SpawnEggItem::getLayerIcon(int auxValue, int spriteLayer) shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level *level, int *piResult) { shared_ptr newEntity = EntityIO::newById(iAuxVal, level); - if (newEntity != nullptr) + if (newEntity != NULL) { bool canSpawn = false; @@ -200,7 +200,7 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrremoveTile(x,y,z); level->setTileAndData(x,y,z,Tile::mobSpawner_Id, 0, Tile::UPDATE_ALL); shared_ptr mste = dynamic_pointer_cast( level->getTileEntity(x,y,z) ); - if(mste != nullptr) + if(mste != NULL) { mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) ); return true; @@ -213,7 +213,7 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrgetRenderShape() == Tile::SHAPE_FENCE)) + if (face == Facing::UP && (Tile::tiles[tile] != NULL && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE)) { // special case yOff = .5; @@ -224,10 +224,10 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrinstanceof(eTYPE_MOB) && itemInstance->hasCustomHoverName() ) @@ -252,7 +252,7 @@ shared_ptr SpawnEggItem::use(shared_ptr itemInstance if (level->isClientSide) return itemInstance; HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == nullptr) + if (hr == NULL) { delete hr; return itemInstance; @@ -275,7 +275,7 @@ shared_ptr SpawnEggItem::use(shared_ptr itemInstance { int iResult=0; shared_ptr result = spawnMobAt(level, itemInstance->getAuxValue(), xt, yt, zt, &iResult); - if (result != nullptr) + if (result != NULL) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; so change instanceof to check for Mobs. if ( result->instanceof(eTYPE_MOB) && itemInstance->hasCustomHoverName() ) @@ -317,7 +317,7 @@ shared_ptr SpawnEggItem::spawnMobAt(Level *level, int auxVal, double x, newEntity = canSpawn(mobId, level, piResult); // 4J-JEV: DynCasting to Mob not LivingEntity; so change instanceof to check for Mobs. - if ( newEntity != nullptr && newEntity->instanceof(eTYPE_MOB) ) + if ( newEntity != NULL && newEntity->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(newEntity); newEntity->moveTo(x, y, z, Mth::wrapDegrees(level->random->nextFloat() * 360), 0); @@ -325,7 +325,7 @@ shared_ptr SpawnEggItem::spawnMobAt(Level *level, int auxVal, double x, mob->yHeadRot = mob->yRot; mob->yBodyRot = mob->yRot; - mob->finalizeMobSpawn(nullptr, extraData); + mob->finalizeMobSpawn(NULL, extraData); level->addEntity(newEntity); mob->playAmbientSound(); } diff --git a/Minecraft.World/Spider.cpp b/Minecraft.World/Spider.cpp index 5d7bdd2c..49997db3 100644 --- a/Minecraft.World/Spider.cpp +++ b/Minecraft.World/Spider.cpp @@ -31,7 +31,7 @@ void Spider::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, (byte) 0); } void Spider::tick() @@ -109,7 +109,7 @@ void Spider::checkHurtTarget(shared_ptr target, float d) { double xdd = target->x - x; double zdd = target->z - z; - float dd = static_cast(sqrt(xdd * xdd + zdd * zdd)); + float dd = (float) sqrt(xdd * xdd + zdd * zdd); xd = (xdd / dd * 0.5f) * 0.8f + xd * 0.2f; zd = (zdd / dd * 0.5f) * 0.8f + zd * 0.2f; yd = 0.4f; @@ -195,26 +195,26 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /* if (level->random->nextInt(100) == 0) #endif { - shared_ptr skeleton = std::make_shared(level); + shared_ptr skeleton = shared_ptr( new Skeleton(level) ); skeleton->moveTo(x, y, z, yRot, 0); - skeleton->finalizeMobSpawn(nullptr); + skeleton->finalizeMobSpawn(NULL); level->addEntity(skeleton); skeleton->ride(shared_from_this()); } - if (groupData == nullptr) + if (groupData == NULL) { groupData = new SpiderEffectsGroupData(); if (level->difficulty > Difficulty::NORMAL && level->random->nextFloat() < SPIDER_SPECIAL_EFFECT_CHANCE * level->getDifficulty(x, y, z)) { - static_cast(groupData)->setRandomEffect(level->random); + ((SpiderEffectsGroupData *) groupData)->setRandomEffect(level->random); } } - if ( dynamic_cast( groupData ) != nullptr) + if ( dynamic_cast( groupData ) != NULL) { - int effect = static_cast(groupData)->effectId; - if (effect > 0 && MobEffect::effects[effect] != nullptr) + int effect = ((SpiderEffectsGroupData *) groupData)->effectId; + if (effect > 0 && MobEffect::effects[effect] != NULL) { addEffect(new MobEffectInstance(effect, Integer::MAX_VALUE)); } diff --git a/Minecraft.World/SpikeFeature.cpp b/Minecraft.World/SpikeFeature.cpp index 912e3aff..629b3c83 100644 --- a/Minecraft.World/SpikeFeature.cpp +++ b/Minecraft.World/SpikeFeature.cpp @@ -50,7 +50,7 @@ bool SpikeFeature::place(Level *level, Random *random, int x, int y, int z) } else break; } - shared_ptr enderCrystal = std::make_shared(level); + shared_ptr enderCrystal = shared_ptr(new EnderCrystal(level)); enderCrystal->moveTo(x + 0.5f, y + hh, z + 0.5f, random->nextFloat() * 360, 0); level->addEntity(enderCrystal); level->setTileAndData(x, y + hh, z, Tile::unbreakable_Id, 0, Tile::UPDATE_CLIENTS); @@ -168,7 +168,7 @@ bool SpikeFeature::placeWithIndex(Level *level, Random *random, int x, int y, in } } - shared_ptr enderCrystal = std::make_shared(level); + shared_ptr enderCrystal = shared_ptr(new EnderCrystal(level)); enderCrystal->moveTo(x + 0.5f, y + hh, z + 0.5f, random->nextFloat() * 360, 0); level->addEntity(enderCrystal); placeBlock(level, x, y + hh, z, Tile::unbreakable_Id, 0); diff --git a/Minecraft.World/SpringFeature.cpp b/Minecraft.World/SpringFeature.cpp index fdd1cbef..c6fa5e9f 100644 --- a/Minecraft.World/SpringFeature.cpp +++ b/Minecraft.World/SpringFeature.cpp @@ -11,7 +11,7 @@ SpringFeature::SpringFeature(int tile) bool SpringFeature::place(Level *level, Random *random, int x, int y, int z) { // 4J Stu Added to stop spring features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x, y, z, x, y, z); diff --git a/Minecraft.World/SpruceFeature.cpp b/Minecraft.World/SpruceFeature.cpp index d42e46f3..39d628cf 100644 --- a/Minecraft.World/SpruceFeature.cpp +++ b/Minecraft.World/SpruceFeature.cpp @@ -23,7 +23,7 @@ bool SpruceFeature::place(Level *level, Random *random, int x, int y, int z) } // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - leafRadius, y - 1, z - leafRadius, x + leafRadius, y + treeHeight, z + leafRadius); diff --git a/Minecraft.World/Squid.cpp b/Minecraft.World/Squid.cpp index f1b660eb..7aae3615 100644 --- a/Minecraft.World/Squid.cpp +++ b/Minecraft.World/Squid.cpp @@ -81,7 +81,7 @@ void Squid::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) int count = random->nextInt(3 + playerBonusLevel) + 1; for (int i = 0; i < count; i++) { - spawnAtLocation(std::make_shared(Item::dye_powder, 1, DyePowderItem::BLACK), 0.0f); + spawnAtLocation(shared_ptr( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BLACK) ), 0.0f); } } @@ -140,10 +140,10 @@ void Squid::aiStep() double horizontalMovement = sqrt(xd * xd + zd * zd); - yBodyRot += ((-static_cast(atan2(xd, zd)) * 180 / PI) - yBodyRot) * 0.1f; + yBodyRot += ((-(float) atan2(xd, zd) * 180 / PI) - yBodyRot) * 0.1f; yRot = yBodyRot; zBodyRot = zBodyRot + (float) PI * rotateSpeed * 1.5f; - xBodyRot += ((-static_cast(atan2(horizontalMovement, yd)) * 180 / PI) - xBodyRot) * 0.1f; + xBodyRot += ((-(float) atan2(horizontalMovement, yd) * 180 / PI) - xBodyRot) * 0.1f; } else { diff --git a/Minecraft.World/StairTile.cpp b/Minecraft.World/StairTile.cpp index 094ebf6f..de2cc865 100644 --- a/Minecraft.World/StairTile.cpp +++ b/Minecraft.World/StairTile.cpp @@ -66,7 +66,7 @@ void StairTile::setBaseShape(LevelSource *level, int x, int y, int z) bool StairTile::isStairs(int id) { StairTile *st = dynamic_cast(Tile::tiles[id]); - return id > 0 && st != nullptr; //Tile::tiles[id] instanceof StairTile; + return id > 0 && st != NULL; //Tile::tiles[id] instanceof StairTile; } bool StairTile::isLockAttached(LevelSource *level, int x, int y, int z, int data) @@ -476,7 +476,7 @@ HitResult *StairTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 * HitResult *results[8]; for(unsigned int i = 0; i < 8; ++i) { - results[i] = nullptr; + results[i] = NULL; } int data = level->getData(xt, yt, zt); int dir = data & 0x3; @@ -498,16 +498,16 @@ HitResult *StairTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 * for(unsigned int j = 0; j < DEAD_SPACE_COLUMN_COUNT; ++j) { - results[deadSpaces[j]] = nullptr; + results[deadSpaces[j]] = NULL; } - HitResult *closest = nullptr; + HitResult *closest = NULL; double closestDist = 0; for (unsigned int i = 0; i < 8; ++i) { HitResult *result = results[i]; - if (result != nullptr) + if (result != NULL) { double dist = result->pos->distanceToSqr(b); diff --git a/Minecraft.World/Stats.cpp b/Minecraft.World/Stats.cpp index 43ff486c..c8a615ff 100644 --- a/Minecraft.World/Stats.cpp +++ b/Minecraft.World/Stats.cpp @@ -27,30 +27,30 @@ vector *Stats::itemsCraftedStats = new vector; vector *Stats::blocksPlacedStats = new vector; #endif -Stat *Stats::walkOneM = nullptr; -Stat *Stats::swimOneM = nullptr; -Stat *Stats::fallOneM = nullptr; -Stat *Stats::climbOneM = nullptr; -Stat *Stats::minecartOneM = nullptr; -Stat *Stats::boatOneM = nullptr; -Stat *Stats::pigOneM = nullptr; -Stat *Stats::portalsCreated = nullptr; -Stat *Stats::cowsMilked = nullptr; -Stat *Stats::netherLavaCollected = nullptr; -Stat *Stats::killsZombie = nullptr; -Stat *Stats::killsSkeleton = nullptr; -Stat *Stats::killsCreeper = nullptr; -Stat *Stats::killsSpider = nullptr; -Stat *Stats::killsSpiderJockey = nullptr; -Stat *Stats::killsZombiePigman = nullptr; -Stat *Stats::killsSlime = nullptr; -Stat *Stats::killsGhast = nullptr; -Stat *Stats::killsNetherZombiePigman = nullptr; +Stat *Stats::walkOneM = NULL; +Stat *Stats::swimOneM = NULL; +Stat *Stats::fallOneM = NULL; +Stat *Stats::climbOneM = NULL; +Stat *Stats::minecartOneM = NULL; +Stat *Stats::boatOneM = NULL; +Stat *Stats::pigOneM = NULL; +Stat *Stats::portalsCreated = NULL; +Stat *Stats::cowsMilked = NULL; +Stat *Stats::netherLavaCollected = NULL; +Stat *Stats::killsZombie = NULL; +Stat *Stats::killsSkeleton = NULL; +Stat *Stats::killsCreeper = NULL; +Stat *Stats::killsSpider = NULL; +Stat *Stats::killsSpiderJockey = NULL; +Stat *Stats::killsZombiePigman = NULL; +Stat *Stats::killsSlime = NULL; +Stat *Stats::killsGhast = NULL; +Stat *Stats::killsNetherZombiePigman = NULL; // 4J : WESTY : Added for new achievements. -Stat *Stats::befriendsWolf = nullptr; -Stat *Stats::totalBlocksMined = nullptr; -Stat *Stats::timePlayed = nullptr; +Stat *Stats::befriendsWolf = NULL; +Stat *Stats::totalBlocksMined = NULL; +Stat *Stats::timePlayed = NULL; StatArray Stats::blocksMined; StatArray Stats::itemsCollected; @@ -62,18 +62,18 @@ StatArray Stats::rainbowCollection; StatArray Stats::biomesVisisted; #endif -Stat *Stats::killsEnderdragon = nullptr; // The number of times this player has dealt the killing blow to the Enderdragon -Stat *Stats::completeTheEnd = nullptr; // The number of times this player has been present when the Enderdragon has died +Stat *Stats::killsEnderdragon = NULL; // The number of times this player has dealt the killing blow to the Enderdragon +Stat *Stats::completeTheEnd = NULL; // The number of times this player has been present when the Enderdragon has died void Stats::staticCtor() { - Stats::walkOneM = (new GeneralStat(2000, L"stat.walkOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::swimOneM = (new GeneralStat(2001, L"stat.swimOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::fallOneM = (new GeneralStat(2002, L"stat.fallOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::climbOneM = (new GeneralStat(2003, L"stat.climbOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::minecartOneM = (new GeneralStat(2004, L"stat.minecartOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::boatOneM = (new GeneralStat(2005, L"stat.boatOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); - Stats::pigOneM = (new GeneralStat(2006, L"stat.pigOneM", static_cast(Stat::distanceFormatter)))->setAwardLocallyOnly()->postConstruct(); + Stats::walkOneM = (new GeneralStat(2000, L"stat.walkOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::swimOneM = (new GeneralStat(2001, L"stat.swimOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::fallOneM = (new GeneralStat(2002, L"stat.fallOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::climbOneM = (new GeneralStat(2003, L"stat.climbOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::minecartOneM = (new GeneralStat(2004, L"stat.minecartOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::boatOneM = (new GeneralStat(2005, L"stat.boatOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); + Stats::pigOneM = (new GeneralStat(2006, L"stat.pigOneM", (StatFormatter *) Stat::distanceFormatter))->setAwardLocallyOnly()->postConstruct(); Stats::portalsCreated = (new GeneralStat(2007, L"stat.portalsUsed"))->postConstruct(); Stats::cowsMilked = (new GeneralStat(2008, L"stat.cowsMilked"))->postConstruct(); Stats::netherLavaCollected = (new GeneralStat(2009, L"stat.netherLavaCollected"))->postConstruct(); @@ -517,7 +517,7 @@ void Stats::buildAdditionalStats() blocksPlaced[itemStat->getItemId()] = itemStat; itemStat->postConstruct(); - GeneralStat *generalStat = nullptr; + GeneralStat *generalStat = NULL; rainbowCollection = StatArray(16); for (unsigned int i = 0; i < 16; i++) diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index 476b643c..62b0d57b 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -17,7 +17,7 @@ StemTile::StemTile(int id, Tile *fruit) : Bush(id) float ss = 0.125f; this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); - iconAngled = nullptr; + iconAngled = NULL; } bool StemTile::mayPlaceOn(int tile) @@ -34,7 +34,7 @@ void StemTile::tick(Level *level, int x, int y, int z, Random *random) float growthSpeed = getGrowthSpeed(level, x, y, z); // 4J Stu - Brought forward change from 1.2.3 to make fruit more likely to grow - if (random->nextInt(static_cast(25 / growthSpeed) + 1) == 0) + if (random->nextInt((int) (25 / growthSpeed) + 1) == 0) { int age = level->getData(x, y, z); if (age < 7) @@ -149,10 +149,10 @@ void StemTile::updateDefaultShape() void StemTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); tls->yy1 = (level->getData(x, y, z) * 2 + 2) / 16.0f; float ss = 0.125f; - setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, static_cast(tls->yy1), 0.5f + ss); + setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, (float) tls->yy1, 0.5f + ss); } int StemTile::getRenderShape() @@ -184,12 +184,12 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float return; } - Item *seed = nullptr; + Item *seed = NULL; if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin; if (fruit == Tile::melon) seed = Item::seeds_melon; - if (seed != nullptr) + if (seed != NULL) { - popResource(level, x, y, z, std::make_shared(seed)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(seed))); } } diff --git a/Minecraft.World/StoneMonsterTile.cpp b/Minecraft.World/StoneMonsterTile.cpp index fd3f1b90..ec31992f 100644 --- a/Minecraft.World/StoneMonsterTile.cpp +++ b/Minecraft.World/StoneMonsterTile.cpp @@ -48,7 +48,7 @@ void StoneMonsterTile::destroy(Level *level, int x, int y, int z, int data) // Also limit the amount of silverfish specifically if(level->countInstanceOf( eTYPE_SILVERFISH, true) < 15 ) { - shared_ptr silverfish = std::make_shared(level); + shared_ptr silverfish = shared_ptr(new Silverfish(level)); silverfish->moveTo(x + .5, y, z + .5, 0, 0); level->addEntity(silverfish); @@ -106,7 +106,7 @@ shared_ptr StoneMonsterTile::getSilkTouchItemInstance(int data) { tile = Tile::stoneBrick; } - return std::make_shared(tile); + return shared_ptr(new ItemInstance(tile)); } int StoneMonsterTile::cloneTileData(Level *level, int x, int y, int z) diff --git a/Minecraft.World/StoneSlabTile.cpp b/Minecraft.World/StoneSlabTile.cpp index 10f1ee71..e4de58da 100644 --- a/Minecraft.World/StoneSlabTile.cpp +++ b/Minecraft.World/StoneSlabTile.cpp @@ -80,5 +80,5 @@ int StoneSlabTile::getAuxName(int auxValue) shared_ptr StoneSlabTile::getSilkTouchItemInstance(int data) { - return std::make_shared(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK); + return shared_ptr(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK)); } diff --git a/Minecraft.World/StringHelpers.cpp b/Minecraft.World/StringHelpers.cpp index b56a85f1..6985c88f 100644 --- a/Minecraft.World/StringHelpers.cpp +++ b/Minecraft.World/StringHelpers.cpp @@ -10,10 +10,10 @@ wstring toLower(const wstring& a) wstring trimString(const wstring& a) { wstring b; - size_t start = a.find_first_not_of(L" \t\n\r"); - size_t end = a.find_last_not_of(L" \t\n\r"); + int start = (int)a.find_first_not_of(L" \t\n\r"); + int end = (int)a.find_last_not_of(L" \t\n\r"); if( start == wstring::npos ) start = 0; - if( end == wstring::npos ) end = a.size() - 1; + if( end == wstring::npos ) end = (int)a.size()-1; b = a.substr(start,(end-start)+1); return b; } @@ -62,7 +62,7 @@ const char *wstringtofilename(const wstring& name) if(c=='/') c='\\'; #endif assert(c<128); // Will we have to do any conversion of non-ASCII characters in filenames? - buf[i] = static_cast(c); + buf[i] = (char)c; } buf[name.length()] = 0; return buf; @@ -76,7 +76,7 @@ const char *wstringtochararray(const wstring& name) { wchar_t c = name[i]; assert(c<128); // Will we have to do any conversion of non-ASCII characters in filenames? - buf[i] = static_cast(c); + buf[i] = (char)c; } buf[name.length()] = 0; return buf; diff --git a/Minecraft.World/StringTag.h b/Minecraft.World/StringTag.h index 36b60368..8eb0eb7f 100644 --- a/Minecraft.World/StringTag.h +++ b/Minecraft.World/StringTag.h @@ -34,7 +34,7 @@ public: { if (Tag::equals(obj)) { - StringTag *o = static_cast(obj); + StringTag *o = (StringTag *) obj; return ((data.empty() && o->data.empty()) || (!data.empty() && data.compare(o->data) == 0)); } return false; diff --git a/Minecraft.World/StrongholdFeature.cpp b/Minecraft.World/StrongholdFeature.cpp index 83f05cf3..fa85dc42 100644 --- a/Minecraft.World/StrongholdFeature.cpp +++ b/Minecraft.World/StrongholdFeature.cpp @@ -39,7 +39,7 @@ void StrongholdFeature::_init() // 4J added initialisers for (int i = 0; i < strongholdPos_length; i++) { - strongholdPos[i] = nullptr; + strongholdPos[i] = NULL; } isSpotSelected = false; } @@ -136,11 +136,11 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) } #endif - int selectedX = static_cast(Math::round(cos(angle) * dist)); - int selectedZ = static_cast(Math::round(sin(angle) * dist)); + int selectedX = (int) (Math::round(cos(angle) * dist)); + int selectedZ = (int) (Math::round(sin(angle) * dist)); TilePos *position = level->getBiomeSource()->findBiome((selectedX << 4) + 8, (selectedZ << 4) + 8, 7 << 4, allowedBiomes, &random); - if (position != nullptr) + if (position != NULL) { selectedX = position->x >> 4; selectedZ = position->z >> 4; @@ -164,7 +164,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) delete strongholdPos[i]; strongholdPos[i] = new ChunkPos(selectedX, selectedZ); - angle += PI * 2.0 / static_cast(strongholdPos_length); + angle += PI * 2.0 / (double) strongholdPos_length; } // 4J Stu - We want to make sure that we have at least one stronghold in this world @@ -172,7 +172,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) // 4J Stu - Randomise the angles for retries as well #ifdef _LARGE_WORLDS - angle = random.nextDouble() * PI * 2.0 * circle / static_cast(spread); + angle = random.nextDouble() * PI * 2.0 * circle / (double) spread; #endif } while(!hasFoundValidPos && findAttempts < MAX_STRONGHOLD_ATTEMPTS); @@ -191,7 +191,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) { bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Stronghold); } @@ -211,7 +211,7 @@ vector *StrongholdFeature::getGuesstimatedFeaturePositions() for( int i = 0; i < strongholdPos_length; i++ ) { ChunkPos *chunkPos = strongholdPos[i]; - if (chunkPos != nullptr) + if (chunkPos != NULL) { positions->push_back(chunkPos->getMiddleBlockPosition(64)); } @@ -225,7 +225,7 @@ StructureStart *StrongholdFeature::createStructureStart(int x, int z) StrongholdStart *start = new StrongholdStart(level, random, x, z); // 4J - front() was get(0) - while (start->getPieces()->empty() || static_cast(start->getPieces()->front())->portalRoomPiece == nullptr) + while (start->getPieces()->empty() || ((StrongholdPieces::StartPiece *) start->getPieces()->front())->portalRoomPiece == NULL) { delete start; // regenerate stronghold without changing seed @@ -254,7 +254,7 @@ StrongholdFeature::StrongholdStart::StrongholdStart(Level *level, Random *random vector *pendingChildren = &startRoom->pendingChildren; while (!pendingChildren->empty()) { - int pos = random->nextInt(static_cast(pendingChildren->size())); + int pos = random->nextInt((int)pendingChildren->size()); auto it = pendingChildren->begin() + pos; StructurePiece *structurePiece = *it; pendingChildren->erase(it); diff --git a/Minecraft.World/StrongholdPieces.cpp b/Minecraft.World/StrongholdPieces.cpp index d98d9488..383be42c 100644 --- a/Minecraft.World/StrongholdPieces.cpp +++ b/Minecraft.World/StrongholdPieces.cpp @@ -90,7 +90,7 @@ bool StrongholdPieces::updatePieceWeight() StrongholdPieces::StrongholdPiece *StrongholdPieces::findAndCreatePieceFactory(EPieceClass pieceClass, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { - StrongholdPiece *strongholdPiece = nullptr; + StrongholdPiece *strongholdPiece = NULL; if (pieceClass == EPieceClass_Straight) { @@ -145,7 +145,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( { if (!updatePieceWeight()) { - return nullptr; + return NULL; } if (imposedPiece != EPieceClass_NULL) @@ -153,7 +153,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( StrongholdPiece *strongholdPiece = findAndCreatePieceFactory(imposedPiece, pieces, random, footX, footY, footZ, direction, depth); imposedPiece = EPieceClass_NULL; - if (strongholdPiece != nullptr) + if (strongholdPiece != NULL) { return strongholdPiece; } @@ -176,7 +176,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( } StrongholdPiece *strongholdPiece = findAndCreatePieceFactory(piece->pieceClass, pieces, random, footX, footY, footZ, direction, depth); - if (strongholdPiece != nullptr) + if (strongholdPiece != NULL) { piece->placeCount++; startPiece->previousPiece = piece; @@ -192,21 +192,21 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( } { BoundingBox *box = FillerCorridor::findPieceBox(pieces, random, footX, footY, footZ, direction); - if (box != nullptr && box->y0 > 1) + if (box != NULL && box->y0 > 1) { return new FillerCorridor(depth, random, box, direction); } - if(box != nullptr) delete box; + if(box != NULL) delete box; } - return nullptr; + return NULL; } StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return nullptr; + return NULL; } if (abs(footX - startPiece->getBoundingBox()->x0) > 3 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 3 * 16) { @@ -221,7 +221,7 @@ StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, li printf("Portal room forcing attempt\n"); #endif StrongholdPiece *strongholdPiece = PortalRoom::createPiece(pieces, random, footX, footY, footZ, direction, depth); - if (strongholdPiece != nullptr) + if (strongholdPiece != NULL) { piece->placeCount++; startPiece->previousPiece = piece; @@ -237,11 +237,11 @@ StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, li } } } - return nullptr; + return NULL; } StructurePiece *newPiece = generatePieceFromSmallDoor(startPiece, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != nullptr) + if (newPiece != NULL) { pieces->push_back(newPiece); startPiece->pendingChildren.push_back(newPiece); @@ -268,7 +268,7 @@ void StrongholdPieces::StrongholdPiece::addAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::StrongholdPiece::readAdditonalSaveData(CompoundTag *tag) { - entryDoor = static_cast(_fromString(tag->getString(L"EntryDoor"))); + entryDoor = (SmallDoorType)_fromString(tag->getString(L"EntryDoor")); } void StrongholdPieces::StrongholdPiece::generateSmallDoor(Level *level, Random *random, BoundingBox *chunkBB, StrongholdPieces::StrongholdPiece::SmallDoorType doorType, int footX, int footY, int footZ) @@ -349,7 +349,7 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildForward case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + yOff, boundingBox->z0 + xOff, orientation, getGenDepth()); } - return nullptr; + return NULL; } StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -365,7 +365,7 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildLeft(St case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); } - return nullptr; + return NULL; } StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -381,20 +381,20 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildRight(S case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); } - return nullptr; + return NULL; } bool StrongholdPieces::StrongholdPiece::isOkBox(BoundingBox *box, StartPiece *startRoom) { - //return box != nullptr && box->y0 > LOWEST_Y_POSITION; + //return box != NULL && box->y0 > LOWEST_Y_POSITION; bool bIsOk = false; - if(box != nullptr) + if(box != NULL) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; - if( startRoom != nullptr && startRoom->m_level->getOriginalSaveVersion() >= SAVE_FILE_VERSION_MOVED_STRONGHOLD ) + if( startRoom != NULL && startRoom->m_level->getOriginalSaveVersion() >= SAVE_FILE_VERSION_MOVED_STRONGHOLD ) { int xzSize = startRoom->m_level->getLevelData()->getXZSize(); int blockMin = -( (xzSize << 4) / 2) + 1; @@ -442,12 +442,12 @@ BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(listgetBoundingBox()->y0 == box->y0) @@ -468,7 +468,7 @@ BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(list(startPiece), pieces, random, 1, 1); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); } StrongholdPieces::StairsDown *StrongholdPieces::StairsDown::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 4 - height, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new StairsDown(genDepth, random, box, direction); @@ -618,15 +618,15 @@ StrongholdPieces::StartPiece::StartPiece(int genDepth, Random *random, int west, { // 4J added initialisers isLibraryAdded = false; - previousPiece = nullptr; - portalRoomPiece = nullptr; + previousPiece = NULL; + portalRoomPiece = NULL; m_level = level; } TilePos *StrongholdPieces::StartPiece::getLocatorPosition() { - if( portalRoomPiece != nullptr ) + if( portalRoomPiece != NULL ) { return portalRoomPiece->getLocatorPosition(); } @@ -663,22 +663,22 @@ void StrongholdPieces::Straight::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::Straight::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); - if (leftChild) generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, 1, 2); - if (rightChild) generateSmallDoorChildRight(static_cast(startPiece), pieces, random, 1, 2); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); + if (leftChild) generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, 1, 2); + if (rightChild) generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, 1, 2); } StrongholdPieces::Straight *StrongholdPieces::Straight::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new Straight(genDepth, random, box, direction); @@ -765,20 +765,20 @@ void StrongholdPieces::ChestCorridor::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::ChestCorridor::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); } StrongholdPieces::ChestCorridor *StrongholdPieces::ChestCorridor::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new ChestCorridor(genDepth, random, box, direction); @@ -837,20 +837,20 @@ StrongholdPieces::StraightStairsDown::StraightStairsDown(int genDepth, Random *r void StrongholdPieces::StraightStairsDown::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); } StrongholdPieces::StraightStairsDown *StrongholdPieces::StraightStairsDown::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 4 - height, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new StraightStairsDown(genDepth, random, box, direction); @@ -904,11 +904,11 @@ void StrongholdPieces::LeftTurn::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 1, 1); + generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, 1, 1); } else { - generateSmallDoorChildRight(static_cast(startPiece), pieces, random, 1, 1); + generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, 1, 1); } } @@ -916,13 +916,13 @@ StrongholdPieces::LeftTurn *StrongholdPieces::LeftTurn::createPiece(list(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new LeftTurn(genDepth, random, box, direction); @@ -965,11 +965,11 @@ void StrongholdPieces::RightTurn::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 1, 1); + generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, 1, 1); } else { - generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, 1, 1); + generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, 1, 1); } } @@ -1023,22 +1023,22 @@ void StrongholdPieces::RoomCrossing::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 4, 1); - generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, 1, 4); - generateSmallDoorChildRight(static_cast(startPiece), pieces, random, 1, 4); + generateSmallDoorChildForward((StartPiece*) startPiece, pieces, random, 4, 1); + generateSmallDoorChildLeft((StartPiece*) startPiece, pieces, random, 1, 4); + generateSmallDoorChildRight((StartPiece*) startPiece, pieces, random, 1, 4); } StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new RoomCrossing(genDepth, random, box, direction); @@ -1177,20 +1177,20 @@ StrongholdPieces::PrisonHall::PrisonHall(int genDepth, Random *random, BoundingB void StrongholdPieces::PrisonHall::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); } StrongholdPieces::PrisonHall *StrongholdPieces::PrisonHall::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new PrisonHall(genDepth, random, box, direction); @@ -1263,19 +1263,19 @@ StrongholdPieces::Library *StrongholdPieces::Library::createPiece(list(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; // make a short library box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } } @@ -1465,24 +1465,24 @@ void StrongholdPieces::FiveCrossing::addChildren(StructurePiece *startPiece, lis zOffB = depth - 3 - zOffB; } - generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 5, 1); - if (leftLow) generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, zOffA, 1); - if (leftHigh) generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, zOffB, 7); - if (rightLow) generateSmallDoorChildRight(static_cast(startPiece), pieces, random, zOffA, 1); - if (rightHigh) generateSmallDoorChildRight(static_cast(startPiece), pieces, random, zOffB, 7); + generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 5, 1); + if (leftLow) generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, zOffA, 1); + if (leftHigh) generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, zOffB, 7); + if (rightLow) generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, zOffA, 1); + if (rightHigh) generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, zOffB, 7); } StrongholdPieces::FiveCrossing *StrongholdPieces::FiveCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -3, 0, width, height, depth, direction); - StartPiece *startPiece = nullptr; - if(pieces != nullptr) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new FiveCrossing(genDepth, random, box, direction); @@ -1561,9 +1561,9 @@ void StrongholdPieces::PortalRoom::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::PortalRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - if (startPiece != nullptr) + if (startPiece != NULL) { - static_cast(startPiece)->portalRoomPiece = this; + ((StartPiece *) startPiece)->portalRoomPiece = this; } } @@ -1572,13 +1572,13 @@ StrongholdPieces::PortalRoom *StrongholdPieces::PortalRoom::createPiece(list(pieces->front()); + StartPiece *startPiece = NULL; + if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new PortalRoom(genDepth, random, box, direction); @@ -1688,7 +1688,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (entity != nullptr) entity->getSpawner()->setEntityId(L"Silverfish"); + if (entity != NULL) entity->getSpawner()->setEntityId(L"Silverfish"); } } diff --git a/Minecraft.World/StructureFeature.cpp b/Minecraft.World/StructureFeature.cpp index 8de619ca..bbce7e1a 100644 --- a/Minecraft.World/StructureFeature.cpp +++ b/Minecraft.World/StructureFeature.cpp @@ -109,7 +109,7 @@ bool StructureFeature::isIntersection(int cellX, int cellZ) bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) { restoreSavedData(level); - return getStructureAt(cellX, cellY, cellZ) != nullptr; + return getStructureAt(cellX, cellY, cellZ) != NULL; } StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ) @@ -142,7 +142,7 @@ StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ } } } - return nullptr; + return NULL; } bool StructureFeature::isInsideBoundingFeature(int cellX, int cellY, int cellZ) @@ -178,7 +178,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i addFeature(level, cellX >> 4, cellZ >> 4, 0, 0, byteArray()); double minDistance = DBL_MAX; - TilePos *selected = nullptr; + TilePos *selected = NULL; for(auto& it : cachedStructures) { @@ -203,14 +203,14 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i } } } - if (selected != nullptr) + if (selected != NULL) { return selected; } else { vector *guesstimatedFeaturePositions = getGuesstimatedFeaturePositions(); - if (guesstimatedFeaturePositions != nullptr) + if (guesstimatedFeaturePositions != NULL) { TilePos *pSelectedPos = new TilePos(0,0,0); @@ -233,22 +233,22 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i return pSelectedPos; } } - return nullptr; + return NULL; } vector *StructureFeature::getGuesstimatedFeaturePositions() { - return nullptr; + return NULL; } void StructureFeature::restoreSavedData(Level *level) { #ifdef ENABLE_STRUCTURE_SAVING - if (savedData == nullptr) + if (savedData == NULL) { savedData = dynamic_pointer_cast( level->getSavedData(typeid(StructureFeatureSavedData), getFeatureName()) ); - if (savedData == nullptr) + if (savedData == NULL) { savedData = shared_ptr( new StructureFeatureSavedData(getFeatureName()) ); level->setSavedData(getFeatureName(), savedData); diff --git a/Minecraft.World/StructureFeatureIO.cpp b/Minecraft.World/StructureFeatureIO.cpp index 784d14c9..3e73b028 100644 --- a/Minecraft.World/StructureFeatureIO.cpp +++ b/Minecraft.World/StructureFeatureIO.cpp @@ -63,7 +63,7 @@ wstring StructureFeatureIO::getEncodeId(StructurePiece *piece) StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *level) { - StructureStart *start = nullptr; + StructureStart *start = NULL; auto it = startIdClassMap.find(tag->getString(L"id")); if(it != startIdClassMap.end()) @@ -71,7 +71,7 @@ StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *lev start = (it->second)(); } - if (start != nullptr) + if (start != NULL) { start->load(level, tag); } @@ -84,7 +84,7 @@ StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *lev StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *level) { - StructurePiece *piece = nullptr; + StructurePiece *piece = NULL; auto it = pieceIdClassMap.find(tag->getString(L"id")); if(it != pieceIdClassMap.end()) @@ -92,7 +92,7 @@ StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *lev piece = (it->second)(); } - if (piece != nullptr) + if (piece != NULL) { piece->load(level, tag); } diff --git a/Minecraft.World/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index bb3887c0..85a19ab4 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -44,7 +44,7 @@ StructurePiece::StructurePiece() { - boundingBox = nullptr; + boundingBox = NULL; orientation = 0; genDepth = 0; // for reflection @@ -52,14 +52,14 @@ StructurePiece::StructurePiece() StructurePiece::StructurePiece( int genDepth ) { - boundingBox = nullptr; + boundingBox = NULL; this->genDepth = genDepth; orientation = Direction::UNDEFINED; } StructurePiece::~StructurePiece() { - if(boundingBox != nullptr) delete boundingBox; + if(boundingBox != NULL) delete boundingBox; } CompoundTag *StructurePiece::createTag() @@ -120,7 +120,7 @@ StructurePiece* StructurePiece::findCollisionPiece( list< StructurePiece* > *pie return piece; } } - return nullptr; + return NULL; } // 4J-PB - Added from 1.2.3 @@ -437,7 +437,7 @@ int StructurePiece::getOrientationData( int tile, int data ) } } } - else if (tile == Tile::tripWireSource_Id || (Tile::tiles[tile] != nullptr && dynamic_cast(Tile::tiles[tile]))) + else if (tile == Tile::tripWireSource_Id || (Tile::tiles[tile] != NULL && dynamic_cast(Tile::tiles[tile]))) { if (orientation == Direction::SOUTH) { @@ -730,15 +730,15 @@ void StructurePiece::maybeGenerateBlock( Level* level, BoundingBox* chunkBB, Ran void StructurePiece::generateUpperHalfSphere( Level* level, BoundingBox* chunkBB, int x0, int y0, int z0, int x1, int y1, int z1, int fillTile, bool skipAir ) { - float diagX = static_cast(x1 - x0 + 1); - float diagY = static_cast(y1 - y0 + 1); - float diagZ = static_cast(z1 - z0 + 1); + float diagX = (float)( x1 - x0 + 1 ); + float diagY = (float)( y1 - y0 + 1 ); + float diagZ = (float)( z1 - z0 + 1 ); float cx = x0 + diagX / 2; float cz = z0 + diagZ / 2; for ( int y = y0; y <= y1; y++ ) { - float normalizedYDistance = static_cast(y - y0) / diagY; + float normalizedYDistance = ( float )( y - y0 ) / diagY; for ( int x = x0; x <= x1; x++ ) { @@ -816,7 +816,7 @@ bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* ra { level->setTileAndData( worldX, worldY, worldZ, Tile::chest->id, 0, Tile::UPDATE_CLIENTS ); shared_ptr chest = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); - if ( chest != nullptr ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); + if ( chest != NULL ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); return true; } } @@ -835,7 +835,7 @@ bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random { level->setTileAndData(worldX, worldY, worldZ, Tile::dispenser_Id, getOrientationData(Tile::dispenser_Id, facing), Tile::UPDATE_CLIENTS); shared_ptr dispenser = dynamic_pointer_cast(level->getTileEntity(worldX, worldY, worldZ)); - if (dispenser != nullptr) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); + if (dispenser != NULL) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); return true; } } diff --git a/Minecraft.World/StructureRecipies.cpp b/Minecraft.World/StructureRecipies.cpp index 1706a7ce..c3e62863 100644 --- a/Minecraft.World/StructureRecipies.cpp +++ b/Minecraft.World/StructureRecipies.cpp @@ -66,7 +66,7 @@ void StructureRecipies::addRecipes(Recipes *r) L'#', Tile::cobblestone, L'S'); - r->addShapedRecipy(new ItemInstance(static_cast(Tile::chest)), // + r->addShapedRecipy(new ItemInstance((Tile*)Tile::chest), // L"sssctg", L"###", // L"# #", // diff --git a/Minecraft.World/StructureStart.cpp b/Minecraft.World/StructureStart.cpp index 0065160e..3f22b4a7 100644 --- a/Minecraft.World/StructureStart.cpp +++ b/Minecraft.World/StructureStart.cpp @@ -9,14 +9,14 @@ StructureStart::StructureStart() { chunkX = chunkZ = 0; - boundingBox = nullptr; // 4J added initialiser + boundingBox = NULL; // 4J added initialiser } StructureStart::StructureStart(int x, int z) { this->chunkX = x; this->chunkZ = z; - boundingBox = nullptr; + boundingBox = NULL; } StructureStart::~StructureStart() diff --git a/Minecraft.World/SwampTreeFeature.cpp b/Minecraft.World/SwampTreeFeature.cpp index 5b94767a..19d3f66a 100644 --- a/Minecraft.World/SwampTreeFeature.cpp +++ b/Minecraft.World/SwampTreeFeature.cpp @@ -14,7 +14,7 @@ bool SwampTreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::genDepth) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 3, y - 1, z - 3, x + 3, y + treeHeight, z + 3); diff --git a/Minecraft.World/SwellGoal.cpp b/Minecraft.World/SwellGoal.cpp index 0fd3c34a..040d09c2 100644 --- a/Minecraft.World/SwellGoal.cpp +++ b/Minecraft.World/SwellGoal.cpp @@ -16,7 +16,7 @@ SwellGoal::SwellGoal(Creeper *creeper) bool SwellGoal::canUse() { shared_ptr target = creeper->getTarget(); - return creeper->getSwellDir() > 0 || (target != nullptr && (creeper->distanceToSqr(target) < 3 * 3)); + return creeper->getSwellDir() > 0 || (target != NULL && (creeper->distanceToSqr(target) < 3 * 3)); } void SwellGoal::start() @@ -32,7 +32,7 @@ void SwellGoal::stop() void SwellGoal::tick() { - if (target.lock() == nullptr) + if (target.lock() == NULL) { creeper->setSwellDir(-1); return; diff --git a/Minecraft.World/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index 69d419b0..655fa0c3 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -19,7 +19,7 @@ void SynchedEntityData::define(int id, int value) MemSect(17); checkId(id); int type = TYPE_INT; - shared_ptr dataItem = std::make_shared(type, id, value); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -30,7 +30,7 @@ void SynchedEntityData::define(int id, byte value) MemSect(17); checkId(id); int type = TYPE_BYTE; - shared_ptr dataItem = std::make_shared(type, id, value); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -41,7 +41,7 @@ void SynchedEntityData::define(int id, short value) MemSect(17); checkId(id); int type = TYPE_SHORT; - shared_ptr dataItem = std::make_shared(type, id, value); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -52,7 +52,7 @@ void SynchedEntityData::define(int id, float value) MemSect(17); checkId(id); int type = TYPE_FLOAT; - shared_ptr dataItem = std::make_shared(type, id, value); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -63,7 +63,7 @@ void SynchedEntityData::define(int id, const wstring& value) MemSect(17); checkId(id); int type = TYPE_STRING; - shared_ptr dataItem = std::make_shared(type, id, value); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, value) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -74,7 +74,7 @@ void SynchedEntityData::defineNULL(int id, void *pVal) MemSect(17); checkId(id); int type = TYPE_ITEMINSTANCE; - shared_ptr dataItem = std::make_shared(type, id, shared_ptr()); + shared_ptr dataItem = shared_ptr( new DataItem(type, id, shared_ptr()) ); itemsById[id] = dataItem; MemSect(0); m_isEmpty = false; @@ -128,7 +128,7 @@ shared_ptr SynchedEntityData::getItemInstance(int id) Pos *SynchedEntityData::getPos(int id) { assert(false); // 4J - not currently implemented - return nullptr; + return NULL; } void SynchedEntityData::set(int id, int value) @@ -238,18 +238,18 @@ void SynchedEntityData::pack(vector > *items, DataOutputStr vector > *SynchedEntityData::packDirty() { - vector > *result = nullptr; + vector > *result = NULL; if (m_isDirty) { for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if ((dataItem != nullptr) && dataItem->isDirty()) + if ((dataItem != NULL) && dataItem->isDirty()) { dataItem->setDirty(false); - if (result == nullptr) + if (result == NULL) { result = new vector >(); } @@ -267,7 +267,7 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != nullptr) + if(dataItem != NULL) { writeDataItem(output, dataItem); } @@ -279,14 +279,14 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException vector > *SynchedEntityData::getAll() { - vector > *result = nullptr; + vector > *result = NULL; for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != nullptr) + if(dataItem != NULL) { - if (result == nullptr) + if (result == NULL) { result = new vector >(); } @@ -338,14 +338,14 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException { - vector > *result = nullptr; + vector > *result = NULL; int currentHeader = input->readByte(); while (currentHeader != EOF_MARKER) { - if (result == nullptr) + if (result == NULL) { result = new vector >(); } @@ -360,40 +360,40 @@ vector > *SynchedEntityData::unpack(Data case TYPE_BYTE: { byte dataRead = input->readByte(); - item = std::make_shared(itemType, itemId, dataRead); + item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_SHORT: { short dataRead = input->readShort(); - item = std::make_shared(itemType, itemId, dataRead); + item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_INT: { int dataRead = input->readInt(); - item = std::make_shared(itemType, itemId, dataRead); + item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_FLOAT: { float dataRead = input->readFloat(); - item = std::make_shared(itemType, itemId, dataRead); + item = shared_ptr( new DataItem(itemType, itemId, dataRead) ); } break; case TYPE_STRING: - item = std::make_shared(itemType, itemId, Packet::readUtf(input, MAX_STRING_DATA_LENGTH)); + item = shared_ptr( new DataItem(itemType, itemId, Packet::readUtf(input, MAX_STRING_DATA_LENGTH)) ); break; case TYPE_ITEMINSTANCE: { - item = std::make_shared(itemType, itemId, Packet::readItem(input)); + item = shared_ptr(new DataItem(itemType, itemId, Packet::readItem(input))); } break; default: app.DebugPrintf(" ------ garbage data, or early end of stream due to an incomplete packet\n"); delete result; - return nullptr; + return NULL; break; } result->push_back(item); @@ -415,7 +415,7 @@ void SynchedEntityData::assignValues(vector > *items) for (auto& item : *items) { shared_ptr itemFromId = itemsById[item->getId()]; - if( itemFromId != nullptr ) + if( itemFromId != NULL ) { switch(item->getType()) { @@ -465,7 +465,7 @@ int SynchedEntityData::getSizeInBytes() for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != nullptr) + if(dataItem != NULL) { size += 1; @@ -485,7 +485,7 @@ int SynchedEntityData::getSizeInBytes() size += 4; break; case TYPE_STRING: - size += static_cast(dataItem->getValue_wstring().length()) + 2; // Estimate, assuming all ascii chars + size += (int)dataItem->getValue_wstring().length() + 2; // Estimate, assuming all ascii chars break; case TYPE_ITEMINSTANCE: // short + byte + short diff --git a/Minecraft.World/Tag.cpp b/Minecraft.World/Tag.cpp index b594bb0e..aa988e02 100644 --- a/Minecraft.World/Tag.cpp +++ b/Minecraft.World/Tag.cpp @@ -27,7 +27,7 @@ Tag::Tag(const wstring &name) // 4J - Was Object obj bool Tag::equals(Tag *obj) { - if (obj == nullptr )// || !(obj instanceof Tag)) + if (obj == NULL )// || !(obj instanceof Tag)) { return false; } @@ -150,7 +150,7 @@ Tag *Tag::newTag(byte type, const wstring &name) case TAG_Compound: return new CompoundTag(name); } - return nullptr; + return NULL; } const wchar_t *Tag::getTagName(byte type) diff --git a/Minecraft.World/TakeFlowerGoal.cpp b/Minecraft.World/TakeFlowerGoal.cpp index 71e7c7c6..48db34d3 100644 --- a/Minecraft.World/TakeFlowerGoal.cpp +++ b/Minecraft.World/TakeFlowerGoal.cpp @@ -53,12 +53,12 @@ bool TakeFlowerGoal::canUse() bool TakeFlowerGoal::canContinueToUse() { - return golem.lock() != nullptr && golem.lock()->getOfferFlowerTick() > 0; + return golem.lock() != NULL && golem.lock()->getOfferFlowerTick() > 0; } void TakeFlowerGoal::start() { - pickupTick = villager->getRandom()->nextInt(static_cast(OfferFlowerGoal::OFFER_TICKS * 0.8)); + pickupTick = villager->getRandom()->nextInt((int) (OfferFlowerGoal::OFFER_TICKS * 0.8)); takeFlower = false; golem.lock()->getNavigation()->stop(); } diff --git a/Minecraft.World/TakeItemEntityPacket.h b/Minecraft.World/TakeItemEntityPacket.h index 7acbfdc4..7c4b45fe 100644 --- a/Minecraft.World/TakeItemEntityPacket.h +++ b/Minecraft.World/TakeItemEntityPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TakeItemEntityPacket()); } virtual int getId() { return 22; } }; \ No newline at end of file diff --git a/Minecraft.World/TallGrass.cpp b/Minecraft.World/TallGrass.cpp index 337e343d..1a89d3ed 100644 --- a/Minecraft.World/TallGrass.cpp +++ b/Minecraft.World/TallGrass.cpp @@ -81,7 +81,7 @@ int TallGrass::getResourceCountForLootBonus(int bonusLevel, Random *random) void TallGrass::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), @@ -89,7 +89,7 @@ void TallGrass::playerDestroy(Level *level, shared_ptr player, int x, in ); // drop leaf block instead of sapling - popResource(level, x, y, z, std::make_shared(Tile::tallgrass, 1, data)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::tallgrass, 1, data))); } else { diff --git a/Minecraft.World/TamableAnimal.cpp b/Minecraft.World/TamableAnimal.cpp index 1fb41df3..2a3ea037 100644 --- a/Minecraft.World/TamableAnimal.cpp +++ b/Minecraft.World/TamableAnimal.cpp @@ -13,13 +13,13 @@ TamableAnimal::TamableAnimal(Level *level) : Animal(level) TamableAnimal::~TamableAnimal() { - if(sitGoal != nullptr) delete sitGoal; + if(sitGoal != NULL) delete sitGoal; } void TamableAnimal::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, (byte) 0); entityData->define(DATA_OWNERUUID_ID, L""); } @@ -113,11 +113,11 @@ void TamableAnimal::setTame(bool value) byte current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x04)); + entityData->set(DATA_FLAGS_ID, (byte) (current | 0x04)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x04)); + entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x04)); } } @@ -131,11 +131,11 @@ void TamableAnimal::setSitting(bool value) byte current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); + entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); + entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); } } @@ -169,7 +169,7 @@ Team *TamableAnimal::getTeam() if (isTame()) { shared_ptr owner = dynamic_pointer_cast(getOwner()); - if (owner != nullptr) + if (owner != NULL) { return owner->getTeam(); } @@ -186,7 +186,7 @@ bool TamableAnimal::isAlliedTo(shared_ptr other) { return true; } - if (owner != nullptr) + if (owner != NULL) { return owner->isAlliedTo(other); } diff --git a/Minecraft.World/TargetGoal.cpp b/Minecraft.World/TargetGoal.cpp index 0c2b9363..982acb5e 100644 --- a/Minecraft.World/TargetGoal.cpp +++ b/Minecraft.World/TargetGoal.cpp @@ -34,7 +34,7 @@ TargetGoal::TargetGoal(PathfinderMob *mob, bool mustSee, bool mustReach) bool TargetGoal::canContinueToUse() { shared_ptr target = mob->getTarget(); - if (target == nullptr) return false; + if (target == NULL) return false; if (!target->isAlive()) return false; double within = getFollowDistance(); @@ -56,7 +56,7 @@ bool TargetGoal::canContinueToUse() double TargetGoal::getFollowDistance() { AttributeInstance *followRange = mob->getAttribute(SharedMonsterAttributes::FOLLOW_RANGE); - return followRange == nullptr ? 16 : followRange->getValue(); + return followRange == NULL ? 16 : followRange->getValue(); } void TargetGoal::start() @@ -73,16 +73,16 @@ void TargetGoal::stop() bool TargetGoal::canAttack(shared_ptr target, bool allowInvulnerable) { - if (target == nullptr) return false; + if (target == NULL) return false; if (target == mob->shared_from_this()) return false; if (!target->isAlive()) return false; if (!mob->canAttackType(target->GetType())) return false; OwnableEntity *ownableMob = dynamic_cast(mob); - if (ownableMob != nullptr && !ownableMob->getOwnerUUID().empty()) + if (ownableMob != NULL && !ownableMob->getOwnerUUID().empty()) { shared_ptr ownableTarget = dynamic_pointer_cast(target); - if (ownableTarget != nullptr && ownableMob->getOwnerUUID().compare(ownableTarget->getOwnerUUID()) == 0) + if (ownableTarget != NULL && ownableMob->getOwnerUUID().compare(ownableTarget->getOwnerUUID()) == 0) { // We're attacking something owned by the same person... return false; @@ -117,9 +117,9 @@ bool TargetGoal::canReach(shared_ptr target) { reachCacheTime = 10 + mob->getRandom()->nextInt(5); Path *path = mob->getNavigation()->createPath(target); - if (path == nullptr) return false; + if (path == NULL) return false; Node *last = path->last(); - if (last == nullptr) + if (last == NULL) { delete path; return false; diff --git a/Minecraft.World/Team.cpp b/Minecraft.World/Team.cpp index 7c3bde0c..f3f6e04e 100644 --- a/Minecraft.World/Team.cpp +++ b/Minecraft.World/Team.cpp @@ -4,7 +4,7 @@ bool Team::isAlliedTo(Team *other) { - if (other == nullptr) + if (other == NULL) { return false; } diff --git a/Minecraft.World/TeleportEntityPacket.cpp b/Minecraft.World/TeleportEntityPacket.cpp index ccac5e51..d31f5bc2 100644 --- a/Minecraft.World/TeleportEntityPacket.cpp +++ b/Minecraft.World/TeleportEntityPacket.cpp @@ -23,8 +23,8 @@ TeleportEntityPacket::TeleportEntityPacket(shared_ptr e) x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - yRot = static_cast(e->yRot * 256 / 360); - xRot = static_cast(e->xRot * 256 / 360); + yRot = (byte) (e->yRot * 256 / 360); + xRot = (byte) (e->xRot * 256 / 360); } TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, byte yRot, byte xRot) diff --git a/Minecraft.World/TeleportEntityPacket.h b/Minecraft.World/TeleportEntityPacket.h index 38e09286..6fc28732 100644 --- a/Minecraft.World/TeleportEntityPacket.h +++ b/Minecraft.World/TeleportEntityPacket.h @@ -22,6 +22,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TeleportEntityPacket()); } virtual int getId() { return 34; } }; \ No newline at end of file diff --git a/Minecraft.World/TemptGoal.cpp b/Minecraft.World/TemptGoal.cpp index 40b3201c..aebab8fa 100644 --- a/Minecraft.World/TemptGoal.cpp +++ b/Minecraft.World/TemptGoal.cpp @@ -29,10 +29,10 @@ bool TemptGoal::canUse() return false; } player = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), 10)); - if (player.lock() == nullptr) return false; + if (player.lock() == NULL) return false; mob->setDespawnProtected(); // If we've got a nearby player, then consider this mob as something we'd miss if it despawned shared_ptr item = player.lock()->getSelectedItem(); - if (item == nullptr) return false; + if (item == NULL) return false; if (item->id != itemId) return false; return true; } @@ -41,7 +41,7 @@ bool TemptGoal::canContinueToUse() { if (canScare) { - if(player.lock() == nullptr) return false; + if(player.lock() == NULL) return false; if (mob->distanceToSqr(player.lock()) < 6 * 6) { if (player.lock()->distanceToSqr(px, py, pz) > 0.1 * 0.1) return false; diff --git a/Minecraft.World/TextureAndGeometryChangePacket.cpp b/Minecraft.World/TextureAndGeometryChangePacket.cpp index ec84031f..04c88bed 100644 --- a/Minecraft.World/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/TextureAndGeometryChangePacket.cpp @@ -49,5 +49,5 @@ void TextureAndGeometryChangePacket::handle(PacketListener *listener) int TextureAndGeometryChangePacket::getEstimatedSize() { - return 8 + static_cast(path.size()); + return 8 + (int)path.size(); } diff --git a/Minecraft.World/TextureAndGeometryChangePacket.h b/Minecraft.World/TextureAndGeometryChangePacket.h index 812222fc..dabe78fa 100644 --- a/Minecraft.World/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/TextureAndGeometryChangePacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TextureAndGeometryChangePacket()); } virtual int getId() { return 161; } }; \ No newline at end of file diff --git a/Minecraft.World/TextureAndGeometryPacket.cpp b/Minecraft.World/TextureAndGeometryPacket.cpp index bf5eccdb..d28fc862 100644 --- a/Minecraft.World/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/TextureAndGeometryPacket.cpp @@ -10,21 +10,21 @@ TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = L""; this->dwTextureBytes = 0; - this->pbData = nullptr; + this->pbData = NULL; this->dwBoxC = 0; - this->BoxDataA = nullptr; + this->BoxDataA = NULL; uiAnimOverrideBitmask=0; } TextureAndGeometryPacket::~TextureAndGeometryPacket() { // can't free these - they're used elsewhere -// if(this->BoxDataA!=nullptr) +// if(this->BoxDataA!=NULL) // { // delete [] this->BoxDataA; // } // -// if(this->pbData!=nullptr) +// if(this->pbData!=NULL) // { // delete [] this->pbData; // } @@ -43,7 +43,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P this->pbData = pbData; this->dwTextureBytes = dwBytes; this->dwBoxC = 0; - this->BoxDataA=nullptr; + this->BoxDataA=NULL; this->uiAnimOverrideBitmask=0; } @@ -75,7 +75,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P } else { - this->BoxDataA=nullptr; + this->BoxDataA=NULL; } } @@ -93,14 +93,14 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P this->pbData = pbData; this->dwTextureBytes = dwBytes; this->uiAnimOverrideBitmask = uiAnimOverrideBitmask; - if(pvSkinBoxes==nullptr) + if(pvSkinBoxes==NULL) { this->dwBoxC=0; - this->BoxDataA=nullptr; + this->BoxDataA=NULL; } else { - this->dwBoxC = static_cast(pvSkinBoxes->size()); + this->dwBoxC = (DWORD)pvSkinBoxes->size(); this->BoxDataA= new SKIN_BOX [this->dwBoxC]; int iCount=0; @@ -120,8 +120,8 @@ void TextureAndGeometryPacket::handle(PacketListener *listener) void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwSkinID = static_cast(dis->readInt()); - dwTextureBytes = static_cast(dis->readShort()); + dwSkinID = (DWORD)dis->readInt(); + dwTextureBytes = (DWORD)dis->readShort(); if(dwTextureBytes>0) { @@ -134,7 +134,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException } uiAnimOverrideBitmask = dis->readInt(); - dwBoxC = static_cast(dis->readShort()); + dwBoxC = (DWORD)dis->readShort(); if(dwBoxC>0) { @@ -143,7 +143,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException for(DWORD i=0;iBoxDataA[i].ePart = static_cast(dis->readShort()); + this->BoxDataA[i].ePart = (eBodyPart) dis->readShort(); this->BoxDataA[i].fX = dis->readFloat(); this->BoxDataA[i].fY = dis->readFloat(); this->BoxDataA[i].fZ = dis->readFloat(); @@ -159,17 +159,17 @@ void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); dos->writeInt(dwSkinID); - dos->writeShort(static_cast(dwTextureBytes)); + dos->writeShort((short)dwTextureBytes); for(DWORD i=0;iwriteByte(this->pbData[i]); } dos->writeInt(uiAnimOverrideBitmask); - dos->writeShort(static_cast(dwBoxC)); + dos->writeShort((short)dwBoxC); for(DWORD i=0;iwriteShort(static_cast(this->BoxDataA[i].ePart)); + dos->writeShort((short)this->BoxDataA[i].ePart); dos->writeFloat(this->BoxDataA[i].fX); dos->writeFloat(this->BoxDataA[i].fY); dos->writeFloat(this->BoxDataA[i].fZ); diff --git a/Minecraft.World/TextureChangePacket.cpp b/Minecraft.World/TextureChangePacket.cpp index cea04d25..2368136c 100644 --- a/Minecraft.World/TextureChangePacket.cpp +++ b/Minecraft.World/TextureChangePacket.cpp @@ -24,7 +24,7 @@ TextureChangePacket::TextureChangePacket(shared_ptr e, ETextureChangeTyp void TextureChangePacket::read(DataInputStream *dis) //throws IOException { id = dis->readInt(); - action = static_cast(dis->readByte()); + action = (ETextureChangeType)dis->readByte(); path = dis->readUTF(); } @@ -42,5 +42,5 @@ void TextureChangePacket::handle(PacketListener *listener) int TextureChangePacket::getEstimatedSize() { - return 5 + static_cast(path.size()); + return 5 + (int)path.size(); } diff --git a/Minecraft.World/TextureChangePacket.h b/Minecraft.World/TextureChangePacket.h index 81f45f4c..959fc4fe 100644 --- a/Minecraft.World/TextureChangePacket.h +++ b/Minecraft.World/TextureChangePacket.h @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TextureChangePacket()); } virtual int getId() { return 157; } }; \ No newline at end of file diff --git a/Minecraft.World/TexturePacket.cpp b/Minecraft.World/TexturePacket.cpp index eadcb3ed..77dfdc38 100644 --- a/Minecraft.World/TexturePacket.cpp +++ b/Minecraft.World/TexturePacket.cpp @@ -10,13 +10,13 @@ TexturePacket::TexturePacket() { this->textureName = L""; this->dwBytes = 0; - this->pbData = nullptr; + this->pbData = NULL; } TexturePacket::~TexturePacket() { // can't free this - it's used elsewhere -// if(this->pbData!=nullptr) +// if(this->pbData!=NULL) // { // delete [] this->pbData; // } @@ -37,7 +37,7 @@ void TexturePacket::handle(PacketListener *listener) void TexturePacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwBytes = static_cast(dis->readShort()); + dwBytes = (DWORD)dis->readShort(); if(dwBytes>0) { @@ -53,7 +53,7 @@ void TexturePacket::read(DataInputStream *dis) //throws IOException void TexturePacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); - dos->writeShort(static_cast(dwBytes)); + dos->writeShort((short)dwBytes); for(DWORD i=0;iwriteByte(this->pbData[i]); diff --git a/Minecraft.World/TheEndBiome.cpp b/Minecraft.World/TheEndBiome.cpp index d54efb36..9e2359ed 100644 --- a/Minecraft.World/TheEndBiome.cpp +++ b/Minecraft.World/TheEndBiome.cpp @@ -14,8 +14,8 @@ TheEndBiome::TheEndBiome(int id) : Biome(id) ambientFriendlies.clear(); enemies.push_back(new MobSpawnerData(eTYPE_ENDERMAN, 10, 4, 4)); - topMaterial = static_cast(Tile::dirt_Id); - material = static_cast(Tile::dirt_Id); + topMaterial = (byte) Tile::dirt_Id; + material = (byte) Tile::dirt_Id; decorator = new TheEndBiomeDecorator(this); } diff --git a/Minecraft.World/TheEndBiomeDecorator.cpp b/Minecraft.World/TheEndBiomeDecorator.cpp index 2b80bcfc..0ab1f766 100644 --- a/Minecraft.World/TheEndBiomeDecorator.cpp +++ b/Minecraft.World/TheEndBiomeDecorator.cpp @@ -58,7 +58,7 @@ void TheEndBiomeDecorator::decorate() } if (xo == 0 && zo == 0) { - shared_ptr enderDragon = std::make_shared(level); + shared_ptr enderDragon = shared_ptr(new EnderDragon(level)); enderDragon->AddParts(); // 4J added enderDragon->moveTo(0, 128, 0, random->nextFloat() * 360, 0); level->addEntity(enderDragon); diff --git a/Minecraft.World/TheEndDimension.cpp b/Minecraft.World/TheEndDimension.cpp index 7f26d0e8..031d6de4 100644 --- a/Minecraft.World/TheEndDimension.cpp +++ b/Minecraft.World/TheEndDimension.cpp @@ -26,7 +26,7 @@ float TheEndDimension::getTimeOfDay(int64_t time, float a) const float *TheEndDimension::getSunriseColor(float td, float a) { - return nullptr; + return NULL; } Vec3 *TheEndDimension::getFogColor(float td, float a) const diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 3b42f8ca..f9f38470 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/TheEndLevelRandomLevelSource.cpp @@ -53,7 +53,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra { for (int yc = 0; yc < Level::genDepth / CHUNK_HEIGHT; yc++) { - double yStep = 1 / static_cast(CHUNK_HEIGHT); + double yStep = 1 / (double) CHUNK_HEIGHT; double s0 = buffer[((xc + 0) * zSize + (zc + 0)) * ySize + (yc + 0)]; double s1 = buffer[((xc + 0) * zSize + (zc + 1)) * ySize + (yc + 0)]; double s2 = buffer[((xc + 1) * zSize + (zc + 0)) * ySize + (yc + 0)]; @@ -66,7 +66,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra for (int y = 0; y < CHUNK_HEIGHT; y++) { - double xStep = 1 / static_cast(CHUNK_WIDTH); + double xStep = 1 / (double) CHUNK_WIDTH; double _s0 = s0; double _s1 = s1; @@ -77,7 +77,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra { int offs = (x + xc * CHUNK_WIDTH) << Level::genDepthBitsPlusFour | (0 + zc * CHUNK_WIDTH) << Level::genDepthBits | (yc * CHUNK_HEIGHT + y); int step = 1 << Level::genDepthBits; - double zStep = 1 / static_cast(CHUNK_WIDTH); + double zStep = 1 / (double) CHUNK_WIDTH; double val = _s0; double vala = (_s1 - _s0) * zStep; @@ -90,7 +90,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra } else { } - blocks[offs] = static_cast(tileId); + blocks[offs] = (byte) tileId; offs += step; val += vala; } @@ -139,7 +139,7 @@ void TheEndLevelRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray if (runDepth <= 0) { top = 0; - material = static_cast(Tile::endStone_Id); + material = (byte) Tile::endStone_Id; } run = runDepth; @@ -169,7 +169,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) BiomeArray biomes; // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed unsigned int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -195,7 +195,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) doubleArray TheEndLevelRandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize) { - if (buffer.data == nullptr) + if (buffer.data == NULL) { buffer = doubleArray(xSize * ySize * zSize); } @@ -407,16 +407,16 @@ wstring TheEndLevelRandomLevelSource::gatherStats() vector *TheEndLevelRandomLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == nullptr) + if (biome == NULL) { - return nullptr; + return NULL; } return biome->getMobs(mobCategory); } TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return nullptr; + return NULL; } void TheEndLevelRandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/TheEndPortal.cpp b/Minecraft.World/TheEndPortal.cpp index c3e5cbf5..f2cb5dad 100644 --- a/Minecraft.World/TheEndPortal.cpp +++ b/Minecraft.World/TheEndPortal.cpp @@ -13,7 +13,7 @@ DWORD TheEndPortal::tlsIdx = TlsAlloc(); // 4J - allowAnywhere is a static in java, implementing as TLS here to make thread safe bool TheEndPortal::allowAnywhere() { - return (TlsGetValue(tlsIdx) != nullptr); + return (TlsGetValue(tlsIdx) != NULL); } void TheEndPortal::allowAnywhere(bool set) @@ -28,7 +28,7 @@ TheEndPortal::TheEndPortal(int id, Material *material) : BaseEntityTile(id, mate shared_ptr TheEndPortal::newTileEntity(Level *level) { - return std::make_shared(); + return shared_ptr(new TheEndPortalTileEntity()); } void TheEndPortal::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param @@ -66,7 +66,7 @@ void TheEndPortal::entityInside(Level *level, int x, int y, int z, shared_ptrGetType() == eTYPE_EXPERIENCEORB ) return; // 4J added - if (entity->riding == nullptr && entity->rider.lock() == nullptr) + if (entity->riding == NULL && entity->rider.lock() == NULL) { if (!level->isClientSide) { diff --git a/Minecraft.World/TheEndPortalFrameTile.cpp b/Minecraft.World/TheEndPortalFrameTile.cpp index 80e78f49..f7b10a05 100644 --- a/Minecraft.World/TheEndPortalFrameTile.cpp +++ b/Minecraft.World/TheEndPortalFrameTile.cpp @@ -9,8 +9,8 @@ const wstring TheEndPortalFrameTile::TEXTURE_EYE = L"endframe_eye"; TheEndPortalFrameTile::TheEndPortalFrameTile(int id) : Tile(id, Material::glass, isSolidRender() ) { - iconTop = nullptr; - iconEye = nullptr; + iconTop = NULL; + iconEye = NULL; } Icon *TheEndPortalFrameTile::getTexture(int face, int data) diff --git a/Minecraft.World/TheEndPortalTileEntity.cpp b/Minecraft.World/TheEndPortalTileEntity.cpp index 63c0af56..fa9b3544 100644 --- a/Minecraft.World/TheEndPortalTileEntity.cpp +++ b/Minecraft.World/TheEndPortalTileEntity.cpp @@ -4,7 +4,7 @@ // 4J Added shared_ptr TheEndPortalTileEntity::clone() { - shared_ptr result = std::make_shared(); + shared_ptr result = shared_ptr( new TheEndPortalTileEntity() ); TileEntity::clone(result); return result; } \ No newline at end of file diff --git a/Minecraft.World/ThinFenceTile.cpp b/Minecraft.World/ThinFenceTile.cpp index 65638ef6..3f471ce4 100644 --- a/Minecraft.World/ThinFenceTile.cpp +++ b/Minecraft.World/ThinFenceTile.cpp @@ -5,7 +5,7 @@ ThinFenceTile::ThinFenceTile(int id, const wstring &tex, const wstring &edgeTex, Material *material, bool dropsResources) : Tile(id, material,isSolidRender()) { - iconSide = nullptr; + iconSide = NULL; edgeTexture = edgeTex; this->dropsResources = dropsResources; this->texture = tex; @@ -144,7 +144,7 @@ bool ThinFenceTile::isSilkTouchable() shared_ptr ThinFenceTile::getSilkTouchItemInstance(int data) { - return std::make_shared(id, 1, data); + return shared_ptr(new ItemInstance(id, 1, data)); } void ThinFenceTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/ThornsEnchantment.cpp b/Minecraft.World/ThornsEnchantment.cpp index a301907e..53668642 100644 --- a/Minecraft.World/ThornsEnchantment.cpp +++ b/Minecraft.World/ThornsEnchantment.cpp @@ -62,14 +62,14 @@ void ThornsEnchantment::doThornsAfterAttack(shared_ptr source, shared_pt source->hurt(DamageSource::thorns(target), getDamage(level, random)); source->playSound(eSoundType_DAMAGE_THORNS, .5f, 1.0f); - if (item != nullptr) + if (item != NULL) { item->hurtAndBreak(3, target); } } else { - if (item != nullptr) + if (item != NULL) { item->hurtAndBreak(1, target); } diff --git a/Minecraft.World/Throwable.cpp b/Minecraft.World/Throwable.cpp index 08e40aa6..7d30b898 100644 --- a/Minecraft.World/Throwable.cpp +++ b/Minecraft.World/Throwable.cpp @@ -106,10 +106,10 @@ void Throwable::shoot(double xd, double yd, double zd, float pow, float uncertai this->yd = yd; this->zd = zd; - float sd = static_cast(sqrt(xd * xd + zd * zd)); + float sd = (float) sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); life = 0; } @@ -120,9 +120,9 @@ void Throwable::lerpMotion(double xd, double yd, double zd) this->zd = zd; if (xRotO == 0 && yRotO == 0) { - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); } } @@ -166,7 +166,7 @@ void Throwable::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != nullptr) + if (res != NULL) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -185,7 +185,7 @@ void Throwable::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != nullptr) + if (p != NULL) { double dd = from->distanceTo(p->pos); delete p; @@ -197,14 +197,14 @@ void Throwable::tick() } } - if (hitEntity != nullptr) + if (hitEntity != NULL) { - if(res != nullptr) delete res; + if(res != NULL) delete res; res = new HitResult(hitEntity); } } - if (res != nullptr) + if (res != NULL) { if ( (res->type == HitResult::TILE) && (level->getTile(res->x, res->y, res->z) == Tile::portalTile_Id) ) { @@ -220,9 +220,9 @@ void Throwable::tick() y += yd; z += zd; - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, (double)sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -267,14 +267,14 @@ float Throwable::getGravity() void Throwable::addAdditonalSaveData(CompoundTag *tag) { - tag->putShort(L"xTile", static_cast(xTile)); - tag->putShort(L"yTile", static_cast(yTile)); - tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putShort(L"xTile", (short) xTile); + tag->putShort(L"yTile", (short) yTile); + tag->putShort(L"zTile", (short) zTile); + tag->putByte(L"inTile", (byte) lastTile); + tag->putByte(L"shake", (byte) shakeTime); + tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); - if (ownerName.empty() && (owner != nullptr) && owner->instanceof(eTYPE_PLAYER) ) + if (ownerName.empty() && (owner != NULL) && owner->instanceof(eTYPE_PLAYER) ) { ownerName = owner->getAName(); } @@ -301,7 +301,7 @@ float Throwable::getShadowHeightOffs() shared_ptr Throwable::getOwner() { - if (owner == nullptr && !ownerName.empty() ) + if (owner == NULL && !ownerName.empty() ) { owner = level->getPlayerByName(ownerName); } diff --git a/Minecraft.World/ThrownEgg.cpp b/Minecraft.World/ThrownEgg.cpp index 9bdfae10..1378e094 100644 --- a/Minecraft.World/ThrownEgg.cpp +++ b/Minecraft.World/ThrownEgg.cpp @@ -33,7 +33,7 @@ ThrownEgg::ThrownEgg(Level *level, double x, double y, double z) : Throwable(lev void ThrownEgg::onHit(HitResult *res) { - if (res->entity != nullptr) + if (res->entity != NULL) { DamageSource *damageSource = DamageSource::thrown(shared_from_this(), owner); res->entity->hurt(damageSource, 0); @@ -47,7 +47,7 @@ void ThrownEgg::onHit(HitResult *res) if (random->nextInt(32) == 0) count = 4; for (int i = 0; i < count; i++) { - shared_ptr chicken = std::make_shared(level); + shared_ptr chicken = shared_ptr( new Chicken(level) ); chicken->setAge(-20 * 60 * 20); chicken->moveTo(x, y, z, yRot, 0); diff --git a/Minecraft.World/ThrownEnderpearl.cpp b/Minecraft.World/ThrownEnderpearl.cpp index c325f1c9..1035bffd 100644 --- a/Minecraft.World/ThrownEnderpearl.cpp +++ b/Minecraft.World/ThrownEnderpearl.cpp @@ -32,7 +32,7 @@ ThrownEnderpearl::ThrownEnderpearl(Level *level, double x, double y, double z) : void ThrownEnderpearl::onHit(HitResult *res) { - if (res->entity != nullptr) + if (res->entity != NULL) { DamageSource *damageSource = DamageSource::thrown(shared_from_this(), getOwner() ); res->entity->hurt(damageSource, 0); @@ -49,7 +49,7 @@ void ThrownEnderpearl::onHit(HitResult *res) // If the owner has been removed, then ignore // 4J-JEV: Cheap type check first. - if ( (getOwner() != nullptr) && getOwner()->instanceof(eTYPE_SERVERPLAYER) ) + if ( (getOwner() != NULL) && getOwner()->instanceof(eTYPE_SERVERPLAYER) ) { shared_ptr serverPlayer = dynamic_pointer_cast(getOwner() ); if (!serverPlayer->removed) diff --git a/Minecraft.World/ThrownExpBottle.cpp b/Minecraft.World/ThrownExpBottle.cpp index acab0d05..b8dbef96 100644 --- a/Minecraft.World/ThrownExpBottle.cpp +++ b/Minecraft.World/ThrownExpBottle.cpp @@ -40,14 +40,14 @@ void ThrownExpBottle::onHit(HitResult *res) if (!level->isClientSide) { - level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); + level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); int xpCount = 3 + level->random->nextInt(5) + level->random->nextInt(5); while (xpCount > 0) { int newCount = ExperienceOrb::getExperienceValue(xpCount); xpCount -= newCount; - level->addEntity(std::make_shared(level, x, y, z, newCount)); + level->addEntity(shared_ptr( new ExperienceOrb(level, x, y, z, newCount) ) ); } remove(); diff --git a/Minecraft.World/ThrownPotion.cpp b/Minecraft.World/ThrownPotion.cpp index 170f6474..69c096a2 100644 --- a/Minecraft.World/ThrownPotion.cpp +++ b/Minecraft.World/ThrownPotion.cpp @@ -31,7 +31,7 @@ ThrownPotion::ThrownPotion(Level *level, shared_ptr mob, int potio { _init(); - potionItem = std::make_shared(Item::potion, 1, potionValue); + potionItem = shared_ptr( new ItemInstance(Item::potion, 1, potionValue)); } ThrownPotion::ThrownPotion(Level *level, shared_ptr mob, shared_ptr potion) : Throwable(level, mob) @@ -45,7 +45,7 @@ ThrownPotion::ThrownPotion(Level *level, double x, double y, double z, int potio { _init(); - potionItem = std::make_shared(Item::potion, 1, potionValue); + potionItem = shared_ptr( new ItemInstance(Item::potion, 1, potionValue)); } ThrownPotion::ThrownPotion(Level *level, double x, double y, double z, shared_ptr potion) : Throwable(level, x, y, z) @@ -72,13 +72,13 @@ float ThrownPotion::getThrowUpAngleOffset() void ThrownPotion::setPotionValue(int potionValue) { - if (potionItem == nullptr) potionItem = std::make_shared(Item::potion, 1, 0); + if (potionItem == NULL) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); potionItem->setAuxValue(potionValue); } int ThrownPotion::getPotionValue() { - if (potionItem == nullptr) potionItem = std::make_shared(Item::potion, 1, 0); + if (potionItem == NULL) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); return potionItem->getAuxValue(); } @@ -88,12 +88,12 @@ void ThrownPotion::onHit(HitResult *res) { vector *mobEffects = Item::potion->getMobEffects(potionItem); - if (mobEffects != nullptr && !mobEffects->empty()) + if (mobEffects != NULL && !mobEffects->empty()) { AABB *aoe = bb->grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE); vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(LivingEntity), aoe); - if (entitiesOfClass != nullptr && !entitiesOfClass->empty()) + if (entitiesOfClass != NULL && !entitiesOfClass->empty()) { for(auto & it : *entitiesOfClass) { @@ -117,7 +117,7 @@ void ThrownPotion::onHit(HitResult *res) } else { - int duration = static_cast(scale * (double)effect->getDuration() + .5); + int duration = (int) (scale * (double) effect->getDuration() + .5); if (duration > SharedConstants::TICKS_PER_SECOND) { e->addEffect(new MobEffectInstance(id, duration, effect->getAmplifier())); @@ -129,7 +129,7 @@ void ThrownPotion::onHit(HitResult *res) } delete entitiesOfClass; } - level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), getPotionValue() ); + level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), getPotionValue() ); remove(); } @@ -148,12 +148,12 @@ void ThrownPotion::readAdditionalSaveData(CompoundTag *tag) setPotionValue(tag->getInt(L"potionValue")); } - if (potionItem == nullptr) remove(); + if (potionItem == NULL) remove(); } void ThrownPotion::addAdditonalSaveData(CompoundTag *tag) { Throwable::addAdditonalSaveData(tag); - if (potionItem != nullptr) tag->putCompound(L"Potion", potionItem->save(new CompoundTag())); + if (potionItem != NULL) tag->putCompound(L"Potion", potionItem->save(new CompoundTag())); } \ No newline at end of file diff --git a/Minecraft.World/TickNextTickData.cpp b/Minecraft.World/TickNextTickData.cpp index 95639b04..277be1f8 100644 --- a/Minecraft.World/TickNextTickData.cpp +++ b/Minecraft.World/TickNextTickData.cpp @@ -21,7 +21,7 @@ bool TickNextTickData::equals(const TickNextTickData *o) const { // TODO 4J Is this safe to cast it before we do a dynamic_cast? Will the dynamic_cast still fail? // We cannot dynamic_cast a void* - if ( o != nullptr) + if ( o != NULL) { TickNextTickData *t = (TickNextTickData *) o; return x == t->x && y == t->y && z == t->z && Tile::isMatching(tileId, t->tileId); diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index de113714..67148274 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -21,18 +21,18 @@ wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; const float Tile::INDESTRUCTIBLE_DESTROY_TIME = -1.0f; -Tile::SoundType *Tile::SOUND_NORMAL = nullptr; -Tile::SoundType *Tile::SOUND_WOOD = nullptr; -Tile::SoundType *Tile::SOUND_GRAVEL = nullptr; -Tile::SoundType *Tile::SOUND_GRASS = nullptr; -Tile::SoundType *Tile::SOUND_STONE = nullptr; -Tile::SoundType *Tile::SOUND_METAL = nullptr; -Tile::SoundType *Tile::SOUND_GLASS = nullptr; -Tile::SoundType *Tile::SOUND_CLOTH = nullptr; -Tile::SoundType *Tile::SOUND_SAND = nullptr; -Tile::SoundType *Tile::SOUND_SNOW = nullptr; -Tile::SoundType *Tile::SOUND_LADDER = nullptr; -Tile::SoundType *Tile::SOUND_ANVIL = nullptr; +Tile::SoundType *Tile::SOUND_NORMAL = NULL; +Tile::SoundType *Tile::SOUND_WOOD = NULL; +Tile::SoundType *Tile::SOUND_GRAVEL = NULL; +Tile::SoundType *Tile::SOUND_GRASS = NULL; +Tile::SoundType *Tile::SOUND_STONE = NULL; +Tile::SoundType *Tile::SOUND_METAL = NULL; +Tile::SoundType *Tile::SOUND_GLASS = NULL; +Tile::SoundType *Tile::SOUND_CLOTH = NULL; +Tile::SoundType *Tile::SOUND_SAND = NULL; +Tile::SoundType *Tile::SOUND_SNOW = NULL; +Tile::SoundType *Tile::SOUND_LADDER = NULL; +Tile::SoundType *Tile::SOUND_ANVIL = NULL; bool Tile::solid[TILE_NUM_COUNT]; int Tile::lightBlock[TILE_NUM_COUNT]; @@ -42,183 +42,183 @@ unsigned char Tile::_sendTileData[TILE_NUM_COUNT]; // 4J changed - was bool, no bool Tile::mipmapEnable[TILE_NUM_COUNT]; bool Tile::propagate[TILE_NUM_COUNT]; -Tile **Tile::tiles = nullptr; +Tile **Tile::tiles = NULL; -Tile *Tile::stone = nullptr; -GrassTile *Tile::grass = nullptr; -Tile *Tile::dirt = nullptr; -Tile *Tile::cobblestone = nullptr; -Tile *Tile::wood = nullptr; -Tile *Tile::sapling = nullptr; -Tile *Tile::unbreakable = nullptr; -LiquidTile *Tile::water = nullptr; -Tile *Tile::calmWater = nullptr; -LiquidTile *Tile::lava = nullptr; -Tile *Tile::calmLava = nullptr; -Tile *Tile::sand = nullptr; -Tile *Tile::gravel = nullptr; -Tile *Tile::goldOre = nullptr; -Tile *Tile::ironOre = nullptr; -Tile *Tile::coalOre = nullptr; -Tile *Tile::treeTrunk = nullptr; -LeafTile *Tile::leaves = nullptr; -Tile *Tile::sponge = nullptr; -Tile *Tile::glass = nullptr; -Tile *Tile::lapisOre = nullptr; -Tile *Tile::lapisBlock = nullptr; -Tile *Tile::dispenser = nullptr; -Tile *Tile::sandStone = nullptr; -Tile *Tile::noteblock = nullptr; -Tile *Tile::bed = nullptr; -Tile *Tile::goldenRail = nullptr; -Tile *Tile::detectorRail = nullptr; -PistonBaseTile *Tile::pistonStickyBase = nullptr; -Tile *Tile::web = nullptr; -TallGrass *Tile::tallgrass = nullptr; -DeadBushTile *Tile::deadBush = nullptr; -PistonBaseTile *Tile::pistonBase = nullptr; -PistonExtensionTile *Tile::pistonExtension = nullptr; -Tile *Tile::wool = nullptr; -PistonMovingPiece *Tile::pistonMovingPiece = nullptr; -Bush *Tile::flower = nullptr; -Bush *Tile::rose = nullptr; -Bush *Tile::mushroom_brown = nullptr; -Bush *Tile::mushroom_red = nullptr; -Tile *Tile::goldBlock = nullptr; -Tile *Tile::ironBlock = nullptr; -HalfSlabTile *Tile::stoneSlab = nullptr; -HalfSlabTile *Tile::stoneSlabHalf = nullptr; -Tile *Tile::redBrick = nullptr; -Tile *Tile::tnt = nullptr; -Tile *Tile::bookshelf = nullptr; -Tile *Tile::mossyCobblestone = nullptr; -Tile *Tile::obsidian = nullptr; -Tile *Tile::torch = nullptr; -FireTile *Tile::fire = nullptr; -Tile *Tile::mobSpawner = nullptr; -Tile *Tile::stairs_wood = nullptr; -ChestTile *Tile::chest = nullptr; -RedStoneDustTile *Tile::redStoneDust = nullptr; -Tile *Tile::diamondOre = nullptr; -Tile *Tile::diamondBlock = nullptr; -Tile *Tile::workBench = nullptr; -Tile *Tile::wheat = nullptr; -Tile *Tile::farmland = nullptr; -Tile *Tile::furnace = nullptr; -Tile *Tile::furnace_lit = nullptr; -Tile *Tile::sign = nullptr; -Tile *Tile::door_wood = nullptr; -Tile *Tile::ladder = nullptr; -Tile *Tile::rail = nullptr; -Tile *Tile::stairs_stone = nullptr; -Tile *Tile::wallSign = nullptr; -Tile *Tile::lever = nullptr; -Tile *Tile::pressurePlate_stone = nullptr; -Tile *Tile::door_iron = nullptr; -Tile *Tile::pressurePlate_wood = nullptr; -Tile *Tile::redStoneOre = nullptr; -Tile *Tile::redStoneOre_lit = nullptr; -Tile *Tile::redstoneTorch_off = nullptr; -Tile *Tile::redstoneTorch_on = nullptr; -Tile *Tile::button = nullptr; -Tile *Tile::topSnow = nullptr; -Tile *Tile::ice = nullptr; -Tile *Tile::snow = nullptr; -Tile *Tile::cactus = nullptr; -Tile *Tile::clay = nullptr; -Tile *Tile::reeds = nullptr; -Tile *Tile::jukebox = nullptr; -Tile *Tile::fence = nullptr; -Tile *Tile::pumpkin = nullptr; -Tile *Tile::netherRack = nullptr; -Tile *Tile::soulsand = nullptr; -Tile *Tile::glowstone = nullptr; -PortalTile *Tile::portalTile = nullptr; -Tile *Tile::litPumpkin = nullptr; -Tile *Tile::cake = nullptr; -RepeaterTile *Tile::diode_off = nullptr; -RepeaterTile *Tile::diode_on = nullptr; -Tile *Tile::stained_glass = nullptr; -Tile *Tile::trapdoor = nullptr; +Tile *Tile::stone = NULL; +GrassTile *Tile::grass = NULL; +Tile *Tile::dirt = NULL; +Tile *Tile::cobblestone = NULL; +Tile *Tile::wood = NULL; +Tile *Tile::sapling = NULL; +Tile *Tile::unbreakable = NULL; +LiquidTile *Tile::water = NULL; +Tile *Tile::calmWater = NULL; +LiquidTile *Tile::lava = NULL; +Tile *Tile::calmLava = NULL; +Tile *Tile::sand = NULL; +Tile *Tile::gravel = NULL; +Tile *Tile::goldOre = NULL; +Tile *Tile::ironOre = NULL; +Tile *Tile::coalOre = NULL; +Tile *Tile::treeTrunk = NULL; +LeafTile *Tile::leaves = NULL; +Tile *Tile::sponge = NULL; +Tile *Tile::glass = NULL; +Tile *Tile::lapisOre = NULL; +Tile *Tile::lapisBlock = NULL; +Tile *Tile::dispenser = NULL; +Tile *Tile::sandStone = NULL; +Tile *Tile::noteblock = NULL; +Tile *Tile::bed = NULL; +Tile *Tile::goldenRail = NULL; +Tile *Tile::detectorRail = NULL; +PistonBaseTile *Tile::pistonStickyBase = NULL; +Tile *Tile::web = NULL; +TallGrass *Tile::tallgrass = NULL; +DeadBushTile *Tile::deadBush = NULL; +PistonBaseTile *Tile::pistonBase = NULL; +PistonExtensionTile *Tile::pistonExtension = NULL; +Tile *Tile::wool = NULL; +PistonMovingPiece *Tile::pistonMovingPiece = NULL; +Bush *Tile::flower = NULL; +Bush *Tile::rose = NULL; +Bush *Tile::mushroom_brown = NULL; +Bush *Tile::mushroom_red = NULL; +Tile *Tile::goldBlock = NULL; +Tile *Tile::ironBlock = NULL; +HalfSlabTile *Tile::stoneSlab = NULL; +HalfSlabTile *Tile::stoneSlabHalf = NULL; +Tile *Tile::redBrick = NULL; +Tile *Tile::tnt = NULL; +Tile *Tile::bookshelf = NULL; +Tile *Tile::mossyCobblestone = NULL; +Tile *Tile::obsidian = NULL; +Tile *Tile::torch = NULL; +FireTile *Tile::fire = NULL; +Tile *Tile::mobSpawner = NULL; +Tile *Tile::stairs_wood = NULL; +ChestTile *Tile::chest = NULL; +RedStoneDustTile *Tile::redStoneDust = NULL; +Tile *Tile::diamondOre = NULL; +Tile *Tile::diamondBlock = NULL; +Tile *Tile::workBench = NULL; +Tile *Tile::wheat = NULL; +Tile *Tile::farmland = NULL; +Tile *Tile::furnace = NULL; +Tile *Tile::furnace_lit = NULL; +Tile *Tile::sign = NULL; +Tile *Tile::door_wood = NULL; +Tile *Tile::ladder = NULL; +Tile *Tile::rail = NULL; +Tile *Tile::stairs_stone = NULL; +Tile *Tile::wallSign = NULL; +Tile *Tile::lever = NULL; +Tile *Tile::pressurePlate_stone = NULL; +Tile *Tile::door_iron = NULL; +Tile *Tile::pressurePlate_wood = NULL; +Tile *Tile::redStoneOre = NULL; +Tile *Tile::redStoneOre_lit = NULL; +Tile *Tile::redstoneTorch_off = NULL; +Tile *Tile::redstoneTorch_on = NULL; +Tile *Tile::button = NULL; +Tile *Tile::topSnow = NULL; +Tile *Tile::ice = NULL; +Tile *Tile::snow = NULL; +Tile *Tile::cactus = NULL; +Tile *Tile::clay = NULL; +Tile *Tile::reeds = NULL; +Tile *Tile::jukebox = NULL; +Tile *Tile::fence = NULL; +Tile *Tile::pumpkin = NULL; +Tile *Tile::netherRack = NULL; +Tile *Tile::soulsand = NULL; +Tile *Tile::glowstone = NULL; +PortalTile *Tile::portalTile = NULL; +Tile *Tile::litPumpkin = NULL; +Tile *Tile::cake = NULL; +RepeaterTile *Tile::diode_off = NULL; +RepeaterTile *Tile::diode_on = NULL; +Tile *Tile::stained_glass = NULL; +Tile *Tile::trapdoor = NULL; -Tile *Tile::monsterStoneEgg = nullptr; -Tile *Tile::stoneBrick = nullptr; -Tile *Tile::hugeMushroom_brown = nullptr; -Tile *Tile::hugeMushroom_red = nullptr; -Tile *Tile::ironFence = nullptr; -Tile *Tile::thinGlass = nullptr; -Tile *Tile::melon = nullptr; -Tile *Tile::pumpkinStem = nullptr; -Tile *Tile::melonStem = nullptr; -Tile *Tile::vine = nullptr; -Tile *Tile::fenceGate = nullptr; -Tile *Tile::stairs_bricks = nullptr; -Tile *Tile::stairs_stoneBrickSmooth = nullptr; +Tile *Tile::monsterStoneEgg = NULL; +Tile *Tile::stoneBrick = NULL; +Tile *Tile::hugeMushroom_brown = NULL; +Tile *Tile::hugeMushroom_red = NULL; +Tile *Tile::ironFence = NULL; +Tile *Tile::thinGlass = NULL; +Tile *Tile::melon = NULL; +Tile *Tile::pumpkinStem = NULL; +Tile *Tile::melonStem = NULL; +Tile *Tile::vine = NULL; +Tile *Tile::fenceGate = NULL; +Tile *Tile::stairs_bricks = NULL; +Tile *Tile::stairs_stoneBrickSmooth = NULL; -MycelTile *Tile::mycel = nullptr; -Tile *Tile::waterLily = nullptr; -Tile *Tile::netherBrick = nullptr; -Tile *Tile::netherFence = nullptr; -Tile *Tile::stairs_netherBricks = nullptr; -Tile *Tile::netherStalk = nullptr; -Tile *Tile::enchantTable = nullptr; -Tile *Tile::brewingStand = nullptr; -CauldronTile *Tile::cauldron = nullptr; -Tile *Tile::endPortalTile = nullptr; -Tile *Tile::endPortalFrameTile = nullptr; -Tile *Tile::endStone = nullptr; -Tile *Tile::dragonEgg = nullptr; -Tile *Tile::redstoneLight = nullptr; -Tile *Tile::redstoneLight_lit = nullptr; +MycelTile *Tile::mycel = NULL; +Tile *Tile::waterLily = NULL; +Tile *Tile::netherBrick = NULL; +Tile *Tile::netherFence = NULL; +Tile *Tile::stairs_netherBricks = NULL; +Tile *Tile::netherStalk = NULL; +Tile *Tile::enchantTable = NULL; +Tile *Tile::brewingStand = NULL; +CauldronTile *Tile::cauldron = NULL; +Tile *Tile::endPortalTile = NULL; +Tile *Tile::endPortalFrameTile = NULL; +Tile *Tile::endStone = NULL; +Tile *Tile::dragonEgg = NULL; +Tile *Tile::redstoneLight = NULL; +Tile *Tile::redstoneLight_lit = NULL; // TU9 -Tile *Tile::stairs_sandstone = nullptr; -Tile *Tile::woodStairsDark = nullptr; -Tile *Tile::woodStairsBirch = nullptr; -Tile *Tile::woodStairsJungle = nullptr; -Tile *Tile::commandBlock = nullptr; -BeaconTile *Tile::beacon = nullptr; -Tile *Tile::button_wood = nullptr; -HalfSlabTile *Tile::woodSlab = nullptr; -HalfSlabTile *Tile::woodSlabHalf = nullptr; +Tile *Tile::stairs_sandstone = NULL; +Tile *Tile::woodStairsDark = NULL; +Tile *Tile::woodStairsBirch = NULL; +Tile *Tile::woodStairsJungle = NULL; +Tile *Tile::commandBlock = NULL; +BeaconTile *Tile::beacon = NULL; +Tile *Tile::button_wood = NULL; +HalfSlabTile *Tile::woodSlab = NULL; +HalfSlabTile *Tile::woodSlabHalf = NULL; -Tile *Tile::emeraldOre = nullptr; -Tile *Tile::enderChest = nullptr; -TripWireSourceTile *Tile::tripWireSource = nullptr; -Tile *Tile::tripWire = nullptr; -Tile *Tile::emeraldBlock = nullptr; +Tile *Tile::emeraldOre = NULL; +Tile *Tile::enderChest = NULL; +TripWireSourceTile *Tile::tripWireSource = NULL; +Tile *Tile::tripWire = NULL; +Tile *Tile::emeraldBlock = NULL; -Tile *Tile::cocoa = nullptr; -Tile *Tile::skull = nullptr; +Tile *Tile::cocoa = NULL; +Tile *Tile::skull = NULL; -Tile *Tile::cobbleWall = nullptr; -Tile *Tile::flowerPot = nullptr; -Tile *Tile::carrots = nullptr; -Tile *Tile::potatoes = nullptr; -Tile *Tile::anvil = nullptr; -Tile *Tile::chest_trap = nullptr; -Tile *Tile::weightedPlate_light = nullptr; -Tile *Tile::weightedPlate_heavy = nullptr; -ComparatorTile *Tile::comparator_off = nullptr; -ComparatorTile *Tile::comparator_on = nullptr; +Tile *Tile::cobbleWall = NULL; +Tile *Tile::flowerPot = NULL; +Tile *Tile::carrots = NULL; +Tile *Tile::potatoes = NULL; +Tile *Tile::anvil = NULL; +Tile *Tile::chest_trap = NULL; +Tile *Tile::weightedPlate_light = NULL; +Tile *Tile::weightedPlate_heavy = NULL; +ComparatorTile *Tile::comparator_off = NULL; +ComparatorTile *Tile::comparator_on = NULL; -DaylightDetectorTile *Tile::daylightDetector = nullptr; -Tile *Tile::redstoneBlock = nullptr; +DaylightDetectorTile *Tile::daylightDetector = NULL; +Tile *Tile::redstoneBlock = NULL; -Tile *Tile::netherQuartz = nullptr; -HopperTile *Tile::hopper = nullptr; -Tile *Tile::quartzBlock = nullptr; -Tile *Tile::stairs_quartz = nullptr; -Tile *Tile::activatorRail = nullptr; -Tile *Tile::dropper = nullptr; -Tile *Tile::clayHardened_colored = nullptr; -Tile *Tile::stained_glass_pane = nullptr; +Tile *Tile::netherQuartz = NULL; +HopperTile *Tile::hopper = NULL; +Tile *Tile::quartzBlock = NULL; +Tile *Tile::stairs_quartz = NULL; +Tile *Tile::activatorRail = NULL; +Tile *Tile::dropper = NULL; +Tile *Tile::clayHardened_colored = NULL; +Tile *Tile::stained_glass_pane = NULL; -Tile *Tile::hayBlock = nullptr; -Tile *Tile::woolCarpet = nullptr; -Tile *Tile::clayHardened = nullptr; -Tile *Tile::coalBlock = nullptr; +Tile *Tile::hayBlock = NULL; +Tile *Tile::woolCarpet = NULL; +Tile *Tile::clayHardened = NULL; +Tile *Tile::coalBlock = NULL; DWORD Tile::tlsIdxShape = TlsAlloc(); @@ -236,7 +236,7 @@ void Tile::CreateNewThreadStorage() void Tile::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); delete tls; } @@ -259,15 +259,15 @@ void Tile::staticCtor() memset( tiles, 0, sizeof( Tile *)*TILE_NUM_COUNT ); Tile::stone = (new StoneTile(1)) ->setDestroyTime(1.5f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stone")->setDescriptionId(IDS_TILE_STONE)->setUseDescriptionId(IDS_DESC_STONE); - Tile::grass = static_cast((new GrassTile(2))->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"grass")->setDescriptionId(IDS_TILE_GRASS)->setUseDescriptionId(IDS_DESC_GRASS)); + Tile::grass = (GrassTile *) (new GrassTile(2)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"grass")->setDescriptionId(IDS_TILE_GRASS)->setUseDescriptionId(IDS_DESC_GRASS); Tile::dirt = (new DirtTile(3)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_GRAVEL)->setIconName(L"dirt")->setDescriptionId(IDS_TILE_DIRT)->setUseDescriptionId(IDS_DESC_DIRT); Tile::cobblestone = (new Tile(4, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"cobblestone")->setDescriptionId(IDS_TILE_STONE_BRICK)->setUseDescriptionId(IDS_DESC_STONE_BRICK); Tile::wood = (new WoodTile(5)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structwoodstuff, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"planks")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->sendTileData()->setUseDescriptionId(IDS_DESC_WOODENPLANKS); Tile::sapling = (new Sapling(6)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"sapling")->setDescriptionId(IDS_TILE_SAPLING)->sendTileData()->setUseDescriptionId(IDS_DESC_SAPLING)->disableMipmap(); Tile::unbreakable = (new Tile(7, Material::stone)) ->setIndestructible()->setExplodeable(6000000)->setSoundType(Tile::SOUND_STONE)->setIconName(L"bedrock")->setDescriptionId(IDS_TILE_BEDROCK)->setNotCollectStatistics()->setUseDescriptionId(IDS_DESC_BEDROCK); - Tile::water = static_cast((new LiquidTileDynamic(8, Material::water))->setDestroyTime(100.0f)->setLightBlock(3)->setIconName(L"water_flow")->setDescriptionId(IDS_TILE_WATER)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_WATER)); + Tile::water = (LiquidTile *)(new LiquidTileDynamic(8, Material::water)) ->setDestroyTime(100.0f)->setLightBlock(3)->setIconName(L"water_flow")->setDescriptionId(IDS_TILE_WATER)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_WATER); Tile::calmWater = (new LiquidTileStatic(9, Material::water)) ->setDestroyTime(100.0f)->setLightBlock(3)->setIconName(L"water_still")->setDescriptionId(IDS_TILE_WATER)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_WATER); - Tile::lava = static_cast((new LiquidTileDynamic(10, Material::lava))->setDestroyTime(00.0f)->setLightEmission(1.0f)->setLightBlock(255)->setIconName(L"lava_flow")->setDescriptionId(IDS_TILE_LAVA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_LAVA)); + Tile::lava = (LiquidTile *)(new LiquidTileDynamic(10, Material::lava)) ->setDestroyTime(00.0f)->setLightEmission(1.0f)->setLightBlock(255)->setIconName(L"lava_flow")->setDescriptionId(IDS_TILE_LAVA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_LAVA); Tile::calmLava = (new LiquidTileStatic(11, Material::lava)) ->setDestroyTime(100.0f)->setLightEmission(1.0f)->setLightBlock(255)->setIconName(L"lava_still")->setDescriptionId(IDS_TILE_LAVA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_LAVA); Tile::sand = (new HeavyTile(12)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_SAND)->setIconName(L"sand")->setDescriptionId(IDS_TILE_SAND)->setUseDescriptionId(IDS_DESC_SAND); @@ -277,7 +277,7 @@ void Tile::staticCtor() Tile::coalOre = (new OreTile(16)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"coal_ore")->setDescriptionId(IDS_TILE_ORE_COAL)->setUseDescriptionId(IDS_DESC_ORE_COAL); Tile::treeTrunk = (new TreeTile(17))->setDestroyTime(2.0f) ->setSoundType(Tile::SOUND_WOOD)->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->sendTileData()->setUseDescriptionId(IDS_DESC_LOG); // 4J - for leaves, have specified that only the data bits that encode the type of leaf are important to be sent - Tile::leaves = static_cast((new LeafTile(18))->setDestroyTime(0.2f)->setLightBlock(1)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->sendTileData(LeafTile::LEAF_TYPE_MASK)->setUseDescriptionId(IDS_DESC_LEAVES)); + Tile::leaves = (LeafTile *)(new LeafTile(18)) ->setDestroyTime(0.2f)->setLightBlock(1)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->sendTileData(LeafTile::LEAF_TYPE_MASK)->setUseDescriptionId(IDS_DESC_LEAVES); Tile::sponge = (new Sponge(19)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"sponge")->setDescriptionId(IDS_TILE_SPONGE)->setUseDescriptionId(IDS_DESC_SPONGE); Tile::glass = (new GlassTile(20, Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(Tile::SOUND_GLASS)->setIconName(L"glass")->setDescriptionId(IDS_TILE_GLASS)->setUseDescriptionId(IDS_DESC_GLASS); @@ -289,24 +289,24 @@ void Tile::staticCtor() Tile::bed = (new BedTile(26)) ->setDestroyTime(0.2f)->setIconName(L"bed")->setDescriptionId(IDS_TILE_BED)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_BED); Tile::goldenRail = (new PoweredRailTile(27)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_rail, Item::eMaterial_gold)->setDestroyTime(0.7f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"rail_golden")->setDescriptionId(IDS_TILE_GOLDEN_RAIL)->sendTileData()->setUseDescriptionId(IDS_DESC_POWEREDRAIL)->disableMipmap(); Tile::detectorRail = (new DetectorRailTile(28)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_rail, Item::eMaterial_detector)->setDestroyTime(0.7f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"rail_detector")->setDescriptionId(IDS_TILE_DETECTOR_RAIL)->sendTileData()->setUseDescriptionId(IDS_DESC_DETECTORRAIL)->disableMipmap(); - Tile::pistonStickyBase = static_cast((new PistonBaseTile(29, true))->setBaseItemTypeAndMaterial(Item::eBaseItemType_piston, Item::eMaterial_stickypiston)->setIconName(L"pistonStickyBase")->setDescriptionId(IDS_TILE_PISTON_STICK_BASE)->setUseDescriptionId(IDS_DESC_STICKY_PISTON)->sendTileData()); + Tile::pistonStickyBase = (PistonBaseTile *)(new PistonBaseTile(29, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_piston, Item::eMaterial_stickypiston)->setIconName(L"pistonStickyBase")->setDescriptionId(IDS_TILE_PISTON_STICK_BASE)->setUseDescriptionId(IDS_DESC_STICKY_PISTON)->sendTileData(); Tile::web = (new WebTile(30)) ->setLightBlock(1)->setDestroyTime(4.0f)->setIconName(L"web")->setDescriptionId(IDS_TILE_WEB)->setUseDescriptionId(IDS_DESC_WEB); - Tile::tallgrass = static_cast((new TallGrass(31))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"tallgrass")->setDescriptionId(IDS_TILE_TALL_GRASS)->setUseDescriptionId(IDS_DESC_TALL_GRASS)->disableMipmap()); - Tile::deadBush = static_cast((new DeadBushTile(32))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"deadbush")->setDescriptionId(IDS_TILE_DEAD_BUSH)->setUseDescriptionId(IDS_DESC_DEAD_BUSH)->disableMipmap()); - Tile::pistonBase = static_cast((new PistonBaseTile(33, false))->setBaseItemTypeAndMaterial(Item::eBaseItemType_piston, Item::eMaterial_piston)->setIconName(L"pistonBase")->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(IDS_DESC_PISTON)->sendTileData()); - Tile::pistonExtension = static_cast((new PistonExtensionTile(34))->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(-1)->sendTileData()); + Tile::tallgrass = (TallGrass *)(new TallGrass(31)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"tallgrass")->setDescriptionId(IDS_TILE_TALL_GRASS)->setUseDescriptionId(IDS_DESC_TALL_GRASS)->disableMipmap(); + Tile::deadBush = (DeadBushTile *)(new DeadBushTile(32)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"deadbush")->setDescriptionId(IDS_TILE_DEAD_BUSH)->setUseDescriptionId(IDS_DESC_DEAD_BUSH)->disableMipmap(); + Tile::pistonBase = (PistonBaseTile *)(new PistonBaseTile(33,false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_piston, Item::eMaterial_piston)->setIconName(L"pistonBase")->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(IDS_DESC_PISTON)->sendTileData(); + Tile::pistonExtension = (PistonExtensionTile *)(new PistonExtensionTile(34))->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(-1)->sendTileData(); Tile::wool = (new ColoredTile(35, Material::cloth)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_cloth, Item::eMaterial_cloth)->setDestroyTime(0.8f)->setSoundType(Tile::SOUND_CLOTH)->setIconName(L"wool_colored")->setDescriptionId(IDS_TILE_CLOTH)->sendTileData()->setUseDescriptionId(IDS_DESC_WOOL); - Tile::pistonMovingPiece = static_cast((new PistonMovingPiece(36))->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(-1)); - Tile::flower = static_cast((new Bush(37))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_dandelion")->setDescriptionId(IDS_TILE_FLOWER)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap()); - Tile::rose = static_cast((new Bush(38))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap()); - Tile::mushroom_brown = static_cast((new Mushroom(39))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setLightEmission(2 / 16.0f)->setIconName(L"mushroom_brown")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap()); - Tile::mushroom_red = static_cast((new Mushroom(40))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"mushroom_red")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap()); + Tile::pistonMovingPiece = (PistonMovingPiece *)(new PistonMovingPiece(36)) ->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(-1); + Tile::flower = (Bush *) (new Bush(37)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_dandelion")->setDescriptionId(IDS_TILE_FLOWER)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap(); + Tile::rose = (Bush *) (new Bush(38)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER)->disableMipmap(); + Tile::mushroom_brown = (Bush *) (new Mushroom(39)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setLightEmission(2 / 16.0f)->setIconName(L"mushroom_brown")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap(); + Tile::mushroom_red = (Bush *) (new Mushroom(40)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"mushroom_red")->setDescriptionId(IDS_TILE_MUSHROOM)->setUseDescriptionId(IDS_DESC_MUSHROOM)->disableMipmap(); Tile::goldBlock = (new MetalTile(41)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_gold)->setDestroyTime(3.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_METAL)->setIconName(L"gold_block")->setDescriptionId(IDS_TILE_BLOCK_GOLD)->setUseDescriptionId(IDS_DESC_BLOCK_GOLD); Tile::ironBlock = (new MetalTile(42)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_iron)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_METAL)->setIconName(L"iron_block")->setDescriptionId(IDS_TILE_BLOCK_IRON)->setUseDescriptionId(IDS_DESC_BLOCK_IRON); - Tile::stoneSlab = static_cast((new StoneSlabTile(Tile::stoneSlab_Id, true))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_SLAB)); - Tile::stoneSlabHalf = static_cast((new StoneSlabTile(Tile::stoneSlabHalf_Id, false))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_HALFSLAB)); + Tile::stoneSlab = (HalfSlabTile *) (new StoneSlabTile(Tile::stoneSlab_Id, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_SLAB); + Tile::stoneSlabHalf = (HalfSlabTile *) (new StoneSlabTile(Tile::stoneSlabHalf_Id, false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_HALFSLAB); Tile::redBrick = (new Tile(45, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_brick)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"brick")->setDescriptionId(IDS_TILE_BRICK)->setUseDescriptionId(IDS_DESC_BRICK); Tile::tnt = (new TntTile(46)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"tnt")->setDescriptionId(IDS_TILE_TNT)->setUseDescriptionId(IDS_DESC_TNT); Tile::bookshelf = (new BookshelfTile(47)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_paper, Item::eMaterial_bookshelf)->setDestroyTime(1.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"bookshelf")->setDescriptionId(IDS_TILE_BOOKSHELF)->setUseDescriptionId(IDS_DESC_BOOKSHELF); @@ -314,11 +314,11 @@ void Tile::staticCtor() Tile::obsidian = (new ObsidianTile(49)) ->setDestroyTime(50.0f)->setExplodeable(2000)->setSoundType(Tile::SOUND_STONE)->setIconName(L"obsidian")->setDescriptionId(IDS_TILE_OBSIDIAN)->setUseDescriptionId(IDS_DESC_OBSIDIAN); Tile::torch = (new TorchTile(50)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_wood)->setDestroyTime(0.0f)->setLightEmission(15 / 16.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"torch_on")->setDescriptionId(IDS_TILE_TORCH)->setUseDescriptionId(IDS_DESC_TORCH)->disableMipmap(); - Tile::fire = static_cast(((new FireTile(51))->setDestroyTime(0.0f)->setLightEmission(1.0f)->setSoundType(Tile::SOUND_WOOD))->setIconName(L"fire")->setDescriptionId(IDS_TILE_FIRE)->setNotCollectStatistics()->setUseDescriptionId(-1)); + Tile::fire = (FireTile *) ((new FireTile(51)) ->setDestroyTime(0.0f)->setLightEmission(1.0f)->setSoundType(Tile::SOUND_WOOD))->setIconName(L"fire")->setDescriptionId(IDS_TILE_FIRE)->setNotCollectStatistics()->setUseDescriptionId(-1); Tile::mobSpawner = (new MobSpawnerTile(52)) ->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"mob_spawner")->setDescriptionId(IDS_TILE_MOB_SPAWNER)->setNotCollectStatistics()->setUseDescriptionId(IDS_DESC_MOB_SPAWNER); Tile::stairs_wood = (new StairTile(53, Tile::wood,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_wood) ->setIconName(L"stairsWood")->setDescriptionId(IDS_TILE_STAIRS_WOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::chest = static_cast((new ChestTile(54, ChestTile::TYPE_BASIC))->setBaseItemTypeAndMaterial(Item::eBaseItemType_chest, Item::eMaterial_wood)->setDestroyTime(2.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"chest")->setDescriptionId(IDS_TILE_CHEST)->sendTileData()->setUseDescriptionId(IDS_DESC_CHEST)); - Tile::redStoneDust = static_cast((new RedStoneDustTile(55))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_NORMAL)->setIconName(L"redstone_dust")->setDescriptionId(IDS_TILE_REDSTONE_DUST)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONE_DUST)); + Tile::chest = (ChestTile *)(new ChestTile(54, ChestTile::TYPE_BASIC)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_chest, Item::eMaterial_wood)->setDestroyTime(2.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"chest")->setDescriptionId(IDS_TILE_CHEST)->sendTileData()->setUseDescriptionId(IDS_DESC_CHEST); + Tile::redStoneDust = (RedStoneDustTile *)(new RedStoneDustTile(55)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_NORMAL)->setIconName(L"redstone_dust")->setDescriptionId(IDS_TILE_REDSTONE_DUST)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONE_DUST); Tile::diamondOre = (new OreTile(56)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"diamond_ore")->setDescriptionId(IDS_TILE_ORE_DIAMOND)->setUseDescriptionId(IDS_DESC_ORE_DIAMOND); Tile::diamondBlock = (new MetalTile(57)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_diamond)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_METAL)->setIconName(L"diamond_block")->setDescriptionId(IDS_TILE_BLOCK_DIAMOND)->setUseDescriptionId(IDS_DESC_BLOCK_DIAMOND); Tile::workBench = (new WorkbenchTile(58)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_device, Item::eMaterial_wood)->setDestroyTime(2.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"crafting_table")->setDescriptionId(IDS_TILE_WORKBENCH)->setUseDescriptionId(IDS_DESC_CRAFTINGTABLE); @@ -356,12 +356,12 @@ void Tile::staticCtor() Tile::netherRack = (new NetherrackTile(87)) ->setDestroyTime(0.4f)->setSoundType(Tile::SOUND_STONE)->setIconName(L"netherrack")->setDescriptionId(IDS_TILE_HELL_ROCK)->setUseDescriptionId(IDS_DESC_HELL_ROCK); Tile::soulsand = (new SoulSandTile(88)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_SAND)->setIconName(L"soul_sand")->setDescriptionId(IDS_TILE_HELL_SAND)->setUseDescriptionId(IDS_DESC_HELL_SAND); Tile::glowstone = (new Glowstonetile(89, Material::glass)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_glowstone)->setDestroyTime(0.3f)->setSoundType(Tile::SOUND_GLASS)->setLightEmission(1.0f)->setIconName(L"glowstone")->setDescriptionId(IDS_TILE_LIGHT_GEM)->setUseDescriptionId(IDS_DESC_GLOWSTONE); - Tile::portalTile = static_cast(((new PortalTile(90))->setDestroyTime(-1)->setSoundType(Tile::SOUND_GLASS)->setLightEmission(0.75f))->setIconName(L"portal")->setDescriptionId(IDS_TILE_PORTAL)->setUseDescriptionId(IDS_DESC_PORTAL)); + Tile::portalTile = (PortalTile *) ((new PortalTile(90)) ->setDestroyTime(-1)->setSoundType(Tile::SOUND_GLASS)->setLightEmission(0.75f))->setIconName(L"portal")->setDescriptionId(IDS_TILE_PORTAL)->setUseDescriptionId(IDS_DESC_PORTAL); Tile::litPumpkin = (new PumpkinTile(91, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_torch, Item::eMaterial_pumpkin)->setDestroyTime(1.0f)->setSoundType(Tile::SOUND_WOOD)->setLightEmission(1.0f)->setIconName(L"pumpkin")->setDescriptionId(IDS_TILE_LIT_PUMPKIN)->sendTileData()->setUseDescriptionId(IDS_DESC_JACKOLANTERN); Tile::cake = (new CakeTile(92)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_CLOTH)->setIconName(L"cake")->setDescriptionId(IDS_TILE_CAKE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_CAKE); - Tile::diode_off = static_cast((new RepeaterTile(93, false))->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"repeater_off")->setDescriptionId(IDS_ITEM_DIODE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER)->disableMipmap()); - Tile::diode_on = static_cast((new RepeaterTile(94, true))->setDestroyTime(0.0f)->setLightEmission(10 / 16.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"repeater_on")->setDescriptionId(IDS_ITEM_DIODE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER)->disableMipmap()); + Tile::diode_off = (RepeaterTile *)(new RepeaterTile(93, false)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"repeater_off")->setDescriptionId(IDS_ITEM_DIODE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER)->disableMipmap(); + Tile::diode_on = (RepeaterTile *)(new RepeaterTile(94, true)) ->setDestroyTime(0.0f)->setLightEmission(10 / 16.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"repeater_on")->setDescriptionId(IDS_ITEM_DIODE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER)->disableMipmap(); Tile::stained_glass = (new StainedGlassBlock(95, Material::glass))->setBaseItemTypeAndMaterial(Item::eBaseItemType_glass, Item::eMaterial_glass)->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"glass")->setDescriptionId(IDS_TILE_STAINED_GLASS)->setUseDescriptionId(IDS_DESC_STAINED_GLASS); Tile::trapdoor = (new TrapDoorTile(96, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_trap)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"trapdoor")->setDescriptionId(IDS_TILE_TRAPDOOR)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_TRAPDOOR); Tile::monsterStoneEgg = (new StoneMonsterTile(97)) ->setDestroyTime(0.75f)->setIconName(L"monsterStoneEgg")->setDescriptionId(IDS_TILE_STONE_SILVERFISH)->setUseDescriptionId(IDS_DESC_STONE_SILVERFISH); @@ -379,7 +379,7 @@ void Tile::staticCtor() Tile::fenceGate = (new FenceGateTile(107)) ->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); Tile::stairs_bricks = (new StairTile(108, Tile::redBrick,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_brick) ->setIconName(L"stairsBrick")->setDescriptionId(IDS_TILE_STAIRS_BRICKS) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::stairs_stoneBrickSmooth = (new StairTile(109, Tile::stoneBrick,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_stoneSmooth)->setIconName(L"stairsStoneBrickSmooth")->setDescriptionId(IDS_TILE_STAIRS_STONE_BRICKS_SMOOTH) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::mycel = static_cast((new MycelTile(110))->setDestroyTime(0.6f)->setSoundType(SOUND_GRASS)->setIconName(L"mycelium")->setDescriptionId(IDS_TILE_MYCEL)->setUseDescriptionId(IDS_DESC_MYCEL)); + Tile::mycel = (MycelTile *)(new MycelTile(110)) ->setDestroyTime(0.6f)->setSoundType(SOUND_GRASS)->setIconName(L"mycelium")->setDescriptionId(IDS_TILE_MYCEL)->setUseDescriptionId(IDS_DESC_MYCEL); Tile::waterLily = (new WaterlilyTile(111)) ->setDestroyTime(0.0f)->setSoundType(SOUND_GRASS)->setIconName(L"waterlily")->setDescriptionId(IDS_TILE_WATERLILY)->setUseDescriptionId(IDS_DESC_WATERLILY); Tile::netherBrick = (new Tile(112, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_netherbrick)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"nether_brick")->setDescriptionId(IDS_TILE_NETHERBRICK)->setUseDescriptionId(IDS_DESC_NETHERBRICK); @@ -388,7 +388,7 @@ void Tile::staticCtor() Tile::netherStalk = (new NetherWartTile(115)) ->setIconName(L"nether_wart")->setDescriptionId(IDS_TILE_NETHERSTALK)->sendTileData()->setUseDescriptionId(IDS_DESC_NETHERSTALK); Tile::enchantTable = (new EnchantmentTableTile(116)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_device, Item::eMaterial_magic)->setDestroyTime(5.0f)->setExplodeable(2000)->setIconName(L"enchanting_table")->setDescriptionId(IDS_TILE_ENCHANTMENTTABLE)->setUseDescriptionId(IDS_DESC_ENCHANTMENTTABLE); Tile::brewingStand = (new BrewingStandTile(117)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_device, Item::eMaterial_blaze)->setDestroyTime(0.5f)->setLightEmission(2 / 16.0f)->setIconName(L"brewing_stand")->setDescriptionId(IDS_TILE_BREWINGSTAND)->sendTileData()->setUseDescriptionId(IDS_DESC_BREWING_STAND); - Tile::cauldron = static_cast((new CauldronTile(118))->setDestroyTime(2.0f)->setIconName(L"cauldron")->setDescriptionId(IDS_TILE_CAULDRON)->sendTileData()->setUseDescriptionId(IDS_DESC_CAULDRON)); + Tile::cauldron = (CauldronTile *)(new CauldronTile(118)) ->setDestroyTime(2.0f)->setIconName(L"cauldron")->setDescriptionId(IDS_TILE_CAULDRON)->sendTileData()->setUseDescriptionId(IDS_DESC_CAULDRON); Tile::endPortalTile = (new TheEndPortal(119, Material::portal)) ->setDestroyTime(INDESTRUCTIBLE_DESTROY_TIME)->setExplodeable(6000000)->setDescriptionId(IDS_TILE_END_PORTAL)->setUseDescriptionId(IDS_DESC_END_PORTAL); Tile::endPortalFrameTile = (new TheEndPortalFrameTile(120)) ->setSoundType(SOUND_GLASS)->setLightEmission(2 / 16.0f)->setDestroyTime(INDESTRUCTIBLE_DESTROY_TIME)->setIconName(L"endframe")->setDescriptionId(IDS_TILE_ENDPORTALFRAME)->sendTileData()->setExplodeable(6000000)->setUseDescriptionId(IDS_DESC_ENDPORTALFRAME); @@ -396,22 +396,22 @@ void Tile::staticCtor() Tile::dragonEgg = (new EggTile(122)) ->setDestroyTime(3.0f)->setExplodeable(15)->setSoundType(SOUND_STONE)->setLightEmission(2.0f / 16.0f)->setIconName(L"dragon_egg")->setDescriptionId(IDS_TILE_DRAGONEGG)->setUseDescriptionId(IDS_DESC_DRAGONEGG); Tile::redstoneLight = (new RedlightTile(123, false)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"redstone_lamp_off")->setDescriptionId(IDS_TILE_REDSTONE_LIGHT)->setUseDescriptionId(IDS_DESC_REDSTONE_LIGHT); Tile::redstoneLight_lit = (new RedlightTile(124, true)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"redstone_lamp_on")->setDescriptionId(IDS_TILE_REDSTONE_LIGHT)->setUseDescriptionId(IDS_DESC_REDSTONE_LIGHT); - Tile::woodSlab = static_cast((new WoodSlabTile(Tile::woodSlab_Id, true))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); - Tile::woodSlabHalf = static_cast((new WoodSlabTile(Tile::woodSlabHalf_Id, false))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); + Tile::woodSlab = (HalfSlabTile *) (new WoodSlabTile(Tile::woodSlab_Id, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB); + Tile::woodSlabHalf = (HalfSlabTile *) (new WoodSlabTile(Tile::woodSlabHalf_Id, false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB); Tile::cocoa = (new CocoaTile(127)) ->setDestroyTime(0.2f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"cocoa")->sendTileData()->setDescriptionId(IDS_TILE_COCOA)->setUseDescriptionId(IDS_DESC_COCOA); Tile::stairs_sandstone = (new StairTile(128, Tile::sandStone,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sand) ->setIconName(L"stairsSandstone")->setDescriptionId(IDS_TILE_STAIRS_SANDSTONE) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::emeraldOre = (new OreTile(129)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(SOUND_STONE)->setIconName(L"emerald_ore")->setDescriptionId(IDS_TILE_EMERALDORE)->setUseDescriptionId(IDS_DESC_EMERALDORE); Tile::enderChest = (new EnderChestTile(130)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_chest, Item::eMaterial_ender)->setDestroyTime(22.5f)->setExplodeable(1000)->setSoundType(SOUND_STONE)->setIconName(L"enderChest")->sendTileData()->setLightEmission(.5f)->setDescriptionId(IDS_TILE_ENDERCHEST)->setUseDescriptionId(IDS_DESC_ENDERCHEST); - Tile::tripWireSource = static_cast((new TripWireSourceTile(131))->setBaseItemTypeAndMaterial(Item::eBaseItemType_lever, Item::eMaterial_undefined)->setIconName(L"trip_wire_source")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE_SOURCE)->setUseDescriptionId(IDS_DESC_TRIPWIRE_SOURCE)); + Tile::tripWireSource = (TripWireSourceTile *)( new TripWireSourceTile(131) ) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_lever, Item::eMaterial_undefined)->setIconName(L"trip_wire_source")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE_SOURCE)->setUseDescriptionId(IDS_DESC_TRIPWIRE_SOURCE); Tile::tripWire = (new TripWireTile(132)) ->setIconName(L"trip_wire")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE)->setUseDescriptionId(IDS_DESC_TRIPWIRE); Tile::emeraldBlock = (new MetalTile(133)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_emerald)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setIconName(L"emerald_block")->setDescriptionId(IDS_TILE_EMERALDBLOCK)->setUseDescriptionId(IDS_DESC_EMERALDBLOCK); Tile::woodStairsDark = (new StairTile(134, Tile::wood, TreeTile::DARK_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sprucewood)->setIconName(L"stairsWoodSpruce")->setDescriptionId(IDS_TILE_STAIRS_SPRUCEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::woodStairsBirch = (new StairTile(135, Tile::wood, TreeTile::BIRCH_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_birchwood)->setIconName(L"stairsWoodBirch")->setDescriptionId(IDS_TILE_STAIRS_BIRCHWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::woodStairsJungle =(new StairTile(136, Tile::wood, TreeTile::JUNGLE_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_junglewood)->setIconName(L"stairsWoodJungle")->setDescriptionId(IDS_TILE_STAIRS_JUNGLEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::commandBlock = (new CommandBlock(137)) ->setIndestructible()->setExplodeable(6000000)->setIconName(L"command_block")->setDescriptionId(IDS_TILE_COMMAND_BLOCK)->setUseDescriptionId(IDS_DESC_COMMAND_BLOCK); - Tile::beacon = static_cast((new BeaconTile(138))->setLightEmission(1.0f)->setIconName(L"beacon")->setDescriptionId(IDS_TILE_BEACON)->setUseDescriptionId(IDS_DESC_BEACON)); + Tile::beacon = (BeaconTile *) (new BeaconTile(138)) ->setLightEmission(1.0f)->setIconName(L"beacon")->setDescriptionId(IDS_TILE_BEACON)->setUseDescriptionId(IDS_DESC_BEACON); Tile::cobbleWall = (new WallTile(139, Tile::stoneBrick)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_stone)->setIconName(L"cobbleWall")->setDescriptionId(IDS_TILE_COBBLESTONE_WALL)->setUseDescriptionId(IDS_DESC_COBBLESTONE_WALL); Tile::flowerPot = (new FlowerPotTile(140)) ->setDestroyTime(0.0f)->setSoundType(SOUND_NORMAL)->setIconName(L"flower_pot")->setDescriptionId(IDS_TILE_FLOWERPOT)->setUseDescriptionId(IDS_DESC_FLOWERPOT); @@ -423,13 +423,13 @@ void Tile::staticCtor() Tile::chest_trap = (new ChestTile(146, ChestTile::TYPE_TRAP)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_chest, Item::eMaterial_trap)->setDestroyTime(2.5f)->setSoundType(SOUND_WOOD)->setDescriptionId(IDS_TILE_CHEST_TRAP)->setUseDescriptionId(IDS_DESC_CHEST_TRAP); Tile::weightedPlate_light = (new WeightedPressurePlateTile(147, L"gold_block", Material::metal, Redstone::SIGNAL_MAX)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_pressureplate, Item::eMaterial_gold)->setDestroyTime(0.5f)->setSoundType(SOUND_WOOD)->setDescriptionId(IDS_TILE_WEIGHTED_PLATE_LIGHT)->setUseDescriptionId(IDS_DESC_WEIGHTED_PLATE_LIGHT); Tile::weightedPlate_heavy = (new WeightedPressurePlateTile(148, L"iron_block", Material::metal, Redstone::SIGNAL_MAX * 10))->setBaseItemTypeAndMaterial(Item::eBaseItemType_pressureplate, Item::eMaterial_iron)->setDestroyTime(0.5f)->setSoundType(SOUND_WOOD)->setDescriptionId(IDS_TILE_WEIGHTED_PLATE_HEAVY)->setUseDescriptionId(IDS_DESC_WEIGHTED_PLATE_HEAVY); - Tile::comparator_off = static_cast((new ComparatorTile(149, false))->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_off")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR)); - Tile::comparator_on = static_cast((new ComparatorTile(150, true))->setDestroyTime(0.0f)->setLightEmission(10 / 16.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_on")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR)); + Tile::comparator_off = (ComparatorTile *) (new ComparatorTile(149, false)) ->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_off")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR); + Tile::comparator_on = (ComparatorTile *) (new ComparatorTile(150, true)) ->setDestroyTime(0.0f)->setLightEmission(10 / 16.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_on")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR); - Tile::daylightDetector = static_cast((new DaylightDetectorTile(151))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR)); + Tile::daylightDetector = (DaylightDetectorTile *) (new DaylightDetectorTile(151))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR); Tile::redstoneBlock = (new PoweredMetalTile(152)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_redstone)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setIconName(L"redstone_block")->setDescriptionId(IDS_TILE_REDSTONE_BLOCK)->setUseDescriptionId(IDS_DESC_REDSTONE_BLOCK); Tile::netherQuartz = (new OreTile(153)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(SOUND_STONE)->setIconName(L"quartz_ore")->setDescriptionId(IDS_TILE_NETHER_QUARTZ)->setUseDescriptionId(IDS_DESC_NETHER_QUARTZ_ORE); - Tile::hopper = static_cast((new HopperTile(154))->setBaseItemTypeAndMaterial(Item::eBaseItemType_redstoneContainer, Item::eMaterial_undefined)->setDestroyTime(3.0f)->setExplodeable(8)->setSoundType(SOUND_WOOD)->setIconName(L"hopper")->setDescriptionId(IDS_TILE_HOPPER)->setUseDescriptionId(IDS_DESC_HOPPER)); + Tile::hopper = (HopperTile *)(new HopperTile(154)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_redstoneContainer, Item::eMaterial_undefined)->setDestroyTime(3.0f)->setExplodeable(8)->setSoundType(SOUND_WOOD)->setIconName(L"hopper")->setDescriptionId(IDS_TILE_HOPPER)->setUseDescriptionId(IDS_DESC_HOPPER); Tile::quartzBlock = (new QuartzBlockTile(155)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_quartz)->setSoundType(SOUND_STONE)->setDestroyTime(0.8f)->setIconName(L"quartz_block")->setDescriptionId(IDS_TILE_QUARTZ_BLOCK)->setUseDescriptionId(IDS_DESC_QUARTZ_BLOCK); Tile::stairs_quartz = (new StairTile(156, Tile::quartzBlock, QuartzBlockTile::TYPE_DEFAULT)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_quartz)->setIconName(L"stairsQuartz")->setDescriptionId(IDS_TILE_STAIRS_QUARTZ)->setUseDescriptionId(IDS_DESC_STAIRS); Tile::activatorRail = (new PoweredRailTile(157)) ->setDestroyTime(0.7f)->setSoundType(SOUND_METAL)->setIconName(L"rail_activator")->setDescriptionId(IDS_TILE_ACTIVATOR_RAIL)->setUseDescriptionId(IDS_DESC_ACTIVATOR_RAIL); @@ -464,7 +464,7 @@ void Tile::staticCtor() Item::items[vine_Id] = ( new ColoredTileItem(Tile::vine_Id - 256, false))->setDescriptionId(IDS_TILE_VINE)->setUseDescriptionId(IDS_DESC_VINE); int idsData[3] = {IDS_TILE_SHRUB, IDS_TILE_TALL_GRASS, IDS_TILE_FERN}; intArray ids = intArray(idsData, 3); - Item::items[tallgrass_Id] = static_cast((new ColoredTileItem(Tile::tallgrass_Id - 256, true))->setDescriptionId(IDS_TILE_TALL_GRASS))->setDescriptionPostfixes(ids); + Item::items[tallgrass_Id] = ( (ColoredTileItem *)(new ColoredTileItem(Tile::tallgrass_Id - 256, true))->setDescriptionId(IDS_TILE_TALL_GRASS))->setDescriptionPostfixes(ids); Item::items[topSnow_Id] = ( new SnowItem(topSnow_Id - 256, topSnow) ); Item::items[waterLily_Id] = ( new WaterLilyTileItem(Tile::waterLily_Id - 256)); Item::items[pistonBase_Id] = ( new PistonTileItem(Tile::pistonBase_Id - 256) )->setDescriptionId(IDS_TILE_PISTON_BASE)->setUseDescriptionId(IDS_DESC_PISTON); @@ -475,9 +475,9 @@ void Tile::staticCtor() for (int i = 0; i < 256; i++) { - if ( Tile::tiles[i] != nullptr ) + if ( Tile::tiles[i] != NULL ) { - if( Item::items[i] == nullptr) + if( Item::items[i] == NULL) { Item::items[i] = new TileItem(i - 256); Tile::tiles[i]->init(); @@ -485,7 +485,7 @@ void Tile::staticCtor() bool propagate = false; if (i > 0 && Tile::tiles[i]->getRenderShape() == Tile::SHAPE_STAIRS) propagate = true; - if (i > 0 && dynamic_cast(Tile::tiles[i]) != nullptr) + if (i > 0 && dynamic_cast(Tile::tiles[i]) != NULL) { propagate = true; } @@ -549,7 +549,7 @@ Tile::Tile(int id, Material *material, bool isSolidRender) _init(id,material, isSolidRender); m_iMaterial=Item::eMaterial_undefined; m_iBaseItemType=Item::eBaseItemType_undefined; - icon = nullptr; + icon = NULL; } Tile *Tile::sendTileData(unsigned char importantMask/*=15*/) @@ -597,7 +597,7 @@ Tile *Tile::setLightBlock(int i) Tile *Tile::setLightEmission(float f) { - Tile::lightEmission[id] = static_cast(Level::MAX_BRIGHTNESS * f); + Tile::lightEmission[id] = (int) (Level::MAX_BRIGHTNESS * f); return this; } @@ -610,7 +610,7 @@ Tile *Tile::setExplodeable(float explosionResistance) bool Tile::isSolidBlockingTile(int t) { Tile *tile = Tile::tiles[t]; - if (tile == nullptr) return false; + if (tile == NULL) return false; return tile->material->isSolidBlocking() && tile->isCubeShaped() && !tile->isSignalSource(); } @@ -671,7 +671,7 @@ Tile *Tile::disableMipmap() void Tile::setShape(float x0, float y0, float z0, float x1, float y1, float z1) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); tls->xx0 = x0; tls->yy0 = y0; tls->zz0 = z0; @@ -721,7 +721,7 @@ bool Tile::isFaceVisible(Level *level, int x, int y, int z, int f) bool Tile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); if (face == 0 && tls->yy0 > 0) return true; @@ -738,7 +738,7 @@ int Tile::getFaceFlags(LevelSource *level, int x, int y, int z) { int faceFlags = 0; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); @@ -779,13 +779,13 @@ Icon *Tile::getTexture(LevelSource *level, int x, int y, int z, int face) for( int i = 0; (i < 6) && opaque; i++ ) { int t = level->getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) { opaque = false; } } - Icon *icon = nullptr; + Icon *icon = NULL; if(opaque) { Tile::leaves->setFancy(false); @@ -813,7 +813,7 @@ Icon *Tile::getTexture(int face) AABB *Tile::getTileAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -822,12 +822,12 @@ AABB *Tile::getTileAABB(Level *level, int x, int y, int z) void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) { AABB *aabb = getAABB(level, x, y, z); - if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); + if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); } AABB *Tile::getAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -917,7 +917,7 @@ void Tile::spawnResources(Level *level, int x, int y, int z, int data, float odd int type = getResource(data, level->random, playerBonusLevel); if (type <= 0) continue; - popResource(level, x, y, z, std::make_shared(type, 1, getSpawnResourcesAuxValue(data))); + popResource(level, x, y, z, shared_ptr( new ItemInstance(type, 1, getSpawnResourcesAuxValue(data) ) ) ); } } @@ -929,7 +929,7 @@ void Tile::popResource(Level *level, int x, int y, int z, shared_ptrrandom->nextFloat() * s + (1 - s) * 0.5; double yo = level->random->nextFloat() * s + (1 - s) * 0.5; double zo = level->random->nextFloat() * s + (1 - s) * 0.5; - shared_ptr item = std::make_shared(level, x + xo, y + yo, z + zo, itemInstance); + shared_ptr item = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, itemInstance ) ); item->throwTime = 10; level->addEntity(item); } @@ -943,7 +943,7 @@ void Tile::popExperience(Level *level, int x, int y, int z, int amount) { int newCount = ExperienceOrb::getExperienceValue(amount); amount -= newCount; - level->addEntity(std::make_shared(level, x + .5, y + .5, z + .5, newCount)); + level->addEntity(shared_ptr( new ExperienceOrb(level, x + .5, y + .5, z + .5, newCount))); } } } @@ -965,7 +965,7 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) a = a->add(-xt, -yt, -zt); b = b->add(-xt, -yt, -zt); - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); Vec3 *xh0 = a->clipX(b, tls->xx0); Vec3 *xh1 = a->clipX(b, tls->xx1); @@ -975,16 +975,16 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) Vec3 *zh0 = a->clipZ(b, tls->zz0); Vec3 *zh1 = a->clipZ(b, tls->zz1); - Vec3 *closest = nullptr; + Vec3 *closest = NULL; - if (containsX(xh0) && (closest == nullptr || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; - if (containsX(xh1) && (closest == nullptr || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; - if (containsY(yh0) && (closest == nullptr || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; - if (containsY(yh1) && (closest == nullptr || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; - if (containsZ(zh0) && (closest == nullptr || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; - if (containsZ(zh1) && (closest == nullptr || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; + if (containsX(xh0) && (closest == NULL || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; + if (containsX(xh1) && (closest == NULL || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; + if (containsY(yh0) && (closest == NULL || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; + if (containsY(yh1) && (closest == NULL || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; + if (containsZ(zh0) && (closest == NULL || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; + if (containsZ(zh1) && (closest == NULL || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; - if (closest == nullptr) return nullptr; + if (closest == NULL) return NULL; int face = -1; @@ -1000,9 +1000,9 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) bool Tile::containsX(Vec3 *v) { - if( v == nullptr) return false; + if( v == NULL) return false; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->y >= tls->yy0 && v->y <= tls->yy1 && v->z >= tls->zz0 && v->z <= tls->zz1; @@ -1010,9 +1010,9 @@ bool Tile::containsX(Vec3 *v) bool Tile::containsY(Vec3 *v) { - if( v == nullptr) return false; + if( v == NULL) return false; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->x >= tls->xx0 && v->x <= tls->xx1 && v->z >= tls->zz0 && v->z <= tls->zz1; @@ -1020,9 +1020,9 @@ bool Tile::containsY(Vec3 *v) bool Tile::containsZ(Vec3 *v) { - if( v == nullptr) return false; + if( v == NULL) return false; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return v->x >= tls->xx0 && v->x <= tls->xx1 && v->y >= tls->yy0 && v->y <= tls->yy1; @@ -1092,14 +1092,14 @@ void Tile::handleEntityInside(Level *level, int x, int y, int z, shared_ptr forceEntity) // 4J added forceData, forceEntity param { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); } double Tile::getShapeX0() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->xx0; @@ -1107,7 +1107,7 @@ double Tile::getShapeX0() double Tile::getShapeX1() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->xx1; @@ -1115,7 +1115,7 @@ double Tile::getShapeX1() double Tile::getShapeY0() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->yy0; @@ -1123,7 +1123,7 @@ double Tile::getShapeY0() double Tile::getShapeY1() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->yy1; @@ -1131,7 +1131,7 @@ double Tile::getShapeY1() double Tile::getShapeZ0() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->zz0; @@ -1139,7 +1139,7 @@ double Tile::getShapeZ0() double Tile::getShapeZ1() { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return tls->zz1; @@ -1194,7 +1194,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, // 4J Stu - Special case - only record a crop destroy if is fully grown if( id==Tile::wheat_Id ) { - if( Tile::wheat->getResource(data, nullptr, 0) > 0 ) + if( Tile::wheat->getResource(data, NULL, 0) > 0 ) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1202,7 +1202,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, } else if (id == Tile::potatoes_Id) { - if (Tile::potatoes->getResource(data, nullptr, 0) > 0) + if (Tile::potatoes->getResource(data, NULL, 0) > 0) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1210,7 +1210,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, } else if (id == Tile::carrots_Id) { - if (Tile::potatoes->getResource(data, nullptr, 0) > 0) + if (Tile::potatoes->getResource(data, NULL, 0) > 0) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1233,7 +1233,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player)) { shared_ptr item = getSilkTouchItemInstance(data); - if (item != nullptr) + if (item != NULL) { popResource(level, x, y, z, item); } @@ -1257,7 +1257,7 @@ shared_ptr Tile::getSilkTouchItemInstance(int data) { popData = data; } - return std::make_shared(id, 1, popData); + return shared_ptr(new ItemInstance(id, 1, popData)); } int Tile::getResourceCountForLootBonus(int bonusLevel, Random *random) @@ -1388,7 +1388,7 @@ bool Tile::isMatching(int tileIdA, int tileIdB) { return true; } - if (tileIdA == 0 || tileIdB == 0 || tiles[tileIdA] == nullptr || tiles[tileIdB] == nullptr) + if (tileIdA == 0 || tileIdB == 0 || tiles[tileIdA] == NULL || tiles[tileIdB] == NULL) { return false; } diff --git a/Minecraft.World/TileDestructionPacket.h b/Minecraft.World/TileDestructionPacket.h index 76509349..20cd7db9 100644 --- a/Minecraft.World/TileDestructionPacket.h +++ b/Minecraft.World/TileDestructionPacket.h @@ -30,6 +30,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TileDestructionPacket()); } virtual int getId() { return 55; } }; \ No newline at end of file diff --git a/Minecraft.World/TileEditorOpenPacket.h b/Minecraft.World/TileEditorOpenPacket.h index ee68a6cf..20a731bb 100644 --- a/Minecraft.World/TileEditorOpenPacket.h +++ b/Minecraft.World/TileEditorOpenPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TileEditorOpenPacket()); } virtual int getId() { return 133; } }; \ No newline at end of file diff --git a/Minecraft.World/TileEntity.cpp b/Minecraft.World/TileEntity.cpp index 1fff44bb..1eb9cab2 100644 --- a/Minecraft.World/TileEntity.cpp +++ b/Minecraft.World/TileEntity.cpp @@ -46,11 +46,11 @@ void TileEntity::setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id TileEntity::TileEntity() { - level = nullptr; + level = NULL; x = y = z = 0; remove = false; data = -1; - tile = nullptr; + tile = NULL; renderRemoveStage = e_RenderRemoveStageKeep; } @@ -66,7 +66,7 @@ void TileEntity::setLevel(Level *level) bool TileEntity::hasLevel() { - return level != nullptr; + return level != NULL; } void TileEntity::load(CompoundTag *tag) @@ -101,7 +101,7 @@ shared_ptr TileEntity::loadStatic(CompoundTag *tag) auto it = idCreateMap.find(tag->getString(L"id")); if (it != idCreateMap.end()) entity = shared_ptr(it->second()); - if (entity != nullptr) + if (entity != NULL) { entity->load(tag); } @@ -129,11 +129,11 @@ void TileEntity::setData(int data, int updateFlags) void TileEntity::setChanged() { - if (level != nullptr) + if (level != NULL) { data = level->getData(x, y, z); level->tileEntityChanged(x, y, z, shared_from_this()); - if (getTile() != nullptr) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id); + if (getTile() != NULL) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id); } } @@ -152,7 +152,7 @@ double TileEntity::getViewDistance() Tile *TileEntity::getTile() { - if( tile == nullptr ) tile = Tile::tiles[level->getTile(x, y, z)]; + if( tile == NULL ) tile = Tile::tiles[level->getTile(x, y, z)]; return tile; } @@ -183,7 +183,7 @@ bool TileEntity::triggerEvent(int b0, int b1) void TileEntity::clearCache() { - tile = nullptr; + tile = NULL; data = -1; } diff --git a/Minecraft.World/TileEntityDataPacket.cpp b/Minecraft.World/TileEntityDataPacket.cpp index a30f7873..41be4526 100644 --- a/Minecraft.World/TileEntityDataPacket.cpp +++ b/Minecraft.World/TileEntityDataPacket.cpp @@ -10,7 +10,7 @@ void TileEntityDataPacket::_init() { x = y = z = 0; type = TYPE_MOB_SPAWNER; - tag = nullptr; + tag = NULL; } @@ -50,7 +50,7 @@ void TileEntityDataPacket::write(DataOutputStream *dos) dos->writeInt(x); dos->writeShort(y); dos->writeInt(z); - dos->writeByte(static_cast(type)); + dos->writeByte((byte) type); writeNbt(tag, dos); } diff --git a/Minecraft.World/TileEntityDataPacket.h b/Minecraft.World/TileEntityDataPacket.h index 6fe3bf89..2ee998f3 100644 --- a/Minecraft.World/TileEntityDataPacket.h +++ b/Minecraft.World/TileEntityDataPacket.h @@ -31,6 +31,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TileEntityDataPacket()); } virtual int getId() { return 132; } }; \ No newline at end of file diff --git a/Minecraft.World/TileEventPacket.h b/Minecraft.World/TileEventPacket.h index f587b1ff..ca2685fa 100644 --- a/Minecraft.World/TileEventPacket.h +++ b/Minecraft.World/TileEventPacket.h @@ -17,6 +17,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TileEventPacket()); } virtual int getId() { return 54; } }; \ No newline at end of file diff --git a/Minecraft.World/TileItem.cpp b/Minecraft.World/TileItem.cpp index 8d22594d..ce313dd6 100644 --- a/Minecraft.World/TileItem.cpp +++ b/Minecraft.World/TileItem.cpp @@ -20,7 +20,7 @@ using namespace std; TileItem::TileItem(int id) : Item(id) { this->tileId = id + 256; - itemIcon = nullptr; + itemIcon = NULL; } int TileItem::getTileId() @@ -39,7 +39,7 @@ int TileItem::getIconType() Icon *TileItem::getIcon(int auxValue) { - if (itemIcon != nullptr) + if (itemIcon != NULL) { return itemIcon; } @@ -128,7 +128,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // // if(iPlaceSound==-1) // { - // strcpy(szPlaceSoundName,"nullptr"); + // strcpy(szPlaceSoundName,"NULL"); // } // else // { @@ -136,7 +136,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // } // if(iStepSound==-1) // { - // strcpy(szStepSoundName,"nullptr"); + // strcpy(szStepSoundName,"NULL"); // } // else // { diff --git a/Minecraft.World/TileUpdatePacket.cpp b/Minecraft.World/TileUpdatePacket.cpp index 067d0615..a1423129 100644 --- a/Minecraft.World/TileUpdatePacket.cpp +++ b/Minecraft.World/TileUpdatePacket.cpp @@ -31,7 +31,7 @@ void TileUpdatePacket::read(DataInputStream *dis) //throws IOException y = dis->readUnsignedByte(); z = dis->readInt(); - block = static_cast(dis->readShort()) & 0xffff; + block = (int)dis->readShort() & 0xffff; BYTE dataLevel = dis->readByte(); data = dataLevel & 0xf; diff --git a/Minecraft.World/TileUpdatePacket.h b/Minecraft.World/TileUpdatePacket.h index c9bb93ce..fe69c763 100644 --- a/Minecraft.World/TileUpdatePacket.h +++ b/Minecraft.World/TileUpdatePacket.h @@ -18,6 +18,6 @@ public: virtual void handle(PacketListener *listener); virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TileUpdatePacket()); } virtual int getId() { return 53; } }; \ No newline at end of file diff --git a/Minecraft.World/TimeCommand.cpp b/Minecraft.World/TimeCommand.cpp index 05147983..4ac23c94 100644 --- a/Minecraft.World/TimeCommand.cpp +++ b/Minecraft.World/TimeCommand.cpp @@ -81,5 +81,5 @@ shared_ptr TimeCommand::preparePacket(bool night) dos.writeBoolean(night); - return std::make_shared(eGameCommand_Time, baos.toByteArray()); + return shared_ptr( new GameCommandPacket(eGameCommand_Time, baos.toByteArray() )); } \ No newline at end of file diff --git a/Minecraft.World/TntTile.cpp b/Minecraft.World/TntTile.cpp index eff9efae..430755fc 100644 --- a/Minecraft.World/TntTile.cpp +++ b/Minecraft.World/TntTile.cpp @@ -12,8 +12,8 @@ TntTile::TntTile(int id) : Tile(id, Material::explosive) { - iconTop = nullptr; - iconBottom = nullptr; + iconTop = NULL; + iconBottom = NULL; } Icon *TntTile::getTexture(int face, int data) @@ -57,7 +57,7 @@ void TntTile::wasExploded(Level *level, int x, int y, int z, Explosion *explosio // 4J-JEV: Fix for #90934 - Customer Encountered: TU11: Content: Gameplay: TNT blocks are triggered by explosions even though "TNT explodes" option is unchecked. if( level->newPrimedTntAllowed() && app.GetGameHostOption(eGameHostOption_TNT) ) { - shared_ptr primed = std::make_shared(level, x + 0.5f, y + 0.5f, z + 0.5f, explosion->getSourceMob()); + shared_ptr primed = shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f, explosion->getSourceMob()) ); primed->life = level->random->nextInt(primed->life / 4) + primed->life / 8; level->addEntity(primed); } @@ -77,7 +77,7 @@ void TntTile::destroy(Level *level, int x, int y, int z, int data, shared_ptr
  • newPrimedTntAllowed() && app.GetGameHostOption(eGameHostOption_TNT) ) { - shared_ptr tnt = std::make_shared(level, x + 0.5f, y + 0.5f, z + 0.5f, source); + shared_ptr tnt = shared_ptr( new PrimedTnt(level, x + 0.5f, y + 0.5f, z + 0.5f, source) ); level->addEntity(tnt); level->playEntitySound(tnt, eSoundType_RANDOM_FUSE, 1, 1.0f); } @@ -87,7 +87,7 @@ void TntTile::destroy(Level *level, int x, int y, int z, int data, shared_ptr
  • player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; - if (player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::flintAndSteel_Id) + if (player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::flintAndSteel_Id) { destroy(level, x, y, z, EXPLODE_BIT, player); level->removeTile(x, y, z); diff --git a/Minecraft.World/ToggleDownfallCommand.cpp b/Minecraft.World/ToggleDownfallCommand.cpp index 526be353..1d0a4d9e 100644 --- a/Minecraft.World/ToggleDownfallCommand.cpp +++ b/Minecraft.World/ToggleDownfallCommand.cpp @@ -31,5 +31,5 @@ void ToggleDownfallCommand::doToggleDownfall() shared_ptr ToggleDownfallCommand::preparePacket() { - return std::make_shared(eGameCommand_ToggleDownfall, byteArray()); + return shared_ptr( new GameCommandPacket(eGameCommand_ToggleDownfall, byteArray() )); } \ No newline at end of file diff --git a/Minecraft.World/ToolRecipies.cpp b/Minecraft.World/ToolRecipies.cpp index 82b02df1..8ee4bbab 100644 --- a/Minecraft.World/ToolRecipies.cpp +++ b/Minecraft.World/ToolRecipies.cpp @@ -103,7 +103,7 @@ void ToolRecipies::addRecipes(Recipes *r) } } } - r->addShapedRecipy(new ItemInstance(static_cast(Item::shears)), + r->addShapedRecipy(new ItemInstance((Item *)Item::shears), L"sscig", L" #", // L"# ", // diff --git a/Minecraft.World/TopSnowTile.cpp b/Minecraft.World/TopSnowTile.cpp index 7719f838..033b4eb2 100644 --- a/Minecraft.World/TopSnowTile.cpp +++ b/Minecraft.World/TopSnowTile.cpp @@ -27,7 +27,7 @@ AABB *TopSnowTile::getAABB(Level *level, int x, int y, int z) { int height = level->getData(x, y, z) & HEIGHT_MASK; float offset = 2.0f / SharedConstants::WORLD_RESOLUTION; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + (height * offset), z + tls->zz1); } @@ -100,7 +100,7 @@ void TopSnowTile::playerDestroy(Level *level, shared_ptr player, int x, { int type = Item::snowBall->id; int height = data & HEIGHT_MASK; - popResource(level, x, y, z, std::make_shared(type, height + 1, 0)); + popResource(level, x, y, z, shared_ptr( new ItemInstance(type, height + 1, 0))); level->removeTile(x, y, z); } diff --git a/Minecraft.World/TorchTile.cpp b/Minecraft.World/TorchTile.cpp index 129a3b13..cc377574 100644 --- a/Minecraft.World/TorchTile.cpp +++ b/Minecraft.World/TorchTile.cpp @@ -11,7 +11,7 @@ TorchTile::TorchTile(int id) : Tile(id, Material::decoration,isSolidRender()) AABB *TorchTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } AABB *TorchTile::getTileAABB(Level *level, int x, int y, int z) diff --git a/Minecraft.World/TradeItemPacket.h b/Minecraft.World/TradeItemPacket.h index 6a23ce7a..ecd0f707 100644 --- a/Minecraft.World/TradeItemPacket.h +++ b/Minecraft.World/TradeItemPacket.h @@ -25,7 +25,7 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new TradeItemPacket()); } virtual int getId() { return 151; } }; diff --git a/Minecraft.World/TradeWithPlayerGoal.cpp b/Minecraft.World/TradeWithPlayerGoal.cpp index 155525bc..e8b791d1 100644 --- a/Minecraft.World/TradeWithPlayerGoal.cpp +++ b/Minecraft.World/TradeWithPlayerGoal.cpp @@ -19,7 +19,7 @@ bool TradeWithPlayerGoal::canUse() if (mob->hurtMarked) return false; shared_ptr trader = mob->getTradingPlayer(); - if (trader == nullptr) + if (trader == NULL) { // no interaction return false; diff --git a/Minecraft.World/TrapDoorTile.cpp b/Minecraft.World/TrapDoorTile.cpp index 6ea64172..9b668e3f 100644 --- a/Minecraft.World/TrapDoorTile.cpp +++ b/Minecraft.World/TrapDoorTile.cpp @@ -212,5 +212,5 @@ bool TrapDoorTile::attachesTo(int id) } Tile *tile = Tile::tiles[id]; - return tile != nullptr && (tile->material->isSolidBlocking() && tile->isCubeShaped()) || tile == Tile::glowstone || (dynamic_cast(tile) != nullptr) || (dynamic_cast(tile) != nullptr); + return tile != NULL && (tile->material->isSolidBlocking() && tile->isCubeShaped()) || tile == Tile::glowstone || (dynamic_cast(tile) != NULL) || (dynamic_cast(tile) != NULL); } \ No newline at end of file diff --git a/Minecraft.World/TrapMenu.cpp b/Minecraft.World/TrapMenu.cpp index a89069c7..65757839 100644 --- a/Minecraft.World/TrapMenu.cpp +++ b/Minecraft.World/TrapMenu.cpp @@ -40,7 +40,7 @@ shared_ptr TrapMenu::quickMoveStack(shared_ptr player, int { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != nullptr && slot->hasItem()) + if (slot != NULL && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/TreeFeature.cpp b/Minecraft.World/TreeFeature.cpp index 2bfec147..f27258af 100644 --- a/Minecraft.World/TreeFeature.cpp +++ b/Minecraft.World/TreeFeature.cpp @@ -19,7 +19,7 @@ bool TreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::maxBuildHeight) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != nullptr) + if(app.getLevelGenerationOptions() != NULL) { PIXBeginNamedEvent(0,"TreeFeature checking intersects"); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); diff --git a/Minecraft.World/TreeTile.cpp b/Minecraft.World/TreeTile.cpp index 6a5860f3..642d8fbb 100644 --- a/Minecraft.World/TreeTile.cpp +++ b/Minecraft.World/TreeTile.cpp @@ -81,7 +81,7 @@ int TreeTile::getWoodType(int data) shared_ptr TreeTile::getSilkTouchItemInstance(int data) { // fix to avoid getting silktouched sideways logs - return std::make_shared(id, 1, getWoodType(data)); + return shared_ptr(new ItemInstance(id, 1, getWoodType(data))); } void TreeTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/TripWireSourceTile.cpp b/Minecraft.World/TripWireSourceTile.cpp index fcd7564d..c9271334 100644 --- a/Minecraft.World/TripWireSourceTile.cpp +++ b/Minecraft.World/TripWireSourceTile.cpp @@ -12,7 +12,7 @@ TripWireSourceTile::TripWireSourceTile(int id) : Tile(id, Material::decoration, AABB *TripWireSourceTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool TripWireSourceTile::blocksLight() diff --git a/Minecraft.World/TripWireTile.cpp b/Minecraft.World/TripWireTile.cpp index ee302af2..b8ae9f33 100644 --- a/Minecraft.World/TripWireTile.cpp +++ b/Minecraft.World/TripWireTile.cpp @@ -20,7 +20,7 @@ int TripWireTile::getTickDelay(Level *level) AABB *TripWireTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool TripWireTile::blocksLight() @@ -106,7 +106,7 @@ void TripWireTile::playerWillDestroy(Level *level, int x, int y, int z, int data { if (level->isClientSide) return; - if (player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears_Id) + if (player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears_Id) { level->setData(x, y, z, data | MASK_DISARMED, Tile::UPDATE_NONE); } @@ -165,7 +165,7 @@ void TripWireTile::checkPressed(Level *level, int x, int y, int z) bool wasPressed = (data & MASK_POWERED) == MASK_POWERED; bool shouldBePressed = false; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); vector > *entities = level->getEntities(nullptr, AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); if (!entities->empty()) { diff --git a/Minecraft.World/UpdateAttributesPacket.h b/Minecraft.World/UpdateAttributesPacket.h index 4f604e0d..77ba08be 100644 --- a/Minecraft.World/UpdateAttributesPacket.h +++ b/Minecraft.World/UpdateAttributesPacket.h @@ -41,6 +41,6 @@ public: unordered_set getValues(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new UpdateAttributesPacket()); } virtual int getId() { return 44; } }; \ No newline at end of file diff --git a/Minecraft.World/UpdateGameRuleProgressPacket.cpp b/Minecraft.World/UpdateGameRuleProgressPacket.cpp index d8856011..9459ed2b 100644 --- a/Minecraft.World/UpdateGameRuleProgressPacket.cpp +++ b/Minecraft.World/UpdateGameRuleProgressPacket.cpp @@ -5,9 +5,13 @@ -// UpdateGameRuleProgressPacket() default constructor -UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket() : m_icon(0), m_auxValue(0), m_dataTag(0) +UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket() { + m_messageId = L""; + m_icon = -1; + m_auxValue = 0; + m_definitionType = ConsoleGameRules::eGameRuleType_LevelRules; + m_dataTag = 0; } UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength) @@ -31,7 +35,7 @@ UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGa void UpdateGameRuleProgressPacket::read(DataInputStream *dis) //throws IOException { - m_definitionType = static_cast(dis->readInt()); + m_definitionType = (ConsoleGameRules::EGameRuleType)dis->readInt(); m_messageId = readUtf(dis,64); m_icon = dis->readInt(); m_auxValue = dis->readByte(); @@ -67,5 +71,5 @@ void UpdateGameRuleProgressPacket::handle(PacketListener *listener) int UpdateGameRuleProgressPacket::getEstimatedSize() { - return static_cast(m_messageId.length()) + 4 + m_data.length; + return (int)m_messageId.length() + 4 + m_data.length; } \ No newline at end of file diff --git a/Minecraft.World/UpdateMobEffectPacket.cpp b/Minecraft.World/UpdateMobEffectPacket.cpp index e8879d76..e2f6233e 100644 --- a/Minecraft.World/UpdateMobEffectPacket.cpp +++ b/Minecraft.World/UpdateMobEffectPacket.cpp @@ -19,8 +19,8 @@ UpdateMobEffectPacket::UpdateMobEffectPacket() UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *effect) { this->entityId = entityId; - effectId = static_cast(effect->getId() & 0xff); - effectAmplifier = static_cast(effect->getAmplifier() & 0xff); + effectId = (BYTE) (effect->getId() & 0xff); + effectAmplifier = (char) (effect->getAmplifier() & 0xff); if (effect->getDuration() > Short::MAX_VALUE) { @@ -28,7 +28,7 @@ UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *ef } else { - effectDurationTicks = static_cast(effect->getDuration()); + effectDurationTicks = (short) effect->getDuration(); } } diff --git a/Minecraft.World/UpdateMobEffectPacket.h b/Minecraft.World/UpdateMobEffectPacket.h index 48462550..39eb98e9 100644 --- a/Minecraft.World/UpdateMobEffectPacket.h +++ b/Minecraft.World/UpdateMobEffectPacket.h @@ -24,6 +24,6 @@ public: virtual bool isInvalidatedBy(shared_ptr packet); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new UpdateMobEffectPacket()); } virtual int getId() { return 41; } }; \ No newline at end of file diff --git a/Minecraft.World/UpdateProgressPacket.h b/Minecraft.World/UpdateProgressPacket.h index 1643fb63..beca6509 100644 --- a/Minecraft.World/UpdateProgressPacket.h +++ b/Minecraft.World/UpdateProgressPacket.h @@ -20,6 +20,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new UpdateProgressPacket()); } virtual int getId() { return 156; } }; \ No newline at end of file diff --git a/Minecraft.World/UseItemPacket.cpp b/Minecraft.World/UseItemPacket.cpp index f8a5dac8..55e44342 100644 --- a/Minecraft.World/UseItemPacket.cpp +++ b/Minecraft.World/UseItemPacket.cpp @@ -56,9 +56,9 @@ void UseItemPacket::write(DataOutputStream *dos) //throws IOException dos->write(face); writeItem(item, dos); - dos->write(static_cast(clickX * CLICK_ACCURACY)); - dos->write(static_cast(clickY * CLICK_ACCURACY)); - dos->write(static_cast(clickZ * CLICK_ACCURACY)); + dos->write((int) (clickX * CLICK_ACCURACY)); + dos->write((int) (clickY * CLICK_ACCURACY)); + dos->write((int) (clickZ * CLICK_ACCURACY)); } void UseItemPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/UseItemPacket.h b/Minecraft.World/UseItemPacket.h index ce4635ba..44e20457 100644 --- a/Minecraft.World/UseItemPacket.h +++ b/Minecraft.World/UseItemPacket.h @@ -31,6 +31,6 @@ public: float getClickZ(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new UseItemPacket()); } virtual int getId() { return 15; } }; diff --git a/Minecraft.World/Vec3.cpp b/Minecraft.World/Vec3.cpp index b513c149..1fc26fd5 100644 --- a/Minecraft.World/Vec3.cpp +++ b/Minecraft.World/Vec3.cpp @@ -3,7 +3,7 @@ #include "AABB.h" DWORD Vec3::tlsIdx = 0; -Vec3::ThreadStorage *Vec3::tlsDefault = nullptr; +Vec3::ThreadStorage *Vec3::tlsDefault = NULL; Vec3::ThreadStorage::ThreadStorage() { @@ -19,7 +19,7 @@ Vec3::ThreadStorage::~ThreadStorage() void Vec3::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == nullptr ) + if(tlsDefault == NULL ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -34,7 +34,7 @@ void Vec3::UseDefaultThreadStorage() void Vec3::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if( tls == tlsDefault ) return; delete tls; @@ -55,7 +55,7 @@ void Vec3::resetPool() Vec3 *Vec3::newTemp(double x, double y, double z) { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); Vec3 *thisVec = &tls->pool[tls->poolPointer]; thisVec->set(x, y, z); tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE; @@ -157,10 +157,10 @@ Vec3 *Vec3::clipX(Vec3 *b, double xt) double yd = b->y - y; double zd = b->z - z; - if (xd * xd < 0.0000001f) return nullptr; + if (xd * xd < 0.0000001f) return NULL; double d = (xt - x) / xd; - if (d < 0 || d > 1) return nullptr; + if (d < 0 || d > 1) return NULL; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -170,10 +170,10 @@ Vec3 *Vec3::clipY(Vec3 *b, double yt) double yd = b->y - y; double zd = b->z - z; - if (yd * yd < 0.0000001f) return nullptr; + if (yd * yd < 0.0000001f) return NULL; double d = (yt - y) / yd; - if (d < 0 || d > 1) return nullptr; + if (d < 0 || d > 1) return NULL; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -183,10 +183,10 @@ Vec3 *Vec3::clipZ(Vec3 *b, double zt) double yd = b->y - y; double zd = b->z - z; - if (zd * zd < 0.0000001f) return nullptr; + if (zd * zd < 0.0000001f) return NULL; double d = (zt - z) / zd; - if (d < 0 || d > 1) return nullptr; + if (d < 0 || d > 1) return NULL; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } diff --git a/Minecraft.World/Village.cpp b/Minecraft.World/Village.cpp index b7c82fa4..a72319fe 100644 --- a/Minecraft.World/Village.cpp +++ b/Minecraft.World/Village.cpp @@ -25,7 +25,7 @@ Village::Village() golemCount = 0; noBreedTimer = 0; - level = nullptr; + level = NULL; } Village::Village(Level *level) @@ -69,9 +69,9 @@ void Village::tick(int tick) if (golemCount < idealGolemCount && doorInfos.size() > 20 && level->random->nextInt(7000) == 0) { Vec3 *spawnPos = findRandomSpawnPos(center->x, center->y, center->z, 2, 4, 2); - if (spawnPos != nullptr) + if (spawnPos != NULL) { - shared_ptr vg = std::make_shared(level); + shared_ptr vg = shared_ptr( new VillagerGolem(level) ); vg->setPos(spawnPos->x, spawnPos->y, spawnPos->z); level->addEntity(vg); ++golemCount; @@ -103,7 +103,7 @@ Vec3 *Village::findRandomSpawnPos(int x, int y, int z, int sx, int sy, int sz) if (!isInside(xx, yy, zz)) continue; if (canSpawnAt(xx, yy, zz, sx, sy, sz)) return Vec3::newTemp(xx, yy, zz); } - return nullptr; + return NULL; } bool Village::canSpawnAt(int x, int y, int z, int sx, int sy, int sz) @@ -215,7 +215,7 @@ shared_ptrVillage::getBestDoorInfo(int x, int y, int z) bool Village::hasDoorInfo(int x, int y, int z) { - return getDoorInfo(x, y, z) != nullptr; + return getDoorInfo(x, y, z) != NULL; } shared_ptr Village::getDoorInfo(int x, int y, int z) @@ -260,7 +260,7 @@ void Village::addAggressor(shared_ptr mob) shared_ptr Village::getClosestAggressor(shared_ptr from) { double closestSqr = Double::MAX_VALUE; - Aggressor *closest = nullptr; + Aggressor *closest = NULL; for(auto& a : aggressors) { double distSqr = a->mob->distanceToSqr(from); @@ -268,7 +268,7 @@ shared_ptr Village::getClosestAggressor(shared_ptr f closest = a; closestSqr = distSqr; } - return closest != nullptr ? closest->mob : nullptr; + return closest != NULL ? closest->mob : nullptr; } shared_ptr Village::getClosestBadStandingPlayer(shared_ptr from) @@ -282,7 +282,7 @@ shared_ptr Village::getClosestBadStandingPlayer(shared_ptr if (isVeryBadStanding(player)) { shared_ptr mob = level->getPlayerByName(player); - if (mob != nullptr) + if (mob != NULL) { double distSqr = mob->distanceToSqr(from); if (distSqr > closestSqr) continue; @@ -422,7 +422,7 @@ void Village::readAdditionalSaveData(CompoundTag *tag) { CompoundTag *dTag = doorTags->get(i); - shared_ptr door = std::make_shared(dTag->getInt(L"X"), dTag->getInt(L"Y"), dTag->getInt(L"Z"), dTag->getInt(L"IDX"), dTag->getInt(L"IDZ"), dTag->getInt(L"TS")); + shared_ptr door = shared_ptr(new DoorInfo(dTag->getInt(L"X"), dTag->getInt(L"Y"), dTag->getInt(L"Z"), dTag->getInt(L"IDX"), dTag->getInt(L"IDZ"), dTag->getInt(L"TS"))); doorInfos.push_back(door); } diff --git a/Minecraft.World/VillageFeature.cpp b/Minecraft.World/VillageFeature.cpp index bde8a66c..5249256c 100644 --- a/Minecraft.World/VillageFeature.cpp +++ b/Minecraft.World/VillageFeature.cpp @@ -82,7 +82,7 @@ bool VillageFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != nullptr ) + if( levelGenOptions != NULL ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Village); } @@ -134,7 +134,7 @@ VillageFeature::VillageStart::VillageStart(Level *level, Random *random, int chu // prioritize roads if (pendingRoads->empty()) { - int pos = random->nextInt(static_cast(pendingHouses->size())); + int pos = random->nextInt((int)pendingHouses->size()); auto it = pendingHouses->begin() + pos; StructurePiece *structurePiece = *it; pendingHouses->erase(it); @@ -142,7 +142,7 @@ VillageFeature::VillageStart::VillageStart(Level *level, Random *random, int chu } else { - int pos = random->nextInt(static_cast(pendingRoads->size())); + int pos = random->nextInt((int)pendingRoads->size()); auto it = pendingRoads->begin() + pos; StructurePiece *structurePiece = *it; pendingRoads->erase(it); diff --git a/Minecraft.World/VillagePieces.cpp b/Minecraft.World/VillagePieces.cpp index dcd765e0..1737d6e0 100644 --- a/Minecraft.World/VillagePieces.cpp +++ b/Minecraft.World/VillagePieces.cpp @@ -101,7 +101,7 @@ int VillagePieces::updatePieceWeight(list *currentPieces) VillagePieces::VillagePiece *VillagePieces::findAndCreatePieceFactory(StartPiece *startPiece, VillagePieces::PieceWeight *piece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { VillagePieces::EPieceClass pieceClass = piece->pieceClass; - VillagePiece *villagePiece = nullptr; + VillagePiece *villagePiece = NULL; if (pieceClass == VillagePieces::EPieceClass_SimpleHouse) { @@ -148,7 +148,7 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec int totalWeight = updatePieceWeight(startPiece->pieceSet); if (totalWeight <= 0) { - return nullptr; + return NULL; } int numAttempts = 0; @@ -168,7 +168,7 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec } VillagePiece *villagePiece = findAndCreatePieceFactory(startPiece, piece, pieces, random, footX, footY, footZ, direction, depth); - if (villagePiece != nullptr) + if (villagePiece != NULL) { piece->placeCount++; startPiece->previousPiece = piece; @@ -186,29 +186,29 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec // attempt to place a light post instead { BoundingBox *box = LightPost::findPieceBox(startPiece, pieces, random, footX, footY, footZ, direction); - if (box != nullptr) + if (box != NULL) { return new LightPost(startPiece, depth, random, box, direction); } delete box; } - return nullptr; + return NULL; } StructurePiece *VillagePieces::generateAndAddPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return nullptr; + return NULL; } if (abs(footX - startPiece->getBoundingBox()->x0) > 7 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 7 * 16) { - return nullptr; + return NULL; } StructurePiece *newPiece = generatePieceFromSmallDoor(startPiece, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != nullptr) + if (newPiece != NULL) { int x = (newPiece->boundingBox->x0 + newPiece->boundingBox->x1) / 2; int z = (newPiece->boundingBox->z0 + newPiece->boundingBox->z1) / 2; @@ -223,22 +223,22 @@ StructurePiece *VillagePieces::generateAndAddPiece(StartPiece *startPiece, list< } delete newPiece; } - return nullptr; + return NULL; } StructurePiece *VillagePieces::generateAndAddRoadPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > BASE_ROAD_DEPTH + startPiece->villageSize) { - return nullptr; + return NULL; } if (abs(footX - startPiece->getBoundingBox()->x0) > 7 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 7 * 16) { - return nullptr; + return NULL; } BoundingBox *box = StraightRoad::findPieceBox(startPiece, pieces, random, footX, footY, footZ, direction); - if (box != nullptr && box->y0 > LOWEST_Y_POSITION) + if (box != NULL && box->y0 > LOWEST_Y_POSITION) { StructurePiece *newPiece = new StraightRoad(startPiece, depth, random, box, direction); int x = (newPiece->boundingBox->x0 + newPiece->boundingBox->x1) / 2; @@ -255,12 +255,12 @@ StructurePiece *VillagePieces::generateAndAddRoadPiece(StartPiece *startPiece, l // 4J Stu - The dtor for newPiece will destroy box delete newPiece; } - else if(box != nullptr) + else if(box != NULL) { delete box; } - return nullptr; + return NULL; } VillagePieces::VillagePiece::VillagePiece() @@ -268,7 +268,7 @@ VillagePieces::VillagePiece::VillagePiece() heightPosition = -1; spawnedVillagerCount = 0; isDesertVillage = false; - startPiece = nullptr; + startPiece = NULL; // for reflection } @@ -278,7 +278,7 @@ VillagePieces::VillagePiece::VillagePiece(StartPiece *startPiece, int genDepth) isDesertVillage = false; spawnedVillagerCount = 0; this->startPiece = startPiece; - if (startPiece != nullptr) + if (startPiece != NULL) { this->isDesertVillage = startPiece->isDesertVillage; } @@ -311,7 +311,7 @@ StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernLeft(StartPiec case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); } - return nullptr; + return NULL; } StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -327,7 +327,7 @@ StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernRight(StartPie case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); } - return nullptr; + return NULL; } int VillagePieces::VillagePiece::getAverageGroundHeight(Level *level, BoundingBox *chunkBB) @@ -357,7 +357,7 @@ bool VillagePieces::VillagePiece::isOkBox(BoundingBox *box, StartPiece *startRoo { bool bIsOk = false; - if(box != nullptr) + if(box != NULL) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; @@ -391,7 +391,7 @@ void VillagePieces::VillagePiece::spawnVillagers(Level *level, BoundingBox *chun { spawnedVillagerCount++; - shared_ptr villager = std::make_shared(level, getVillagerProfession(i)); + shared_ptr villager = shared_ptr(new Villager(level, getVillagerProfession(i))); villager->moveTo(worldX + 0.5, worldY, worldZ + 0.5, 0, 0); level->addEntity(villager); } @@ -512,10 +512,10 @@ VillagePieces::Well::Well(StartPiece *startPiece, int genDepth, Random *random, void VillagePieces::Well::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 - 1, boundingBox->y1 - 4, boundingBox->z0 + 1, Direction::WEST, getGenDepth()); - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 + 1, boundingBox->y1 - 4, boundingBox->z0 + 1, Direction::EAST, getGenDepth()); - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 + 1, boundingBox->y1 - 4, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 + 1, boundingBox->y1 - 4, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y1 - 4, boundingBox->z0 + 1, Direction::WEST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y1 - 4, boundingBox->z0 + 1, Direction::EAST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 + 1, boundingBox->y1 - 4, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 + 1, boundingBox->y1 - 4, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); } bool VillagePieces::Well::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -569,10 +569,10 @@ VillagePieces::StartPiece::StartPiece() // for reflection } -VillagePieces::StartPiece::StartPiece(BiomeSource *biomeSource, int genDepth, Random *random, int west, int north, list *pieceSet, int villageSize, Level *level) : Well(nullptr, 0, random, west, north) +VillagePieces::StartPiece::StartPiece(BiomeSource *biomeSource, int genDepth, Random *random, int west, int north, list *pieceSet, int villageSize, Level *level) : Well(NULL, 0, random, west, north) { isLibraryAdded = false; // 4J - added initialiser - previousPiece = nullptr; // 4J - added initialiser + previousPiece = NULL; // 4J - added initialiser this->biomeSource = biomeSource; this->pieceSet = pieceSet; this->villageSize = villageSize; @@ -628,8 +628,8 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listnextInt(5); while (depth < length - 8) { - StructurePiece *piece = generateHouseNorthernLeft(static_cast(startPiece), pieces, random, 0, depth); - if (piece != nullptr) + StructurePiece *piece = generateHouseNorthernLeft((StartPiece *) startPiece, pieces, random, 0, depth); + if (piece != NULL) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; @@ -641,8 +641,8 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listnextInt(5); while (depth < length - 8) { - StructurePiece *piece = generateHouseNorthernRight(static_cast(startPiece), pieces, random, 0, depth); - if (piece != nullptr) + StructurePiece *piece = generateHouseNorthernRight((StartPiece *) startPiece, pieces, random, 0, depth); + if (piece != NULL) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; @@ -655,16 +655,16 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z0, Direction::WEST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z0, Direction::WEST, getGenDepth()); break; case Direction::SOUTH: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z1 - 2, Direction::WEST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z1 - 2, Direction::WEST, getGenDepth()); break; case Direction::EAST: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); break; case Direction::WEST: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); break; } } @@ -673,16 +673,16 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z0, Direction::EAST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z0, Direction::EAST, getGenDepth()); break; case Direction::SOUTH: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z1 - 2, Direction::EAST, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z1 - 2, Direction::EAST, getGenDepth()); break; case Direction::EAST: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); break; case Direction::WEST: - generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); + generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); break; } } @@ -696,7 +696,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, 3, length, direction); - if (isOkBox(box, startPiece) && StructurePiece::findCollisionPiece(pieces, box) == nullptr) + if (isOkBox(box, startPiece) && StructurePiece::findCollisionPiece(pieces, box) == NULL) { return box; } @@ -704,7 +704,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l length -= 7; } - return nullptr; + return NULL; } bool VillagePieces::StraightRoad::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -753,10 +753,10 @@ VillagePieces::SimpleHouse *VillagePieces::SimpleHouse::createPiece(StartPiece * { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new SimpleHouse(startPiece, genDepth, random, box, direction); @@ -880,10 +880,10 @@ VillagePieces::SmallTemple *VillagePieces::SmallTemple::createPiece(StartPiece * { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new SmallTemple(startPiece, genDepth, random, box, direction); @@ -1022,10 +1022,10 @@ VillagePieces::BookHouse *VillagePieces::BookHouse::createPiece(StartPiece *star { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new BookHouse(startPiece, genDepth, random, box, direction); @@ -1178,10 +1178,10 @@ VillagePieces::SmallHut *VillagePieces::SmallHut::createPiece(StartPiece *startP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new SmallHut(startPiece, genDepth, random, box, direction); @@ -1284,10 +1284,10 @@ VillagePieces::PigHouse *VillagePieces::PigHouse::createPiece(StartPiece *startP BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new PigHouse(startPiece, genDepth, random, box, direction); @@ -1429,10 +1429,10 @@ VillagePieces::TwoRoomHouse *VillagePieces::TwoRoomHouse::createPiece(StartPiece { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new TwoRoomHouse(startPiece, genDepth, random, box, direction); @@ -1619,10 +1619,10 @@ VillagePieces::Smithy *VillagePieces::Smithy::createPiece(StartPiece *startPiece { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new Smithy(startPiece, genDepth, random, box, direction); @@ -1790,10 +1790,10 @@ VillagePieces::Farmland *VillagePieces::Farmland::createPiece(StartPiece *startP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new Farmland(startPiece, genDepth, random, box, direction); @@ -1902,10 +1902,10 @@ VillagePieces::DoubleFarmland *VillagePieces::DoubleFarmland::createPiece(StartP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return new DoubleFarmland(startPiece, genDepth, random, box, direction); @@ -1983,10 +1983,10 @@ BoundingBox *VillagePieces::LightPost::findPieceBox(StartPiece *startPiece, list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { delete box; - return nullptr; + return NULL; } return box; diff --git a/Minecraft.World/VillageSiege.cpp b/Minecraft.World/VillageSiege.cpp index 5a39b6eb..e3d20ef3 100644 --- a/Minecraft.World/VillageSiege.cpp +++ b/Minecraft.World/VillageSiege.cpp @@ -80,10 +80,10 @@ bool VillageSiege::tryToSetupSiege() vector > *players = &level->players; for(auto& player : *players) { - shared_ptr _village = level->villages->getClosestVillage(static_cast(player->x), static_cast(player->y), static_cast(player->z), 1); + shared_ptr _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1); village = _village; - if (_village == nullptr) continue; + if (_village == NULL) continue; if (_village->getDoorCount() < 10) continue; if (_village->getStableAge() < 20) continue; if (_village->getPopulationSize() < 20) continue; @@ -95,9 +95,9 @@ bool VillageSiege::tryToSetupSiege() bool overlaps = false; for (int i = 0; i < 10; ++i) { - spawnX = center->x + static_cast(Mth::cos(level->random->nextFloat() * PI * 2.f) * radius * 0.9); + spawnX = center->x + (int) (Mth::cos(level->random->nextFloat() * PI * 2.f) * radius * 0.9); spawnY = center->y; - spawnZ = center->z + static_cast(Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9); + spawnZ = center->z + (int) (Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9); overlaps = false; vector > *villages = level->villages->getVillages(); //for (Village v : level.villages.getVillages()) @@ -115,7 +115,7 @@ bool VillageSiege::tryToSetupSiege() if (overlaps) return false; Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ); - if (spawnPos == nullptr) continue; + if (spawnPos == NULL) continue; nextSpawnTime = 0; siegeCount = 20; @@ -127,17 +127,17 @@ bool VillageSiege::tryToSetupSiege() bool VillageSiege::trySpawn() { Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ); - if (spawnPos == nullptr) return false; + if (spawnPos == NULL) return false; shared_ptr mob; { - mob = std::make_shared(level); - mob->finalizeMobSpawn(nullptr); + mob = shared_ptr( new Zombie(level) ); + mob->finalizeMobSpawn(NULL); mob->setVillager(false); } mob->moveTo(spawnPos->x, spawnPos->y, spawnPos->z, level->random->nextFloat() * 360, 0); level->addEntity(mob); shared_ptr _village = village.lock(); - if( _village == nullptr ) return false; + if( _village == NULL ) return false; Pos *center = _village->getCenter(); mob->restrictTo(center->x, center->y, center->z, _village->getRadius()); @@ -147,7 +147,7 @@ bool VillageSiege::trySpawn() Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z) { shared_ptr _village = village.lock(); - if( _village == nullptr ) return nullptr; + if( _village == NULL ) return NULL; for (int i = 0; i < 10; ++i) { @@ -157,5 +157,5 @@ Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z) if (!_village->isInside(xx, yy, zz)) continue; if (MobSpawner::isSpawnPositionOk(MobCategory::monster, level, xx, yy, zz)) return Vec3::newTemp(xx, yy, zz); } - return nullptr; + return NULL; } \ No newline at end of file diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 4e57affe..19303b0d 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -38,7 +38,7 @@ void Villager::_init(int profession) village = weak_ptr(); tradingPlayer = weak_ptr(); - offers = nullptr; + offers = NULL; updateMerchantTimer = 0; addRecipeOnUpdate = false; riches = 0; @@ -102,11 +102,11 @@ void Villager::serverAiMobStep() shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; - if (_village == nullptr) clearRestriction(); + if (_village == NULL) clearRestriction(); else { Pos *center = _village->getCenter(); - restrictTo(center->x, center->y, center->z, static_cast((float)_village->getRadius() * 0.6f)); + restrictTo(center->x, center->y, center->z, (int)((float)_village->getRadius() * 0.6f)); if (rewardPlayersOnFirstVillage) { rewardPlayersOnFirstVillage = false; @@ -137,7 +137,7 @@ void Villager::serverAiMobStep() addOffers(1); addRecipeOnUpdate = false; - if (village.lock() != nullptr && !lastPlayerTradeName.empty()) + if (village.lock() != NULL && !lastPlayerTradeName.empty()) { level->broadcastEntityEvent(shared_from_this(), EntityEvent::VILLAGER_HAPPY); village.lock()->modifyStanding(lastPlayerTradeName, 1); @@ -154,7 +154,7 @@ bool Villager::mobInteract(shared_ptr player) { // [EB]: Truly dislike this code but I don't see another easy way shared_ptr item = player->inventory->getSelected(); - bool holdingSpawnEgg = item != nullptr && item->id == Item::spawnEgg_Id; + bool holdingSpawnEgg = item != NULL && item->id == Item::spawnEgg_Id; if (!holdingSpawnEgg && isAlive() && !isTrading() && !isBaby()) { @@ -182,7 +182,7 @@ void Villager::addAdditonalSaveData(CompoundTag *tag) AgableMob::addAdditonalSaveData(tag); tag->putInt(L"Profession", getProfession()); tag->putInt(L"Riches", riches); - if (offers != nullptr) + if (offers != NULL) { tag->putCompound(L"Offers", offers->createTag()); } @@ -259,7 +259,7 @@ void Villager::setLastHurtByMob(shared_ptr mob) { AgableMob::setLastHurtByMob(mob); shared_ptr _village = village.lock(); - if (_village != nullptr && mob != nullptr) + if (_village != NULL && mob != NULL) { _village->addAggressor(mob); @@ -282,10 +282,10 @@ void Villager::setLastHurtByMob(shared_ptr mob) void Villager::die(DamageSource *source) { shared_ptr _village = village.lock(); - if (_village != nullptr) + if (_village != NULL) { shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr) + if (sourceEntity != NULL) { if ( sourceEntity->instanceof(eTYPE_PLAYER) ) { @@ -296,12 +296,12 @@ void Villager::die(DamageSource *source) _village->resetNoBreedTimer(); } } - else if (sourceEntity == nullptr) + else if (sourceEntity == NULL) { // if the villager was killed by the world (such as lava or falling), blame // the nearest player by not reproducing for a while shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 16.0f); - if (nearestPlayer != nullptr) + if (nearestPlayer != NULL) { _village->resetNoBreedTimer(); } @@ -335,7 +335,7 @@ shared_ptr Villager::getTradingPlayer() bool Villager::isTrading() { - return tradingPlayer.lock() != nullptr; + return tradingPlayer.lock() != NULL; } void Villager::notifyTrade(MerchantRecipe *activeRecipe) @@ -349,7 +349,7 @@ void Villager::notifyTrade(MerchantRecipe *activeRecipe) { updateMerchantTimer = SharedConstants::TICKS_PER_SECOND * 2; addRecipeOnUpdate = true; - if (tradingPlayer.lock() != nullptr) + if (tradingPlayer.lock() != NULL) { lastPlayerTradeName = tradingPlayer.lock()->getName(); } @@ -370,7 +370,7 @@ void Villager::notifyTradeUpdated(shared_ptr item) if (!level->isClientSide && (ambientSoundTime > (-getAmbientSoundInterval() + SharedConstants::TICKS_PER_SECOND))) { ambientSoundTime = -getAmbientSoundInterval(); - if (item != nullptr) + if (item != NULL) { playSound(eSoundType_MOB_VILLAGER_YES, getSoundVolume(), getVoicePitch()); } @@ -383,7 +383,7 @@ void Villager::notifyTradeUpdated(shared_ptr item) MerchantRecipeList *Villager::getOffers(shared_ptr forPlayer) { - if (offers == nullptr) + if (offers == NULL) { addOffers(1); } @@ -420,7 +420,7 @@ void Villager::addOffers(int addCount) addItemForPurchase(newOffers, Item::arrow_Id, random, getRecipeChance(.5f)); if (random->nextFloat() < getRecipeChance(.5f)) { - newOffers->push_back(new MerchantRecipe(std::make_shared(Tile::gravel, 10), std::make_shared(Item::emerald), std::make_shared(Item::flint_Id, 4 + random->nextInt(2), 0))); + newOffers->push_back(new MerchantRecipe(shared_ptr( new ItemInstance(Tile::gravel, 10) ), shared_ptr( new ItemInstance(Item::emerald) ), shared_ptr( new ItemInstance(Item::flint_Id, 4 + random->nextInt(2), 0)))); } break; case PROFESSION_BUTCHER: @@ -480,7 +480,7 @@ void Villager::addOffers(int addCount) shared_ptr book = Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, level)); int cost = 2 + random->nextInt(5 + (level * 10)) + 3 * level; - newOffers->push_back(new MerchantRecipe(std::make_shared(Item::book), std::make_shared(Item::emerald, cost), book)); + newOffers->push_back(new MerchantRecipe(shared_ptr(new ItemInstance(Item::book)), shared_ptr(new ItemInstance(Item::emerald, cost)), book)); } break; case PROFESSION_PRIEST: @@ -498,9 +498,9 @@ void Villager::addOffers(int addCount) int id = enchantItems[i]; if (random->nextFloat() < getRecipeChance(.05f)) { - newOffers->push_back(new MerchantRecipe(std::make_shared(id, 1, 0), - std::make_shared(Item::emerald, 2 + random->nextInt(3), 0), - EnchantmentHelper::enchantItem(random, std::make_shared(id, 1, 0), 5 + random->nextInt(15)))); + newOffers->push_back(new MerchantRecipe(shared_ptr(new ItemInstance(id, 1, 0)), + shared_ptr(new ItemInstance(Item::emerald, 2 + random->nextInt(3), 0)), + EnchantmentHelper::enchantItem(random, shared_ptr(new ItemInstance(id, 1, 0)), 5 + random->nextInt(15)))); } } } @@ -515,7 +515,7 @@ void Villager::addOffers(int addCount) // shuffle the list to make it more interesting std::shuffle(newOffers->begin(), newOffers->end(), std::mt19937{std::random_device{}()}); - if (offers == nullptr) + if (offers == NULL) { offers = new MerchantRecipeList(); } @@ -622,7 +622,7 @@ void Villager::addItemForTradeIn(MerchantRecipeList *list, int itemId, Random *r shared_ptr Villager::getItemTradeInValue(int itemId, Random *random) { - return std::make_shared(itemId, getTradeInValue(itemId, random), 0); + return shared_ptr(new ItemInstance(itemId, getTradeInValue(itemId, random), 0)); } int Villager::getTradeInValue(int itemId, Random *random) @@ -658,13 +658,13 @@ void Villager::addItemForPurchase(MerchantRecipeList *list, int itemId, Random * shared_ptr resultItem; if (purchaseCost < 0) { - rubyItem = std::make_shared(Item::emerald_Id, 1, 0); - resultItem = std::make_shared(itemId, -purchaseCost, 0); + rubyItem = shared_ptr( new ItemInstance(Item::emerald_Id, 1, 0) ); + resultItem = shared_ptr( new ItemInstance(itemId, -purchaseCost, 0) ); } else { - rubyItem = std::make_shared(Item::emerald_Id, purchaseCost, 0); - resultItem = std::make_shared(itemId, 1, 0); + rubyItem = shared_ptr( new ItemInstance(Item::emerald_Id, purchaseCost, 0) ); + resultItem = shared_ptr( new ItemInstance(itemId, 1, 0) ); } list->push_back(new MerchantRecipe(rubyItem, resultItem)); } @@ -735,8 +735,8 @@ shared_ptr Villager::getBreedOffspring(shared_ptr target) // 4J - added limit to villagers that can be bred if(level->canCreateMore(GetType(), Level::eSpawnType_Breed) ) { - shared_ptr villager = std::make_shared(level); - villager->finalizeMobSpawn(nullptr); + shared_ptr villager = shared_ptr(new Villager(level)); + villager->finalizeMobSpawn(NULL); return villager; } else diff --git a/Minecraft.World/VillagerGolem.cpp b/Minecraft.World/VillagerGolem.cpp index 09508bfc..dba80ffa 100644 --- a/Minecraft.World/VillagerGolem.cpp +++ b/Minecraft.World/VillagerGolem.cpp @@ -53,7 +53,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level) void VillagerGolem::defineSynchedData() { Golem::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, (byte) 0); } bool VillagerGolem::useNewAi() @@ -68,11 +68,11 @@ void VillagerGolem::serverAiMobStep() villageUpdateInterval = 70 + random->nextInt(50); shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; - if (_village == nullptr) clearRestriction(); + if (_village == NULL) clearRestriction(); else { Pos *center = _village->getCenter(); - restrictTo(center->x, center->y, center->z, static_cast((float)_village->getRadius()) * 0.6f); + restrictTo(center->x, center->y, center->z, (int)((float)_village->getRadius()) * 0.6f); } } @@ -234,17 +234,17 @@ void VillagerGolem::setPlayerCreated(bool value) byte current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); + entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); + entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); } } void VillagerGolem::die(DamageSource *source) { - if (!isPlayerCreated() && lastHurtByPlayer != nullptr && village.lock() != nullptr) + if (!isPlayerCreated() && lastHurtByPlayer != NULL && village.lock() != NULL) { village.lock()->modifyStanding(lastHurtByPlayer->getName(), -5); } @@ -257,7 +257,7 @@ bool VillagerGolem::hurt(DamageSource *source, float dmg) if (isPlayerCreated()) { shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) + if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(entity); if (!player->isAllowedToAttackPlayers()) return false; diff --git a/Minecraft.World/Villages.cpp b/Minecraft.World/Villages.cpp index 432a8b6b..e636ed74 100644 --- a/Minecraft.World/Villages.cpp +++ b/Minecraft.World/Villages.cpp @@ -11,7 +11,7 @@ const wstring Villages::VILLAGE_FILE_ID = L"villages"; Villages::Villages(const wstring &id) : SavedData(id) { _tick = 0; - level = nullptr; + level = NULL; } Villages::Villages(Level *level) : SavedData(VILLAGE_FILE_ID) @@ -117,7 +117,7 @@ void Villages::cluster() bool found = false; for(auto& village : villages) { - int dist = static_cast(village->getCenter()->distSqr(di->x, di->y, di->z)); + int dist = (int) village->getCenter()->distSqr(di->x, di->y, di->z); int radius = MaxDoorDist + village->getRadius(); if (dist > radius * radius) continue; village->addDoorInfo(di); @@ -127,7 +127,7 @@ void Villages::cluster() if (found) continue; // create new Village - shared_ptr village = std::make_shared(level); + shared_ptr village = shared_ptr(new Village(level)); village->addDoorInfo(di); villages.push_back(village); setDirty(); @@ -147,7 +147,7 @@ void Villages::addDoorInfos(Pos *pos) if (isDoor(xx, yy, zz)) { shared_ptr currentDoor = getDoorInfo(xx, yy, zz); - if (currentDoor == nullptr) createDoorInfo(xx, yy, zz); + if (currentDoor == NULL) createDoorInfo(xx, yy, zz); else currentDoor->timeStamp = _tick; } } @@ -173,7 +173,7 @@ shared_ptr Villages::getDoorInfo(int x, int y, int z) void Villages::createDoorInfo(int x, int y, int z) { - int dir = static_cast(Tile::door_wood)->getDir(level, x, y, z); + int dir = ((DoorTile *) Tile::door_wood)->getDir(level, x, y, z); if (dir == 0 || dir == 2) { int canSeeX = 0; @@ -181,7 +181,7 @@ void Villages::createDoorInfo(int x, int y, int z) if (level->canSeeSky(x + i, y, z)) canSeeX--; for (int i = 1; i <= 5; ++i) if (level->canSeeSky(x + i, y, z)) canSeeX++; - if (canSeeX != 0) unclustered.push_back(std::make_shared(x, y, z, canSeeX > 0 ? -2 : 2, 0, _tick)); + if (canSeeX != 0) unclustered.push_back(shared_ptr(new DoorInfo(x, y, z, canSeeX > 0 ? -2 : 2, 0, _tick))); } else { @@ -190,7 +190,7 @@ void Villages::createDoorInfo(int x, int y, int z) if (level->canSeeSky(x, y, z + i)) canSeeZ--; for (int i = 1; i <= 5; ++i) if (level->canSeeSky(x, y, z + i)) canSeeZ++; - if (canSeeZ != 0) unclustered.push_back(std::make_shared(x, y, z, 0, canSeeZ > 0 ? -2 : 2, _tick)); + if (canSeeZ != 0) unclustered.push_back(shared_ptr(new DoorInfo(x, y, z, 0, canSeeZ > 0 ? -2 : 2, _tick))); } } @@ -218,7 +218,7 @@ void Villages::load(CompoundTag *tag) for (int i = 0; i < villageTags->size(); i++) { CompoundTag *compoundTag = villageTags->get(i); - shared_ptr village = std::make_shared(); + shared_ptr village = shared_ptr(new Village()); village->readAdditionalSaveData(compoundTag); villages.push_back(village); } diff --git a/Minecraft.World/VineTile.cpp b/Minecraft.World/VineTile.cpp index 8f16a921..25600cbd 100644 --- a/Minecraft.World/VineTile.cpp +++ b/Minecraft.World/VineTile.cpp @@ -102,7 +102,7 @@ void VineTile::updateShape(LevelSource *level, int x, int y, int z, int forceDat AABB *VineTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } bool VineTile::mayPlace(Level *level, int x, int y, int z, int face) @@ -259,7 +259,7 @@ testLoop: if(noSideSpread) break; int edgeTile = level->getTile(x + Direction::STEP_X[testDirection], y, z + Direction::STEP_Z[testDirection]); - if (edgeTile == 0 || Tile::tiles[edgeTile] == nullptr) + if (edgeTile == 0 || Tile::tiles[edgeTile] == NULL) { // if the edge tile is air, we could possibly cling // to something @@ -371,7 +371,7 @@ int VineTile::getResourceCount(Random *random) void VineTile::playerDestroy(Level *level, shared_ptrplayer, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), @@ -379,7 +379,7 @@ void VineTile::playerDestroy(Level *level, shared_ptrplayer, int x, int ); // drop leaf block instead of sapling - popResource(level, x, y, z, std::make_shared(Tile::vine, 1, 0)); + popResource(level, x, y, z, shared_ptr(new ItemInstance(Tile::vine, 1, 0))); } else { diff --git a/Minecraft.World/WallTile.cpp b/Minecraft.World/WallTile.cpp index b7d3f038..a95360ce 100644 --- a/Minecraft.World/WallTile.cpp +++ b/Minecraft.World/WallTile.cpp @@ -159,7 +159,7 @@ bool WallTile::connectsTo(LevelSource *level, int x, int y, int z) return true; } Tile *tileInstance = Tile::tiles[tile]; - if (tileInstance != nullptr) + if (tileInstance != NULL) { if (tileInstance->material->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.World/WaterLevelChunk.cpp b/Minecraft.World/WaterLevelChunk.cpp index 5cce2f80..3f4bd704 100644 --- a/Minecraft.World/WaterLevelChunk.cpp +++ b/Minecraft.World/WaterLevelChunk.cpp @@ -160,5 +160,5 @@ void WaterLevelChunk::setLevelChunkBrightness(LightLayer::variety layer, int x, Biome *WaterLevelChunk::getBiome(int x, int z, BiomeSource *biomeSource) { - return nullptr; + return NULL; } diff --git a/Minecraft.World/WaterLilyTile.cpp b/Minecraft.World/WaterLilyTile.cpp index 71c37874..15e43b9d 100644 --- a/Minecraft.World/WaterLilyTile.cpp +++ b/Minecraft.World/WaterLilyTile.cpp @@ -25,7 +25,7 @@ int WaterlilyTile::getRenderShape() void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) { - if (source == nullptr || !source->instanceof(eTYPE_BOAT)) + if (source == NULL || !source->instanceof(eTYPE_BOAT)) { Bush::addAABBs(level, x, y, z, box, boxes, source); } @@ -33,7 +33,7 @@ void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBL AABB *WaterlilyTile::getAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); diff --git a/Minecraft.World/WaterLilyTileItem.cpp b/Minecraft.World/WaterLilyTileItem.cpp index 978a611f..fe523c05 100644 --- a/Minecraft.World/WaterLilyTileItem.cpp +++ b/Minecraft.World/WaterLilyTileItem.cpp @@ -13,7 +13,7 @@ WaterLilyTileItem::WaterLilyTileItem(int id) : ColoredTileItem(id, false) bool WaterLilyTileItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == nullptr) return false; + if (hr == NULL) return false; if (hr->type == HitResult::TILE) { @@ -47,7 +47,7 @@ bool WaterLilyTileItem::TestUse(shared_ptr itemInstance, Level *le shared_ptr WaterLilyTileItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == nullptr) return itemInstance; + if (hr == NULL) return itemInstance; if (hr->type == HitResult::TILE) { diff --git a/Minecraft.World/WebTile.cpp b/Minecraft.World/WebTile.cpp index 43609e56..a724c36d 100644 --- a/Minecraft.World/WebTile.cpp +++ b/Minecraft.World/WebTile.cpp @@ -22,7 +22,7 @@ bool WebTile::isSolidRender(bool isServerLevel) AABB *WebTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return NULL; } diff --git a/Minecraft.World/WeighedRandom.cpp b/Minecraft.World/WeighedRandom.cpp index 777ab92f..0c27bf32 100644 --- a/Minecraft.World/WeighedRandom.cpp +++ b/Minecraft.World/WeighedRandom.cpp @@ -28,7 +28,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, vector *items) @@ -62,7 +62,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, WeighedRandomIte return items[i]; } } - return nullptr; + return NULL; } diff --git a/Minecraft.World/WeighedTreasure.cpp b/Minecraft.World/WeighedTreasure.cpp index 3c20ae66..ec4280e4 100644 --- a/Minecraft.World/WeighedTreasure.cpp +++ b/Minecraft.World/WeighedTreasure.cpp @@ -6,7 +6,7 @@ WeighedTreasure::WeighedTreasure(int itemId, int auxValue, int minCount, int maxCount, int weight) : WeighedRandomItem(weight) { - this->item = std::make_shared(itemId, 1, auxValue); + this->item = shared_ptr( new ItemInstance(itemId, 1, auxValue) ); this->minCount = minCount; this->maxCount = maxCount; } @@ -22,7 +22,7 @@ void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, { for (int r = 0; r < numRolls; r++) { - WeighedTreasure *treasure = static_cast(WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items))); + WeighedTreasure *treasure = (WeighedTreasure *) WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items)); int count = treasure->minCount + random->nextInt(treasure->maxCount - treasure->minCount + 1); if (treasure->item->getMaxStackSize() >= count) @@ -48,7 +48,7 @@ void WeighedTreasure::addDispenserItems(Random *random, WeighedTreasureArray ite { for (int r = 0; r < numRolls; r++) { - WeighedTreasure *treasure = static_cast(WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items))); + WeighedTreasure *treasure = (WeighedTreasure *) WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items)); int count = treasure->minCount + random->nextInt(treasure->maxCount - treasure->minCount + 1); if (treasure->item->getMaxStackSize() >= count) diff --git a/Minecraft.World/WeightedPressurePlateTile.cpp b/Minecraft.World/WeightedPressurePlateTile.cpp index c9b7d5c8..352747ce 100644 --- a/Minecraft.World/WeightedPressurePlateTile.cpp +++ b/Minecraft.World/WeightedPressurePlateTile.cpp @@ -25,7 +25,7 @@ int WeightedPressurePlateTile::getSignalStrength(Level *level, int x, int y, int } else { - float pct = min(maxWeight, count) / static_cast(maxWeight); + float pct = min(maxWeight, count) / (float) maxWeight; return Mth::ceil(pct * Redstone::SIGNAL_MAX); } } diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp index 375c8388..c697d467 100644 --- a/Minecraft.World/Witch.cpp +++ b/Minecraft.World/Witch.cpp @@ -43,7 +43,7 @@ void Witch::defineSynchedData() { Monster::defineSynchedData(); - getEntityData()->define(DATA_USING_ITEM, static_cast(0)); + getEntityData()->define(DATA_USING_ITEM, (byte) 0); } int Witch::getAmbientSound() @@ -63,7 +63,7 @@ int Witch::getDeathSound() void Witch::setUsingItem(bool isUsing) { - getEntityData()->set(DATA_USING_ITEM, isUsing ? static_cast(1) : static_cast(0)); + getEntityData()->set(DATA_USING_ITEM, isUsing ? (byte) 1 : (byte) 0); } bool Witch::isUsingItem() @@ -96,10 +96,10 @@ void Witch::aiStep() shared_ptr item = getCarriedItem(); setEquippedSlot(SLOT_WEAPON, nullptr); - if (item != nullptr && item->id == Item::potion_Id) + if (item != NULL && item->id == Item::potion_Id) { vector *effects = Item::potion->getMobEffects(item); - if (effects != nullptr) + if (effects != NULL) { for(auto& effect : *effects) { @@ -124,18 +124,18 @@ void Witch::aiStep() { potion = PotionBrewing::POTION_ID_HEAL; } - else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) + else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) { potion = PotionBrewing::POTION_ID_SWIFTNESS; } - else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) + else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) { potion = PotionBrewing::POTION_ID_SWIFTNESS; } if (potion > -1) { - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::potion, 1, potion)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::potion, 1, potion)) ); usingTime = getCarriedItem()->getUseDuration(); setUsingItem(true); AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); @@ -198,7 +198,7 @@ void Witch::performRangedAttack(shared_ptr target, float power) { if (isUsingItem()) return; - shared_ptr potion = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), PotionBrewing::POTION_ID_SPLASH_DAMAGE); + shared_ptr potion = shared_ptr( new ThrownPotion(level, dynamic_pointer_cast(shared_from_this()), PotionBrewing::POTION_ID_SPLASH_DAMAGE) ); potion->xRot -= -20; double xd = (target->x + target->xd) - x; double yd = (target->y + target->getHeadHeight() - 1.1f) - y; diff --git a/Minecraft.World/WitherBoss.cpp b/Minecraft.World/WitherBoss.cpp index af406a93..84cf1382 100644 --- a/Minecraft.World/WitherBoss.cpp +++ b/Minecraft.World/WitherBoss.cpp @@ -124,7 +124,7 @@ void WitherBoss::aiStep() if (!level->isClientSide && getAlternativeTarget(0) > 0) { shared_ptr e = level->getEntity(getAlternativeTarget(0)); - if (e != nullptr) + if (e != NULL) { if ((y < e->y) || (!isPowered() && y < (e->y + 5))) { @@ -148,7 +148,7 @@ void WitherBoss::aiStep() } if ((xd * xd + zd * zd) > .05f) { - yRot = static_cast(atan2(zd, xd)) * Mth::RADDEG - 90; + yRot = (float) atan2(zd, xd) * Mth::RADDEG - 90; } Monster::aiStep(); @@ -167,7 +167,7 @@ void WitherBoss::aiStep() { e = level->getEntity(entityId); } - if (e != nullptr) + if (e != NULL) { double hx = getHeadX(i + 1); double hy = getHeadY(i + 1); @@ -178,8 +178,8 @@ void WitherBoss::aiStep() double zd = e->z - hz; double sd = Mth::sqrt(xd * xd + zd * zd); - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; - float xRotD = static_cast(-(atan2(yd, sd) * 180 / PI)); + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; + float xRotD = (float) -(atan2(yd, sd) * 180 / PI); xRotHeads[i] = rotlerp(xRotHeads[i], xRotD, 40); yRotHeads[i] = rotlerp(yRotHeads[i], yRotD, 10); @@ -221,7 +221,7 @@ void WitherBoss::newServerAiStep() if (newCount <= 0) { level->explode(shared_from_this(), x, y + getHeadHeight(), z, 7, false, level->getGameRules()->getBoolean(GameRules::RULE_MOBGRIEFING)); - level->globalLevelEvent(LevelEvent::SOUND_WITHER_BOSS_SPAWN, static_cast(x), static_cast(y), static_cast(z), 0); + level->globalLevelEvent(LevelEvent::SOUND_WITHER_BOSS_SPAWN, (int) x, (int) y, (int) z, 0); } setInvulnerableTicks(newCount); @@ -258,7 +258,7 @@ void WitherBoss::newServerAiStep() shared_ptr current = level->getEntity(headTarget); // 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 == NULL || !current->instanceof(eTYPE_LIVINGENTITY) || !current->isAlive() || distanceToSqr(current) > 30 * 30 || !canSee(current)) { setAlternativeTarget(i, 0); } @@ -303,7 +303,7 @@ void WitherBoss::newServerAiStep() } } } - if (getTarget() != nullptr) + if (getTarget() != NULL) { assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); @@ -346,7 +346,7 @@ void WitherBoss::newServerAiStep() } if (destroyed) { - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, (int) x, (int) y, (int) z, 0); } } } @@ -427,7 +427,7 @@ void WitherBoss::performRangedAttack(int head, shared_ptr target) void WitherBoss::performRangedAttack(int head, double tx, double ty, double tz, bool dangerous) { - level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, (int) x, (int) y, (int) z, 0); double hx = getHeadX(head); double hy = getHeadY(head); @@ -437,7 +437,7 @@ void WitherBoss::performRangedAttack(int head, double tx, double ty, double tz, double yd = ty - hy; double zd = tz - hz; - shared_ptr ie = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), xd, yd, zd); + shared_ptr ie = shared_ptr( new WitherSkull(level, dynamic_pointer_cast(shared_from_this()), xd, yd, zd) ); if (dangerous) ie->setDangerous(true); ie->y = hy; ie->x = hx; @@ -462,14 +462,14 @@ bool WitherBoss::hurt(DamageSource *source, float dmg) if (isPowered()) { shared_ptr directEntity = source->getDirectEntity(); - if (directEntity != nullptr && directEntity->GetType() == eTYPE_ARROW) + if (directEntity != NULL && directEntity->GetType() == eTYPE_ARROW) { return false; } } shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr) + if (sourceEntity != NULL) { if ( sourceEntity->instanceof(eTYPE_PLAYER) ) { diff --git a/Minecraft.World/WitherSkull.cpp b/Minecraft.World/WitherSkull.cpp index ccde41d4..d67660c4 100644 --- a/Minecraft.World/WitherSkull.cpp +++ b/Minecraft.World/WitherSkull.cpp @@ -55,9 +55,9 @@ void WitherSkull::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != nullptr) + if (res->entity != NULL) { - if (owner != nullptr) + if (owner != NULL) { DamageSource *damageSource = DamageSource::mobAttack(owner); if (res->entity->hurt(damageSource, 8)) @@ -111,7 +111,7 @@ bool WitherSkull::hurt(DamageSource *source, float damage) void WitherSkull::defineSynchedData() { - entityData->define(DATA_DANGEROUS, static_cast(0)); + entityData->define(DATA_DANGEROUS, (byte) 0); } bool WitherSkull::isDangerous() @@ -121,7 +121,7 @@ bool WitherSkull::isDangerous() void WitherSkull::setDangerous(bool value) { - entityData->set(DATA_DANGEROUS, value ? static_cast(1) : static_cast(0)); + entityData->set(DATA_DANGEROUS, value ? (byte) 1 : (byte) 0); } bool WitherSkull::shouldBurn() diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index 7588a67b..1988382e 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -81,7 +81,7 @@ bool Wolf::useNewAi() void Wolf::setTarget(shared_ptr target) { TamableAnimal::setTarget(target); - if ( target == nullptr ) + if ( target == NULL ) { setAngry(false); } @@ -100,8 +100,8 @@ void Wolf::defineSynchedData() { TamableAnimal::defineSynchedData(); entityData->define(DATA_HEALTH_ID, getHealth()); - entityData->define(DATA_INTERESTED_ID, static_cast(0)); - entityData->define(DATA_COLLAR_COLOR, static_cast(ColoredTile::getTileDataForItemAuxValue(DyePowderItem::RED))); + entityData->define(DATA_INTERESTED_ID, (byte)0); + entityData->define(DATA_COLLAR_COLOR, (byte) ColoredTile::getTileDataForItemAuxValue(DyePowderItem::RED)); } void Wolf::playStepSound(int xt, int yt, int zt, int t) @@ -114,7 +114,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag) TamableAnimal::addAdditonalSaveData(tag); tag->putBoolean(L"Angry", isAngry()); - tag->putByte(L"CollarColor", static_cast(getCollarColor())); + tag->putByte(L"CollarColor", (byte) getCollarColor()); } void Wolf::readAdditionalSaveData(CompoundTag *tag) @@ -224,8 +224,8 @@ void Wolf::tick() if (shakeAnim > 0.4f) { - float yt = static_cast(bb->y0); - int shakeCount = static_cast(Mth::sin((shakeAnim - 0.4f) * PI) * 7.0f); + float yt = (float) bb->y0; + int shakeCount = (int) (Mth::sin((shakeAnim - 0.4f) * PI) * 7.0f); for (int i = 0; i < shakeCount; i++) { float xo = (random->nextFloat() * 2 - 1) * bbWidth * 0.5f; @@ -286,7 +286,7 @@ bool Wolf::hurt(DamageSource *source, float dmg) if (isTame()) { shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) + if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) { shared_ptr attacker = dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerUUID()); @@ -296,7 +296,7 @@ bool Wolf::hurt(DamageSource *source, float dmg) if (isInvulnerable()) return false; shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); - if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || sourceEntity->instanceof(eTYPE_ARROW))) + if (sourceEntity != NULL && !(sourceEntity->instanceof(eTYPE_PLAYER) || sourceEntity->instanceof(eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; @@ -327,7 +327,7 @@ void Wolf::setTame(bool value) void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) { setTame(true); - setPath(nullptr); + setPath(NULL); setTarget(nullptr); sitGoal->wantToSit(bSetSitting); setHealth(TAME_HEALTH); @@ -344,9 +344,9 @@ bool Wolf::mobInteract(shared_ptr player) if (isTame()) { - if (item != nullptr) + if (item != NULL) { - if(dynamic_cast(Item::items[item->id]) != nullptr) + if(dynamic_cast(Item::items[item->id]) != NULL) { FoodItem *food = dynamic_cast( Item::items[item->id] ); @@ -387,7 +387,7 @@ bool Wolf::mobInteract(shared_ptr player) { sitGoal->wantToSit(!isSitting()); jumping = false; - setPath(nullptr); + setPath(NULL); setAttackTarget(nullptr); setTarget(nullptr); } @@ -395,7 +395,7 @@ bool Wolf::mobInteract(shared_ptr player) } else { - if (item != nullptr && item->id == Item::bone->id && !isAngry()) + if (item != NULL && item->id == Item::bone->id && !isAngry()) { // 4J-PB - don't lose the bone in creative mode if (player->abilities.instabuild==false) @@ -430,7 +430,7 @@ bool Wolf::mobInteract(shared_ptr player) } // 4J-PB - stop wild wolves going in to Love Mode (even though they do on Java, but don't breed) - if((item != nullptr) && isFood(item)) + if((item != NULL) && isFood(item)) { return false; } @@ -467,9 +467,9 @@ float Wolf::getTailAngle() bool Wolf::isFood(shared_ptr item) { - if (item == nullptr) return false; - if (dynamic_cast(Item::items[item->id]) == nullptr) return false; - return static_cast(Item::items[item->id])->isMeat(); + if (item == NULL) return false; + if (dynamic_cast(Item::items[item->id]) == NULL) return false; + return ((FoodItem *) Item::items[item->id])->isMeat(); } int Wolf::getMaxSpawnClusterSize() @@ -488,11 +488,11 @@ void Wolf::setAngry(bool value) byte current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x02)); + entityData->set(DATA_FLAGS_ID, (byte) (current | 0x02)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x02)); + entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02)); } } @@ -503,7 +503,7 @@ int Wolf::getCollarColor() void Wolf::setCollarColor(int color) { - entityData->set(DATA_COLLAR_COLOR, static_cast(color & 0xF)); + entityData->set(DATA_COLLAR_COLOR, (byte) (color & 0xF)); } // 4J-PB added for tooltips @@ -517,7 +517,7 @@ shared_ptr Wolf::getBreedOffspring(shared_ptr target) // 4J - added limit to wolves that can be bred if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) ) { - shared_ptr pBabyWolf = std::make_shared(level); + shared_ptr pBabyWolf = shared_ptr( new Wolf(level) ); if(!getOwnerUUID().empty()) { @@ -536,11 +536,11 @@ void Wolf::setIsInterested(bool value) { if (value) { - entityData->set(DATA_INTERESTED_ID, static_cast(1)); + entityData->set(DATA_INTERESTED_ID, (byte) 1); } else { - entityData->set(DATA_INTERESTED_ID, static_cast(0)); + entityData->set(DATA_INTERESTED_ID, (byte) 0); } } @@ -552,7 +552,7 @@ bool Wolf::canMate(shared_ptr animal) if (!animal->instanceof(eTYPE_WOLF)) return false; shared_ptr partner = dynamic_pointer_cast(animal); - if (partner == nullptr) return false; + if (partner == NULL) return false; if (!partner->isTame()) return false; if (partner->isSitting()) return false; diff --git a/Minecraft.World/WoodSlabTile.cpp b/Minecraft.World/WoodSlabTile.cpp index 574dab93..ba3a98e5 100644 --- a/Minecraft.World/WoodSlabTile.cpp +++ b/Minecraft.World/WoodSlabTile.cpp @@ -33,7 +33,7 @@ int WoodSlabTile::getResource(int data, Random *random, int playerBonusLevel) shared_ptr WoodSlabTile::getSilkTouchItemInstance(int data) { - return std::make_shared(Tile::woodSlabHalf, 2, data & TYPE_MASK); + return shared_ptr(new ItemInstance(Tile::woodSlabHalf, 2, data & TYPE_MASK)); } int WoodSlabTile::getAuxName(int auxValue) diff --git a/Minecraft.World/WoodTile.cpp b/Minecraft.World/WoodTile.cpp index 239ef61c..c735c581 100644 --- a/Minecraft.World/WoodTile.cpp +++ b/Minecraft.World/WoodTile.cpp @@ -21,7 +21,7 @@ const wstring WoodTile::TEXTURE_NAMES[] = {L"oak", L"spruce", L"birch", L"jungle WoodTile::WoodTile(int id) : Tile(id, Material::wood) { - icons = nullptr; + icons = NULL; } unsigned int WoodTile::getDescriptionId(int iData) diff --git a/Minecraft.World/WoolCarpetTile.cpp b/Minecraft.World/WoolCarpetTile.cpp index 370b4010..b509a312 100644 --- a/Minecraft.World/WoolCarpetTile.cpp +++ b/Minecraft.World/WoolCarpetTile.cpp @@ -20,7 +20,7 @@ AABB *WoolCarpetTile::getAABB(Level *level, int x, int y, int z) { int height = 0; float offset = 1.0f / SharedConstants::WORLD_RESOLUTION; - ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + (height * offset), z + tls->zz1); diff --git a/Minecraft.World/WorkbenchTile.cpp b/Minecraft.World/WorkbenchTile.cpp index cc505fc6..82193b69 100644 --- a/Minecraft.World/WorkbenchTile.cpp +++ b/Minecraft.World/WorkbenchTile.cpp @@ -7,8 +7,8 @@ WorkbenchTile::WorkbenchTile(int id) : Tile(id, Material::wood) { - iconTop = nullptr; - iconFront = nullptr; + iconTop = NULL; + iconFront = NULL; } Icon *WorkbenchTile::getTexture(int face, int data) diff --git a/Minecraft.World/XZPacket.h b/Minecraft.World/XZPacket.h index 41b6c30d..0c4115e0 100644 --- a/Minecraft.World/XZPacket.h +++ b/Minecraft.World/XZPacket.h @@ -25,6 +25,6 @@ public: virtual int getEstimatedSize(); public: - static shared_ptr create() { return std::make_shared(); } + static shared_ptr create() { return shared_ptr(new XZPacket()); } virtual int getId() { return 166; } }; \ No newline at end of file diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index f982d847..e923822c 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -68,9 +68,9 @@ void Zombie::defineSynchedData() { Monster::defineSynchedData(); - getEntityData()->define(DATA_BABY_ID, static_cast(0)); - getEntityData()->define(DATA_VILLAGER_ID, static_cast(0)); - getEntityData()->define(DATA_CONVERTING_ID, static_cast(0)); + getEntityData()->define(DATA_BABY_ID, (byte) 0); + getEntityData()->define(DATA_VILLAGER_ID, (byte) 0); + getEntityData()->define(DATA_CONVERTING_ID, (byte) 0); } int Zombie::getArmorValue() @@ -87,7 +87,7 @@ bool Zombie::useNewAi() bool Zombie::isBaby() { - return getEntityData()->getByte(DATA_BABY_ID) == static_cast(1); + return getEntityData()->getByte(DATA_BABY_ID) == (byte) 1; } void Zombie::setBaby(bool baby) @@ -95,7 +95,7 @@ void Zombie::setBaby(bool baby) getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0)); updateSize(baby); - if (level != nullptr && !level->isClientSide) + if (level != NULL && !level->isClientSide) { AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_BABY); @@ -108,12 +108,12 @@ void Zombie::setBaby(bool baby) bool Zombie::isVillager() { - return getEntityData()->getByte(DATA_VILLAGER_ID) == static_cast(1); + return getEntityData()->getByte(DATA_VILLAGER_ID) == (byte) 1; } void Zombie::setVillager(bool villager) { - getEntityData()->set(DATA_VILLAGER_ID, static_cast(villager ? 1 : 0)); + getEntityData()->set(DATA_VILLAGER_ID, (byte) (villager ? 1 : 0)); } void Zombie::aiStep() @@ -121,12 +121,12 @@ void Zombie::aiStep() if (level->isDay() && !level->isClientSide && !isBaby()) { float br = getBrightness(1); - if (br > 0.5f && random->nextFloat() * 30 < (br - 0.4f) * 2 && level->canSeeSky(Mth::floor(x), static_cast(floor(y + 0.5)), Mth::floor(z))) + if (br > 0.5f && random->nextFloat() * 30 < (br - 0.4f) * 2 && level->canSeeSky(Mth::floor(x), (int)floor( y + 0.5 ), Mth::floor(z))) { bool burn = true; shared_ptr helmet = getCarried(SLOT_HELM); - if (helmet != nullptr) + if (helmet != NULL) { if (helmet->isDamageableItem()) { @@ -155,15 +155,15 @@ bool Zombie::hurt(DamageSource *source, float dmg) if (Monster::hurt(source, dmg)) { shared_ptr target = getTarget(); - if ( (target == nullptr) && getAttackTarget() != nullptr && getAttackTarget()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( getAttackTarget() ); - if ( (target == nullptr) && source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( source->getEntity() ); + if ( (target == NULL) && getAttackTarget() != NULL && getAttackTarget()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( getAttackTarget() ); + if ( (target == NULL) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( source->getEntity() ); - if ( (target != nullptr) && level->difficulty >= Difficulty::HARD && random->nextFloat() < getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->getValue()) + if ( (target != NULL) && level->difficulty >= Difficulty::HARD && random->nextFloat() < getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->getValue()) { int x = Mth::floor(this->x); int y = Mth::floor(this->y); int z = Mth::floor(this->z); - shared_ptr reinforcement = std::make_shared(level); + shared_ptr reinforcement = shared_ptr( new Zombie(level) ); for (int i = 0; i < REINFORCEMENT_ATTEMPTS; i++) { @@ -179,7 +179,7 @@ bool Zombie::hurt(DamageSource *source, float dmg) { level->addEntity(reinforcement); reinforcement->setTarget(target); - reinforcement->finalizeMobSpawn(nullptr); + reinforcement->finalizeMobSpawn(NULL); getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->addModifier(new AttributeModifier(-0.05f, AttributeModifier::OPERATION_ADDITION)); reinforcement->getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->addModifier(new AttributeModifier(-0.05f, AttributeModifier::OPERATION_ADDITION)); @@ -223,7 +223,7 @@ bool Zombie::doHurtTarget(shared_ptr target) if (result) { - if (getCarriedItem() == nullptr && isOnFire() && random->nextFloat() < level->difficulty * 0.3f) + if (getCarriedItem() == NULL && isOnFire() && random->nextFloat() < level->difficulty * 0.3f) { target->setOnFire(2 * level->difficulty); } @@ -293,11 +293,11 @@ void Zombie::populateDefaultEquipmentSlots() int rand = random->nextInt(3); if (rand == 0) { - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::sword_iron)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::sword_iron)) ); } else { - setEquippedSlot(SLOT_WEAPON, std::make_shared(Item::shovel_iron)); + setEquippedSlot(SLOT_WEAPON, shared_ptr( new ItemInstance(Item::shovel_iron)) ); } } } @@ -328,15 +328,15 @@ void Zombie::killed(shared_ptr mob) { if (level->difficulty == Difficulty::NORMAL && random->nextBoolean()) return; - shared_ptr zombie = std::make_shared(level); + shared_ptr zombie = shared_ptr(new Zombie(level)); zombie->copyPosition(mob); level->removeEntity(mob); - zombie->finalizeMobSpawn(nullptr); + zombie->finalizeMobSpawn(NULL); zombie->setVillager(true); if (mob->isBaby()) zombie->setBaby(true); level->addEntity(zombie); - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_INFECTED, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_INFECTED, (int) x, (int) y, (int) z, 0); } } @@ -347,14 +347,14 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* setCanPickUpLoot(random->nextFloat() < MAX_PICKUP_LOOT_CHANCE * difficulty); - if (groupData == nullptr) + if (groupData == NULL) { groupData = new ZombieGroupData(level->random->nextFloat() < 0.05f, level->random->nextFloat() < 0.05f); } - if ( dynamic_cast( groupData ) != nullptr) + if ( dynamic_cast( groupData ) != NULL) { - ZombieGroupData *zombieData = static_cast(groupData); + ZombieGroupData *zombieData = (ZombieGroupData *) groupData; if (zombieData->isVillager) { @@ -370,7 +370,7 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* populateDefaultEquipmentSlots(); populateDefaultEquipmentEnchantments(); - if (getCarried(SLOT_HELM) == nullptr) + if (getCarried(SLOT_HELM) == NULL) { // [EB]: We have this code in quite some places, shouldn't we set // something like this globally? @@ -378,7 +378,7 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* { // Halloween! OooOOo! 25% of all skeletons/zombies can wear // pumpkins on their heads. - setEquippedSlot(SLOT_HELM, std::make_shared(random->nextFloat() < 0.1f ? Tile::litPumpkin : Tile::pumpkin)); + setEquippedSlot(SLOT_HELM, shared_ptr( new ItemInstance(random->nextFloat() < 0.1f ? Tile::litPumpkin : Tile::pumpkin) )); dropChances[SLOT_HELM] = 0; } } @@ -401,7 +401,7 @@ bool Zombie::mobInteract(shared_ptr player) { shared_ptr item = player->getSelectedItem(); - if (item != nullptr && item->getItem() == Item::apple_gold && item->getAuxValue() == 0 && isVillager() && hasEffect(MobEffect::weakness)) + if (item != NULL && item->getItem() == Item::apple_gold && item->getAuxValue() == 0 && isVillager() && hasEffect(MobEffect::weakness)) { if (!player->abilities.instabuild) item->count--; if (item->count <= 0) @@ -426,7 +426,7 @@ bool Zombie::mobInteract(shared_ptr player) void Zombie::startConverting(int time) { villagerConversionTime = time; - getEntityData()->set(DATA_CONVERTING_ID, static_cast(1)); + getEntityData()->set(DATA_CONVERTING_ID, (byte) 1); removeEffect(MobEffect::weakness->id); addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0))); @@ -453,21 +453,21 @@ bool Zombie::removeWhenFarAway() bool Zombie::isConverting() { - return getEntityData()->getByte(DATA_CONVERTING_ID) == static_cast(1); + return getEntityData()->getByte(DATA_CONVERTING_ID) == (byte) 1; } void Zombie::finishConversion() { - shared_ptr villager = std::make_shared(level); + shared_ptr villager = shared_ptr(new Villager(level)); villager->copyPosition(shared_from_this()); - villager->finalizeMobSpawn(nullptr); + villager->finalizeMobSpawn(NULL); villager->setRewardPlayersInVillage(); if (isBaby()) villager->setAge(-20 * 60 * 20); level->removeEntity(shared_from_this()); level->addEntity(villager); villager->addEffect(new MobEffectInstance(MobEffect::confusion->id, SharedConstants::TICKS_PER_SECOND * 10, 0)); - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_CONVERTED, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_CONVERTED, (int) x, (int) y, (int) z, 0); } int Zombie::getConversionProgress() @@ -478,11 +478,11 @@ int Zombie::getConversionProgress() { int specialBlocksCount = 0; - for (int xx = static_cast(x) - SPECIAL_BLOCK_RADIUS; xx < static_cast(x) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; xx++) + for (int xx = (int) x - SPECIAL_BLOCK_RADIUS; xx < (int) x + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; xx++) { - for (int yy = static_cast(y) - SPECIAL_BLOCK_RADIUS; yy < static_cast(y) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; yy++) + for (int yy = (int) y - SPECIAL_BLOCK_RADIUS; yy < (int) y + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; yy++) { - for (int zz = static_cast(z) - SPECIAL_BLOCK_RADIUS; zz < static_cast(z) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; zz++) + for (int zz = (int) z - SPECIAL_BLOCK_RADIUS; zz < (int) z + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; zz++) { int tile = level->getTile(xx, yy, zz); diff --git a/Minecraft.World/ZoneFile.cpp b/Minecraft.World/ZoneFile.cpp index 582ce26d..661cb7dd 100644 --- a/Minecraft.World/ZoneFile.cpp +++ b/Minecraft.World/ZoneFile.cpp @@ -23,7 +23,7 @@ ZoneFile::ZoneFile(int64_t key, File file, File entityFile) : slots(slotsLength) // this.entityFile = new NbtSlotFile(entityFile); // } - channel = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + channel = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); // 4J - try/catch removed // try { readHeader(); diff --git a/Minecraft.World/ZoneIo.cpp b/Minecraft.World/ZoneIo.cpp index f6adcf0e..0bd2a637 100644 --- a/Minecraft.World/ZoneIo.cpp +++ b/Minecraft.World/ZoneIo.cpp @@ -22,8 +22,8 @@ void ZoneIo::write(byteArray bb, int size) void ZoneIo::write(ByteBuffer *bb, int size) { DWORD numberOfBytesWritten; - SetFilePointer(channel,static_cast(pos),nullptr,nullptr); - WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,nullptr); + SetFilePointer(channel,(int)pos,NULL,NULL); + WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,NULL); pos += size; } @@ -31,13 +31,13 @@ ByteBuffer *ZoneIo::read(int size) { DWORD numberOfBytesRead; byteArray bb = byteArray(size); - SetFilePointer(channel,static_cast(pos),nullptr,nullptr); + SetFilePointer(channel,(int)pos,NULL,NULL); ByteBuffer *buff = ByteBuffer::wrap(bb); // 4J - to investigate - why is this buffer flipped before anything goes in it? buff->order(ZonedChunkStorage::BYTEORDER); buff->position(size); buff->flip(); - ReadFile(channel, buff->getBuffer(), buff->getSize(), &numberOfBytesRead, nullptr); + ReadFile(channel, buff->getBuffer(), buff->getSize(), &numberOfBytesRead, NULL); pos += size; return buff; } diff --git a/Minecraft.World/ZonedChunkStorage.cpp b/Minecraft.World/ZonedChunkStorage.cpp index 19023242..596d7c48 100644 --- a/Minecraft.World/ZonedChunkStorage.cpp +++ b/Minecraft.World/ZonedChunkStorage.cpp @@ -62,8 +62,8 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) if ( !file.exists() ) { - if (!create) return nullptr; - HANDLE ch = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + if (!create) return NULL; + HANDLE ch = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CloseHandle(ch); } @@ -76,7 +76,7 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) zoneFile->lastUse = tickCount; if (!zoneFile->containsSlot(slot)) { - if (!create) return nullptr; + if (!create) return NULL; } return zoneFile; @@ -85,14 +85,14 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) ZoneIo *ZonedChunkStorage::getBuffer(int x, int z, bool create) { ZoneFile *zoneFile = getZoneFile(x, z, create); - if (zoneFile == nullptr) return nullptr; + if (zoneFile == NULL) return NULL; return zoneFile->getZoneIo(getSlot(x, z)); } LevelChunk *ZonedChunkStorage::load(Level *level, int x, int z) { ZoneIo *zoneIo = getBuffer(x, z, false); - if (zoneIo == nullptr) return nullptr; + if (zoneIo == NULL) return NULL; LevelChunk *lc = new LevelChunk(level, x, z); lc->unsaved = false; diff --git a/Minecraft.World/ZoomLayer.cpp b/Minecraft.World/ZoomLayer.cpp index fd452a08..c2123785 100644 --- a/Minecraft.World/ZoomLayer.cpp +++ b/Minecraft.World/ZoomLayer.cpp @@ -86,7 +86,7 @@ shared_ptrZoomLayer::zoom(int64_t seed, shared_ptr sup, int count) shared_ptrresult = sup; for (int i = 0; i < count; i++) { - result = std::make_shared(seed + i, result); + result = shared_ptr(new ZoomLayer(seed + i, result)); } return result; } \ No newline at end of file diff --git a/Minecraft.World/compression.cpp b/Minecraft.World/compression.cpp index 2a8f8e0b..99c5228a 100644 --- a/Minecraft.World/compression.cpp +++ b/Minecraft.World/compression.cpp @@ -12,7 +12,7 @@ DWORD Compression::tlsIdx = 0; -Compression::ThreadStorage *Compression::tlsDefault = nullptr; +Compression::ThreadStorage *Compression::tlsDefault = NULL; Compression::ThreadStorage::ThreadStorage() { @@ -27,7 +27,7 @@ Compression::ThreadStorage::~ThreadStorage() void Compression::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == nullptr ) + if(tlsDefault == NULL ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -42,7 +42,7 @@ void Compression::UseDefaultThreadStorage() void Compression::ReleaseThreadStorage() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); if( tls == tlsDefault ) return; delete tls; @@ -50,7 +50,7 @@ void Compression::ReleaseThreadStorage() Compression *Compression::getCompression() { - ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); + ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); return tls->compression; } @@ -59,7 +59,7 @@ HRESULT Compression::CompressLZXRLE(void *pDestination, unsigned int *pDestSize, EnterCriticalSection(&rleCompressLock); //static unsigned char rleBuf[1024*100]; - unsigned char *pucIn = static_cast(pSource); + unsigned char *pucIn = (unsigned char *)pSource; unsigned char *pucEnd = pucIn + SrcSize; unsigned char *pucOut = (unsigned char *)rleCompressBuf; @@ -101,7 +101,7 @@ HRESULT Compression::CompressLZXRLE(void *pDestination, unsigned int *pDestSize, *pucOut++ = thisOne; } } while (pucIn != pucEnd); - unsigned int rleSize = static_cast(pucOut - rleCompressBuf); + unsigned int rleSize = (unsigned int)(pucOut - rleCompressBuf); PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Secondary compression"); @@ -118,7 +118,7 @@ HRESULT Compression::CompressRLE(void *pDestination, unsigned int *pDestSize, vo EnterCriticalSection(&rleCompressLock); //static unsigned char rleBuf[1024*100]; - unsigned char *pucIn = static_cast(pSource); + unsigned char *pucIn = (unsigned char *)pSource; unsigned char *pucEnd = pucIn + SrcSize; unsigned char *pucOut = (unsigned char *)rleCompressBuf; @@ -160,7 +160,7 @@ HRESULT Compression::CompressRLE(void *pDestination, unsigned int *pDestSize, vo *pucOut++ = thisOne; } } while (pucIn != pucEnd); - unsigned int rleSize = static_cast(pucOut - rleCompressBuf); + unsigned int rleSize = (unsigned int)(pucOut - rleCompressBuf); PIXEndNamedEvent(); LeaveCriticalSection(&rleCompressLock); @@ -189,12 +189,12 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz // only use 5% of this buffer // 4J Stu - Changed this again to dynamically allocate a buffer if it's going to be too big - unsigned char *pucIn = nullptr; + unsigned char *pucIn = NULL; //const unsigned int staticRleSize = 1024*200; //static unsigned char rleBuf[staticRleSize]; unsigned int rleSize = staticRleSize; - unsigned char *dynamicRleBuf = nullptr; + unsigned char *dynamicRleBuf = NULL; if(*pDestSize > rleSize) { @@ -206,12 +206,12 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz else { Decompress(rleDecompressBuf, &rleSize, pSource, SrcSize); - pucIn = static_cast(rleDecompressBuf); + pucIn = (unsigned char *)rleDecompressBuf; } //unsigned char *pucIn = (unsigned char *)rleDecompressBuf; unsigned char *pucEnd = pucIn + rleSize; - unsigned char *pucOut = static_cast(pDestination); + unsigned char *pucOut = (unsigned char *)pDestination; while( pucIn != pucEnd ) { @@ -242,11 +242,11 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz *pucOut++ = thisOne; } } - *pDestSize = static_cast(pucOut - (unsigned char *)pDestination); + *pDestSize = (unsigned int)(pucOut - (unsigned char *)pDestination); // printf("Decompressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize); - if(dynamicRleBuf != nullptr) delete [] dynamicRleBuf; + if(dynamicRleBuf != NULL) delete [] dynamicRleBuf; LeaveCriticalSection(&rleDecompressLock); return S_OK; @@ -257,9 +257,9 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, EnterCriticalSection(&rleDecompressLock); //unsigned char *pucIn = (unsigned char *)rleDecompressBuf; - unsigned char *pucIn = static_cast(pSource); + unsigned char *pucIn = (unsigned char *)pSource; unsigned char *pucEnd = pucIn + SrcSize; - unsigned char *pucOut = static_cast(pDestination); + unsigned char *pucOut = (unsigned char *)pDestination; while( pucIn != pucEnd ) { @@ -290,7 +290,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, *pucOut++ = thisOne; } } - *pDestSize = static_cast(pucOut - (unsigned char *)pDestination); + *pDestSize = (unsigned int)(pucOut - (unsigned char *)pDestination); LeaveCriticalSection(&rleDecompressLock); return S_OK; @@ -302,8 +302,8 @@ HRESULT Compression::Compress(void *pDestination, unsigned int *pDestSize, void // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ SIZE_T destSize = (SIZE_T)(*pDestSize); - int res = ::compress(static_cast(pDestination), (uLongf *)&destSize, static_cast(pSource), SrcSize); - *pDestSize = static_cast(destSize); + int res = ::compress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); + *pDestSize = (unsigned int)destSize; return ( ( res == Z_OK ) ? S_OK : -1 ); #elif defined __PS3__ uint32_t destSize = (uint32_t)(*pDestSize); @@ -330,8 +330,8 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ SIZE_T destSize = (SIZE_T)(*pDestSize); - int res = ::uncompress(static_cast(pDestination), (uLongf *)&destSize, static_cast(pSource), SrcSize); - *pDestSize = static_cast(destSize); + int res = ::uncompress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); + *pDestSize = (unsigned int)destSize; return ( ( res == Z_OK ) ? S_OK : -1 ); #elif defined __PS3__ uint32_t destSize = (uint32_t)(*pDestSize); @@ -350,11 +350,11 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi #ifndef _XBOX VOID Compression::VitaVirtualDecompress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst) { - uint8_t *pSrc = static_cast(pSource); + uint8_t *pSrc = (uint8_t *)pSource; int Offset = 0; int Page = 0; int Index = 0; - uint8_t* Data = static_cast(pDestination); + uint8_t* Data = (uint8_t*)pDestination; while( Index != SrcSize ) { // is this a normal value @@ -397,7 +397,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS #if (defined _XBOX || defined _DURANGO || defined _WIN64) SIZE_T destSize = (SIZE_T)(*pDestSize); HRESULT res = XMemDecompress(decompressionContext, pDestination, (SIZE_T *)&destSize, pSource, SrcSize); - *pDestSize = static_cast(destSize); + *pDestSize = (unsigned int)destSize; return res; #else assert(0); @@ -406,9 +406,9 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS break; case eCompressionType_ZLIBRLE: #if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64) - if (pDestination != nullptr) - return ::uncompress(static_cast(pDestination), (unsigned long *) pDestSize, static_cast(pSource), SrcSize); // Decompress - else break; // Cannot decompress when destination is nullptr + if (pDestination != NULL) + return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress + else break; // Cannot decompress when destination is NULL #else assert(0); break; @@ -417,11 +417,11 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS #if (defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WIN64) // Note that we're missing the normal zlib header and footer so we'll use inflate to // decompress the payload and skip all the CRC checking, etc - if (pDestination != nullptr) + if (pDestination != NULL) { // Read big-endian srcize from array PBYTE pbDestSize = (PBYTE) pDestSize; - PBYTE pbSource = static_cast(pSource); + PBYTE pbSource = (PBYTE) pSource; for (int i = 3; i >= 0; i--) { pbDestSize[3-i] = pbSource[i]; } @@ -436,7 +436,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS strm.next_out = uncompr.data; strm.avail_out = uncompr.length; // Skip those first 4 bytes - strm.next_in = static_cast(pSource) + 4; + strm.next_in = (PBYTE) pSource + 4; strm.avail_in = SrcSize - 4; int hr = inflateInit2(&strm, -15); @@ -466,7 +466,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS delete uncompr.data; return S_OK; } - else break; // Cannot decompress when destination is nullptr + else break; // Cannot decompress when destination is NULL #else assert(0); #endif diff --git a/Minecraft.World/system.cpp b/Minecraft.World/system.cpp index 71d0a85e..f9bd07a7 100644 --- a/Minecraft.World/system.cpp +++ b/Minecraft.World/system.cpp @@ -64,7 +64,7 @@ int64_t System::nanoTime() // Using double to avoid 64-bit overflow during multiplication for long uptime // Precision is sufficient for ~100 days of uptime. - return static_cast(static_cast(counter.QuadPart) * 1000000000.0 / static_cast(s_frequency.QuadPart)); + return (int64_t)((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart); #else return GetTickCount() * 1000000LL; #endif diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index 4af047b5..79882800 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -120,7 +120,7 @@ public: else { LeaveCriticalSection(&m_cs); - return nullptr; + return NULL; } } private: @@ -332,10 +332,10 @@ public: #define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__) #define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a) #else -inline void PIXAddNamedCounter(int, const char*, ...) {} -inline void PIXBeginNamedEvent(int, const char*, ...) {} -inline void PIXEndNamedEvent() {} -inline void PIXSetMarkerDeprecated(int, const char*, ...) {} +void PIXAddNamedCounter(int a, const char *b, ...); +void PIXBeginNamedEvent(int a, const char *b, ...); +void PIXEndNamedEvent(); +void PIXSetMarkerDeprecated(int a, const char *b, ...); #endif void XSetThreadProcessor(HANDLE a, int b); diff --git a/tall cloc b/tall cloc deleted file mode 100644 index 74570f66..00000000 --- a/tall cloc +++ /dev/null @@ -1,324 +0,0 @@ - - SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS - - Commands marked with * may be preceded by a number, _N. - Notes in parentheses indicate the behavior if _N is given. - A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. - - h H Display this help. - q :q Q :Q ZZ Exit. - --------------------------------------------------------------------------- - - MMOOVVIINNGG - - e ^E j ^N CR * Forward one line (or _N lines). - y ^Y k ^K ^P * Backward one line (or _N lines). - ESC-j * Forward one file line (or _N file lines). - ESC-k * Backward one file line (or _N file lines). - f ^F ^V SPACE * Forward one window (or _N lines). - b ^B ESC-v * Backward one window (or _N lines). - z * Forward one window (and set window to _N). - w * Backward one window (and set window to _N). - ESC-SPACE * Forward one window, but don't stop at end-of-file. - ESC-b * Backward one window, but don't stop at beginning-of-file. - d ^D * Forward one half-window (and set half-window to _N). - u ^U * Backward one half-window (and set half-window to _N). - ESC-) RightArrow * Right one half screen width (or _N positions). - ESC-( LeftArrow * Left one half screen width (or _N positions). - ESC-} ^RightArrow Right to last column displayed. - ESC-{ ^LeftArrow Left to first column. - F Forward forever; like "tail -f". - ESC-F Like F but stop when search pattern is found. - r ^R ^L Repaint screen. - R Repaint screen, discarding buffered input. - --------------------------------------------------- - Default "window" is the screen height. - Default "half-window" is half of the screen height. - --------------------------------------------------------------------------- - - SSEEAARRCCHHIINNGG - - /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. - ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. - n * Repeat previous search (for _N-th occurrence). - N * Repeat previous search in reverse direction. - ESC-n * Repeat previous search, spanning files. - ESC-N * Repeat previous search, reverse dir. & spanning files. - ^O^N ^On * Search forward for (_N-th) OSC8 hyperlink. - ^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink. - ^O^L ^Ol Jump to the currently selected OSC8 hyperlink. - ESC-u Undo (toggle) search highlighting. - ESC-U Clear search highlighting. - &_p_a_t_t_e_r_n * Display only matching lines. - --------------------------------------------------- - Search is case-sensitive unless changed with -i or -I. - A search pattern may begin with one or more of: - ^N or ! Search for NON-matching lines. - ^E or * Search multiple files (pass thru END OF FILE). - ^F or @ Start search at FIRST file (for /) or last file (for ?). - ^K Highlight matches, but don't move (KEEP position). - ^R Don't use REGULAR EXPRESSIONS. - ^S _n Search for match in _n-th parenthesized subpattern. - ^W WRAP search if no match found. - ^L Enter next character literally into pattern. - --------------------------------------------------------------------------- - - JJUUMMPPIINNGG - - g < ESC-< * Go to first line in file (or line _N). - G > ESC-> * Go to last line in file (or line _N). - p % * Go to beginning of file (or _N percent into file). - t * Go to the (_N-th) next tag. - T * Go to the (_N-th) previous tag. - { ( [ * Find close bracket } ) ]. - } ) ] * Find open bracket { ( [. - ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. - ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. - --------------------------------------------------- - Each "find close bracket" command goes forward to the close bracket - matching the (_N-th) open bracket in the top line. - Each "find open bracket" command goes backward to the open bracket - matching the (_N-th) close bracket in the bottom line. - - m_<_l_e_t_t_e_r_> Mark the current top line with . - M_<_l_e_t_t_e_r_> Mark the current bottom line with . - '_<_l_e_t_t_e_r_> Go to a previously marked position. - '' Go to the previous position. - ^X^X Same as '. - ESC-m_<_l_e_t_t_e_r_> Clear a mark. - --------------------------------------------------- - A mark is any upper-case or lower-case letter. - Certain marks are predefined: - ^ means beginning of the file - $ means end of the file - --------------------------------------------------------------------------- - - CCHHAANNGGIINNGG FFIILLEESS - - :e [_f_i_l_e] Examine a new file. - ^X^V Same as :e. - :n * Examine the (_N-th) next file from the command line. - :p * Examine the (_N-th) previous file from the command line. - :x * Examine the first (or _N-th) file from the command line. - ^O^O Open the currently selected OSC8 hyperlink. - :d Delete the current file from the command line list. - = ^G :f Print current file name. - --------------------------------------------------------------------------- - - MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS - - -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. - --_<_n_a_m_e_> Toggle a command line option, by name. - __<_f_l_a_g_> Display the setting of a command line option. - ___<_n_a_m_e_> Display the setting of an option, by name. - +_c_m_d Execute the less cmd each time a new file is examined. - - !_c_o_m_m_a_n_d Execute the shell command with $SHELL. - #_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt. - |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. - s _f_i_l_e Save input to a file. - v Edit the current file with $VISUAL or $EDITOR. - V Print version number of "less". - --------------------------------------------------------------------------- - - OOPPTTIIOONNSS - - Most options may be changed either on the command line, - or from within less by using the - or -- command. - Options may be given in one of two forms: either a single - character preceded by a -, or a name preceded by --. - - -? ........ --help - Display help (from command line). - -a ........ --search-skip-screen - Search skips current screen. - -A ........ --SEARCH-SKIP-SCREEN - Search starts just after target line. - -b [_N] .... --buffers=[_N] - Number of buffers. - -B ........ --auto-buffers - Don't automatically allocate buffers for pipes. - -c ........ --clear-screen - Repaint by clearing rather than scrolling. - -d ........ --dumb - Dumb terminal. - -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r - Set screen colors. - -e -E .... --quit-at-eof --QUIT-AT-EOF - Quit at end of file. - -f ........ --force - Force open non-regular files. - -F ........ --quit-if-one-screen - Quit if entire file fits on first screen. - -g ........ --hilite-search - Highlight only last match for searches. - -G ........ --HILITE-SEARCH - Don't highlight any matches for searches. - -h [_N] .... --max-back-scroll=[_N] - Backward scroll limit. - -i ........ --ignore-case - Ignore case in searches that do not contain uppercase. - -I ........ --IGNORE-CASE - Ignore case in all searches. - -j [_N] .... --jump-target=[_N] - Screen position of target lines. - -J ........ --status-column - Display a status column at left edge of screen. - -k _f_i_l_e ... --lesskey-file=_f_i_l_e - Use a compiled lesskey file. - -K ........ --quit-on-intr - Exit less in response to ctrl-C. - -L ........ --no-lessopen - Ignore the LESSOPEN environment variable. - -m -M .... --long-prompt --LONG-PROMPT - Set prompt style. - -n ......... --line-numbers - Suppress line numbers in prompts and messages. - -N ......... --LINE-NUMBERS - Display line number at start of each line. - -o [_f_i_l_e] .. --log-file=[_f_i_l_e] - Copy to log file (standard input only). - -O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e] - Copy to log file (unconditionally overwrite). - -p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n] - Start at pattern (from command line). - -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] - Define new prompt. - -q -Q .... --quiet --QUIET --silent --SILENT - Quiet the terminal bell. - -r -R .... --raw-control-chars --RAW-CONTROL-CHARS - Output "raw" control characters. - -s ........ --squeeze-blank-lines - Squeeze multiple blank lines. - -S ........ --chop-long-lines - Chop (truncate) long lines rather than wrapping. - -t _t_a_g .... --tag=[_t_a_g] - Find a tag. - -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] - Use an alternate tags file. - -u -U .... --underline-special --UNDERLINE-SPECIAL - Change handling of backspaces, tabs and carriage returns. - -V ........ --version - Display the version number of "less". - -w ........ --hilite-unread - Highlight first new line after forward-screen. - -W ........ --HILITE-UNREAD - Highlight first new line after any forward movement. - -x [_N[,...]] --tabs=[_N[,...]] - Set tab stops. - -X ........ --no-init - Don't use termcap init/deinit strings. - -y [_N] .... --max-forw-scroll=[_N] - Forward scroll limit. - -z [_N] .... --window=[_N] - Set size of window. - -" [_c[_c]] . --quotes=[_c[_c]] - Set shell quote characters. - -~ ........ --tilde - Don't display tildes after end of file. - -# [_N] .... --shift=[_N] - Set horizontal scroll amount (0 = one half screen width). - - --exit-follow-on-close - Exit F command on a pipe when writer closes pipe. - --file-size - Automatically determine the size of the input file. - --follow-name - The F command changes files if the input file is renamed. - --form-feed - Stop scrolling when a form feed character is reached. - --header=[_L[,_C[,_N]]] - Use _L lines (starting at line _N) and _C columns as headers. - --incsearch - Search file as each pattern character is typed in. - --intr=[_C] - Use _C instead of ^X to interrupt a read. - --lesskey-context=_t_e_x_t - Use lesskey source file contents. - --lesskey-src=_f_i_l_e - Use a lesskey source file. - --line-num-width=[_N] - Set the width of the -N line number field to _N characters. - --match-shift=[_N] - Show at least _N characters to the left of a search match. - --modelines=[_N] - Read _N lines from the input file and look for vim modelines. - --mouse - Enable mouse input. - --no-edit-warn - Don't warn when using v command on a file opened via LESSOPEN. - --no-keypad - Don't send termcap keypad init/deinit strings. - --no-histdups - Remove duplicates from command history. - --no-number-headers - Don't give line numbers to header lines. - --no-paste - Ignore pasted input. - --no-search-header-lines - Searches do not include header lines. - --no-search-header-columns - Searches do not include header columns. - --no-search-headers - Searches do not include header lines or columns. - --no-vbell - Disable the terminal's visual bell. - --redraw-on-quit - Redraw final screen when quitting. - --rscroll=[_C] - Set the character used to mark truncated lines. - --save-marks - Retain marks across invocations of less. - --search-options=[EFKNRW-] - Set default options for every search. - --show-preproc-errors - Display a message if preprocessor exits with an error status. - --proc-backspace - Process backspaces for bold/underline. - --PROC-BACKSPACE - Treat backspaces as control characters. - --proc-return - Delete carriage returns before newline. - --PROC-RETURN - Treat carriage returns as control characters. - --proc-tab - Expand tabs to spaces. - --PROC-TAB - Treat tabs as control characters. - --status-col-width=[_N] - Set the width of the -J status column to _N characters. - --status-line - Highlight or color the entire line containing a mark. - --use-backslash - Subsequent options use backslash as escape char. - --use-color - Enables colored text. - --wheel-lines=[_N] - Each click of the mouse wheel moves _N lines. - --wordwrap - Wrap lines at spaces. - - - --------------------------------------------------------------------------- - - LLIINNEE EEDDIITTIINNGG - - These keys can be used to edit text being entered - on the "command line" at the bottom of the screen. - - RightArrow ..................... ESC-l ... Move cursor right one character. - LeftArrow ...................... ESC-h ... Move cursor left one character. - ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. - ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. - HOME ........................... ESC-0 ... Move cursor to start of line. - END ............................ ESC-$ ... Move cursor to end of line. - BACKSPACE ................................ Delete char to left of cursor. - DELETE ......................... ESC-x ... Delete char under cursor. - ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. - ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. - ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. - UpArrow ........................ ESC-k ... Retrieve previous command line. - DownArrow ...................... ESC-j ... Retrieve next command line. - TAB ...................................... Complete filename & cycle. - SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. - ctrl-L ................................... Complete filename, list all.