From 5471f91814b5a8fe486ea6c7d22116e0cf9363f8 Mon Sep 17 00:00:00 2001 From: Chase Cooper Date: Thu, 5 Mar 2026 17:43:29 -0500 Subject: [PATCH] Replaced every C-style cast with C++ ones --- Minecraft.Client/AchievementPopup.cpp | 2 +- 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 | 6 +- Minecraft.Client/BubbleParticle.cpp | 8 +- Minecraft.Client/BufferedImage.cpp | 6 +- Minecraft.Client/ChestRenderer.cpp | 4 +- Minecraft.Client/ChickenModel.cpp | 16 +- Minecraft.Client/Chunk.cpp | 20 +- Minecraft.Client/ClientConnection.cpp | 32 +- Minecraft.Client/ClockTexture.cpp | 4 +- Minecraft.Client/Common/Audio/SoundEngine.cpp | 10 +- .../Common/Colours/ColourTable.cpp | 6 +- Minecraft.Client/Common/Consoles_App.cpp | 76 +-- Minecraft.Client/Common/Consoles_App.h | 2 +- Minecraft.Client/Common/DLC/DLCAudioFile.cpp | 12 +- Minecraft.Client/Common/DLC/DLCManager.cpp | 14 +- Minecraft.Client/Common/DLC/DLCPack.cpp | 14 +- Minecraft.Client/Common/DLC/DLCPack.h | 4 +- Minecraft.Client/Common/DLC/DLCSkinFile.cpp | 6 +- .../GameRules/AddItemRuleDefinition.cpp | 2 +- .../ApplySchematicRuleDefinition.cpp | 8 +- .../GameRules/CompleteAllRuleDefinition.cpp | 2 +- .../GameRules/ConsoleGenerateStructure.cpp | 16 +- .../GameRules/ConsoleGenerateStructure.h | 2 +- .../Common/GameRules/ConsoleSchematicFile.cpp | 28 +- .../Common/GameRules/GameRuleManager.cpp | 12 +- .../GameRules/LevelGenerationOptions.cpp | 12 +- .../Common/GameRules/LevelRuleset.cpp | 2 +- .../Common/GameRules/StartFeature.cpp | 2 +- .../GameRules/UpdatePlayerRuleDefinition.cpp | 2 +- .../XboxStructureActionPlaceContainer.cpp | 2 +- .../Leaderboards/LeaderboardInterface.cpp | 2 +- .../Common/Network/GameNetworkManager.cpp | 10 +- .../Network/PlatformNetworkManagerStub.cpp | 14 +- .../Common/Network/Sony/NetworkPlayerSony.cpp | 6 +- .../Common/Network/Sony/SQRNetworkPlayer.h | 2 +- .../Common/Network/Sony/SonyRemoteStorage.cpp | 20 +- .../Common/Telemetry/TelemetryManager.cpp | 48 +- .../Common/Tutorial/RideEntityTask.cpp | 2 +- Minecraft.Client/Common/Tutorial/StatTask.cpp | 2 +- Minecraft.Client/Common/Tutorial/Tutorial.cpp | 6 +- .../UI/IUIScene_AbstractContainerMenu.cpp | 22 +- .../Common/UI/IUIScene_CraftingMenu.cpp | 2 +- .../Common/UI/IUIScene_CreativeMenu.cpp | 10 +- .../Common/UI/IUIScene_EnchantingMenu.cpp | 2 +- Minecraft.Client/Common/UI/IUIScene_HUD.cpp | 16 +- .../Common/UI/IUIScene_PauseMenu.cpp | 4 +- .../Common/UI/IUIScene_StartGame.cpp | 8 +- Minecraft.Client/Common/UI/UIBitmapFont.cpp | 18 +- .../Common/UI/UIComponent_Chat.cpp | 14 +- .../UI/UIComponent_DebugUIMarketingGuide.cpp | 4 +- .../Common/UI/UIComponent_MenuBackground.cpp | 14 +- .../Common/UI/UIComponent_Panorama.cpp | 6 +- .../Common/UI/UIComponent_Tooltips.cpp | 22 +- .../Common/UI/UIComponent_TutorialPopup.cpp | 24 +- Minecraft.Client/Common/UI/UIControl.cpp | 16 +- Minecraft.Client/Common/UI/UIControl_Base.cpp | 2 +- .../Common/UI/UIControl_ButtonList.cpp | 2 +- .../Common/UI/UIControl_DLCList.cpp | 4 +- .../Common/UI/UIControl_DynamicLabel.cpp | 4 +- .../Common/UI/UIControl_EnchantmentBook.cpp | 4 +- .../Common/UI/UIControl_EnchantmentButton.cpp | 10 +- .../Common/UI/UIControl_HTMLLabel.cpp | 4 +- .../Common/UI/UIControl_MinecraftHorse.cpp | 10 +- .../Common/UI/UIControl_MinecraftPlayer.cpp | 10 +- .../Common/UI/UIControl_PlayerList.cpp | 2 +- .../Common/UI/UIControl_PlayerSkinPreview.cpp | 28 +- .../Common/UI/UIControl_Progress.cpp | 2 +- .../Common/UI/UIControl_SaveList.cpp | 4 +- .../Common/UI/UIControl_Slider.cpp | 2 +- .../Common/UI/UIControl_SpaceIndicatorBar.cpp | 6 +- .../Common/UI/UIControl_TexturePackList.cpp | 4 +- Minecraft.Client/Common/UI/UIController.cpp | 236 ++++---- Minecraft.Client/Common/UI/UIGroup.cpp | 18 +- Minecraft.Client/Common/UI/UIScene.cpp | 18 +- .../UI/UIScene_AbstractContainerMenu.cpp | 12 +- .../Common/UI/UIScene_AnvilMenu.cpp | 8 +- .../Common/UI/UIScene_BeaconMenu.cpp | 6 +- .../Common/UI/UIScene_BrewingStandMenu.cpp | 4 +- .../Common/UI/UIScene_ConnectingProgress.cpp | 4 +- .../Common/UI/UIScene_ContainerMenu.cpp | 4 +- .../Common/UI/UIScene_ControlsMenu.cpp | 12 +- .../Common/UI/UIScene_CraftingMenu.cpp | 18 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 26 +- .../Common/UI/UIScene_CreativeMenu.cpp | 16 +- .../Common/UI/UIScene_Credits.cpp | 6 +- .../Common/UI/UIScene_DLCMainMenu.cpp | 8 +- .../Common/UI/UIScene_DLCOffersMenu.cpp | 8 +- .../Common/UI/UIScene_DeathMenu.cpp | 8 +- .../UI/UIScene_DebugCreateSchematic.cpp | 8 +- .../Common/UI/UIScene_DebugOverlay.cpp | 18 +- .../Common/UI/UIScene_DebugSetCamera.cpp | 8 +- .../Common/UI/UIScene_DispenserMenu.cpp | 4 +- Minecraft.Client/Common/UI/UIScene_EULA.cpp | 2 +- .../Common/UI/UIScene_EnchantingMenu.cpp | 6 +- .../Common/UI/UIScene_EndPoem.cpp | 6 +- .../Common/UI/UIScene_FireworksMenu.cpp | 4 +- .../Common/UI/UIScene_FullscreenProgress.cpp | 4 +- .../Common/UI/UIScene_FurnaceMenu.cpp | 4 +- Minecraft.Client/Common/UI/UIScene_HUD.cpp | 28 +- .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 2 +- .../Common/UI/UIScene_HopperMenu.cpp | 4 +- .../Common/UI/UIScene_HorseInventoryMenu.cpp | 4 +- .../Common/UI/UIScene_HowToPlay.cpp | 12 +- .../Common/UI/UIScene_HowToPlayMenu.cpp | 4 +- .../UI/UIScene_InGameHostOptionsMenu.cpp | 2 +- .../Common/UI/UIScene_InGameInfoMenu.cpp | 14 +- .../UI/UIScene_InGamePlayerOptionsMenu.cpp | 12 +- .../UI/UIScene_InGameSaveManagementMenu.cpp | 12 +- .../Common/UI/UIScene_InventoryMenu.cpp | 6 +- .../Common/UI/UIScene_JoinMenu.cpp | 14 +- .../Common/UI/UIScene_Keyboard.cpp | 8 +- .../Common/UI/UIScene_LanguageSelector.cpp | 6 +- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 22 +- .../Common/UI/UIScene_LeaderboardsMenu.cpp | 26 +- .../Common/UI/UIScene_LoadMenu.cpp | 34 +- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 50 +- .../Common/UI/UIScene_MainMenu.cpp | 48 +- .../Common/UI/UIScene_MessageBox.cpp | 6 +- .../Common/UI/UIScene_NewUpdateMessage.cpp | 2 +- .../Common/UI/UIScene_PauseMenu.cpp | 18 +- .../Common/UI/UIScene_QuadrantSignin.cpp | 8 +- .../Common/UI/UIScene_SaveMessage.cpp | 2 +- .../Common/UI/UIScene_SettingsAudioMenu.cpp | 4 +- .../Common/UI/UIScene_SettingsControlMenu.cpp | 4 +- .../UI/UIScene_SettingsGraphicsMenu.cpp | 12 +- .../Common/UI/UIScene_SettingsMenu.cpp | 4 +- .../Common/UI/UIScene_SettingsOptionsMenu.cpp | 6 +- .../Common/UI/UIScene_SettingsUIMenu.cpp | 4 +- .../Common/UI/UIScene_SignEntryMenu.cpp | 10 +- .../Common/UI/UIScene_SkinSelectMenu.cpp | 8 +- .../Common/UI/UIScene_TeleportMenu.cpp | 10 +- .../Common/UI/UIScene_TradingMenu.cpp | 8 +- Minecraft.Client/Common/XUI/XUI_Chat.cpp | 2 +- .../Common/XUI/XUI_ConnectingProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_4JEdit.cpp | 6 +- .../Common/XUI/XUI_Ctrl_4JList.cpp | 12 +- .../Common/XUI/XUI_Ctrl_BrewProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_BubblesProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_BurnProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_EnchantButton.cpp | 10 +- .../Common/XUI/XUI_Ctrl_EnchantmentBook.cpp | 10 +- .../XUI/XUI_Ctrl_EnchantmentButtonText.cpp | 18 +- .../Common/XUI/XUI_Ctrl_FireProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp | 10 +- .../XUI/XUI_Ctrl_MinecraftSkinPreview.cpp | 28 +- .../Common/XUI/XUI_Ctrl_MinecraftSlot.cpp | 44 +- .../Common/XUI/XUI_Ctrl_SliderWrapper.cpp | 4 +- .../Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp | 28 +- .../Common/XUI/XUI_Ctrl_SlotList.cpp | 2 +- .../Common/XUI/XUI_Ctrl_SplashPulser.cpp | 8 +- .../Common/XUI/XUI_CustomMessages.h | 4 +- Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp | 20 +- Minecraft.Client/Common/XUI/XUI_Death.cpp | 4 +- .../Common/XUI/XUI_DebugItemEditor.cpp | 2 +- .../Common/XUI/XUI_DebugOverlay.cpp | 12 +- .../Common/XUI/XUI_DebugSetCamera.cpp | 10 +- Minecraft.Client/Common/XUI/XUI_DebugTips.cpp | 2 +- .../Common/XUI/XUI_FullscreenProgress.cpp | 4 +- Minecraft.Client/Common/XUI/XUI_HUD.cpp | 12 +- .../Common/XUI/XUI_HelpAndOptions.cpp | 2 +- .../Common/XUI/XUI_HelpControls.cpp | 10 +- .../Common/XUI/XUI_HelpCredits.cpp | 4 +- .../Common/XUI/XUI_HelpHowToPlay.cpp | 16 +- .../Common/XUI/XUI_HowToPlayMenu.cpp | 8 +- .../Common/XUI/XUI_InGameHostOptions.cpp | 2 +- .../Common/XUI/XUI_InGameInfo.cpp | 8 +- .../Common/XUI/XUI_InGamePlayerOptions.cpp | 10 +- .../Common/XUI/XUI_Leaderboards.cpp | 46 +- .../Common/XUI/XUI_LoadSettings.cpp | 28 +- Minecraft.Client/Common/XUI/XUI_MainMenu.cpp | 24 +- .../Common/XUI/XUI_MultiGameCreate.cpp | 24 +- .../Common/XUI/XUI_MultiGameInfo.cpp | 4 +- .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 60 +-- .../XUI/XUI_MultiGameLaunchMoreOptions.cpp | 2 +- .../Common/XUI/XUI_NewUpdateMessage.cpp | 2 +- Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp | 34 +- Minecraft.Client/Common/XUI/XUI_Reinstall.cpp | 6 +- .../XUI/XUI_Scene_AbstractContainer.cpp | 2 +- .../Common/XUI/XUI_Scene_Anvil.cpp | 12 +- .../Common/XUI/XUI_Scene_Base.cpp | 42 +- .../Common/XUI/XUI_Scene_BrewingStand.cpp | 2 +- .../Common/XUI/XUI_Scene_Container.cpp | 6 +- .../Common/XUI/XUI_Scene_CraftingPanel.cpp | 22 +- .../Common/XUI/XUI_Scene_Enchant.cpp | 2 +- .../Common/XUI/XUI_Scene_Furnace.cpp | 2 +- .../Common/XUI/XUI_Scene_Inventory.cpp | 6 +- .../XUI/XUI_Scene_Inventory_Creative.cpp | 6 +- .../Common/XUI/XUI_Scene_Trading.cpp | 6 +- .../Common/XUI/XUI_Scene_Trap.cpp | 2 +- Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp | 6 +- .../Common/XUI/XUI_SettingsAll.cpp | 2 +- .../Common/XUI/XUI_SettingsAudio.cpp | 6 +- .../Common/XUI/XUI_SettingsControl.cpp | 6 +- .../Common/XUI/XUI_SettingsGraphics.cpp | 6 +- .../Common/XUI/XUI_SettingsOptions.cpp | 6 +- .../Common/XUI/XUI_SettingsUI.cpp | 6 +- Minecraft.Client/Common/XUI/XUI_SignEntry.cpp | 2 +- .../Common/XUI/XUI_SkinSelect.cpp | 6 +- .../Common/XUI/XUI_SocialPost.cpp | 6 +- Minecraft.Client/Common/XUI/XUI_Teleport.cpp | 4 +- Minecraft.Client/Common/XUI/XUI_TextEntry.cpp | 2 +- .../Common/XUI/XUI_TransferToXboxOne.cpp | 18 +- .../Common/XUI/XUI_TrialExitUpsell.cpp | 2 +- .../Common/XUI/XUI_TutorialPopup.cpp | 28 +- Minecraft.Client/Common/XUI/XUI_debug.cpp | 10 +- Minecraft.Client/CompassTexture.cpp | 6 +- Minecraft.Client/CreeperRenderer.cpp | 4 +- Minecraft.Client/CritParticle2.cpp | 4 +- Minecraft.Client/DLCTexturePack.cpp | 16 +- Minecraft.Client/DragonBreathParticle.cpp | 4 +- Minecraft.Client/DragonModel.cpp | 8 +- Minecraft.Client/DripParticle.cpp | 2 +- Minecraft.Client/Durango/ApplicationView.cpp | 6 +- .../Durango/DurangoExtras/DurangoStubs.cpp | 2 +- Minecraft.Client/Durango/Durango_App.cpp | 26 +- Minecraft.Client/Durango/Durango_App.h | 2 +- .../Durango/Durango_Minecraft.cpp | 12 +- .../Durango/Durango_UIController.cpp | 2 +- .../Durango/Iggy/gdraw/gdraw_shared.inl | 10 +- .../DurangoLeaderboardManager.cpp | 10 +- .../Durango/Leaderboards/GameProgress.cpp | 2 +- .../Durango/Network/ChatIntegrationLayer.h | 2 +- .../Durango/Network/DQRNetworkManager.cpp | 32 +- .../DQRNetworkManager_FriendSessions.cpp | 8 +- .../Network/DQRNetworkManager_SendReceive.cpp | 8 +- .../Network/DQRNetworkManager_XRNSEvent.cpp | 8 +- .../Durango/Network/DQRNetworkPlayer.cpp | 2 +- .../Durango/Network/NetworkPlayerDurango.cpp | 4 +- .../Durango/Network/PartyController.cpp | 10 +- .../Network/PlatformNetworkManagerDurango.cpp | 6 +- Minecraft.Client/Durango/Network/base64.cpp | 6 +- .../Durango/Sentient/DurangoTelemetry.cpp | 2 +- Minecraft.Client/Durango/XML/ATGXmlParser.cpp | 36 +- Minecraft.Client/EchantmentTableParticle.cpp | 12 +- Minecraft.Client/EnchantTableRenderer.cpp | 2 +- Minecraft.Client/EnderChestRenderer.cpp | 2 +- Minecraft.Client/EnderCrystalRenderer.cpp | 2 +- Minecraft.Client/EnderDragonRenderer.cpp | 12 +- Minecraft.Client/EnderParticle.cpp | 14 +- Minecraft.Client/EndermanRenderer.cpp | 2 +- Minecraft.Client/EntityRenderDispatcher.cpp | 2 +- Minecraft.Client/EntityRenderer.cpp | 124 ++--- Minecraft.Client/ExperienceOrbRenderer.cpp | 8 +- Minecraft.Client/ExplodeParticle.cpp | 14 +- Minecraft.Client/Extrax64Stubs.cpp | 6 +- Minecraft.Client/FallingTileRenderer.cpp | 4 +- Minecraft.Client/FireballRenderer.cpp | 22 +- Minecraft.Client/FireworksParticles.cpp | 32 +- Minecraft.Client/FishingHookRenderer.cpp | 20 +- Minecraft.Client/FlameParticle.cpp | 6 +- Minecraft.Client/Font.cpp | 6 +- Minecraft.Client/FootstepParticle.cpp | 14 +- Minecraft.Client/GameRenderer.cpp | 80 +-- Minecraft.Client/GhastModel.cpp | 2 +- Minecraft.Client/Gui.cpp | 70 +-- Minecraft.Client/Gui.h | 2 +- Minecraft.Client/GuiComponent.cpp | 26 +- Minecraft.Client/GuiParticle.cpp | 4 +- Minecraft.Client/HugeExplosionParticle.cpp | 10 +- .../HugeExplosionSeedParticle.cpp | 2 +- Minecraft.Client/HumanoidMobRenderer.cpp | 6 +- Minecraft.Client/HumanoidModel.cpp | 4 +- Minecraft.Client/Input.cpp | 6 +- Minecraft.Client/InventoryScreen.cpp | 4 +- Minecraft.Client/ItemFrameRenderer.cpp | 10 +- Minecraft.Client/ItemInHandRenderer.cpp | 18 +- Minecraft.Client/ItemRenderer.cpp | 48 +- Minecraft.Client/ItemSpriteRenderer.cpp | 10 +- Minecraft.Client/JoinMultiplayerScreen.cpp | 2 +- Minecraft.Client/LavaParticle.cpp | 6 +- Minecraft.Client/LavaSlimeModel.cpp | 2 +- Minecraft.Client/LavaSlimeRenderer.cpp | 2 +- Minecraft.Client/LeashKnotRenderer.cpp | 2 +- Minecraft.Client/LevelRenderer.cpp | 228 ++++---- Minecraft.Client/Lighting.cpp | 2 +- Minecraft.Client/LightningBoltRenderer.cpp | 4 +- Minecraft.Client/LivingEntityRenderer.cpp | 32 +- Minecraft.Client/LocalPlayer.cpp | 46 +- Minecraft.Client/MinecartModel.cpp | 24 +- Minecraft.Client/MinecartRenderer.cpp | 6 +- Minecraft.Client/Minecraft.cpp | 64 +-- Minecraft.Client/MinecraftServer.cpp | 16 +- Minecraft.Client/Minimap.cpp | 24 +- Minecraft.Client/MobRenderer.cpp | 18 +- Minecraft.Client/MobSpawnerRenderer.cpp | 4 +- Minecraft.Client/Model.h | 2 +- Minecraft.Client/ModelPart.cpp | 6 +- Minecraft.Client/MultiPlayerChunkCache.cpp | 8 +- Minecraft.Client/MultiPlayerGameMode.cpp | 10 +- Minecraft.Client/MultiPlayerLevel.cpp | 4 +- Minecraft.Client/MultiPlayerLocalPlayer.cpp | 12 +- Minecraft.Client/MushroomCowRenderer.cpp | 2 +- Minecraft.Client/NetherPortalParticle.cpp | 14 +- Minecraft.Client/NoteParticle.cpp | 4 +- Minecraft.Client/OffsettedRenderList.cpp | 6 +- Minecraft.Client/Options.cpp | 4 +- Minecraft.Client/OptionsScreen.cpp | 2 +- .../Orbis/Iggy/gdraw/gdraw_shared.inl | 10 +- .../Orbis/Network/SonyHttp_Orbis.cpp | 8 +- .../Orbis/Network/SonyRemoteStorage_Orbis.cpp | 2 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl | 116 ++-- .../PS3/Iggy/gdraw/gdraw_shared.inl | 10 +- Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp | 6 +- .../PS3/Network/SonyRemoteStorage_PS3.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp | 2 +- .../ChunkUpdate/ChunkRebuildData.cpp | 126 ++--- .../PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h | 20 +- .../SPU_Tasks/ChunkUpdate/LiquidTile_SPU.cpp | 4 +- .../SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp | 42 +- .../ChunkUpdate/TileRenderer_SPU.cpp | 286 +++++----- .../PSVita/Iggy/gdraw/gdraw_shared.inl | 10 +- .../PSVita/Network/SonyHttp_Vita.cpp | 6 +- .../PSVita/Network/SonyRemoteStorage_Vita.cpp | 4 +- .../PSVita/PSVitaExtras/CustomMap.cpp | 8 +- .../PSVita/PSVitaExtras/CustomSet.cpp | 8 +- .../PSVita/PSVitaExtras/libdivide.h | 56 +- Minecraft.Client/PaintingRenderer.cpp | 2 +- Minecraft.Client/Particle.cpp | 16 +- Minecraft.Client/PauseScreen.cpp | 2 +- Minecraft.Client/PistonPieceRenderer.cpp | 6 +- Minecraft.Client/PlayerChunkMap.cpp | 28 +- Minecraft.Client/PlayerCloudParticle.cpp | 4 +- Minecraft.Client/PlayerConnection.cpp | 20 +- Minecraft.Client/PlayerList.cpp | 30 +- Minecraft.Client/PlayerRenderer.cpp | 18 +- Minecraft.Client/Polygon.cpp | 6 +- Minecraft.Client/PreStitchedTextureMap.cpp | 2 +- Minecraft.Client/QuadrupedModel.cpp | 12 +- Minecraft.Client/RedDustParticle.cpp | 12 +- Minecraft.Client/RemotePlayer.cpp | 6 +- Minecraft.Client/ResourceLocation.h | 2 +- Minecraft.Client/Screen.cpp | 6 +- Minecraft.Client/ScreenSizeCalculator.cpp | 8 +- Minecraft.Client/ScrolledSelectionList.cpp | 4 +- Minecraft.Client/SelectWorldScreen.cpp | 4 +- Minecraft.Client/ServerChunkCache.cpp | 2 +- Minecraft.Client/ServerLevel.cpp | 14 +- Minecraft.Client/ServerLevelListener.cpp | 6 +- Minecraft.Client/ServerPlayer.cpp | 4 +- Minecraft.Client/ServerPlayerGameMode.cpp | 6 +- Minecraft.Client/Settings.cpp | 6 +- Minecraft.Client/SheepRenderer.cpp | 2 +- Minecraft.Client/SignRenderer.cpp | 4 +- Minecraft.Client/SilverfishModel.cpp | 6 +- Minecraft.Client/SkullTileRenderer.cpp | 2 +- Minecraft.Client/SlideButton.cpp | 8 +- Minecraft.Client/SlimeRenderer.cpp | 2 +- Minecraft.Client/SmokeParticle.cpp | 4 +- Minecraft.Client/SnowManRenderer.cpp | 2 +- Minecraft.Client/SnowShovelParticle.cpp | 6 +- Minecraft.Client/SpellParticle.cpp | 2 +- Minecraft.Client/SpiderModel.cpp | 22 +- Minecraft.Client/SquidModel.cpp | 12 +- Minecraft.Client/StatsCounter.cpp | 4 +- Minecraft.Client/StatsScreen.cpp | 4 +- Minecraft.Client/StitchedTexture.cpp | 16 +- Minecraft.Client/SuspendedParticle.cpp | 2 +- Minecraft.Client/SuspendedTownParticle.cpp | 2 +- Minecraft.Client/TakeAnimationParticle.cpp | 2 +- Minecraft.Client/TerrainParticle.cpp | 6 +- Minecraft.Client/Tesselator.cpp | 32 +- Minecraft.Client/TextEditScreen.cpp | 2 +- Minecraft.Client/Texture.cpp | 44 +- Minecraft.Client/TextureHolder.cpp | 6 +- Minecraft.Client/Textures.cpp | 28 +- Minecraft.Client/TheEndPortalRenderer.cpp | 10 +- Minecraft.Client/TileRenderer.cpp | 504 +++++++++--------- Minecraft.Client/Timer.cpp | 22 +- Minecraft.Client/TntRenderer.cpp | 2 +- Minecraft.Client/TrackedEntity.cpp | 36 +- Minecraft.Client/VideoSettingsScreen.cpp | 2 +- Minecraft.Client/VillagerGolemRenderer.cpp | 2 +- Minecraft.Client/VillagerRenderer.cpp | 2 +- Minecraft.Client/WaterDropParticle.cpp | 4 +- .../Iggy/gdraw/gdraw_d3d1x_shared.inl | 66 +-- .../Windows64/Iggy/gdraw/gdraw_shared.inl | 10 +- .../Windows64/KeyboardMouseInput.cpp | 8 +- .../Windows64/Network/WinsockNetLayer.cpp | 44 +- Minecraft.Client/Windows64/Windows64_App.cpp | 2 +- Minecraft.Client/Windows64/Windows64_App.h | 2 +- .../Windows64/Windows64_Minecraft.cpp | 22 +- .../Windows64/Windows64_UIController.cpp | 2 +- Minecraft.Client/WitherBossRenderer.cpp | 2 +- Minecraft.Client/WitherSkullRenderer.cpp | 2 +- Minecraft.Client/Xbox/Audio/SoundEngine.cpp | 18 +- Minecraft.Client/Xbox/Font/XUI_Font.cpp | 22 +- Minecraft.Client/Xbox/Font/XUI_FontData.cpp | 4 +- .../Xbox/Font/XUI_FontRenderer.cpp | 18 +- .../Leaderboards/XboxLeaderboardManager.cpp | 10 +- .../Xbox/Network/NetworkPlayerXbox.cpp | 10 +- .../Network/PlatformNetworkManagerXbox.cpp | 18 +- .../Xbox/Sentient/DynamicConfigurations.cpp | 2 +- .../Xbox/Sentient/Include/SenClientResource.h | 10 +- .../Xbox/Sentient/SentientManager.cpp | 56 +- Minecraft.Client/Xbox/XML/ATGXmlParser.cpp | 36 +- Minecraft.Client/Xbox/Xbox_App.h | 2 +- Minecraft.Client/ZombieRenderer.cpp | 4 +- Minecraft.Client/glWrapper.cpp | 2 +- Minecraft.World/AABB.cpp | 4 +- Minecraft.World/AbstractContainerMenu.cpp | 6 +- Minecraft.World/AbstractContainerMenu.h | 2 +- Minecraft.World/AddEntityPacket.cpp | 6 +- Minecraft.World/AddMobPacket.cpp | 8 +- Minecraft.World/AddPlayerPacket.cpp | 2 +- Minecraft.World/Animal.cpp | 2 +- Minecraft.World/ArmorDyeRecipe.cpp | 22 +- Minecraft.World/Arrow.cpp | 56 +- Minecraft.World/AttributeModifier.cpp | 2 +- Minecraft.World/BaseMobSpawner.cpp | 20 +- Minecraft.World/BaseRailTile.cpp | 2 +- Minecraft.World/BasicTree.cpp | 36 +- Minecraft.World/Bat.cpp | 18 +- Minecraft.World/BeachBiome.cpp | 4 +- Minecraft.World/BeaconTileEntity.cpp | 6 +- Minecraft.World/BedItem.cpp | 2 +- Minecraft.World/Biome.cpp | 8 +- Minecraft.World/BiomeCache.cpp | 4 +- Minecraft.World/BiomeSource.cpp | 8 +- Minecraft.World/Blaze.cpp | 8 +- Minecraft.World/BlockReplacements.cpp | 2 +- Minecraft.World/Boat.cpp | 8 +- Minecraft.World/BottleItem.cpp | 4 +- Minecraft.World/BowItem.cpp | 4 +- Minecraft.World/BreakDoorGoal.cpp | 2 +- Minecraft.World/BrewingStandTile.cpp | 8 +- Minecraft.World/BrewingStandTileEntity.cpp | 4 +- Minecraft.World/BufferedOutputStream.cpp | 2 +- Minecraft.World/ButtonTile.cpp | 2 +- Minecraft.World/ByteArrayOutputStream.cpp | 2 +- Minecraft.World/ByteArrayTag.h | 2 +- Minecraft.World/ByteTag.h | 2 +- Minecraft.World/C4JThread.cpp | 4 +- Minecraft.World/CanyonFeature.cpp | 6 +- Minecraft.World/CaveFeature.cpp | 6 +- Minecraft.World/ChatPacket.cpp | 2 +- Minecraft.World/ChestTile.cpp | 8 +- Minecraft.World/ChestTileEntity.cpp | 6 +- Minecraft.World/ChunkPos.cpp | 4 +- .../ChunkStorageProfileDecorator.cpp | 4 +- Minecraft.World/ChunkTilesUpdatePacket.cpp | 4 +- Minecraft.World/Color.cpp | 42 +- Minecraft.World/CompoundTag.h | 28 +- Minecraft.World/CompressedTileStorage.cpp | 20 +- Minecraft.World/Connection.cpp | 12 +- Minecraft.World/ConsoleSaveFileOriginal.cpp | 46 +- .../ConsoleSaveFileOutputStream.cpp | 2 +- Minecraft.World/ContainerMenu.cpp | 2 +- Minecraft.World/ContainerSetContentPacket.cpp | 2 +- Minecraft.World/ControlledByPlayerGoal.cpp | 4 +- Minecraft.World/Creeper.cpp | 18 +- Minecraft.World/CropTile.cpp | 2 +- Minecraft.World/CustomLevelSource.cpp | 20 +- Minecraft.World/CustomPayloadPacket.cpp | 2 +- Minecraft.World/DataInputStream.cpp | 18 +- Minecraft.World/DataLayer.cpp | 6 +- Minecraft.World/DataOutputStream.cpp | 22 +- Minecraft.World/DaylightDetectorTile.cpp | 2 +- .../DaylightDetectorTileEntity.cpp | 2 +- Minecraft.World/DebugOptionsPacket.cpp | 4 +- Minecraft.World/DesertBiome.cpp | 4 +- Minecraft.World/Dimension.cpp | 8 +- Minecraft.World/Direction.cpp | 2 +- Minecraft.World/DirectoryLevelStorage.cpp | 4 +- Minecraft.World/DisconnectPacket.cpp | 2 +- Minecraft.World/DispenserTile.cpp | 8 +- Minecraft.World/DispenserTileEntity.cpp | 2 +- Minecraft.World/DoorInfo.cpp | 2 +- Minecraft.World/DoorInteractGoal.cpp | 10 +- Minecraft.World/DoubleTag.h | 2 +- Minecraft.World/DragonFireball.cpp | 2 +- Minecraft.World/DungeonFeature.cpp | 6 +- Minecraft.World/DurangoStats.cpp | 12 +- Minecraft.World/DurangoStats.h | 2 +- Minecraft.World/DyePowderItem.cpp | 10 +- Minecraft.World/EnchantedBookItem.cpp | 8 +- Minecraft.World/EnchantmentCategory.cpp | 2 +- Minecraft.World/EnchantmentHelper.cpp | 10 +- Minecraft.World/EnchantmentInstance.cpp | 2 +- Minecraft.World/EnchantmentTableEntity.cpp | 2 +- Minecraft.World/EnderDragon.cpp | 26 +- Minecraft.World/EnderEyeItem.cpp | 2 +- Minecraft.World/EnderMan.cpp | 18 +- Minecraft.World/Entity.cpp | 24 +- Minecraft.World/EntityHorse.cpp | 20 +- Minecraft.World/ExperienceOrb.cpp | 16 +- Minecraft.World/ExplodePacket.cpp | 28 +- Minecraft.World/Explosion.cpp | 4 +- Minecraft.World/EyeOfEnderSignal.cpp | 18 +- Minecraft.World/FallingTile.cpp | 6 +- Minecraft.World/FastNoise.cpp | 12 +- Minecraft.World/File.cpp | 2 +- Minecraft.World/FileHeader.cpp | 12 +- Minecraft.World/FileOutputStream.cpp | 2 +- Minecraft.World/Fireball.cpp | 16 +- Minecraft.World/FireworksChargeItem.cpp | 2 +- Minecraft.World/FireworksRecipe.cpp | 12 +- Minecraft.World/FireworksRocketEntity.cpp | 8 +- Minecraft.World/FishingHook.cpp | 28 +- Minecraft.World/FlatLevelSource.cpp | 4 +- Minecraft.World/FleeSunGoal.cpp | 2 +- Minecraft.World/FlippedIcon.cpp | 4 +- Minecraft.World/FloatTag.h | 2 +- Minecraft.World/FlyingMob.cpp | 2 +- Minecraft.World/FoodConstants.cpp | 4 +- Minecraft.World/FoodItem.h | 2 +- Minecraft.World/FurnaceResultSlot.cpp | 4 +- Minecraft.World/FurnaceTile.cpp | 8 +- Minecraft.World/FurnaceTileEntity.cpp | 12 +- Minecraft.World/GameCommandPacket.cpp | 4 +- Minecraft.World/Ghast.cpp | 12 +- Minecraft.World/HangingEntity.cpp | 12 +- Minecraft.World/HellDimension.cpp | 10 +- Minecraft.World/HellFlatLevelSource.cpp | 18 +- Minecraft.World/HellRandomLevelSource.cpp | 44 +- Minecraft.World/HopperTile.cpp | 8 +- Minecraft.World/HopperTileEntity.cpp | 6 +- Minecraft.World/ImprovedNoise.cpp | 16 +- Minecraft.World/InputStreamReader.cpp | 2 +- Minecraft.World/IntArrayTag.h | 2 +- Minecraft.World/IntCache.cpp | 8 +- Minecraft.World/IntTag.h | 2 +- Minecraft.World/Inventory.cpp | 8 +- Minecraft.World/Item.cpp | 56 +- Minecraft.World/ItemDispenseBehaviors.cpp | 2 +- Minecraft.World/ItemEntity.cpp | 14 +- Minecraft.World/ItemFrame.cpp | 6 +- Minecraft.World/ItemInstance.cpp | 26 +- Minecraft.World/JavaIntHash.h | 4 +- Minecraft.World/JavaMath.cpp | 2 +- Minecraft.World/LargeCaveFeature.cpp | 4 +- Minecraft.World/LargeHellCaveFeature.cpp | 2 +- Minecraft.World/Layer.cpp | 2 +- Minecraft.World/Level.cpp | 42 +- Minecraft.World/LevelChunk.cpp | 20 +- Minecraft.World/LevelData.cpp | 2 +- Minecraft.World/LevelSoundPacket.cpp | 6 +- Minecraft.World/LightningBolt.cpp | 8 +- Minecraft.World/LiquidTile.cpp | 2 +- Minecraft.World/ListTag.h | 10 +- Minecraft.World/LivingEntity.cpp | 80 +-- Minecraft.World/LoginPacket.cpp | 4 +- Minecraft.World/LongTag.h | 2 +- Minecraft.World/LookAtTradingPlayerGoal.cpp | 2 +- Minecraft.World/LookControl.cpp | 4 +- Minecraft.World/MakeLoveGoal.cpp | 2 +- Minecraft.World/MapItem.cpp | 16 +- Minecraft.World/MapItemSavedData.cpp | 74 +-- .../McRegionLevelStorageSource.cpp | 2 +- Minecraft.World/MegaTreeFeature.cpp | 8 +- Minecraft.World/MenuBackup.cpp | 2 +- Minecraft.World/MerchantRecipeList.cpp | 2 +- Minecraft.World/MilkBucketItem.h | 2 +- Minecraft.World/Minecart.cpp | 18 +- Minecraft.World/MinecartContainer.cpp | 16 +- Minecraft.World/MinecartFurnace.cpp | 8 +- Minecraft.World/MinecartItem.cpp | 2 +- Minecraft.World/MinecartSpawner.cpp | 2 +- Minecraft.World/MinecartTNT.cpp | 2 +- Minecraft.World/Mob.cpp | 18 +- Minecraft.World/MobEffect.cpp | 4 +- Minecraft.World/MobEffectInstance.cpp | 4 +- Minecraft.World/MobSpawner.cpp | 4 +- Minecraft.World/Monster.cpp | 2 +- Minecraft.World/MoveControl.cpp | 4 +- Minecraft.World/MoveEntityPacket.cpp | 2 +- Minecraft.World/MoveEntityPacketSmall.cpp | 4 +- Minecraft.World/Mth.cpp | 18 +- Minecraft.World/MushroomIslandBiome.cpp | 2 +- Minecraft.World/MusicTileEntity.cpp | 2 +- Minecraft.World/NbtIo.cpp | 2 +- Minecraft.World/NetherBridgeFeature.cpp | 2 +- Minecraft.World/NetherBridgePieces.cpp | 68 +-- Minecraft.World/Node.cpp | 6 +- Minecraft.World/NoteBlockTile.cpp | 2 +- Minecraft.World/Ocelot.cpp | 6 +- Minecraft.World/OcelotSitOnTileGoal.cpp | 10 +- Minecraft.World/OldChunkStorage.cpp | 8 +- Minecraft.World/Packet.cpp | 6 +- Minecraft.World/Painting.cpp | 2 +- Minecraft.World/Path.cpp | 8 +- Minecraft.World/PathFinder.cpp | 8 +- Minecraft.World/PathNavigation.cpp | 24 +- Minecraft.World/PathfinderMob.cpp | 8 +- Minecraft.World/PerformanceTimer.cpp | 4 +- Minecraft.World/PerlinSimplexNoise.cpp | 2 +- Minecraft.World/Pig.cpp | 6 +- Minecraft.World/PigZombie.cpp | 2 +- Minecraft.World/PistonBaseTile.cpp | 4 +- Minecraft.World/PistonMovingPiece.cpp | 2 +- Minecraft.World/Player.cpp | 42 +- Minecraft.World/PlayerEnderChestContainer.cpp | 2 +- Minecraft.World/Pos.cpp | 4 +- Minecraft.World/PotionBrewing.cpp | 20 +- Minecraft.World/PotionItem.h | 2 +- Minecraft.World/PreLoginPacket.cpp | 4 +- Minecraft.World/PrimedTnt.cpp | 4 +- Minecraft.World/Random.cpp | 14 +- Minecraft.World/RandomLevelSource.cpp | 26 +- Minecraft.World/Recipes.cpp | 12 +- Minecraft.World/RecordingItem.cpp | 2 +- Minecraft.World/Region.cpp | 6 +- Minecraft.World/RegionFile.cpp | 8 +- Minecraft.World/RemoveMobEffectPacket.cpp | 2 +- Minecraft.World/RespawnPacket.cpp | 2 +- Minecraft.World/SetEntityMotionPacket.cpp | 12 +- Minecraft.World/SetHealthPacket.cpp | 2 +- Minecraft.World/ShapedRecipy.cpp | 2 +- Minecraft.World/ShapelessRecipy.cpp | 2 +- Minecraft.World/SharedMonsterAttributes.cpp | 2 +- Minecraft.World/Sheep.cpp | 16 +- Minecraft.World/ShortTag.h | 2 +- Minecraft.World/SignTileEntity.cpp | 4 +- Minecraft.World/SignUpdatePacket.cpp | 2 +- Minecraft.World/SimplexNoise.cpp | 2 +- Minecraft.World/Skeleton.cpp | 10 +- Minecraft.World/SkullItem.cpp | 2 +- Minecraft.World/SkullTileEntity.cpp | 4 +- Minecraft.World/Slime.cpp | 6 +- Minecraft.World/Socket.cpp | 4 +- Minecraft.World/SparseDataStorage.cpp | 30 +- Minecraft.World/SparseLightStorage.cpp | 32 +- Minecraft.World/Spider.cpp | 8 +- Minecraft.World/Squid.cpp | 4 +- Minecraft.World/Stats.cpp | 14 +- Minecraft.World/StemTile.cpp | 6 +- Minecraft.World/StringHelpers.cpp | 10 +- Minecraft.World/StringTag.h | 2 +- Minecraft.World/StrongholdFeature.cpp | 12 +- Minecraft.World/StrongholdPieces.cpp | 62 +-- Minecraft.World/StructurePiece.cpp | 8 +- Minecraft.World/StructureRecipies.cpp | 2 +- Minecraft.World/SynchedEntityData.cpp | 2 +- Minecraft.World/TakeFlowerGoal.cpp | 2 +- Minecraft.World/TamableAnimal.cpp | 10 +- Minecraft.World/TeleportEntityPacket.cpp | 4 +- .../TextureAndGeometryChangePacket.cpp | 2 +- Minecraft.World/TextureAndGeometryPacket.cpp | 16 +- Minecraft.World/TextureChangePacket.cpp | 4 +- Minecraft.World/TexturePacket.cpp | 4 +- Minecraft.World/TheEndBiome.cpp | 4 +- .../TheEndLevelRandomLevelSource.cpp | 12 +- Minecraft.World/Throwable.cpp | 30 +- Minecraft.World/ThrownExpBottle.cpp | 2 +- Minecraft.World/ThrownPotion.cpp | 4 +- Minecraft.World/Tile.cpp | 102 ++-- Minecraft.World/TileEntityDataPacket.cpp | 2 +- Minecraft.World/TileUpdatePacket.cpp | 2 +- Minecraft.World/ToolRecipies.cpp | 2 +- Minecraft.World/TopSnowTile.cpp | 2 +- Minecraft.World/TripWireTile.cpp | 2 +- .../UpdateGameRuleProgressPacket.cpp | 4 +- Minecraft.World/UpdateMobEffectPacket.cpp | 6 +- Minecraft.World/UseItemPacket.cpp | 6 +- Minecraft.World/Vec3.cpp | 4 +- Minecraft.World/VillageFeature.cpp | 4 +- Minecraft.World/VillagePieces.cpp | 28 +- Minecraft.World/VillageSiege.cpp | 6 +- Minecraft.World/Villager.cpp | 2 +- Minecraft.World/VillagerGolem.cpp | 8 +- Minecraft.World/Villages.cpp | 4 +- Minecraft.World/WaterLilyTile.cpp | 2 +- Minecraft.World/WeighedTreasure.cpp | 4 +- Minecraft.World/WeightedPressurePlateTile.cpp | 2 +- Minecraft.World/Witch.cpp | 4 +- Minecraft.World/WitherBoss.cpp | 12 +- Minecraft.World/WitherSkull.cpp | 4 +- Minecraft.World/Wolf.cpp | 22 +- Minecraft.World/WoolCarpetTile.cpp | 2 +- Minecraft.World/Zombie.cpp | 32 +- Minecraft.World/ZoneIo.cpp | 4 +- Minecraft.World/compression.cpp | 44 +- Minecraft.World/system.cpp | 2 +- 677 files changed, 4314 insertions(+), 4314 deletions(-) diff --git a/Minecraft.Client/AchievementPopup.cpp b/Minecraft.Client/AchievementPopup.cpp index 04f822aba..c10ebde32 100644 --- a/Minecraft.Client/AchievementPopup.cpp +++ b/Minecraft.Client/AchievementPopup.cpp @@ -59,7 +59,7 @@ void AchievementPopup::prepareWindow() glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, (float)width, (float)height, 0, 1000, 3000); + glOrtho(0, static_cast(width), static_cast(height), 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); diff --git a/Minecraft.Client/ArrowRenderer.cpp b/Minecraft.Client/ArrowRenderer.cpp index 4698cd6e3..a7dd6efdd 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((float)x, (float)y, (float)z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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((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->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->end(); // glNormal3f(-ss, 0, 0); // 4J - changed to use tesselator t->begin(); t->normal(-1,0,0); - 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->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->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((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->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->end(); } glDisable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/BatRenderer.cpp b/Minecraft.Client/BatRenderer.cpp index 629fe014a..97c6412d7 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 = ((BatModel *)model)->modelVersion(); + modelVersion = static_cast(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 8e0da036b..f8426a2f3 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 = ((BlazeModel *) model)->modelVersion(); + modelVersion = static_cast(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 = ((BlazeModel *) model)->modelVersion(); + int modelVersion = static_cast(model)->modelVersion(); if (modelVersion != this->modelVersion) { this->modelVersion = modelVersion; diff --git a/Minecraft.Client/BoatModel.cpp b/Minecraft.Client/BoatModel.cpp index d0d465e52..5a55e7e84 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((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0); - cubes[0]->setPos(0, (float)(0 + yOff), 0); + 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[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[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[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[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[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[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[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[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[0]->xRot = PI / 2; cubes[1]->yRot = PI / 2 * 3; diff --git a/Minecraft.Client/BoatRenderer.cpp b/Minecraft.Client/BoatRenderer.cpp index 4c2e9baf9..c012168a4 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 51b721f51..2eab8616d 100644 --- a/Minecraft.Client/BreakingItemParticle.cpp +++ b/Minecraft.Client/BreakingItemParticle.cpp @@ -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 = (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 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 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 2d1380eb5..29dd12029 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+(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; + 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; - lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); } void BubbleParticle::tick() diff --git a/Minecraft.Client/BufferedImage.cpp b/Minecraft.Client/BufferedImage.cpp index 89e37e4f4..0b95c763d 100644 --- a/Minecraft.Client/BufferedImage.cpp +++ b/Minecraft.Client/BufferedImage.cpp @@ -391,9 +391,9 @@ void BufferedImage::preMultiplyAlpha() { cur = curData[i]; alpha = (cur >> 24) & 0xff; - r = ((cur >> 16) & 0xff) * (float)alpha/255; - g = ((cur >> 8) & 0xff) * (float)alpha/255; - b = (cur & 0xff) * (float)alpha/255; + r = ((cur >> 16) & 0xff) * static_cast(alpha)/255; + g = ((cur >> 8) & 0xff) * static_cast(alpha)/255; + b = (cur & 0xff) * static_cast(alpha)/255; curData[i] = (r << 16) | (g << 8) | (b ) | (alpha << 24); } diff --git a/Minecraft.Client/ChestRenderer.cpp b/Minecraft.Client/ChestRenderer.cpp index 97954b55a..5b59eb411 100644 --- a/Minecraft.Client/ChestRenderer.cpp +++ b/Minecraft.Client/ChestRenderer.cpp @@ -54,7 +54,7 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d if (dynamic_cast(tile) != NULL && data == 0) { - ((ChestTile *) tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z); + static_cast(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z); data = chest->getData(); } @@ -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((float) x, (float) y + 1, (float) z + 1); + glTranslatef(static_cast(x), static_cast(y) + 1, static_cast(z) + 1); glScalef(1, -1, -1); glTranslatef(0.5f, 0.5f, 0.5f); diff --git a/Minecraft.Client/ChickenModel.cpp b/Minecraft.Client/ChickenModel.cpp index 98ef93587..14eb61270 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, (float)(-1 + yo), -4); + head->setPos(0, static_cast(-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, (float)(-1 + yo), -4); + beak->setPos(0, static_cast(-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, (float)(-1 + yo), -4); + redThing->setPos(0, static_cast(-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, (float)(0 + yo), 0); + body->setPos(0, static_cast(0 + yo), 0); leg0 = new ModelPart(this, 26, 0); leg0->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg0 - leg0->setPos(-2, (float)(3 + yo), 1); + leg0->setPos(-2, static_cast(3 + yo), 1); leg1 = new ModelPart(this, 26, 0); leg1->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg1 - leg1->setPos(1, (float)(3 + yo), 1); + leg1->setPos(1, static_cast(3 + yo), 1); wing0 = new ModelPart(this, 24, 13); wing0->addBox(0.0f, 0.0f, -3.0f, 1, 4, 6); // Wing0 - wing0->setPos(-4, (float)(-3 + yo), 0); + wing0->setPos(-4, static_cast(-3 + yo), 0); wing1 = new ModelPart(this, 24, 13); wing1->addBox(-1.0f, 0.0f, -3.0f, 1, 4, 6); // Wing1 - wing1->setPos(4, (float)(-3 + yo), 0); + wing1->setPos(4, static_cast(-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 850b79fb3..58ee7f484 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -32,13 +32,13 @@ void Chunk::CreateNewThreadStorage() void Chunk::ReleaseThreadStorage() { - unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx); + unsigned char *tileIds = static_cast(TlsGetValue(tlsIdx)); delete tileIds; } unsigned char *Chunk::GetTileIdsStorage() { - unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx); + unsigned char *tileIds = static_cast(TlsGetValue(tlsIdx)); return tileIds; } #else @@ -148,7 +148,7 @@ void Chunk::setPos(int x, int y, int z) void Chunk::translateToPos() { - glTranslatef((float)xRenderOffs, (float)yRenderOffs, (float)zRenderOffs); + glTranslatef(static_cast(xRenderOffs), static_cast(yRenderOffs), static_cast(zRenderOffs)); } @@ -399,7 +399,7 @@ void Chunk::rebuild() glTranslatef(zs / 2.0f, ys / 2.0f, zs / 2.0f); #endif t->begin(); - t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z)); + t->offset(static_cast(-this->x), static_cast(-this->y), static_cast(-this->z)); } Tile *tile = Tile::tiles[tileId]; @@ -936,17 +936,17 @@ void Chunk::rebuild_SPU() float Chunk::distanceToSqr(shared_ptr player) const { - float xd = (float) (player->x - xm); - float yd = (float) (player->y - ym); - float zd = (float) (player->z - zm); + float xd = static_cast(player->x - xm); + float yd = static_cast(player->y - ym); + float zd = static_cast(player->z - zm); return xd * xd + yd * yd + zd * zd; } float Chunk::squishedDistanceToSqr(shared_ptr player) { - float xd = (float) (player->x - xm); - float yd = (float) (player->y - ym) * 2; - float zd = (float) (player->z - zm); + float xd = static_cast(player->x - xm); + float yd = static_cast(player->y - ym) * 2; + float zd = static_cast(player->z - zm); return xd * xd + yd * yd + zd * zd; } diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 2270433d3..26d3b379f 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -468,12 +468,12 @@ void ClientConnection::handleAddEntity(shared_ptr packet) break; case AddEntityPacket::ITEM_FRAME: { - int ix=(int) x; - int iy=(int) y; - int iz = (int) z; + int ix=static_cast(x); + int iy=static_cast(y); + int iz = static_cast(z); app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz); } - e = shared_ptr(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data)); + e = shared_ptr(new ItemFrame(level, static_cast(x), static_cast(y), static_cast(z), packet->data)); packet->data = 0; setRot = false; break; @@ -530,7 +530,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) e = shared_ptr(new FireworksRocketEntity(level, x, y, z, nullptr)); break; case AddEntityPacket::LEASH_KNOT: - e = shared_ptr(new LeashFenceKnotEntity(level, (int) x, (int) y, (int) z)); + e = shared_ptr(new LeashFenceKnotEntity(level, static_cast(x), static_cast(y), static_cast(z))); packet->data = 0; break; #ifndef _FINAL_BUILD @@ -804,11 +804,11 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e; if (pktXuid >= WIN64_XUID_BASE && pktXuid < WIN64_XUID_BASE + MINECRAFT_NET_MAX_PLAYERS) { - BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE); + BYTE smallId = static_cast(pktXuid - WIN64_XUID_BASE); INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId); if (np != NULL) { - NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; + NetworkPlayerXbox* npx = static_cast(np); IQNetPlayer* qp = npx->GetQNetPlayer(); if (qp != NULL && qp->m_gamertag[0] == 0) { @@ -976,7 +976,7 @@ void ClientConnection::handleRemoveEntity(shared_ptr packe INetworkPlayer* np = g_NetworkManager.GetPlayerByXuid(xuid); if (np != NULL) { - NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; + NetworkPlayerXbox* npx = static_cast(np); IQNetPlayer* qp = npx->GetQNetPlayer(); if (qp != NULL) { @@ -1727,7 +1727,7 @@ void ClientConnection::handleChat(shared_ptr packet) } else { - message = replaceAll(message,L"{*DESTINATION*}", app.getEntityName((eINSTANCEOF)packet->m_intArgs[0])); + message = replaceAll(message,L"{*DESTINATION*}", app.getEntityName(static_cast(packet->m_intArgs[0]))); } break; case ChatPacket::e_ChatCommandTeleportMe: @@ -1767,7 +1767,7 @@ void ClientConnection::handleChat(shared_ptr packet) } else { - entityName = app.getEntityName((eINSTANCEOF) packet->m_intArgs[0]); + entityName = app.getEntityName(static_cast(packet->m_intArgs[0])); } message = replaceAll(message,L"{*SOURCE*}", entityName); @@ -2744,7 +2744,7 @@ void ClientConnection::handleRespawn(shared_ptr packet) if( minecraft->localgameModes[m_userIndex] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_userIndex]; + TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_userIndex]); gameMode->getTutorial()->showTutorialPopup(false); } @@ -3267,7 +3267,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack } else if (event == GameEventPacket::WIN_GAME) { - ui.SetWinUserIndex( (BYTE)gameEventPacket->param ); + ui.SetWinUserIndex( static_cast(gameEventPacket->param) ); #ifdef _XBOX @@ -3439,11 +3439,11 @@ void ClientConnection::displayPrivilegeChanges(shared_ptrGetXboxPad(); unsigned int newPrivileges = player->getAllPlayerGamePrivileges(); - Player::EPlayerGamePrivileges priv = (Player::EPlayerGamePrivileges)0; + Player::EPlayerGamePrivileges priv = static_cast(0); bool privOn = false; for(unsigned int i = 0; i < Player::ePlayerGamePrivilege_MAX; ++i) { - priv = (Player::EPlayerGamePrivileges) i; + priv = static_cast(i); if( Player::getPlayerGamePrivilege(newPrivileges,priv) != Player::getPlayerGamePrivilege(oldPrivileges,priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges,priv); @@ -3579,7 +3579,7 @@ void ClientConnection::handleCustomPayload(shared_ptr custo } #else UIScene *scene = ui.GetTopScene(m_userIndex, eUILayer_Scene); - UIScene_TradingMenu *screen = (UIScene_TradingMenu *)scene; + UIScene_TradingMenu *screen = static_cast(scene); trader = screen->getMerchant(); #endif @@ -3665,7 +3665,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) diff --git a/Minecraft.Client/ClockTexture.cpp b/Minecraft.Client/ClockTexture.cpp index 837532fb7..37efc1839 100644 --- a/Minecraft.Client/ClockTexture.cpp +++ b/Minecraft.Client/ClockTexture.cpp @@ -57,7 +57,7 @@ void ClockTexture::cycleFrames() // 4J Stu - We share data with another texture if(m_dataTexture != NULL) { - int newFrame = (int) ((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = static_cast((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 = (int) ((rot + 1.0) * frames->size()) % frames->size(); + int newFrame = static_cast((rot + 1.0) * frames->size()) % frames->size(); while (newFrame < 0) { newFrame = (newFrame + frames->size()) % frames->size(); diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index e9affe6b8..e3e8cee93 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -447,7 +447,7 @@ void SoundEngine::updateMiles() int Playing = 0; while (AIL_enumerate_sound_instances(0, &token, 0, 0, 0, &SoundInfo)) { - AUDIO_INFO* game_data= (AUDIO_INFO*)( SoundInfo.UserBuffer ); + AUDIO_INFO* game_data= static_cast(SoundInfo.UserBuffer); if( SoundInfo.Status == MILESEVENT_SOUND_STATUS_PLAYING ) { @@ -1134,7 +1134,7 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter ) #ifdef __DISABLE_MILES__ return 0; #endif - SoundEngine *soundEngine = (SoundEngine *)lpParameter; + SoundEngine *soundEngine = static_cast(lpParameter); soundEngine->m_hStream = AIL_open_stream(soundEngine->m_hDriver,soundEngine->m_szStreamName,0); if(soundEngine->m_hStream==0) @@ -1211,9 +1211,9 @@ void SoundEngine::playMusicUpdate() { // It's a mash-up - need to use the DLC path for the music TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; + DLCTexturePack *pDLCTexPack=static_cast(pTexPack); DLCPack *pack = pDLCTexPack->getDLCInfoParentPack(); - DLCAudioFile *dlcAudioFile = (DLCAudioFile *) pack->getFile(DLCManager::e_DLCType_Audio, 0); + DLCAudioFile *dlcAudioFile = static_cast(pack->getFile(DLCManager::e_DLCType_Audio, 0)); app.DebugPrintf("Mashup pack \n"); @@ -1683,7 +1683,7 @@ char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpac { if(c==' ') c='_'; } - buf[i] = (char)c; + buf[i] = static_cast(c); } buf[name.length()] = 0; return buf; diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index e4bfe7327..e103c3198 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], (eMinecraftColour)i) ); + s_colourNamesMap.insert( unordered_map::value_type( ColourTableElements[i], static_cast(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[(int)it->second] = value; + m_colourValues[static_cast(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[(int)id]; + return m_colourValues[static_cast(id)]; } diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 00dedbe15..692e00d87 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -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]=(GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(i); + GameSettingsA[i]=static_cast(ProfileManager.GetGameDefinedProfileData(i)); #endif // clear the flag to say the settings have changed GameSettingsA[i]->bSettingsChanged=false; @@ -933,7 +933,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTI int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) #endif { - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast(pParam); // flag the default options to be set @@ -1368,20 +1368,20 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_MusicVolume: if(iPad==ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set(Options::Option::MUSIC,((float)GameSettingsA[iPad]->ucMusicVolume)/100.0f); + pMinecraft->options->set(Options::Option::MUSIC,static_cast(GameSettingsA[iPad]->ucMusicVolume)/100.0f); } break; case eGameSetting_SoundFXVolume: if(iPad==ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set(Options::Option::SOUND,((float)GameSettingsA[iPad]->ucSoundFXVolume)/100.0f); + pMinecraft->options->set(Options::Option::SOUND,static_cast(GameSettingsA[iPad]->ucSoundFXVolume)/100.0f); } break; case eGameSetting_Gamma: if(iPad==ProfileManager.GetPrimaryPad()) { #if defined(_WIN64) || defined(_WINDOWS64) - pMinecraft->options->set(Options::Option::GAMMA, ((float)GameSettingsA[iPad]->ucGamma) / 100.0f); + pMinecraft->options->set(Options::Option::GAMMA, static_cast(GameSettingsA[iPad]->ucGamma) / 100.0f); #else // ucGamma range is 0-100, UpdateGamma is 0 - 32768 float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f; @@ -1417,7 +1417,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,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); + pMinecraft->options->set(Options::Option::SENSITIVITY,static_cast(GameSettingsA[iPad]->ucSensitivity)/100.0f); //InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); break; @@ -1697,7 +1697,7 @@ unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad) void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos) { - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=(unsigned char)iPos; + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=static_cast(iPos); GameSettingsA[iPad]->bSettingsChanged = true; } @@ -2644,7 +2644,7 @@ int CMinecraftApp::DisplaySavingMessage(void *pParam, C4JStorage::ESavingMessage void CMinecraftApp::SetActionConfirmed(LPVOID param) { - XuiActionParam *actionInfo = (XuiActionParam *)param; + XuiActionParam *actionInfo = static_cast(param); app.SetAction(actionInfo->iPad, actionInfo->action); } @@ -2800,7 +2800,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (LPVOID)false; + loadingParams->lpParam = static_cast(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; @@ -2861,7 +2861,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; @@ -3692,7 +3692,7 @@ void CMinecraftApp::HandleXuiActions(void) if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it - pDLCTexPack=(DLCTexturePack *)pTexPack; + pDLCTexPack=static_cast(pTexPack); } // change to the default texture pack @@ -3745,7 +3745,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; - loadingParams->lpParam = (LPVOID)&m_InviteData; + loadingParams->lpParam = static_cast(&m_InviteData); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -3768,7 +3768,7 @@ void CMinecraftApp::HandleXuiActions(void) g_NetworkManager.SetLocalGame(false); - JoinFromInviteData *inviteData = (JoinFromInviteData *)param; + JoinFromInviteData *inviteData = static_cast(param); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -3894,7 +3894,7 @@ void CMinecraftApp::HandleXuiActions(void) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i); #else - SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i); + SetDefaultOptions(static_cast(param),i); #endif // if the profile data has been changed, then force a profile write @@ -4312,7 +4312,7 @@ void CMinecraftApp::HandleXuiActions(void) int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast(pParam); //Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4721,7 +4721,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast(pParam); Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4793,7 +4793,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast(pParam); Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4851,7 +4851,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR void CMinecraftApp::ProfileReadErrorCallback(void *pParam) { - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast(pParam); int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); } @@ -4883,7 +4883,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); #endif - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast(pParam); // check if the primary player signed out int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); @@ -5058,7 +5058,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam) { - CMinecraftApp* pClass = (CMinecraftApp*)pParam; + CMinecraftApp* pClass = static_cast(pParam); // push these on to the notifications to be handled in qnet's dowork @@ -5247,7 +5247,7 @@ void CMinecraftApp::SetDebugSequence(const char *pchSeq) } int CMinecraftApp::DebugInputCallback(LPVOID pParam) { - CMinecraftApp* pClass = (CMinecraftApp*)pParam; + CMinecraftApp* pClass = static_cast(pParam); //printf("sequence matched\n"); pClass->m_bDebugOptions=!pClass->m_bDebugOptions; @@ -5592,7 +5592,7 @@ void CMinecraftApp::InitTime() // Get the frequency of the timer LARGE_INTEGER qwTicksPerSec; QueryPerformanceFrequency( &qwTicksPerSec ); - m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; + m_Time.fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); // Save the start time QueryPerformanceCounter( &m_Time.qwTime ); @@ -5618,8 +5618,8 @@ void CMinecraftApp::UpdateTime() m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart; m_Time.qwTime.QuadPart = qwNewTime.QuadPart; - m_Time.fElapsedTime = m_Time.fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); - m_Time.fAppTime = m_Time.fSecsPerTick * ((FLOAT)(m_Time.qwAppTime.QuadPart)); + m_Time.fElapsedTime = m_Time.fSecsPerTick * static_cast(qwDeltaTime.QuadPart); + m_Time.fAppTime = m_Time.fSecsPerTick * static_cast(m_Time.qwAppTime.QuadPart); } @@ -5913,7 +5913,7 @@ void CMinecraftApp::ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, con int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast(pParam); //Minecraft *pMinecraft=Minecraft::GetInstance(); // buttons are swapped on this menu @@ -5927,7 +5927,7 @@ int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMess int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp *pClass = (CMinecraftApp *)pParam; + CMinecraftApp *pClass = static_cast(pParam); // Exit with or without saving // Decline means save in this dialog if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) @@ -7487,7 +7487,7 @@ 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 = (UIScene_FullscreenProgress *)ui.FindScene(eUIScene_FullscreenProgress); + UIScene_FullscreenProgress *pScene = static_cast(ui.FindScene(eUIScene_FullscreenProgress)); #ifdef __PS3__ if(pScene!=NULL) #else @@ -7565,7 +7565,7 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps if(bWriteToTMS) { - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); + DWORD dwDataBytes=static_cast(sizeof(BANNEDLISTDATA) * m_vBannedListA[iPad]->size()); PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]); int iCount=0; for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] ) @@ -7638,7 +7638,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } } - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); + DWORD dwDataBytes=static_cast(sizeof(BANNEDLISTDATA) * m_vBannedListA[iPad]->size()); if(dwDataBytes==0) { // wipe the file @@ -7652,7 +7652,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha { PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]); - int iSize=(int)m_vBannedListA[iPad]->size(); + int iSize=static_cast(m_vBannedListA[iPad]->size()); for(int i=0;iat(i); @@ -7706,7 +7706,7 @@ bool CMinecraftApp::AlreadySeenCreditText(const wstring &wstemp) unsigned int CMinecraftApp::GetDLCCreditsCount() { - return (unsigned int)vDLCCredits.size(); + return static_cast(vDLCCredits.size()); } SCreditTextItemDef * CMinecraftApp::GetDLCCredits(int iIndex) @@ -8825,7 +8825,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto { #endif - CMinecraftApp* pClass = (CMinecraftApp *) pParam; + CMinecraftApp* pClass = static_cast(pParam); // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -9086,7 +9086,7 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved() int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad) { - CMinecraftApp* pClass = (CMinecraftApp *) pParam; + CMinecraftApp* pClass = static_cast(pParam); // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -9111,10 +9111,10 @@ eDLCContentType CMinecraftApp::Find_eDLCContentType(DWORD dwType) { if(m_dwContentTypeA[i]==dwType) { - return (eDLCContentType)i; + return static_cast(i); } } - return (eDLCContentType)0; + return static_cast(0); } bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) { @@ -9457,18 +9457,18 @@ int CMinecraftApp::GetDLCInfoFullOffersCount() #else int CMinecraftApp::GetDLCInfoTrialOffersCount() { - return (int)DLCInfo_Trial.size(); + return static_cast(DLCInfo_Trial.size()); } int CMinecraftApp::GetDLCInfoFullOffersCount() { - return (int)DLCInfo_Full.size(); + return static_cast(DLCInfo_Full.size()); } #endif int CMinecraftApp::GetDLCInfoTexturesOffersCount() { - return (int)DLCTextures_PackID.size(); + return static_cast(DLCTextures_PackID.size()); } // AUTOSAVE diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index ec36b7652..0e4d66154 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -625,7 +625,7 @@ public: virtual void ReleaseSaveThumbnail()=0; virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0; - virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0; + virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false)=0; private: diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp index 6faf0c3b3..ff18b540a 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp @@ -40,7 +40,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring & { if(paramName.compare(wchTypeNamesA[i]) == 0) { - type = (EAudioParameterType)i; + type = static_cast(i); break; } } @@ -87,7 +87,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons { i++; } - int iLast=(int)creditValue.find_last_of(L" ",i); + int iLast=static_cast(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=(int)creditValue.find_last_of(L" ",i); + iLast=static_cast(creditValue.find_last_of(L" ", i)); break; } @@ -145,7 +145,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) for(unsigned int i=0;iwchData); + wstring parameterName(static_cast(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;idwType; + EAudioType type = static_cast(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,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData); + addParameter(type,static_cast(pParams->dwType),(WCHAR *)pParams->wchData); } pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 36f4d7f7e..89da3cebe 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -47,7 +47,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const wstring ¶mN { if(paramName.compare(wchTypeNamesA[i]) == 0) { - type = (EDLCParameterType)i; + type = static_cast(i); break; } } @@ -70,7 +70,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) } else { - packCount = (DWORD)m_packs.size(); + packCount = static_cast(m_packs.size()); } return packCount; } @@ -403,7 +403,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;iwchData); + wstring parameterName(static_cast(pParams->wchData)); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { @@ -429,7 +429,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;idwType; + DLCManager::EDLCType type = static_cast(pFile->dwType); DLCFile *dlcFile = NULL; DLCPack *dlcTexturePack = NULL; @@ -608,7 +608,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;iwchData); + wstring parameterName(static_cast(pParams->wchData)); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { @@ -633,7 +633,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;idwType; + DLCManager::EDLCType type = static_cast(pFile->dwType); // Params uiParameterCount=*(unsigned int *)pbTemp; @@ -649,7 +649,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { if(it->second==e_DLCParamType_PackId) { - wstring wsTemp=(WCHAR *)pParams->wchData; + wstring wsTemp=static_cast(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 ea8a270fd..7986bf6d6 100644 --- a/Minecraft.Client/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Common/DLC/DLCPack.cpp @@ -156,7 +156,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va m_dataPath = value; break; default: - m_parameters[(int)type] = value; + m_parameters[static_cast(type)] = value; break; } } @@ -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 = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) + for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) { hasFile = doesPackContainFile(currentType,path); if(hasFile) break; @@ -287,7 +287,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) { - for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) + for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) { file = getFile(currentType,index); if(file != NULL) break; @@ -309,7 +309,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) DLCFile *file = NULL; if(type == DLCManager::e_DLCType_All) { - for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1)) + for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) { file = getFile(currentType,path); if(file != NULL) break; @@ -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((DLCManager::EDLCType)i); + count += getDLCItemsCount(static_cast(i)); } break; default: - count = (DWORD)m_files[(int)type].size(); + count = static_cast(m_files[(int)type].size()); break; }; return count; @@ -425,7 +425,7 @@ void DLCPack::UpdateLanguage() if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0) { file = m_files[DLCManager::e_DLCType_LocalisationData][0]; - DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); + DLCLocalisationFile *localisationFile = static_cast(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 df1f65f04..14129cbed 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 (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); } - DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); } + 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)); } 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 c845acd9b..2416c9439 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++; } - int iLast=(int)creditValue.find_last_of(L" ",i); + int iLast=static_cast(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=(int)creditValue.find_last_of(L" ",i); + iLast=static_cast(creditValue.find_last_of(L" ", i)); break; } @@ -178,7 +178,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring int DLCSkinFile::getAdditionalBoxesCount() { - return (int)m_AdditionalBoxes.size(); + return static_cast(m_AdditionalBoxes.size()); } vector *DLCSkinFile::getAdditionalBoxes() { diff --git a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp index 801a29373..012a9f7b6 100644 --- a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp @@ -45,7 +45,7 @@ GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleT if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) { rule = new AddEnchantmentRuleDefinition(); - m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule); + m_enchantments.push_back(static_cast(rule)); } else { diff --git a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp index a740a2beb..7c2b0d955 100644 --- a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -72,20 +72,20 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co else if(attributeName.compare(L"x") == 0) { m_location->x = _fromString(attributeValue); - if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1; + if( static_cast(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( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1; + if( static_cast(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(((int)abs(m_location->z))%2 != 0) m_location->z -= 1; + if(static_cast(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 = (int)(quad + 0.5f); + degrees = static_cast(quad + 0.5f); switch(degrees) { case 1: diff --git a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp index b928b26cc..65bf79ae3 100644 --- a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -58,7 +58,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength) { - PacketData *values = (PacketData *)data; + PacketData *values = static_cast(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/ConsoleGenerateStructure.cpp b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp index f505ce7a3..62154cdcd 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp @@ -29,22 +29,22 @@ GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRu if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) { rule = new XboxStructureActionGenerateBox(); - m_actions.push_back((XboxStructureActionGenerateBox *)rule); + m_actions.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock) { rule = new XboxStructureActionPlaceBlock(); - m_actions.push_back((XboxStructureActionPlaceBlock *)rule); + m_actions.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer) { rule = new XboxStructureActionPlaceContainer(); - m_actions.push_back((XboxStructureActionPlaceContainer *)rule); + m_actions.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner) { rule = new XboxStructureActionPlaceSpawner(); - m_actions.push_back((XboxStructureActionPlaceSpawner *)rule); + m_actions.push_back(static_cast(rule)); } else { @@ -139,25 +139,25 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin { case ConsoleGameRules::eGameRuleType_GenerateBox: { - XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action; + XboxStructureActionGenerateBox *genBox = static_cast(action); genBox->generateBoxInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceBlock: { - XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action; + XboxStructureActionPlaceBlock *pPlaceBlock = static_cast(action); pPlaceBlock->placeBlockInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceContainer: { - XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action; + XboxStructureActionPlaceContainer *pPlaceContainer = static_cast(action); pPlaceContainer->placeContainerInLevel(this,level,chunkBB); } break; case ConsoleGameRules::eGameRuleType_PlaceSpawner: { - XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action; + XboxStructureActionPlaceSpawner *pPlaceSpawner = static_cast(action); pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB); } break; diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h index 91c4ef357..712a29ab1 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 (EStructurePiece)0; } + EStructurePiece GetType() { return static_cast(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 01a8119e3..15009e5f4 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp @@ -61,7 +61,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions { - compressionType = (Compression::ECompressionTypes)dis->readByte(); + compressionType = static_cast(dis->readByte()); } if (version > XBOX_SCHEMATIC_CURRENT_VERSION) @@ -146,14 +146,14 @@ void ConsoleSchematicFile::load(DataInputStream *dis) if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME ) { - x = ((IntTag *) eTag->get(L"TileX") )->data; - y = ((IntTag *) eTag->get(L"TileY") )->data; - z = ((IntTag *) eTag->get(L"TileZ") )->data; + x = static_cast(eTag->get(L"TileX"))->data; + y = static_cast(eTag->get(L"TileY"))->data; + z = static_cast(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),(CompoundTag *)eTag->copy())); + m_entities.push_back( pair(Vec3::newPermanent(x,y,z),static_cast(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( (CompoundTag *)(it).second->copy() ); + entityTags->add( static_cast((it).second->copy()) ); NbtIo::write(tag,dos); delete tag; @@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos) __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) { - 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 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 yStart = destinationBox->y0; int yEnd = destinationBox->y1; if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; - 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)); + 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)); #ifdef _DEBUG app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1); @@ -442,7 +442,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); if( chunkBox->containsIncludingLowerBound(pos) ) { - shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); + shared_ptr teCopy = chunk->getTileEntity( static_cast(targetX) & 15, static_cast(targetY) & 15, static_cast(targetZ) & 15 ); if ( teCopy != NULL ) { @@ -726,9 +726,9 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l if( e->instanceof(eTYPE_HANGING_ENTITY) ) { - ((IntTag *) eTag->get(L"TileX") )->data -= xStart; - ((IntTag *) eTag->get(L"TileY") )->data -= yStart; - ((IntTag *) eTag->get(L"TileZ") )->data -= zStart; + static_cast(eTag->get(L"TileX"))->data -= xStart; + static_cast(eTag->get(L"TileY"))->data -= yStart; + static_cast(eTag->get(L"TileZ"))->data -= zStart; } entitiesTag->add(eTag); diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index f18aa7ae2..9b4d0493c 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -95,14 +95,14 @@ void GameRuleManager::loadGameRules(DLCPack *pack) if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc")) { - DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); + DLCLocalisationFile *localisationFile = static_cast(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 = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); + DLCGameRulesHeader *dlcHeader = static_cast(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 = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); + DLCGameRulesFile *dlcFile = static_cast(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( (Compression::ECompressionTypes)compression_type ); + Compression::getCompression()->SetDecompressionType( static_cast(compression_type) ); Compression::getCompression()->DecompressLZXRLE( content.data, &content.length, compr_content.data, compr_content.length); Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL ); @@ -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 < (int)ConsoleGameRules::eGameRuleType_Count; ++type) + for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < static_cast(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, (ConsoleGameRules::EGameRuleType)type) ); + tagIdMap.insert( unordered_map::value_type(i, static_cast(type)) ); break; } } diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp index e49ee293d..7232e9c65 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp @@ -145,22 +145,22 @@ GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRule if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) { rule = new ApplySchematicRuleDefinition(this); - m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule); + m_schematicRules.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure) { rule = new ConsoleGenerateStructure(); - m_structureRules.push_back((ConsoleGenerateStructure *)rule); + m_structureRules.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride) { rule = new BiomeOverride(); - m_biomeOverrides.push_back((BiomeOverride *)rule); + m_biomeOverrides.push_back(static_cast(rule)); } else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature) { rule = new StartFeature(); - m_features.push_back((StartFeature *)rule); + m_features.push_back(static_cast(rule)); } else { @@ -485,7 +485,7 @@ void LevelGenerationOptions::loadBaseSaveData() int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) { - LevelGenerationOptions *lgo = (LevelGenerationOptions *)pParam; + LevelGenerationOptions *lgo = static_cast(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 = (DLCGameRulesHeader *) lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); + DLCGameRulesHeader *dlcFile = static_cast(lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); if (!dlcFile->getGrfPath().empty()) { diff --git a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp index 658abe91f..b6525b73d 100644 --- a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp @@ -30,7 +30,7 @@ GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleT if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea) { rule = new NamedAreaRuleDefinition(); - m_areas.push_back((NamedAreaRuleDefinition *)rule); + m_areas.push_back(static_cast(rule)); } else { diff --git a/Minecraft.Client/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Common/GameRules/StartFeature.cpp index 904bce734..c2ad23505 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 = (StructureFeature::EFeatureTypes)value; + m_feature = static_cast(value); app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature); } else diff --git a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp index ec218c7a9..038ba5c78 100644 --- a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -69,7 +69,7 @@ GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGame if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); - m_items.push_back((AddItemRuleDefinition *)rule); + m_items.push_back(static_cast(rule)); } else { diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp index fa68ef6a4..cd26ad451 100644 --- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -37,7 +37,7 @@ GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); - m_items.push_back((AddItemRuleDefinition *)rule); + m_items.push_back(static_cast(rule)); } else { diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp index 07463517a..e93613c18 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp @@ -6,7 +6,7 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man) m_manager = man; m_pending = false; - m_filter = (LeaderboardManager::EFilterMode) -1; + m_filter = static_cast(-1); m_callback = NULL; m_difficulty = 0; m_type = LeaderboardManager::eStatsType_UNDEFINED; diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index dbae30103..f8d1f0dad 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -197,7 +197,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame __int64 seed = 0; if(lpParameter != NULL) { - NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; + NetworkGameInitData *param = static_cast(lpParameter); seed = param->seed; app.setLevelGenerationOptions(param->levelGen); @@ -744,7 +744,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession // Make sure that the Primary Pad is in by default localUsersMask |= GetLocalPlayerMask( ProfileManager.GetPrimaryPad() ); - return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex )); + return static_cast(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 = (INVITE_INFO *)pParam; + INVITE_INFO * pInviteInfo = static_cast(pParam); if(bContinue==true) { @@ -932,7 +932,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter ) __int64 seed = 0; if(lpParameter != NULL) { - NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; + NetworkGameInitData *param = static_cast(lpParameter); seed = param->seed; app.SetGameHostOption(eGameHostOption_All,param->settings); @@ -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 = (JoinFromInviteData *)lpParam; + JoinFromInviteData *inviteData = static_cast(lpParam); app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); #else if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 85531e472..0f79fd855 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -23,7 +23,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); + NetworkPlayerXbox *networkPlayer = static_cast(addNetworkPlayer(pQNetPlayer)); if( pQNetPlayer->IsLocal() ) { @@ -540,7 +540,7 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; + INetworkPlayer *pNetworkPlayer = static_cast(lpParam); Socket *socket = pNetworkPlayer->GetSocket(); @@ -667,7 +667,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() for(unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = static_cast(GetPlayerByIndex(i))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -711,7 +711,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 = (unsigned char)nameLen; + info->displayLabelLength = static_cast(nameLen); info->displayLabelViewableStartIndex = 0; info->data.netVersion = lanSessions[i].netVersion; @@ -726,7 +726,7 @@ void CPlatformNetworkManagerStub::SearchForGames() info->data.playerCount = lanSessions[i].playerCount; info->data.maxPlayers = lanSessions[i].maxPlayers; - info->sessionId = (SessionID)((unsigned __int64)inet_addr(lanSessions[i].hostIP) | ((unsigned __int64)lanSessions[i].hostPort << 32)); + info->sessionId = (SessionID)(static_cast(inet_addr(lanSessions[i].hostIP)) | (static_cast(lanSessions[i].hostPort) << 32)); friendsSessions[0].push_back(info); } @@ -766,7 +766,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 = (unsigned char)nameLen; + info->displayLabelLength = static_cast(nameLen); info->displayLabelViewableStartIndex = 0; info->data.isReadyToJoin = true; info->data.isJoinable = true; @@ -780,7 +780,7 @@ void CPlatformNetworkManagerStub::SearchForGames() std::fclose(file); } - m_searchResultsCount[0] = (int)friendsSessions[0].size(); + m_searchResultsCount[0] = static_cast(friendsSessions[0].size()); if (m_SessionsUpdatedCallback != NULL) m_SessionsUpdatedCallback(m_pSearchParam); diff --git a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp index a7a4628b1..9b44418f7 100644 --- a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp @@ -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( ((NetworkPlayerSony *)player)->m_sqrPlayer, pvData, dataSize, ack ); + m_sqrPlayer->SendData( static_cast(player)->m_sqrPlayer, pvData, dataSize, ack ); } bool NetworkPlayerSony::IsSameSystem(INetworkPlayer *player) { - return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony *)player)->m_sqrPlayer); + return m_sqrPlayer->IsSameSystem(static_cast(player)->m_sqrPlayer); } int NetworkPlayerSony::GetOutstandingAckCount() @@ -133,5 +133,5 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms() } __int64 currentTime = System::currentTimeMillis(); - return (int)( currentTime - m_lastChunkPacketTime ); + return static_cast(currentTime - m_lastChunkPacketTime); } diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h index d0efe635d..397e2c008 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 (AckFlags)m_ackFlags;} + AckFlags GetAckFlags() { return static_cast(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 4468d163a..6ea168c3e 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp @@ -39,13 +39,13 @@ static SceRemoteStorageStatus statParams; void SonyRemoteStorage::SetRetrievedDescData() { DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription; - ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]); + ESavePlatform testPlatform = static_cast(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 = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]); + 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_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 = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]); + 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_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 = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast(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 = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast(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 = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pRemoteStorage = static_cast(lpParam); if(error_code != 0) { app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code); @@ -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= (SonyRemoteStorage *)lpParam; + SonyRemoteStorage *pClass= static_cast(lpParam); if(pClass->m_bAborting) { @@ -277,7 +277,7 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum int SonyRemoteStorage::setDataThread(void* lpParam) { - SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam; + SonyRemoteStorage* pClass = static_cast(lpParam); pClass->m_startTime = System::currentTimeMillis(); pClass->setDataInternal(); return 0; @@ -322,8 +322,8 @@ int SonyRemoteStorage::getDataProgress() __int64 time = System::currentTimeMillis(); int elapsedSecs = (time - m_startTime) / 1000; - float estimatedTransfered = float(elapsedSecs * transferRatePerSec); - int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; + float estimatedTransfered = static_cast(elapsedSecs * transferRatePerSec); + int progVal = m_dataProgress + (estimatedTransfered / static_cast(totalSize)) * 100; if(progVal > nextChunk) return nextChunk; if(progVal > 99) diff --git a/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp b/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp index 4b04b19c1..cc47e9287 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 (INT)(app.getAppTime() - m_initialiseTime); + return static_cast(app.getAppTime() - m_initialiseTime); } /* @@ -171,15 +171,15 @@ INT CTelemetryManager::GetMode(DWORD dwUserId) if (gameType->isSurvival()) { - mode = (INT)eTelem_ModeId_Survival; + mode = static_cast(eTelem_ModeId_Survival); } else if (gameType->isCreative()) { - mode = (INT)eTelem_ModeId_Creative; + mode = static_cast(eTelem_ModeId_Creative); } else { - mode = (INT)eTelem_ModeId_Undefined; + mode = static_cast(eTelem_ModeId_Undefined); } } return mode; @@ -198,11 +198,11 @@ INT CTelemetryManager::GetSubMode(DWORD dwUserId) if(Minecraft::GetInstance()->isTutorial()) { - subMode = (INT)eTelem_SubModeId_Tutorial; + subMode = static_cast(eTelem_SubModeId_Tutorial); } else { - subMode = (INT)eTelem_SubModeId_Normal; + subMode = static_cast(eTelem_SubModeId_Normal); } return subMode; @@ -220,7 +220,7 @@ INT CTelemetryManager::GetLevelId(DWORD dwUserId) { INT levelId = (INT)eTelem_LevelId_Undefined; - levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel; + levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); return levelId; } @@ -242,13 +242,13 @@ INT CTelemetryManager::GetSubLevelId(DWORD dwUserId) switch(pMinecraft->localplayers[dwUserId]->dimension) { case 0: - subLevelId = (INT)eTelem_SubLevelId_Overworld; + subLevelId = static_cast(eTelem_SubLevelId_Overworld); break; case -1: - subLevelId = (INT)eTelem_SubLevelId_Nether; + subLevelId = static_cast(eTelem_SubLevelId_Nether); break; case 1: - subLevelId = (INT)eTelem_SubLevelId_End; + subLevelId = static_cast(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 (INT)m_levelInstanceID; + return static_cast(m_levelInstanceID); } /* @@ -314,19 +314,19 @@ INT CTelemetryManager::GetSingleOrMultiplayer() if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Single_Player); } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); } else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); } return singleOrMultiplayer; @@ -343,16 +343,16 @@ INT CTelemetryManager::GetDifficultyLevel(INT diff) switch(diff) { case 0: - difficultyLevel = (INT)eSen_DifficultyLevel_Easiest; + difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); break; case 1: - difficultyLevel = (INT)eSen_DifficultyLevel_Easier; + difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); break; case 2: - difficultyLevel = (INT)eSen_DifficultyLevel_Normal; + difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); break; case 3: - difficultyLevel = (INT)eSen_DifficultyLevel_Harder; + difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); break; } @@ -372,11 +372,11 @@ INT CTelemetryManager::GetLicense() if(ProfileManager.IsFullVersion()) { - license = (INT)eSen_License_Full_Purchased_Title; + license = static_cast(eSen_License_Full_Purchased_Title); } else { - license = (INT)eSen_License_Trial_or_Demo; + license = static_cast(eSen_License_Trial_or_Demo); } return license; } @@ -411,15 +411,15 @@ INT CTelemetryManager::GetAudioSettings(DWORD dwUserId) if(volume == 0) { - audioSettings = (INT)eSen_AudioSettings_Off; + audioSettings = static_cast(eSen_AudioSettings_Off); } else if(volume == DEFAULT_VOLUME_LEVEL) { - audioSettings = (INT)eSen_AudioSettings_On_Default; + audioSettings = static_cast(eSen_AudioSettings_On_Default); } else { - audioSettings = (INT)eSen_AudioSettings_On_CustomSetting; + audioSettings = static_cast(eSen_AudioSettings_On_CustomSetting); } } return audioSettings; diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp b/Minecraft.Client/Common/Tutorial/RideEntityTask.cpp index 29fe592d5..29b776453 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((eINSTANCEOF) m_eType)) + if (entity->instanceof(static_cast(m_eType))) { bIsCompleted = true; } diff --git a/Minecraft.Client/Common/Tutorial/StatTask.cpp b/Minecraft.Client/Common/Tutorial/StatTask.cpp index 5f8b215e3..e06db393c 100644 --- a/Minecraft.Client/Common/Tutorial/StatTask.cpp +++ b/Minecraft.Client/Common/Tutorial/StatTask.cpp @@ -20,6 +20,6 @@ bool StatTask::isCompleted() return true; Minecraft *minecraft = Minecraft::GetInstance(); - bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= (unsigned int)targetValue; + bIsCompleted = minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue( stat ) >= static_cast(targetValue); return bIsCompleted; } \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Common/Tutorial/Tutorial.cpp index 60feba11e..e46555cd9 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/Tutorial.cpp @@ -1173,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 = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(iPad); + GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(iPad)); #endif ZeroMemory( pGameSettings->ucTutorialCompletion, TUTORIAL_PROFILE_STORAGE_BYTES ); pGameSettings->uiSpecialTutorialBitmask = 0; @@ -1202,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 = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); + GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(m_iPad)); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); @@ -1235,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 = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad); + GAME_SETTINGS *pGameSettings = static_cast(ProfileManager.GetGameDefinedProfileData(m_iPad)); #endif int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 882584211..41dc28c87 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -296,8 +296,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() int iPad = getPad(); bool bStickInput = false; - 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 + 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 #ifdef __ORBIS__ // should have sensitivity for the touchpad @@ -406,7 +406,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING ) { ++m_iConsectiveInputTicks; - fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) ); + fInputScale = ( static_cast(m_iConsectiveInputTicks) / static_cast((MAX_INPUT_TICKS_FOR_SCALING)) ); } #ifdef TAP_DETECTION else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING ) @@ -494,11 +494,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if (winW > 0 && winH > 0) { - float scaleX = (float)getMovieWidth() / (float)winW; - float scaleY = (float)getMovieHeight() / (float)winH; + float scaleX = static_cast(getMovieWidth()) / static_cast(winW); + float scaleY = static_cast(getMovieHeight()) / static_cast(winH); - vPointerPos.x += (float)deltaX * scaleX; - vPointerPos.y += (float)deltaY * scaleY; + vPointerPos.x += static_cast(deltaX) * scaleX; + vPointerPos.y += static_cast(deltaY) * scaleY; } if (deltaX != 0 || deltaY != 0) @@ -527,7 +527,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else if ( eSectionUnderPointer == eSectionNone ) { - ESceneSection eSection = ( ESceneSection )( iSection ); + ESceneSection eSection = static_cast(iSection); // Get position of this section. UIVec2D sectionPos; @@ -1309,9 +1309,9 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } vPointerPos.x = floor(vPointerPos.x); - vPointerPos.x += ( (int)vPointerPos.x%2); + vPointerPos.x += ( static_cast(vPointerPos.x)%2); vPointerPos.y = floor(vPointerPos.y); - vPointerPos.y += ( (int)vPointerPos.y%2); + vPointerPos.y += ( static_cast(vPointerPos.y)%2); m_pointerPos = vPointerPos; adjustPointerForSafeZone(); @@ -1525,7 +1525,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b message->m_iAuxVal = item->getAuxValue(); message->m_forceDisplay = true; - TutorialMode *gameMode = (TutorialMode *)Minecraft::GetInstance()->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(Minecraft::GetInstance()->localgameModes[iPad]); gameMode->getTutorial()->setMessage(NULL, message); ui.PlayUISFX(eSFX_Press); } diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index fc012be3f..e0d8472a1 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -620,7 +620,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() */ RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); - int iRecipeC=(int)recipes->size(); + int iRecipeC=static_cast(recipes->size()); auto itRecipe = recipes->begin(); // dump out the recipe products diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 0d3f7dace..efe19ce9d 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -1040,7 +1040,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu { m_menu->getSlot(i)->set(nullptr); // call this function to synchronize multiplayer item bar - pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START); + pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - static_cast(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START); } } return true; @@ -1082,8 +1082,8 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction) // Fall through intentional case ACTION_MENU_RIGHT_SCROLL: { - ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir); - if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1); + ECreativeInventoryTabs tab = static_cast(m_curTab + dir); + if (tab < 0) tab = static_cast(eCreativeInventoryTab_COUNT - 1); if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks; switchTab(tab); ui.PlayUISFX(eSFX_Focus); @@ -1188,7 +1188,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 - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START); + pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - static_cast(m_menu->slots.size()) + 9 + InventoryMenu::USE_ROW_SLOT_START); if(m_bCarryingCreativeItem) { @@ -1370,7 +1370,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis expTags->add(expTag); fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, (byte) sulphur); + fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphur)); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); diff --git a/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp index c73f7dc5c..fbbf7c24f 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 (EnchantmentMenu *)m_menu; + return static_cast(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 03adbd2c2..294816ed6 100644 --- a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp @@ -146,8 +146,8 @@ void IUIScene_HUD::updateFrameTick() { if(uiOpacityTimer<10) { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -156,7 +156,7 @@ void IUIScene_HUD::updateFrameTick() } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else @@ -166,7 +166,7 @@ void IUIScene_HUD::updateFrameTick() { ucAlpha=15; } - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } SetOpacity(fVal); @@ -198,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 = (float)maxHealthAttribute->getValue(); + float maxHealth = static_cast(maxHealthAttribute->getValue()); float totalAbsorption = pMinecraft->localplayers[iPad]->getAbsorptionAmount(); // Update armour @@ -242,8 +242,8 @@ void IUIScene_HUD::renderPlayerHealth() if (pMinecraft->localplayers[iPad]->isUnderLiquid(Material::water)) { ShowAir(true); - 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; + 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; SetAir(count, extra); } else @@ -254,7 +254,7 @@ void IUIScene_HUD::renderPlayerHealth() else if(riding->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(riding); - int riderCurrentHealth = (int) ceil(living->getHealth()); + int riderCurrentHealth = static_cast(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 ab1767d4f..852928785 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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) @@ -352,7 +352,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 int IUIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) { - bool bAutosave=(bool)lpParameter; + bool bAutosave=static_cast(lpParameter); if(bAutosave) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); diff --git a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index d3a9e8f08..08be958aa 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -123,7 +123,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() void IUIScene_StartGame::handleSelectionChanged(F64 selectedId) { - m_iSetTexturePackDescription = (int)selectedId; + m_iSetTexturePackDescription = static_cast(selectedId); if(!m_texturePackDescDisplayed) { @@ -254,7 +254,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) int IUIScene_StartGame::TrialTexturePackWarningReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; + IUIScene_StartGame* pScene = static_cast(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 = (IUIScene_StartGame*)pParam; + IUIScene_StartGame* pScene = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { @@ -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 = (IUIScene_StartGame *)pParam; + IUIScene_StartGame *pClass = static_cast(pParam); #ifdef _XBOX diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index afc2b1392..98c19dc87 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 ((UIAbstractBitmapFont *) user_context)->GetFontMetrics(metrics); + return static_cast(user_context)->GetFontMetrics(metrics); } S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void *user_context,U32 codepoint) { - return ((UIAbstractBitmapFont *) user_context)->GetCodepointGlyph(codepoint); + return static_cast(user_context)->GetCodepointGlyph(codepoint); } IggyGlyphMetrics * RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(void *user_context,S32 glyph,IggyGlyphMetrics *metrics) { - return ((UIAbstractBitmapFont *) user_context)->GetGlyphMetrics(glyph,metrics); + return static_cast(user_context)->GetGlyphMetrics(glyph,metrics); } rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void *user_context,S32 glyph) { - return ((UIAbstractBitmapFont *) user_context)->IsGlyphEmpty(glyph); + return static_cast(user_context)->IsGlyphEmpty(glyph); } F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(void *user_context,S32 first_glyph,S32 second_glyph) { - return ((UIAbstractBitmapFont *) user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); + return static_cast(user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); } rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale) { - return ((UIAbstractBitmapFont *) user_context)->CanProvideBitmap(glyph,pixel_scale); + return static_cast(user_context)->CanProvideBitmap(glyph,pixel_scale); } rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return ((UIAbstractBitmapFont *) user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); + return static_cast(user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); } void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return ((UIAbstractBitmapFont *) user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap); + return static_cast(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 = -((S32) m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; + bitmap->top_left_y = -static_cast(m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; bitmap->oversample = 0; bitmap->point_sample = true; diff --git a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp index 98b4f1654..49999255f 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp @@ -96,15 +96,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 = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; } ui.setupRenderPosition(xPos, yPos); @@ -118,14 +118,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 = (S32)(ui.getScreenHeight()); + tileHeight = static_cast(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(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 240429bc5..3aab5b983 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 = (F64)0; // WIN64 + value[0].number = static_cast(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 = (F64)0; + value[0].number = static_cast(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 d3a4c4c00..1718e8cb8 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 = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(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 = (S32)(ui.getScreenHeight()); + tileHeight = static_cast(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(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 cb6443a17..6a0065034 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp @@ -85,10 +85,10 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - yPos = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(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 = (S32)(ui.getScreenHeight()); + S32 tileHeight = static_cast(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 255740c9a..9b672939d 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-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -164,7 +164,7 @@ void UIComponent_Tooltips::tick() } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else @@ -174,7 +174,7 @@ void UIComponent_Tooltips::tick() { ucAlpha=15; } - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(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 = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(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 = (S32)(ui.getScreenHeight()); + tileHeight = static_cast(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp index 3b4eb097f..01f124bd8 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp @@ -219,13 +219,13 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, m_iconItem = nullptr; wstring openTag(L"{*ICON*}"); wstring closeTag(L"{*/ICON*}"); - int iconTagStartPos = (int)temp.find(openTag); - int iconStartPos = iconTagStartPos + (int)openTag.length(); - if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) + int iconTagStartPos = static_cast(temp.find(openTag)); + int iconStartPos = iconTagStartPos + static_cast(openTag.length()); + if( iconTagStartPos > 0 && iconStartPos < static_cast(temp.length()) ) { - int iconEndPos = (int)temp.find( closeTag, iconStartPos ); + int iconEndPos = static_cast(temp.find(closeTag, iconStartPos)); - if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) + if(iconEndPos > iconStartPos && iconEndPos < static_cast(temp.length()) ) { wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); @@ -479,20 +479,20 @@ void UIComponent_TutorialPopup::render(S32 width, S32 height, C4JRender::eViewpo switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; } //Adjust for safezone @@ -538,7 +538,7 @@ void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) IggyDataValue result; IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = (F64)icon; + value[0].number = static_cast(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 be267ada6..cbbbf7cac 100644 --- a/Minecraft.Client/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Common/UI/UIControl.cpp @@ -34,10 +34,10 @@ bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string 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); + m_x = static_cast(fx); + m_y = static_cast(fy); + m_width = static_cast(Math::round(fwidth)); + m_height = static_cast(Math::round(fheight)); return res; } @@ -49,10 +49,10 @@ void UIControl::UpdateControl() 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); + m_x = static_cast(fx); + m_y = static_cast(fy); + m_width = static_cast(Math::round(fwidth)); + m_height = static_cast(Math::round(fheight)); } void UIControl::ReInit() diff --git a/Minecraft.Client/Common/UI/UIControl_Base.cpp b/Minecraft.Client/Common/UI/UIControl_Base.cpp index 7a4a24e5e..743aaa92b 100644 --- a/Minecraft.Client/Common/UI/UIControl_Base.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Base.cpp @@ -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 = (IggyUTF16 *)labels[i]; + stringVal[i].string = static_cast(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 68a3d655a..9591be9cf 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp @@ -82,7 +82,7 @@ void UIControl_ButtonList::addItem(const string &label, int data) IggyStringUTF8 stringVal; stringVal.string = (char*)label.c_str(); - stringVal.length = (S32)label.length(); + stringVal.length = static_cast(label.length()); value[0].type = IGGY_DATATYPE_string_UTF8; value[0].string8 = stringVal; diff --git a/Minecraft.Client/Common/UI/UIControl_DLCList.cpp b/Minecraft.Client/Common/UI/UIControl_DLCList.cpp index 35e6b08a4..39f8ff39a 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 = (S32)label.length(); + stringVal.length = static_cast(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 = (S32)label.length(); + stringVal.length = static_cast(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 fa29a1375..ab2d5a44a 100644 --- a/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp @@ -79,7 +79,7 @@ S32 UIControl_DynamicLabel::GetRealWidth() S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = (S32)result.number; + iRealWidth = static_cast(result.number); } return iRealWidth; } @@ -92,7 +92,7 @@ S32 UIControl_DynamicLabel::GetRealHeight() S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = (S32)result.number; + iRealHeight = static_cast(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 9664dbf4f..b8b41c3d0 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp @@ -73,7 +73,7 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region) { // Share the model the the EnchantTableRenderer - EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY); + EnchantTableRenderer *etr = static_cast(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 = (UIScene_EnchantingMenu *)m_parentScene; + UIScene_EnchantingMenu *m_containerScene = static_cast(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 f1e2735ae..156f98156 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 = (UIScene_EnchantingMenu *)m_parentScene; + UIScene_EnchantingMenu *enchantingScene = static_cast(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, (float)m_width/ss, col, (float)m_height/ss); + font->drawWordWrap(m_enchantmentString, 0, 0, static_cast(m_width)/ss, col, static_cast(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, (float)m_width/ss, col, (float)m_height/ss); + font->drawWordWrap(m_enchantmentString, 0, 0, static_cast(m_width)/ss, col, static_cast(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 = (UIScene_EnchantingMenu *)m_parentScene; + UIScene_EnchantingMenu *enchantingScene = static_cast(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 = (int)state; + value[0].number = static_cast(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 8b7eb9a1f..1e2e85993 100644 --- a/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp @@ -84,7 +84,7 @@ S32 UIControl_HTMLLabel::GetRealWidth() S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = (S32)result.number; + iRealWidth = static_cast(result.number); } return iRealWidth; } @@ -97,7 +97,7 @@ S32 UIControl_HTMLLabel::GetRealHeight() S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = (S32)result.number; + iRealHeight = static_cast(result.number); } return iRealHeight; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp index 457e20286..25fc0316d 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); } 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 = (UIScene_HorseInventoryMenu *)m_parentScene; + UIScene_HorseInventoryMenu *containerMenu = static_cast(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 d0625bce8..ae65ac2b5 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); } 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 = (UIScene_InventoryMenu *)m_parentScene; + UIScene_InventoryMenu *containerMenu = static_cast(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 41534dc23..0703919fb 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 = (S32)label.length(); + stringVal.length = static_cast(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 d74bd185c..b03c858f5 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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_customTextureUrl = L"default"; m_backupTexture = TN_MOB_CHAR; @@ -167,7 +167,7 @@ void UIControl_PlayerSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAni void UIControl_PlayerSkinPreview::CycleNextAnimation() { - m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1); + m_currentAnimation = static_cast(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 = (ESkinPreviewAnimations)(m_currentAnimation - 1); - if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); + m_currentAnimation = static_cast(m_currentAnimation - 1); + if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast(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(-(float)m_xRot, 1, 0, 0); + glRotatef(-static_cast(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; @@ -257,7 +257,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou glPushMatrix(); glDisable(GL_CULL_FACE); - HumanoidModel *model = (HumanoidModel *)renderer->getModel(); + HumanoidModel *model = static_cast(renderer->getModel()); //getAttackAnim(mob, a); //if (armor != NULL) armor->attackTime = model->attackTime; @@ -292,7 +292,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou { m_swingTime = 0; } - model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3); + model->attackTime = m_swingTime / static_cast(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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 = (float) yd * 10; + float flap = static_cast(yd) * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = (float) (xd * xa + zd * za) * 100; - float lean2 = (float) (xd * za - zd * xa) * 100; + float lean = static_cast(xd * xa + zd * za) * 100; + float lean2 = static_cast(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 78e7c1d0c..20dc1ff7e 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 = (float)((m_current-m_min))/(m_max-m_min); + float percent = static_cast((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 f83454d73..5ae9c8f05 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 = (S32)label.length(); + stringVal.length = static_cast(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 = (S32)label.length(); + stringVal.length = static_cast(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 c21680029..7f8a8180f 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -97,7 +97,7 @@ S32 UIControl_Slider::GetRealWidth() S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) { - iRealWidth = (S32)result.number; + iRealWidth = static_cast(result.number); } return iRealWidth; } diff --git a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp index 74683a62e..5d6b8d57d 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 size) { - float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min); + float startPercent = static_cast((m_currentTotal - m_min))/(m_max-m_min); m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) ); @@ -90,7 +90,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) { m_currentSave = size; - float percent = (float)((m_currentSave-m_min))/(m_max-m_min); + float percent = static_cast((m_currentSave - m_min))/(m_max-m_min); IggyDataValue result; IggyDataValue value[1]; @@ -101,7 +101,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size) { - float percent = (float)((m_currentTotal-m_min))/(m_max-m_min); + float percent = static_cast((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 02336e004..8e81ac28b 100644 --- a/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp @@ -125,7 +125,7 @@ bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) S32 bCanTouchTrigger = false; if(result.type == IGGY_DATATYPE_boolean) { - bCanTouchTrigger = (bool)result.boolval; + bCanTouchTrigger = static_cast(result.boolval); } return bCanTouchTrigger; } @@ -138,7 +138,7 @@ S32 UIControl_TexturePackList::GetRealHeight() S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) { - iRealHeight = (S32)result.number; + iRealHeight = static_cast(result.number); } return iRealHeight; } diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 5375b784d..8d558d4a8 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -65,7 +65,7 @@ static UIControl_Slider *FindSliderById(UIScene *pScene, int sliderId) { UIControl *ctrl = (*controls)[i]; if (ctrl && ctrl->getControlType() == UIControl::eSlider && ctrl->getId() == sliderId) - return (UIControl_Slider *)ctrl; + return static_cast(ctrl); } return NULL; } @@ -147,7 +147,7 @@ __int64 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 = (UIController *)alloc_callback_user_data; + UIController *controller = static_cast(alloc_callback_user_data); EnterCriticalSection(&controller->m_Allocatorlock); #ifdef EXCLUDE_IGGY_ALLOCATIONS_FROM_HEAP_INSPECTOR void *alloc = __real_malloc(size_requested); @@ -164,7 +164,7 @@ static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_ static void RADLINK DeallocateFunction ( void * alloc_callback_user_data , void * ptr ) { - UIController *controller = (UIController *)alloc_callback_user_data; + UIController *controller = static_cast(alloc_callback_user_data); EnterCriticalSection(&controller->m_Allocatorlock); size_t size = allocations[ptr]; UIController::iggyAllocCount -= size; @@ -267,7 +267,7 @@ void UIController::SetSysUIShowing(bool bVal) void UIController::SetSystemUIShowing(LPVOID lpParam,bool bVal) { - UIController *pClass=(UIController *)lpParam; + UIController *pClass=static_cast(lpParam); pClass->SetSysUIShowing(bVal); } @@ -307,7 +307,7 @@ void UIController::postInit() for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) { - m_groups[i] = new UIGroup((EUIGroup)i,i-1); + m_groups[i] = new UIGroup(static_cast(i),i-1); } @@ -689,7 +689,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 = (UIController *)lpParam; + UIController *controller = static_cast(lpParam); // Load new skin controller->loadSkins(); @@ -802,8 +802,8 @@ void UIController::tickInput() Iggy *movie = pScene->getMovie(); int rawMouseX = g_KBMInput.GetMouseX(); int rawMouseY = g_KBMInput.GetMouseY(); - F32 mouseX = (F32)rawMouseX; - F32 mouseY = (F32)rawMouseY; + F32 mouseX = static_cast(rawMouseX); + F32 mouseY = static_cast(rawMouseY); extern HWND g_hWnd; if (g_hWnd) @@ -814,8 +814,8 @@ void UIController::tickInput() int winH = rc.bottom - rc.top; if (winW > 0 && winH > 0) { - mouseX = mouseX * (m_fScreenWidth / (F32)winW); - mouseY = mouseY * (m_fScreenHeight / (F32)winH); + mouseX = mouseX * (m_fScreenWidth / static_cast(winW)); + mouseY = mouseY * (m_fScreenHeight / static_cast(winH)); } } @@ -861,8 +861,8 @@ void UIController::tickInput() pScene->GetParentLayer()->getRenderDimensions(displayWidth, displayHeight); if (displayWidth > 0 && displayHeight > 0) { - sceneMouseX = mouseX * ((F32)pScene->getRenderWidth() / (F32)displayWidth); - sceneMouseY = mouseY * ((F32)pScene->getRenderHeight() / (F32)displayHeight); + sceneMouseX = mouseX * (static_cast(pScene->getRenderWidth()) / static_cast(displayWidth)); + sceneMouseY = mouseY * (static_cast(pScene->getRenderHeight()) / static_cast(displayHeight)); } } @@ -896,7 +896,7 @@ void UIController::tickInput() if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible()) continue; - UIControl_Slider *pSlider = (UIControl_Slider *)ctrl; + UIControl_Slider *pSlider = static_cast(ctrl); pSlider->UpdateControl(); S32 cx = pSlider->getXPos() + panelOffsetX; S32 cy = pSlider->getYPos() + panelOffsetY; @@ -925,7 +925,7 @@ void UIController::tickInput() S32 sliderWidth = pSlider->GetRealWidth(); if (sliderWidth > 0) { - float fNewSliderPos = (sceneMouseX - (float)sliderX) / (float)sliderWidth; + float fNewSliderPos = (sceneMouseX - static_cast(sliderX)) / static_cast(sliderWidth); if (fNewSliderPos < 0.0f) fNewSliderPos = 0.0f; if (fNewSliderPos > 1.0f) fNewSliderPos = 1.0f; pSlider->SetSliderTouchPos(fNewSliderPos); @@ -1347,7 +1347,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) bool handled = false; // Send the key to the fullscreen group first - m_groups[(int)eUIGroup_Fullscreen]->handleInput(iPad, key, repeat, pressed, released, handled); + m_groups[static_cast(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 @@ -1358,7 +1358,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) rrbool RADLINK UIController::ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call) { - UIScene *scene = (UIScene *)IggyPlayerGetUserdata(player); + UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); if(scene != NULL) { @@ -1425,25 +1425,25 @@ void UIController::getRenderDimensions(C4JRender::eViewportType viewport, S32 &w switch( viewport ) { case C4JRender::VIEWPORT_TYPE_FULLSCREEN: - width = (S32)(getScreenWidth()); - height = (S32)(getScreenHeight()); + width = static_cast(getScreenWidth()); + height = static_cast(getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - width = (S32)(getScreenWidth() / 2); - height = (S32)(getScreenHeight() / 2); + width = static_cast(getScreenWidth() / 2); + height = static_cast(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - width = (S32)(getScreenWidth() / 2); - height = (S32)(getScreenHeight() / 2); + width = static_cast(getScreenWidth() / 2); + height = static_cast(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 = (S32)(getScreenWidth() / 2); - height = (S32)(getScreenHeight() / 2); + width = static_cast(getScreenWidth() / 2); + height = static_cast(getScreenHeight() / 2); break; } } @@ -1459,30 +1459,30 @@ void UIController::setupRenderPosition(C4JRender::eViewportType viewport) switch( viewport ) { case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - xPos = (S32)(getScreenWidth() / 4); + xPos = static_cast(getScreenWidth() / 4); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - xPos = (S32)(getScreenWidth() / 4); - yPos = (S32)(getScreenHeight() / 2); + xPos = static_cast(getScreenWidth() / 4); + yPos = static_cast(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - yPos = (S32)(getScreenHeight() / 4); + yPos = static_cast(getScreenHeight() / 4); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - xPos = (S32)(getScreenWidth() / 2); - yPos = (S32)(getScreenHeight() / 4); + xPos = static_cast(getScreenWidth() / 2); + yPos = static_cast(getScreenHeight() / 4); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(getScreenWidth() / 2); + xPos = static_cast(getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - yPos = (S32)(getScreenHeight() / 2); + yPos = static_cast(getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(getScreenWidth() / 2); - yPos = (S32)(getScreenHeight() / 2); + xPos = static_cast(getScreenWidth() / 2); + yPos = static_cast(getScreenHeight() / 2); break; } m_tileOriginX = xPos; @@ -1547,8 +1547,8 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo Minecraft *pMinecraft=Minecraft::GetInstance(); // Clear just the region required for this control. - float sceneWidth = (float)scene->getRenderWidth(); - float sceneHeight = (float)scene->getRenderHeight(); + float sceneWidth = static_cast(scene->getRenderWidth()); + float sceneHeight = static_cast(scene->getRenderHeight()); LONG left, right, top, bottom; #ifdef __PS3__ @@ -1578,8 +1578,8 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo Minecraft *pMinecraft=Minecraft::GetInstance(); if(pMinecraft != NULL) { - m_fScreenWidth=(float)pMinecraft->width_phys; - m_fScreenHeight=(float)pMinecraft->height_phys; + m_fScreenWidth=static_cast(pMinecraft->width_phys); + m_fScreenHeight=static_cast(pMinecraft->height_phys); m_bScreenWidthSetup = true; } } @@ -1623,7 +1623,7 @@ void UIController::endCustomDrawGameStateAndMatrices() void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *player, IggyCustomDrawCallbackRegion *region) { - UIScene *scene = (UIScene *)IggyPlayerGetUserdata(player); + UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); if(scene != NULL) { @@ -1670,7 +1670,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * #endif *destroy_callback_data = (void *)id; - app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", (wchar_t *)texture_name, id, image.getWidth(), image.getHeight()); + app.DebugPrintf("Found substitution texture %ls (%d) - %dx%d\n", static_cast(texture_name), id, image.getWidth(), image.getHeight()); return ui.getSubstitutionTexture(id); } else @@ -1680,7 +1680,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * } else { - app.DebugPrintf("Could not find substitution texture %ls\n", (wchar_t *)texture_name); + app.DebugPrintf("Could not find substitution texture %ls\n", static_cast(texture_name)); return NULL; } } @@ -1691,7 +1691,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=(int)llVal; + int id=static_cast(llVal); app.DebugPrintf("Destroying iggy texture %d\n", id); ui.destroySubstitutionTexture(user_callback_data, handle); @@ -1791,7 +1791,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI if( ( iPad != 255 ) && ( iPad >= 0 ) ) { menuDisplayedPad = iPad; - group = (EUIGroup)(iPad+1); + group = static_cast(iPad + 1); } else group = eUIGroup_Fullscreen; } @@ -1806,7 +1806,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI EnterCriticalSection(&m_navigationLock); SetMenuDisplayed(menuDisplayedPad,true); - bool success = m_groups[(int)group]->NavigateToScene(iPad, scene, initData, layer); + bool success = m_groups[static_cast(group)]->NavigateToScene(iPad, scene, initData, layer); if(success && group == eUIGroup_Fullscreen) setFullscreenMenuDisplayed(true); LeaveCriticalSection(&m_navigationLock); @@ -1821,18 +1821,18 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI bool navComplete = false; if( app.GetGameStarted() ) { - bool navComplete = m_groups[(int)eUIGroup_Fullscreen]->NavigateBack(iPad, eScene, eLayer); + bool navComplete = m_groups[static_cast(eUIGroup_Fullscreen)]->NavigateBack(iPad, eScene, eLayer); if(!navComplete && ( iPad != 255 ) && ( iPad >= 0 ) ) { - EUIGroup group = (EUIGroup)(iPad+1); - navComplete = m_groups[(int)group]->NavigateBack(iPad, eScene, eLayer); - if(!m_groups[(int)group]->GetMenuDisplayed())SetMenuDisplayed(iPad,false); + 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); } // 4J-PB - autosave in fullscreen doesn't clear the menuDisplayed flag else { - if(!m_groups[(int)eUIGroup_Fullscreen]->GetMenuDisplayed()) + if(!m_groups[static_cast(eUIGroup_Fullscreen)]->GetMenuDisplayed()) { setFullscreenMenuDisplayed(false); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) @@ -1844,8 +1844,8 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI } else { - navComplete = m_groups[(int)eUIGroup_Fullscreen]->NavigateBack(iPad, eScene, eLayer); - if(!m_groups[(int)eUIGroup_Fullscreen]->GetMenuDisplayed()) SetMenuDisplayed(XUSER_INDEX_ANY,false); + navComplete = m_groups[static_cast(eUIGroup_Fullscreen)]->NavigateBack(iPad, eScene, eLayer); + if(!m_groups[static_cast(eUIGroup_Fullscreen)]->GetMenuDisplayed()) SetMenuDisplayed(XUSER_INDEX_ANY,false); } return navComplete; } @@ -1870,7 +1870,7 @@ void UIController::NavigateToHomeMenu() if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it - pDLCTexPack=(DLCTexturePack *)pTexPack; + pDLCTexPack=static_cast(pTexPack); } // change to the default texture pack @@ -1925,7 +1925,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 = (EUIGroup)(iPad+1); + group = static_cast(iPad + 1); } else group = eUIGroup_Fullscreen; } @@ -1935,7 +1935,7 @@ UIScene *UIController::GetTopScene(int iPad, EUILayer layer, EUIGroup group) group = eUIGroup_Fullscreen; } } - return m_groups[(int)group]->GetTopScene(layer); + return m_groups[static_cast(group)]->GetTopScene(layer); } size_t UIController::RegisterForCallbackId(UIScene *scene) @@ -1983,7 +1983,7 @@ void UIController::LeaveCallbackIdCriticalSection() void UIController::CloseAllPlayersScenes() { - m_groups[(int)eUIGroup_Fullscreen]->getTooltips()->SetTooltips(-1); + m_groups[static_cast(eUIGroup_Fullscreen)]->getTooltips()->SetTooltips(-1); for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) { //m_bCloseAllScenes[i] = true; @@ -2006,7 +2006,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2014,22 +2014,22 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) group = eUIGroup_Fullscreen; } - m_groups[(int)group]->closeAllScenes(); - m_groups[(int)group]->getTooltips()->SetTooltips(-1); + m_groups[static_cast(group)]->closeAllScenes(); + m_groups[static_cast(group)]->getTooltips()->SetTooltips(-1); // This should cause the popup to dissappear TutorialPopupInfo popupInfo; - if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo); + if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetTutorialDescription(&popupInfo); if(group==eUIGroup_Fullscreen) setFullscreenMenuDisplayed(false); - SetMenuDisplayed((group == eUIGroup_Fullscreen ? XUSER_INDEX_ANY : iPad), m_groups[(int)group]->GetMenuDisplayed()); + SetMenuDisplayed((group == eUIGroup_Fullscreen ? XUSER_INDEX_ANY : iPad), m_groups[static_cast(group)]->GetMenuDisplayed()); } void UIController::setFullscreenMenuDisplayed(bool displayed) { // Show/hide the tooltips for the fullscreen group - m_groups[(int)eUIGroup_Fullscreen]->showComponent(ProfileManager.GetPrimaryPad(),eUIComponent_Tooltips,eUILayer_Tooltips,displayed); + m_groups[static_cast(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) @@ -2044,14 +2044,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[(int)group]->IsPauseMenuDisplayed(); + return m_groups[static_cast(group)]->IsPauseMenuDisplayed(); } bool UIController::IsContainerMenuDisplayed(int iPad) @@ -2060,14 +2060,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[(int)group]->IsContainerMenuDisplayed(); + return m_groups[static_cast(group)]->IsContainerMenuDisplayed(); } bool UIController::IsIgnorePlayerJoinMenuDisplayed(int iPad) @@ -2076,14 +2076,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[(int)group]->IsIgnorePlayerJoinMenuDisplayed(); + return m_groups[static_cast(group)]->IsIgnorePlayerJoinMenuDisplayed(); } bool UIController::IsIgnoreAutosaveMenuDisplayed(int iPad) @@ -2092,14 +2092,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[(int)eUIGroup_Fullscreen]->IsIgnoreAutosaveMenuDisplayed() || (group != eUIGroup_Fullscreen && m_groups[(int)group]->IsIgnoreAutosaveMenuDisplayed()); + return m_groups[static_cast(eUIGroup_Fullscreen)]->IsIgnoreAutosaveMenuDisplayed() || (group != eUIGroup_Fullscreen && m_groups[static_cast(group)]->IsIgnoreAutosaveMenuDisplayed()); } void UIController::SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) @@ -2113,14 +2113,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - return m_groups[(int)group]->IsSceneInStack(eScene); + return m_groups[static_cast(group)]->IsSceneInStack(eScene); } bool UIController::GetMenuDisplayed(int iPad) @@ -2201,14 +2201,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltipText(tooltip, iTextID); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->SetTooltipText(tooltip, iTextID); } void UIController::SetEnableTooltips( unsigned int iPad, BOOL bVal ) @@ -2217,14 +2217,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetEnableTooltips(bVal); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->SetEnableTooltips(bVal); } void UIController::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) @@ -2233,14 +2233,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->ShowTooltip(tooltip,show); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(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) @@ -2262,14 +2262,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltips(iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, iRS, iBack, forceUpdate); + 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); } void UIController::EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) @@ -2278,14 +2278,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->EnableTooltip(tooltip,enable); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->EnableTooltip(tooltip,enable); } void UIController::RefreshTooltips(unsigned int iPad) @@ -2304,7 +2304,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2312,7 +2312,7 @@ void UIController::AnimateKeyPress(int iPad, int iAction, bool bRepeat, bool bPr group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->handleInput(iPad, iAction, bRepeat, bPressed, bReleased, handled); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->handleInput(iPad, iAction, bRepeat, bPressed, bReleased, handled); } void UIController::OverrideSFX(int iPad, int iAction,bool bVal) @@ -2322,7 +2322,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2330,7 +2330,7 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal) group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->overrideSFX(iPad, iAction,bVal); + if(m_groups[static_cast(group)]->getTooltips()) m_groups[static_cast(group)]->getTooltips()->overrideSFX(iPad, iAction,bVal); } void UIController::PlayUISFX(ESoundEffect eSound) @@ -2352,13 +2352,13 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) { show = false; } - EUIGroup group = (EUIGroup)(iPad+1); - if(m_groups[(int)group]->getHUD()) m_groups[(int)group]->getHUD()->ShowDisplayName(show); + EUIGroup group = static_cast(iPad + 1); + if(m_groups[static_cast(group)]->getHUD()) m_groups[static_cast(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[(int)group]->getTutorialPopup() && !m_groups[(int)group]->IsContainerMenuDisplayed()) + if(app.GetLocalPlayerCount() > 1 && m_groups[static_cast(group)]->getTutorialPopup() && !m_groups[static_cast(group)]->IsContainerMenuDisplayed()) { - m_groups[(int)group]->getTutorialPopup()->UpdateTutorialPopup(); + m_groups[static_cast(group)]->getTutorialPopup()->UpdateTutorialPopup(); } } @@ -2369,7 +2369,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2377,7 +2377,7 @@ void UIController::SetSelectedItem(unsigned int iPad, const wstring &name) group = eUIGroup_Fullscreen; } bool handled = false; - if(m_groups[(int)group]->getHUD()) m_groups[(int)group]->getHUD()->SetSelectedLabel(name); + if(m_groups[static_cast(group)]->getHUD()) m_groups[static_cast(group)]->getHUD()->SetSelectedLabel(name); } void UIController::UpdateSelectedItemPos(unsigned int iPad) @@ -2430,7 +2430,7 @@ void UIController::HandleInventoryUpdated(int iPad) EUIGroup group = eUIGroup_Fullscreen; if( app.GetGameStarted() && ( iPad != 255 ) && ( iPad >= 0 ) ) { - group = (EUIGroup)(iPad+1); + group = static_cast(iPad + 1); } m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, NULL); @@ -2452,14 +2452,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorial(tutorial); + if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetTutorial(tutorial); } void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) @@ -2468,7 +2468,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2476,11 +2476,11 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTutorialPopup()) + if(m_groups[static_cast(group)]->getTutorialPopup()) { // tutorial popup needs to know if a container menu is being displayed - m_groups[(int)group]->getTutorialPopup()->SetContainerMenuVisible(m_groups[(int)group]->IsContainerMenuDisplayed()); - m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(info); + m_groups[static_cast(group)]->getTutorialPopup()->SetContainerMenuVisible(m_groups[static_cast(group)]->IsContainerMenuDisplayed()); + m_groups[static_cast(group)]->getTutorialPopup()->SetTutorialDescription(info); } } @@ -2488,9 +2488,9 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info) void UIController::RemoveInteractSceneReference(int iPad, UIScene *scene) { EUIGroup group; - if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; - if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->RemoveInteractSceneReference(scene); + if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->RemoveInteractSceneReference(scene); } #endif @@ -2500,14 +2500,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else { group = eUIGroup_Fullscreen; } - if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetVisible(visible); + if(m_groups[static_cast(group)]->getTutorialPopup()) m_groups[static_cast(group)]->getTutorialPopup()->SetVisible(visible); } bool UIController::IsTutorialVisible(int iPad) @@ -2516,7 +2516,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 = (EUIGroup)(iPad+1); + if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = static_cast(iPad + 1); else group = eUIGroup_Fullscreen; } else @@ -2524,7 +2524,7 @@ bool UIController::IsTutorialVisible(int iPad) group = eUIGroup_Fullscreen; } bool visible = false; - if(m_groups[(int)group]->getTutorialPopup()) visible = m_groups[(int)group]->getTutorialPopup()->IsVisible(); + if(m_groups[static_cast(group)]->getTutorialPopup()) visible = m_groups[static_cast(group)]->getTutorialPopup()->IsVisible(); return visible; } @@ -2544,7 +2544,7 @@ void UIController::UpdatePlayerBasePositions() { DisplayGamertag(idx,true); } - m_groups[idx+1]->SetViewportType((C4JRender::eViewportType)pMinecraft->localplayers[idx]->m_iScreenSection); + m_groups[idx+1]->SetViewportType(static_cast(pMinecraft->localplayers[idx]->m_iScreenSection)); } else { @@ -2577,7 +2577,7 @@ void UIController::ShowOtherPlayersBaseScene(unsigned int iPad, bool show) void UIController::ShowTrialTimer(bool show) { - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showTrialTimer(show); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showTrialTimer(show); } void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds) @@ -2589,7 +2589,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) { WCHAR wcTime[20]; - DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); + DWORD dwTimeTicks=static_cast(app.getTrialTimer()); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -2608,11 +2608,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[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcTime); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcTime); } else { - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(L""); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(L""); } // are we out of time? @@ -2631,7 +2631,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) void UIController::ReduceTrialTimerValue() { - DWORD dwTimeTicks=(int)app.getTrialTimer(); + DWORD dwTimeTicks=static_cast(app.getTrialTimer()); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -2643,7 +2643,7 @@ void UIController::ReduceTrialTimerValue() void UIController::ShowAutosaveCountdownTimer(bool show) { - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showTrialTimer(show); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showTrialTimer(show); } void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) @@ -2651,7 +2651,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[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif } @@ -2668,12 +2668,12 @@ void UIController::ShowSavingMessage(unsigned int iPad, C4JStorage::ESavingMessa show = true; break; } - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showSaveIcon(show); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showSaveIcon(show); } void UIController::ShowPlayerDisplayname(bool show) { - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPlayerDisplayName(show); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPlayerDisplayName(show); } void UIController::SetWinUserIndex(unsigned int iPad) @@ -2692,7 +2692,7 @@ void UIController::ShowUIDebugConsole(bool show) if(show) { - m_uiDebugConsole = (UIComponent_DebugUIConsole *)m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIConsole, eUILayer_Debug); + m_uiDebugConsole = static_cast(m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIConsole, eUILayer_Debug)); } else { @@ -2708,7 +2708,7 @@ void UIController::ShowUIDebugMarketingGuide(bool show) if(show) { - m_uiDebugMarketingGuide = (UIComponent_DebugUIMarketingGuide *)m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIMarketingGuide, eUILayer_Debug); + m_uiDebugMarketingGuide = static_cast(m_groups[eUIGroup_Fullscreen]->addComponent(0, eUIComponent_DebugUIMarketingGuide, eUILayer_Debug)); } else { @@ -2731,13 +2731,13 @@ bool UIController::PressStartPlaying(unsigned int iPad) void UIController::ShowPressStart(unsigned int iPad) { m_iPressStartQuadrantsMask|=1<getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPressStart(iPad, true); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPressStart(iPad, true); } void UIController::HidePressStart() { ClearPressStart(); - if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->showPressStart(0, false); + if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->showPressStart(0, false); } void UIController::ClearPressStart() diff --git a/Minecraft.Client/Common/UI/UIGroup.cpp b/Minecraft.Client/Common/UI/UIGroup.cpp index e8bb9fe66..769fd83d6 100644 --- a/Minecraft.Client/Common/UI/UIGroup.cpp +++ b/Minecraft.Client/Common/UI/UIGroup.cpp @@ -23,22 +23,22 @@ UIGroup::UIGroup(EUIGroup group, int iPad) #endif } - m_tooltips = (UIComponent_Tooltips *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_Tooltips); + m_tooltips = (UIComponent_Tooltips *)m_layers[static_cast(eUILayer_Tooltips)]->addComponent(0, eUIComponent_Tooltips); m_tutorialPopup = NULL; m_hud = NULL; m_pressStartToPlay = NULL; if(m_group != eUIGroup_Fullscreen) { - m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[(int)eUILayer_Popup]->addComponent(m_iPad, eUIComponent_TutorialPopup); + m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[static_cast(eUILayer_Popup)]->addComponent(m_iPad, eUIComponent_TutorialPopup); - m_hud = (UIScene_HUD *)m_layers[(int)eUILayer_HUD]->addComponent(m_iPad, eUIScene_HUD); + m_hud = (UIScene_HUD *)m_layers[static_cast(eUILayer_HUD)]->addComponent(m_iPad, eUIScene_HUD); //m_layers[(int)eUILayer_Chat]->addComponent(m_iPad, eUIComponent_Chat); } else { - m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_PressStartToPlay); + m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[static_cast(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 @@ -65,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 != (int)eUILayer_Fullscreen); + if(highestRenderable < eUILayer_COUNT) m_layers[highestRenderable]->ReloadAll(highestRenderable != static_cast(eUILayer_Fullscreen)); } } @@ -127,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[(int)layer]->NavigateToScene(iPad, scene, initData); + bool succeeded = m_layers[static_cast(layer)]->NavigateToScene(iPad, scene, initData); updateStackStates(); return succeeded; } @@ -153,7 +153,7 @@ void UIGroup::closeAllScenes() { if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(true); @@ -163,14 +163,14 @@ void UIGroup::closeAllScenes() for(unsigned int i = 0; i < eUILayer_COUNT; ++i) { // Ignore the error layer - if(i != (int)eUILayer_Error) m_layers[i]->closeAllScenes(); + if(i != static_cast(eUILayer_Error)) m_layers[i]->closeAllScenes(); } updateStackStates(); } UIScene *UIGroup::GetTopScene(EUILayer layer) { - return m_layers[(int)layer]->GetTopScene(); + return m_layers[static_cast(layer)]->GetTopScene(); } bool UIGroup::GetMenuDisplayed() diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index 6ef6d0e82..e736d25cb 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -728,7 +728,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; + float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); float sx = x; float sy = y; float sxoffs = 8 * scaleX; @@ -757,15 +757,15 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt { glPushMatrix(); glScalef(scaleX, scaleY, 1.0f); - int iX= (int)(0.5f+((float)x)/scaleX); - int iY= (int)(0.5f+((float)y)/scaleY); + int iX= static_cast(0.5f + ((float)x) / scaleX); + int iY= static_cast(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, (int)x, (int)y, fAlpha); + m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, item, static_cast(x), static_cast(y), fAlpha); } } @@ -902,7 +902,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, (IggyKeycode)iggyKeyCode, IGGY_KEYLOC_Standard ); + IggyMakeEventKey( &keyEvent, pressed?IGGY_KEYEVENT_Down:IGGY_KEYEVENT_Up, static_cast(iggyKeyCode), IGGY_KEYLOC_Standard ); IggyEventResult result; IggyPlayerDispatchEventRS ( swf , &keyEvent , &result ); @@ -1191,8 +1191,8 @@ bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) void UIScene::_handleFocusChange(F64 controlId, F64 childId) { - m_iFocusControl = (int)controlId; - m_iFocusChild = (int)childId; + m_iFocusControl = static_cast(controlId); + m_iFocusChild = static_cast(childId); handleFocusChange(controlId, childId); ui.PlayUISFX(eSFX_Focus); @@ -1200,8 +1200,8 @@ void UIScene::_handleFocusChange(F64 controlId, F64 childId) void UIScene::_handleInitFocus(F64 controlId, F64 childId) { - m_iFocusControl = (int)controlId; - m_iFocusChild = (int)childId; + m_iFocusControl = static_cast(controlId); + m_iFocusChild = static_cast(childId); //handleInitFocus(controlId, childId); handleFocusChange(controlId, childId); diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 6b196c1b8..a354ba7ae 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -51,7 +51,7 @@ void UIScene_AbstractContainerMenu::handleDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } @@ -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*((float)width/m_movieWidth); - S32 y = m_pointerPos.y*((float)height/m_movieHeight); + S32 x = m_pointerPos.x*(static_cast(width)/m_movieWidth); + S32 y = m_pointerPos.y*(static_cast(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 = (S32)(m_pointerPos.x * ((float)width / m_movieWidth)); - S32 y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight)); + S32 x = static_cast(m_pointerPos.x * ((float)width / m_movieWidth)); + S32 y = static_cast(m_pointerPos.y * ((float)height / m_movieHeight)); IggyMakeEventMouseMove( &mouseEvent, x, y); @@ -265,7 +265,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } else { - swscanf((wchar_t*)region->name,L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index c810ad455..79117bb43 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 = (AnvilScreenInput *)_initData; + AnvilScreenInput *initData = static_cast(_initData); m_inventory = initData->inventory; Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Anvil_Menu, this); } @@ -309,7 +309,7 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection) int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled - UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam; + UIScene_AnvilMenu *pClass=static_cast(lpParam); pClass->setIgnoreInput(false); if (bRes) @@ -342,7 +342,7 @@ void UIScene_AnvilMenu::handleEditNamePressed() break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),(DWORD)m_iPad,30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_TITLE_RENAME),m_textInputAnvil.getLabel(),static_cast(m_iPad),30,&UIScene_AnvilMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp index e70397d68..64e0fdd8b 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 = (BeaconScreenInput *)_initData; + BeaconScreenInput *initData = static_cast(_initData); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Beacon_Menu, this); } @@ -328,7 +328,7 @@ void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) shared_ptr item = nullptr; int slotId = -1; - swscanf((wchar_t*)region->name,L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if(slotId >= 0 && slotId >= m_menu->getSize() ) { diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp index 8563054c6..4df5fa039 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp @@ -14,7 +14,7 @@ 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 = (BrewingScreenInput *)_initData; + BrewingScreenInput *initData = static_cast(_initData); m_brewingStand = initData->brewingStand; m_labelBrewingStand.init( m_brewingStand->getName() ); @@ -22,7 +22,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Brewing_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp index 968072a8e..a387fb294 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 = (ConnectionProgressParams *)_initData; + ConnectionProgressParams *param = static_cast(_initData); if( param->stringId >= 0 ) { @@ -245,7 +245,7 @@ void UIScene_ConnectingProgress::handleInput(int iPad, int key, bool repeat, boo void UIScene_ConnectingProgress::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(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 9e48a57b2..7a3051eff 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 = (ContainerScreenInput *)_initData; + ContainerScreenInput *initData = static_cast(_initData); m_bLargeChest = (initData->container->getContainerSize() > 3*9)?true:false; // Setup all the Iggy references we need for this scene @@ -26,7 +26,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Container_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp index 575672485..07db23904 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 = (F64)0; + value[0].number = static_cast(0); #elif defined(_DURANGO) value[0].number = (F64)1; #elif defined(__PS3__) @@ -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 = (F64)m_iCurrentNavigatedControlsLayout; + value[0].number = static_cast(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((int)controlId) + switch(static_cast(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 = (int)controlId; + int control = static_cast(controlId); switch(control) { case eControl_Button0: case eControl_Button1: case eControl_Button2: - app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)control); + app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast(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 = (int)controlId; + int control = static_cast(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 66d8c41ee..676feb989 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -14,7 +14,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p { m_bIgnoreKeyPresses = false; - CraftingPanelScreenInput* initData = (CraftingPanelScreenInput*)_initData; + CraftingPanelScreenInput* initData = static_cast(_initData); m_iContainerType=initData->iContainerType; m_pPlayer=initData->player; m_bSplitscreen=initData->bSplitscreen; @@ -111,7 +111,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); if(m_iContainerType==RECIPE_TYPE_2x2) { @@ -192,7 +192,7 @@ void UIScene_CraftingMenu::handleDestroy() if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } @@ -443,7 +443,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) float alpha = 1.0f; bool decorations = true; bool inventoryItem = false; - swscanf((wchar_t*)region->name,L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -471,7 +471,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_vSlotsInfo[iIndex].show) { item = m_vSlotsInfo[iIndex].item; - alpha = ((float)m_vSlotsInfo[iIndex].alpha)/31.0f; + alpha = static_cast(m_vSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_H_SLOT_START && slotId < (CRAFTING_H_SLOT_START + m_iCraftablesMaxHSlotC) ) @@ -481,7 +481,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_hSlotsInfo[iIndex].show) { item = m_hSlotsInfo[iIndex].item; - alpha = ((float)m_hSlotsInfo[iIndex].alpha)/31.0f; + alpha = static_cast(m_hSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_LAYOUT_START && slotId < (CRAFTING_INGREDIENTS_LAYOUT_START + m_iIngredientsMaxSlotC) ) @@ -490,7 +490,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsSlotsInfo[iIndex].show) { item = m_ingredientsSlotsInfo[iIndex].item; - alpha = ((float)m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; + alpha = static_cast(m_ingredientsSlotsInfo[iIndex].alpha)/31.0f; } } else if(slotId >= CRAFTING_INGREDIENTS_DESCRIPTION_START && slotId < (CRAFTING_INGREDIENTS_DESCRIPTION_START + 4) ) @@ -499,7 +499,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_ingredientsInfo[iIndex].show) { item = m_ingredientsInfo[iIndex].item; - alpha = ((float)m_ingredientsInfo[iIndex].alpha)/31.0f; + alpha = static_cast(m_ingredientsInfo[iIndex].alpha)/31.0f; } } else if(slotId == CRAFTING_OUTPUT_SLOT_START ) @@ -507,7 +507,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) if(m_craftingOutputSlotInfo.show) { item = m_craftingOutputSlotInfo.item; - alpha = ((float)m_craftingOutputSlotInfo.alpha)/31.0f; + alpha = static_cast(m_craftingOutputSlotInfo.alpha)/31.0f; } } diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 2bd06bc63..241af7bb2 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -317,7 +317,7 @@ void UIScene_CreateWorldMenu::tick() m_iDirectEditCooldown = 4; // absorb the matching ACTION_MENU_OK that follows m_editWorldName.setLabel(m_worldName.c_str()); } - else if ((int)m_worldName.length() < 25) + else if (static_cast(m_worldName.length()) < 25) { m_worldName += ch; changed = true; @@ -470,7 +470,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_EditWorldName: { @@ -519,7 +519,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) break; case eControl_TexturePackList: { - UpdateCurrentTexturePack((int)childId); + UpdateCurrentTexturePack(static_cast(childId)); } break; case eControl_NewWorld: @@ -615,7 +615,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=(DLCTexturePack *)pTexturePack; + DLCTexturePack *pDLCTexPack=static_cast(pTexturePack); m_pDLCPack=pDLCTexPack->getDLCInfoParentPack(); // do we have a license? @@ -686,8 +686,8 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(sliderId)) { case eControl_Difficulty: m_sliderDifficulty.handleSliderMove(value); @@ -801,7 +801,7 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) { - UIScene_CreateWorldMenu *pClass=(UIScene_CreateWorldMenu *)lpParam; + UIScene_CreateWorldMenu *pClass=static_cast(lpParam); pClass->m_bIgnoreInput=false; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) @@ -1173,7 +1173,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD if (wSeed.length() != 0) { __int64 value = 0; - unsigned int len = (unsigned int)wSeed.length(); + unsigned int len = static_cast(wSeed.length()); //Check if the input string contains a numerical value bool isNumber = true; @@ -1247,8 +1247,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 = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1); - pClass->m_MoreOptionsParams.newWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1); + pClass->m_MoreOptionsParams.currentWorldSize = static_cast(pClass->m_MoreOptionsParams.worldSize + 1); + pClass->m_MoreOptionsParams.newWorldSize = static_cast(pClass->m_MoreOptionsParams.worldSize + 1); #endif g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); @@ -1290,7 +1290,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1308,7 +1308,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; + UIScene_CreateWorldMenu* pClass = static_cast(pParam); if(bContinue==true) { @@ -1416,7 +1416,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; + UIScene_CreateWorldMenu* pClass = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { diff --git a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp index 0895cdffe..902b987c4 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp @@ -19,7 +19,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p // Setup all the Iggy references we need for this scene initialiseMovie(); - InventoryScreenInput *initData = (InventoryScreenInput *)_initData; + InventoryScreenInput *initData = static_cast(_initData); shared_ptr creativeContainer = shared_ptr(new SimpleContainer( 0, L"", false, TabSpec::MAX_SIZE )); itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory); @@ -44,7 +44,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(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 = (ECreativeInventoryTabs)((int)eCreativeInventoryTab_BuildingBlocks + (int)eSection - (int)eSectionInventoryCreativeTab_0); + ECreativeInventoryTabs tab = static_cast((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 = (ECreativeInventoryTabs)(m_curTab + dir); - if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1); + ECreativeInventoryTabs tab = static_cast(m_curTab + dir); + if (tab < 0) tab = static_cast(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 = (F64)tab; + value[0].number = static_cast(tab); IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ) , m_funcSetActiveTab , 1 , value ); @@ -468,10 +468,10 @@ void UIScene_CreativeMenu::updateScrollCurrentPage(int currentPage, int pageCoun IggyDataValue value[2]; value[0].type = IGGY_DATATYPE_number; - value[0].number = (F64)pageCount; + value[0].number = static_cast(pageCount); value[1].type = IGGY_DATATYPE_number; - value[1].number = (F64)currentPage - 1; + value[1].number = static_cast(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 75ddf92ff..187bf689a 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -597,7 +597,7 @@ void UIScene_Credits::tick() { if ( pDef->m_iStringID[0] == CREDIT_ICON ) { - addImage((ECreditIcons)pDef->m_iStringID[1]); + addImage(static_cast(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 = (int)size; + value[1].number = static_cast(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 = (int)icon; + value[0].number = static_cast(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 77ffdffd9..6d705765e 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((int)controlId) + switch(static_cast(controlId)) { case eControl_OffersList: { - int iIndex = (int)childId; + int iIndex = static_cast(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((eDLCMarketplaceType)iIndex, true); + app.AddDLCRequest(static_cast(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 = (UIScene_DLCMainMenu*)pParam; + UIScene_DLCMainMenu* pClass = static_cast(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 c109ed62b..cd9f6d6ca 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -16,7 +16,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { m_bProductInfoShown=false; - DLCOffersParam *param=(DLCOffersParam *)initData; + DLCOffersParam *param=static_cast(initData); m_iProductInfoIndex=param->iType; m_iCurrentDLC=0; m_iTotalDLC=0; @@ -103,7 +103,7 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id) int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam; + UIScene_DLCOffersMenu* pClass = static_cast(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((int)controlId) + switch(static_cast(controlId)) { case eControl_OffersList: { @@ -263,7 +263,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) int iIndex = (int)childId; StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); #else - int iIndex = (int)childId; + int iIndex = static_cast(childId); ULONGLONG ullIndexA[1]; ullIndexA[0]=StorageManager.GetOffer(iIndex).qwOfferID; diff --git a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp index 8f0f4c110..7d02367ab 100644 --- a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp @@ -20,7 +20,7 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(false); @@ -32,7 +32,7 @@ UIScene_DeathMenu::~UIScene_DeathMenu() Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(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((int)controlId) + switch(static_cast(controlId)) { case eControl_Respawn: m_bIgnoreInput = true; @@ -106,7 +106,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) int playTime = -1; if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + playTime = static_cast(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 2a8ac9f8e..2372aa36b 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -67,7 +67,7 @@ void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, b void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Create: { @@ -112,7 +112,7 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) case eControl_EndX: case eControl_EndY: case eControl_EndZ: - m_keyboardCallbackControl = (eControls)((int)controlId); + m_keyboardCallbackControl = static_cast((int)controlId); InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugCreateSchematic::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); break; }; @@ -120,7 +120,7 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool selected) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_SaveMobs: m_data->bSaveMobs = selected; @@ -136,7 +136,7 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool sel int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - UIScene_DebugCreateSchematic *pClass=(UIScene_DebugCreateSchematic *)lpParam; + UIScene_DebugCreateSchematic *pClass=static_cast(lpParam); uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t) ); diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index af86d4b81..86b515c35 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -23,11 +23,11 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa Minecraft *pMinecraft = Minecraft::GetInstance(); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)pMinecraft->gameRenderer->GetFovVal()); - m_sliderFov.init(TempString,eControl_FOV,0,100,(int)pMinecraft->gameRenderer->GetFovVal()); + swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", static_cast(pMinecraft->gameRenderer->GetFovVal())); + m_sliderFov.init(TempString,eControl_FOV,0,100,static_cast(pMinecraft->gameRenderer->GetFovVal())); float currentTime = pMinecraft->level->getLevelData()->getGameTime() % 24000; - swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); m_sliderTime.init(TempString,eControl_Time,0,240,currentTime/100); m_buttonRain.init(L"Toggle Rain",eControl_Rain); @@ -140,7 +140,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region) if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; int itemId = -1; - swscanf((wchar_t*)region->name,L"item_%d",&itemId); + swscanf(static_cast(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"); @@ -181,7 +181,7 @@ void UIScene_DebugOverlay::handleInput(int iPad, int key, bool repeat, bool pres void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Items: { @@ -252,7 +252,7 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) { - switch((int)sliderId) + switch(static_cast(sliderId)) { case eControl_Time: { @@ -266,17 +266,17 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) WCHAR TempString[256]; float currentTime = currentValue * 100; - swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime); + swprintf( (WCHAR *)TempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); m_sliderTime.setLabel(TempString); } break; case eControl_FOV: { Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->gameRenderer->SetFovVal((float)currentValue); + pMinecraft->gameRenderer->SetFovVal(static_cast(currentValue)); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)currentValue); + swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", static_cast(currentValue)); m_sliderFov.setLabel(TempString); } break; diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp index dd5a429f0..de200868e 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp @@ -88,7 +88,7 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pr void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Teleport: app.SetXuiServerAction( ProfileManager.GetPrimaryPad(), @@ -100,7 +100,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) case eControl_CamZ: case eControl_YRot: case eControl_Elevation: - m_keyboardCallbackControl = (eControls)((int)controlId); + m_keyboardCallbackControl = static_cast((int)controlId); InputManager.RequestKeyboard(L"Enter something",L"",(DWORD)0,25,&UIScene_DebugSetCamera::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Default); break; }; @@ -108,7 +108,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_LockPlayer: app.SetFreezePlayers(selected); @@ -118,7 +118,7 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, bool selected) int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { - UIScene_DebugSetCamera *pClass=(UIScene_DebugSetCamera *)lpParam; + UIScene_DebugSetCamera *pClass=static_cast(lpParam); uint16_t pchText[2048];//[128]; ZeroMemory(pchText, 2048/*128*/ * sizeof(uint16_t) ); InputManager.GetText(pchText); diff --git a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp index 97cf842a9..f7fe65d69 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 = (TrapScreenInput *)_initData; + TrapScreenInput *initData = static_cast(_initData); m_labelDispenser.init(initData->trap->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trap_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_EULA.cpp b/Minecraft.Client/Common/UI/UIScene_EULA.cpp index 3177344df..492657b03 100644 --- a/Minecraft.Client/Common/UI/UIScene_EULA.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EULA.cpp @@ -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((int)controlId) + switch(static_cast(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 27459ccc1..ced0c45a2 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 = (EnchantingScreenInput *)_initData; + EnchantingScreenInput *initData = static_cast(_initData); m_labelEnchant.init( initData->name.empty() ? app.GetString(IDS_ENCHANT) : initData->name ); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Enchanting_Menu, this); } @@ -264,7 +264,7 @@ void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion *region) else { int slotId = -1; - swscanf((wchar_t*)region->name,L"slot_Button%d",&slotId); + swscanf(static_cast(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 2f43cada2..f06343fe5 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -191,7 +191,7 @@ void UIScene_EndPoem::handleDestroy() void UIScene_EndPoem::handleRequestMoreData(F64 startIndex, bool up) { - m_requestedLabel = (int)startIndex; + m_requestedLabel = static_cast(startIndex); } void UIScene_EndPoem::updateNoise() @@ -221,13 +221,13 @@ void UIScene_EndPoem::updateNoise() { if (ui.UsingBitmapFont()) { - randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; + randomChar = SharedConstants::acceptableLetters[random->nextInt(static_cast(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((int)acceptableLetters.length()) ]; + randomChar = acceptableLetters[ random->nextInt(static_cast(acceptableLetters.length())) ]; } wstring randomCharStr = L""; diff --git a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp index 1d24f989b..533c280f0 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 = (FireworksScreenInput *)_initData; + FireworksScreenInput *initData = static_cast(_initData); m_labelFireworks.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS)); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Fireworks_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp index fb17bda44..66a2c5ee8 100644 --- a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp @@ -27,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 = (LoadingInputParams *)initData; + LoadingInputParams *params = static_cast(initData); m_CompletionData = params->completionData; m_iPad=params->completionData->iPad; @@ -298,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 && (int)controlId == eControl_Confirm) + if(m_threadCompleted && static_cast(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 392221a6f..3be86b109 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 = (FurnaceScreenInput *)_initData; + FurnaceScreenInput *initData = static_cast(_initData); m_furnace = initData->furnace; m_labelFurnace.init(m_furnace->getName()); @@ -23,7 +23,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Furnace_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index c3d52cf9b..0e80c1f99 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -158,7 +158,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; int slot = -1; - swscanf((wchar_t*)region->name,L"slot_%d",&slot); + swscanf(static_cast(region->name),L"slot_%d",&slot); if (slot == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -180,8 +180,8 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { if(uiOpacityTimer<10) { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -190,12 +190,12 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } customDrawSlotControl(region,m_iPad,item,fVal,item->isFoil(),true); } @@ -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 = (S32)(ui.getScreenHeight() / 2); + yPos = static_cast(ui.getScreenHeight() / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - xPos = (S32)(ui.getScreenWidth() / 2); - yPos = (S32)(ui.getScreenHeight() / 2); + xPos = static_cast(ui.getScreenWidth() / 2); + yPos = static_cast(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 = (S32)(ui.getScreenHeight()); + tileHeight = static_cast(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - tileWidth = (S32)(ui.getScreenWidth()); + tileWidth = static_cast(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: @@ -796,11 +796,11 @@ void UIScene_HUD::repositionHud() { case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - height = (S32)(ui.getScreenHeight()); + height = static_cast(ui.getScreenHeight()); break; case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - width = (S32)(ui.getScreenWidth()); + width = static_cast(ui.getScreenWidth()); break; } diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index a0d631723..304b9197b 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -207,7 +207,7 @@ void UIScene_HelpAndOptionsMenu::handleInput(int iPad, int key, bool repeat, boo void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(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 f0f6db18a..d651ecdb8 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 = (HopperScreenInput *)_initData; + HopperScreenInput *initData = static_cast(_initData); m_labelDispenser.init(initData->hopper->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Hopper_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp index ab98e30f9..290085f70 100644 --- a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp @@ -11,7 +11,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, void *_initData // Setup all the Iggy references we need for this scene initialiseMovie(); - HorseScreenInput *initData = (HorseScreenInput *)_initData; + HorseScreenInput *initData = static_cast(_initData); m_labelHorse.init( initData->container->getName() ); m_inventory = initData->inventory; @@ -20,7 +20,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, void *_initData Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Horse_Menu, this); } diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp index e33e24fe7..204c31a48 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 = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1! + EHowToPlayPage eStartPage = static_cast((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 = ( int )( m_eCurrPage ) + 1; + int iNextPage = static_cast(m_eCurrPage) + 1; if ( iNextPage != eHowToPlay_NumPages ) { - StartPage( ( EHowToPlayPage )( iNextPage ) ); + StartPage( static_cast(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 = ( int )( m_eCurrPage ) - 1; + int iPrevPage = static_cast(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( ( EHowToPlayPage )( iPrevPage ) ); + StartPage( static_cast(iPrevPage) ); ui.PlayUISFX(eSFX_Press); } @@ -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[(int)ePage]; + value[0].number = gs_pageToFlashMapping[static_cast(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 92e8bdef8..80492d914 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp @@ -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( (int)controlId == eControl_Buttons) + if( static_cast(controlId) == eControl_Buttons) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); unsigned int uiInitData; - uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) ); + uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[static_cast(childId)] << 16 ) | static_cast(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 68ac537ee..72f9e4fd2 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp @@ -153,7 +153,7 @@ void UIScene_InGameHostOptionsMenu::handlePress(F64 controlId, F64 childId) TeleportMenuInitData *initData = new TeleportMenuInitData(); initData->iPad = m_iPad; initData->teleportToPlayer = false; - if( (int)controlId == eControl_TeleportToPlayer ) + if( static_cast(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 57acf3458..74291b1a7 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -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", (int)controlId, (int)childId); - switch((int)controlId) + app.DebugPrintf("Pressed = %d, %d\n", static_cast(controlId), static_cast(childId)); + switch(static_cast(controlId)) { case eControl_GameOptions: ui.NavigateToScene(m_iPad,eUIScene_InGameHostOptionsMenu); break; case eControl_GamePlayers: - int currentSelection = (int)childId; + int currentSelection = static_cast(childId); INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId); Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -377,10 +377,10 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) void UIScene_InGameInfoMenu::handleFocusChange(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_GamePlayers: - m_playerList.updateChildFocus( (int) childId ); + m_playerList.updateChildFocus( static_cast(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 = (UIScene_InGameInfoMenu *)callbackParam; + UIScene_InGameInfoMenu *scene = static_cast(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 = *(BYTE *)pParam; + BYTE smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index d7196849f..8872b0f3a 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -17,7 +17,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void m_bShouldNavBack = false; - InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)_initData; + InGamePlayerOptionsInitData *initData = static_cast(_initData); m_networkSmallId = initData->networkSmallId; m_playerPrivileges = initData->playerPrivileges; @@ -428,7 +428,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Kick: { @@ -446,7 +446,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; + BYTE smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -470,9 +470,9 @@ 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 = (UIScene_InGamePlayerOptionsMenu *)callbackParam; + UIScene_InGamePlayerOptionsMenu *scene = static_cast(callbackParam); - UIScene_InGameInfoMenu *infoScene = (UIScene_InGameInfoMenu *)scene->getBackScene(); + UIScene_InGameInfoMenu *infoScene = static_cast(scene->getBackScene()); if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) @@ -497,7 +497,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes() void UIScene_InGamePlayerOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { - switch((int)controlId) + switch(static_cast(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 fa2c7e613..561899897 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= (UIScene_InGameSaveManagementMenu *)lpParam; + UIScene_InGameSaveManagementMenu *pClass= static_cast(lpParam); app.DebugPrintf("Received data for save thumbnail\n"); @@ -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", (int)controlId, (int)childId); + app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); } void UIScene_InGameSaveManagementMenu::handleFocusChange(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); + app.DebugPrintf(app.USER_SR, "UIScene_InGameSaveManagementMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(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((int)controlId) + switch(static_cast(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 = (UIScene_InGameSaveManagementMenu*)pParam; + UIScene_InGameSaveManagementMenu* pClass = static_cast(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 = (UIScene_InGameSaveManagementMenu*)lpParam; + UIScene_InGameSaveManagementMenu* pClass = static_cast(lpParam); if(bRes) { diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp index 4a9dab43d..f2bdbd177 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 = (InventoryScreenInput *)_initData; + InventoryScreenInput *initData = static_cast(_initData); Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this); } - InventoryMenu *menu = (InventoryMenu *)initData->player->inventoryMenu; + InventoryMenu *menu = static_cast(initData->player->inventoryMenu); initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory()); diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index c036f7bf9..c25a10855 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 = (JoinMenuInitData *)_initData; + JoinMenuInitData *initData = static_cast(_initData); m_selectedSession = initData->selectedSession; m_friendInfoUpdatedOK = false; m_friendInfoUpdatedERROR = false; @@ -224,7 +224,7 @@ void UIScene_JoinMenu::tick() void UIScene_JoinMenu::friendSessionUpdated(bool success, void *pParam) { - UIScene_JoinMenu *scene = (UIScene_JoinMenu *)pParam; + UIScene_JoinMenu *scene = static_cast(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 = (UIScene_JoinMenu *)pParam; + UIScene_JoinMenu *scene = static_cast(pParam); ui.NavigateBack(scene->m_iPad); return 0; @@ -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((int)controlId) + switch(static_cast(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((int)controlId) + switch(static_cast(controlId)) { case eControl_GamePlayers: - m_buttonListPlayers.updateChildFocus( (int) childId ); + m_buttonListPlayers.updateChildFocus( static_cast(childId) ); }; updateTooltips(); } @@ -370,7 +370,7 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + UIScene_JoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)pParam)); if(pClass) { diff --git a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp index 9e46a42e9..15de62bfc 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp @@ -28,7 +28,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye m_bPCMode = false; if (initData) { - UIKeyboardInitData* kbData = (UIKeyboardInitData*)initData; + UIKeyboardInitData* kbData = static_cast(initData); m_win64Callback = kbData->callback; m_win64CallbackParam = kbData->lpParam; if (kbData->title) titleText = kbData->title; @@ -105,7 +105,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye }; IggyName nameVisible = registerFastName(L"visible"); IggyValuePath* root = IggyPlayerRootPath(getMovie()); - for (int i = 0; i < (int)(sizeof(s_keyNames) / sizeof(s_keyNames[0])); ++i) + for (int i = 0; i < static_cast(sizeof(s_keyNames) / sizeof(s_keyNames[0])); ++i) { IggyValuePath keyPath; if (IggyValuePathMakeNameRef(&keyPath, root, s_keyNames[i])) @@ -186,7 +186,7 @@ void UIScene_Keyboard::tick() m_bKeyboardDonePressed = true; } } - else if ((int)m_win64TextBuffer.length() < m_win64MaxChars) + else if (static_cast(m_win64TextBuffer.length()) < m_win64MaxChars) { m_win64TextBuffer += ch; changed = true; @@ -275,7 +275,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, void UIScene_Keyboard::handlePress(F64 controlId, F64 childId) { - if((int)controlId == 0) + if(static_cast(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 e9dc7eb92..4950f3229 100644 --- a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp @@ -112,14 +112,14 @@ void UIScene_LanguageSelector::handleInput(int iPad, int key, bool repeat, bool void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId) { - if( (int)controlId == eControl_Buttons ) + if( static_cast(controlId) == eControl_Buttons ) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); int newLanguage, newLocale; - newLanguage = uiLangMap[(int)childId]; - newLocale = uiLocaleMap[(int)childId]; + newLanguage = uiLangMap[static_cast(childId)]; + newLocale = uiLocaleMap[static_cast(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 d6f89832c..c48cab3ac 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 = (LaunchMoreOptionsMenuInitData *)initData; + m_params = static_cast(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= int(m_params->currentWorldSize)-1; + int min= static_cast(m_params->currentWorldSize)-1; int max=3; - int curr = int(m_params->newWorldSize)-1; + int curr = static_cast(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); } @@ -349,7 +349,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch((EControls)((int)controlId)) + switch(static_cast((int)controlId)) { case eLaunchCheckbox_Online: m_params->bOnlineGame = selected; @@ -423,7 +423,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId) { int stringId = 0; - switch((int)controlId) + switch(static_cast(controlId)) { case eLaunchCheckbox_Online: stringId = IDS_GAMEOPTION_ONLINE; @@ -544,7 +544,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes) { - UIScene_LaunchMoreOptionsMenu *pClass=(UIScene_LaunchMoreOptionsMenu *)lpParam; + UIScene_LaunchMoreOptionsMenu *pClass=static_cast(lpParam); pClass->m_bIgnoreInput=false; // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) @@ -568,7 +568,7 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) { if(m_bIgnoreInput) return; - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_EditSeed: { @@ -598,8 +598,8 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - int value = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(sliderId)) { case eControl_WorldSize: #ifdef _LARGE_WORLDS @@ -610,11 +610,11 @@ void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentVa break; case eControl_WorldResize: #ifdef _LARGE_WORLDS - EGameHostOptionWorldSize changedSize = EGameHostOptionWorldSize(value+1); + EGameHostOptionWorldSize changedSize = static_cast(value + 1); if(changedSize >= m_params->currentWorldSize) { m_sliderWorldResize.handleSliderMove(value); - m_params->newWorldSize = EGameHostOptionWorldSize(value+1); + m_params->newWorldSize = static_cast(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 12b219053..59268cb86 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -438,7 +438,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) } else { - m_newEntryIndex = (unsigned int)startIndex; + m_newEntryIndex = static_cast(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, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(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, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(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, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(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", ((float)m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); + 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); } } @@ -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", ((float)leaderboardEntry->m_columns[i])/1000.f); + swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(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", ((float)leaderboardEntry->m_columns[i])/1000.f); + swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG //app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif @@ -964,7 +964,7 @@ int UIScene_LeaderboardsMenu::SetLeaderboardTitleIcons() void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int slotId = -1; - swscanf((wchar_t*)region->name,L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { //app.DebugPrintf("This is not the control we are looking for\n"); @@ -979,14 +979,14 @@ void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene_LeaderboardsMenu::handleSelectionChanged(F64 selectedId) { ui.PlayUISFX(eSFX_Focus); - m_newSel = (int)selectedId; + m_newSel = static_cast(selectedId); updateTooltips(); } // Handle a request from Iggy for more data void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { - unsigned int item = (int)startIndex; + unsigned int item = static_cast(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 <= (int)m_leaderboard.m_totalEntryCount ); + assert( readIndex >= 1 && readIndex <= static_cast(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 <= (int)m_leaderboard.m_totalEntryCount ); + assert( readIndex >= 1 && readIndex <= static_cast(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 = (UIScene_LeaderboardsMenu*)pParam; + UIScene_LeaderboardsMenu* pClass = static_cast(pParam); pClass->navigateBack(); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index ed3c8137e..51a3bb610 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= (UIScene_LoadMenu *)ui.GetSceneFromCallbackId((size_t)lpParam); + UIScene_LoadMenu *pClass= static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); if(pClass) { @@ -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 = (LoadMenuInitData *)initData; + LoadMenuInitData *params = static_cast(initData); m_labelGameName.init(app.GetString(IDS_WORLD_NAME)); m_labelSeed.init(L""); @@ -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 = (EGameHostOptionWorldSize)app.GetGameHostOption(uiHostOptions,eGameHostOption_WorldSize); + m_MoreOptionsParams.currentWorldSize = static_cast(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((int)controlId) + switch(static_cast(controlId)) { case eControl_GameMode: switch(m_iGameModeId) @@ -725,7 +725,7 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) break; case eControl_TexturePackList: { - UpdateCurrentTexturePack((int)childId); + UpdateCurrentTexturePack(static_cast(childId)); } break; case eControl_LoadWorld: @@ -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=(DLCTexturePack *)pTexturePack; + DLCTexturePack *pDLCTexPack=static_cast(pTexturePack); m_pDLCPack=pDLCTexPack->getDLCInfoParentPack(); // do we have a license? @@ -946,8 +946,8 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(sliderId)) { case eControl_Difficulty: m_sliderDifficulty.handleSliderMove(value); @@ -1182,7 +1182,7 @@ void UIScene_LoadMenu::LaunchGame(void) int UIScene_LoadMenu::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -1206,7 +1206,7 @@ int UIScene_LoadMenu::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage: int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { @@ -1246,7 +1246,7 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes int UIScene_LoadMenu::LoadDataComplete(void *pParam) { - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); if(!pClass->m_bIsCorrupt) { @@ -1484,7 +1484,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner) { - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(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 = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); return LoadDataComplete(pClass); } int UIScene_LoadMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(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 = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); app.SetCorruptSaveDeleted(true); pClass->navigateBack(); @@ -1642,7 +1642,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(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 = (UIScene_LoadMenu*)pParam; + UIScene_LoadMenu* pClass = static_cast(pParam); if(bContinue==true) { diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index 8664aca12..ed49a701b 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -42,7 +42,7 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) char buf[128] = {}; if (fgets(buf, sizeof(buf), fr)) { - int len = (int)strlen(buf); + int len = static_cast(strlen(buf)); while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r' || buf[len-1] == ' ')) buf[--len] = '\0'; fclose(fr); @@ -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= (UIScene_LoadOrJoinMenu *)lpParam; + UIScene_LoadOrJoinMenu *pClass= static_cast(lpParam); app.DebugPrintf("Received data for save thumbnail\n"); @@ -1015,7 +1015,7 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() if( savesDir.exists() ) { m_saves = savesDir.listFiles(); - uiSaveC = (unsigned int)m_saves->size(); + uiSaveC = static_cast(m_saves->size()); } // add the New Game and Tutorial after the saves list is retrieved, if there are any saves @@ -1353,7 +1353,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=(UIScene_LoadOrJoinMenu *)lpParam; + UIScene_LoadOrJoinMenu *pClass=static_cast(lpParam); pClass->m_bIgnoreInput=false; if (bRes) { @@ -1378,7 +1378,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] = (wchar_t)ui16Text[k]; + wNewName[k] = static_cast(ui16Text[k]); // Convert to narrow for storage and in-memory update char narrowName[128] = {}; @@ -1422,18 +1422,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", (int)controlId, (int)childId); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); } void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", (int)controlId, (int)childId); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(childId)); - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_GamesList: m_iGameListIndex = childId; - m_buttonListGames.updateChildFocus( (int) childId ); + m_buttonListGames.updateChildFocus( static_cast(childId) ); break; case eControl_SavesList: m_iSaveListIndex = childId; @@ -1455,18 +1455,18 @@ void UIScene_LoadOrJoinMenu::remoteStorageGetSaveCallback(LPVOID lpParam, SonyRe void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_SavesList: { m_bIgnoreInput=true; - int lGenID = (int)childId - 1; + int lGenID = static_cast(childId) - 1; //CD - Added for audio ui.PlayUISFX(eSFX_Press); - if((int)childId == JOIN_LOAD_CREATE_BUTTON_INDEX) + if(static_cast(childId) == JOIN_LOAD_CREATE_BUTTON_INDEX) { app.SetTutorialMode( false ); @@ -1524,17 +1524,17 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { - LoadSaveFromDisk(m_saves->at((int)childId-m_iDefaultButtonsC)); + LoadSaveFromDisk(m_saves->at(static_cast(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[((int)childId)-m_iDefaultButtonsC].saveId; + params->iSaveGameInfoIndex=m_saveDetails[static_cast(childId)-m_iDefaultButtonsC].saveId; //params->pbSaveRenamed=&m_bSaveRenamed; params->levelGen = NULL; - params->saveDetails = &m_saveDetails[ ((int)childId)-m_iDefaultButtonsC ]; + params->saveDetails = &m_saveDetails[ static_cast(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 @@ -1568,7 +1568,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); { - int nIndex = (int)childId; + int nIndex = static_cast(childId); m_iGameListIndex = nIndex; CheckAndJoinGame(nIndex); } @@ -1818,7 +1818,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1834,7 +1834,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(LPVOID pParam) { if(pParam != NULL) { - UIScene_LoadOrJoinMenu *pScene = (UIScene_LoadOrJoinMenu *)pParam; + UIScene_LoadOrJoinMenu *pScene = static_cast(pParam); pScene->UpdateGamesList(); } } @@ -1879,7 +1879,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // Update the xui list displayed unsigned int xuiListSize = m_buttonListGames.getItemCount(); - unsigned int filteredListSize = (unsigned int)m_currentSessions->size(); + unsigned int filteredListSize = static_cast(m_currentSessions->size()); BOOL gamesListHasFocus = DoesGamesListHaveFocus(); @@ -2170,7 +2170,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2276,7 +2276,7 @@ static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = static_cast(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) @@ -2322,7 +2322,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) { ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); + UIScene_LoadOrJoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); if(pClass) { @@ -2342,7 +2342,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) { - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)lpParam; + UIScene_LoadOrJoinMenu* pClass = static_cast(lpParam); if(bRes) { @@ -2374,7 +2374,7 @@ void UIScene_LoadOrJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = static_cast(pParam); // results switched for this dialog // EMessage_ResultAccept means cancel @@ -2545,7 +2545,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; + UIScene_LoadOrJoinMenu *pClass = static_cast(pParam); // Exit with or without saving if(result==C4JStorage::EMessage_ResultAccept) diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index fe743adc2..d8d6d66ae 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 = (EUIScene) -1; +EUIScene UIScene_MainMenu::eNavigateWhenReady = static_cast(-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[(int)eControl_PlayGame].init(IDS_PLAY_GAME,eControl_PlayGame); + m_buttons[static_cast(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[(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); + 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); if(ProfileManager.IsFullVersion()) { m_bTrialVersion=false; - m_buttons[(int)eControl_UnlockOrDLC].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); + m_buttons[static_cast(eControl_UnlockOrDLC)].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); } else { m_bTrialVersion=true; - m_buttons[(int)eControl_UnlockOrDLC].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); + m_buttons[static_cast(eControl_UnlockOrDLC)].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); } #ifndef _DURANGO - m_buttons[(int)eControl_Exit].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); + m_buttons[static_cast(eControl_Exit)].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); #else m_buttons[(int)eControl_XboxHelp].init(IDS_XBOX_HELP_APP, eControl_XboxHelp); #endif @@ -182,7 +182,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) if(navBack && ProfileManager.IsFullVersion()) { // Replace the Unlock Full Game with Downloadable Content - m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT); + m_buttons[static_cast(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( (int)m_splashes.size() - (eSplashRandomStart + 1) ); + int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast(m_splashes.size()) - (eSplashRandomStart + 1) ); #endif // Override splash text on certain dates @@ -308,7 +308,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; #endif - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_PlayGame: #ifdef __ORBIS__ @@ -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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); // 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 = (UIScene_MainMenu*)pParam; + UIScene_MainMenu* pClass = static_cast(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 = (UIScene_MainMenu *)pParam; + UIScene_MainMenu *pClass = static_cast(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 = (UIScene_MainMenu*)pParam; + UIScene_MainMenu* pClass = static_cast(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 = (UIScene_MainMenu *)pParam; + UIScene_MainMenu *pClass = static_cast(pParam); if(bContinue) { @@ -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 = (UIScene_MainMenu *)pParam; + UIScene_MainMenu *pClass = static_cast(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 = (UIScene_MainMenu*)pParam; + UIScene_MainMenu* pClass = static_cast(pParam); if (bContinue) { @@ -1898,7 +1898,7 @@ void UIScene_MainMenu::tick() { app.DebugPrintf("[MainMenu] Navigating away from MainMenu.\n"); ui.NavigateToScene(lockedProfile, eNavigateWhenReady); - eNavigateWhenReady = (EUIScene) -1; + eNavigateWhenReady = static_cast(-1); } #ifdef _DURANGO else @@ -2110,7 +2110,7 @@ void UIScene_MainMenu::LoadTrial(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2129,7 +2129,7 @@ void UIScene_MainMenu::LoadTrial(void) void UIScene_MainMenu::handleUnlockFullVersion() { - m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT,true); + m_buttons[static_cast(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 6b8dc552e..52a878e8b 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 = (MessageBoxInfo *)initData; + MessageBoxInfo *param = static_cast(initData); m_buttonCount = param->uiOptionC; @@ -84,7 +84,7 @@ void UIScene_MessageBox::handleReload() value[0].number = m_buttonCount; value[1].type = IGGY_DATATYPE_number; - value[1].number = (F64)getControlFocus(); + value[1].number = static_cast(getControlFocus()); IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInit , 2 , value ); out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); @@ -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((int)controlId) + switch(static_cast(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 998679cab..c3136deb9 100644 --- a/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp @@ -100,7 +100,7 @@ void UIScene_NewUpdateMessage::handleInput(int iPad, int key, bool repeat, bool void UIScene_NewUpdateMessage::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Confirm: { diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 6f502db86..772971370 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -103,7 +103,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); // This just allows it to be shown gameMode->getTutorial()->showTutorialPopup(false); @@ -116,7 +116,7 @@ UIScene_PauseMenu::~UIScene_PauseMenu() Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(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((int)controlId) + switch(static_cast(controlId)) { case BUTTON_PAUSE_RESUMEGAME: if( m_iPad == ProfileManager.GetPrimaryPad() && g_NetworkManager.IsLocalGame() ) @@ -656,7 +656,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) int playTime = -1; if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } #if defined(_XBOX_ONE) || defined(__ORBIS__) @@ -725,7 +725,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) int playTime = -1; if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } TelemetryManager->RecordLevelExit(m_iPad, eSen_LevelExitStatus_Exited); @@ -743,7 +743,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) int playTime = -1; if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } // adjust the trial time played @@ -761,7 +761,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) int playTime = -1; if( pMinecraft->localplayers[m_iPad] != NULL ) { - playTime = (int)pMinecraft->localplayers[m_iPad]->getSessionTimer(); + playTime = static_cast(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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); @@ -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 = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + UIScene_PauseMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)pParam)); if(pClass) pClass->SetIgnoreInput(false); if(bContinue==true) diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp index 0cb6cf2bd..445c6ffcd 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 = *((SignInInfo *)_initData); + m_signInInfo = *static_cast(_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 = (UIScene_QuadrantSignin *)pParam; + UIScene_QuadrantSignin *pClass = static_cast(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 = (int)state; + value[1].number = static_cast(state); IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetControllerStatus , 2 , value ); } @@ -272,7 +272,7 @@ void UIScene_QuadrantSignin::setControllerState(int iPad, EControllerStatus stat int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)lpParam; + UIScene_QuadrantSignin *pClass = static_cast(lpParam); app.DebugPrintf(app.USER_SR,"AvatarReturned callback\n"); if(pbThumbnail != NULL) { diff --git a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp index b58f86fda..98bcab7e0 100644 --- a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp @@ -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((int)controlId) + switch(static_cast(controlId)) { case eControl_Confirm: diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index 6d892d703..c1b38fa04 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -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 = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(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 d5447f779..3a81775dc 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp @@ -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 = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(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 0a76a5e5d..be92bd62d 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -19,7 +19,7 @@ namespace int fovToSliderValue(float fov) { - int clampedFov = clampFov((int)(fov + 0.5f)); + int clampedFov = clampFov(static_cast(fov + 0.5f)); return ((clampedFov - FOV_MIN) * FOV_SLIDER_MAX) / (FOV_MAX - FOV_MIN); } @@ -49,9 +49,9 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD 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)); - int initialFov = clampFov((int)(pMinecraft->gameRenderer->GetFovVal() + 0.5f)); + int initialFov = clampFov(static_cast(pMinecraft->gameRenderer->GetFovVal() + 0.5f)); swprintf((WCHAR*)TempString, 256, L"FOV: %d", initialFov); - m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, fovToSliderValue((float)initialFov)); + m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, fovToSliderValue(static_cast(initialFov))); 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)); @@ -164,8 +164,8 @@ void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, b void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { WCHAR TempString[256]; - int value = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(sliderId)) { case eControl_Gamma: m_sliderGamma.handleSliderMove(value); @@ -181,7 +181,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderFOV.handleSliderMove(value); Minecraft* pMinecraft = Minecraft::GetInstance(); int fovValue = sliderValueToFov(value); - pMinecraft->gameRenderer->SetFovVal((float)fovValue); + pMinecraft->gameRenderer->SetFovVal(static_cast(fovValue)); WCHAR TempString[256]; swprintf((WCHAR*)TempString, 256, L"FOV: %d", fovValue); m_sliderFOV.setLabel(TempString); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp index 39a0b7c66..4f15d1081 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp @@ -119,7 +119,7 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch((int)controlId) + switch(static_cast(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 = (UIScene_SettingsMenu*)pParam; + UIScene_SettingsMenu* pClass = static_cast(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 6898d489a..6780e05bc 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -243,7 +243,7 @@ void UIScene_SettingsOptionsMenu::handlePress(F64 controlId, F64 childId) //CD - Added for audio ui.PlayUISFX(eSFX_Press); - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Languages: m_bNavigateToLanguageSelector = true; @@ -378,8 +378,8 @@ void UIScene_SettingsOptionsMenu::handleReload() void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - int value = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(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 917012d6b..5a515c4b3 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -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 = (int)currentValue; - switch((int)sliderId) + int value = static_cast(currentValue); + switch(static_cast(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 c29bac2d3..74e7e2dcb 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 = (SignEntryScreenInput*)_initData; + SignEntryScreenInput* initData = static_cast(_initData); m_sign = initData->sign; m_bConfirmed = false; @@ -143,7 +143,7 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled - UIScene_SignEntryMenu *pClass=(UIScene_SignEntryMenu *)lpParam; + UIScene_SignEntryMenu *pClass=static_cast(lpParam); pClass->m_bIgnoreInput = false; if (bRes) { @@ -157,7 +157,7 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_Confirm: { @@ -169,7 +169,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) case eControl_Line3: case eControl_Line4: { - m_iEditingLine = (int)controlId; + m_iEditingLine = static_cast(controlId); m_bIgnoreInput = true; #ifdef _XBOX_ONE // 4J-PB - Xbox One uses the Windows virtual keyboard, and doesn't have the Xbox 360 Latin keyboard type, so we can't restrict the input set to alphanumeric. The closest we get is the emailSmtpAddress type. @@ -186,7 +186,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) break; } #else - InputManager.RequestKeyboard(app.GetString(IDS_SIGN_TITLE),m_textInputLines[m_iEditingLine].getLabel(),(DWORD)m_iPad,15,&UIScene_SignEntryMenu::KeyboardCompleteCallback,this,C_4JInput::EKeyboardMode_Alphabet); + 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); #endif } break; diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index d4f26ae71..168c96b64 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -599,7 +599,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int characterId = -1; - swscanf((wchar_t*)region->name,L"Character%d",&characterId); + swscanf(static_cast(region->name),L"Character%d",&characterId); if (characterId == -1) { app.DebugPrintf("Invalid character to render found\n"); @@ -1099,7 +1099,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { - m_skinIndex = (EDefaultSkins) defaultSkinIndex; + m_skinIndex = static_cast(defaultSkinIndex); } } break; @@ -1563,7 +1563,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_SkinSelectMenu* pScene = (UIScene_SkinSelectMenu*)pParam; + UIScene_SkinSelectMenu* pScene = static_cast(pParam); if ( (result == C4JStorage::EMessage_ResultAccept) && ProfileManager.IsSignedIn(iPad) @@ -1642,7 +1642,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: int UIScene_SkinSelectMenu::RenableInput(LPVOID lpVoid, int, int) { - ((UIScene_SkinSelectMenu*) lpVoid)->m_bIgnoreInput = false; + static_cast(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 f6916d133..5d49196c9 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 = (TeleportMenuInitData *)initData; + TeleportMenuInitData *initParam = static_cast(initData); m_teleportToPlayer = initParam->teleportToPlayer; @@ -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", (int)controlId, (int)childId); - switch((int)controlId) + app.DebugPrintf("Pressed = %d, %d\n", static_cast(controlId), static_cast(childId)); + switch(static_cast(controlId)) { case eControl_GamePlayers: - int currentSelection = (int)childId; + int currentSelection = static_cast(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 = (UIScene_TeleportMenu *)callbackParam; + UIScene_TeleportMenu *scene = static_cast(callbackParam); bool playerFound = false; int foundIndex = 0; for(int i = 0; i < scene->m_playersCount; ++i) diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp index 0a35c8e5b..d806c49ff 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 = (TradingScreenInput *)_initData; + TradingScreenInput *initData = static_cast(_initData); m_merchant = initData->trader; Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trading_Menu, this); } @@ -89,7 +89,7 @@ void UIScene_TradingMenu::handleDestroy() Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } @@ -159,7 +159,7 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) shared_ptr item = nullptr; int slotId = -1; - swscanf((wchar_t*)region->name,L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if(slotId < MerchantMenu::USE_ROW_SLOT_END) { diff --git a/Minecraft.Client/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Common/XUI/XUI_Chat.cpp index 3e3faa773..a1c43c63f 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp index 9a82a7b3b..ab99c00dc 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 = (ConnectionProgressParams *)pInitData->pvInitData; + ConnectionProgressParams *param = static_cast(pInitData->pvInitData); m_iPad = param->iPad; MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp index cc3afeca4..65118fa5d 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp @@ -127,7 +127,7 @@ HRESULT CXuiCtrl4JEdit::OnChar(XUIMessageChar* pInputData, BOOL& rfHandled) XuiSendMessage( hBaseObj, &xuiMsg ); rfHandled = TRUE; - SendNotifyValueChanged((int)pInputData->wch); + SendNotifyValueChanged(static_cast(pInputData->wch)); return hr; } @@ -185,14 +185,14 @@ HRESULT CXuiCtrl4JEdit::SendNotifyValueChanged(int iValue) int CXuiCtrl4JEdit::KeyboardReturned(void *pParam,bool bSet) { - CXuiCtrl4JEdit* pClass = (CXuiCtrl4JEdit*)pParam; + CXuiCtrl4JEdit* pClass = static_cast(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, (int)wcsnlen(pClass->wchText, 50)); + XuiEditSetCaretPosition(pClass->m_hObj, static_cast(wcsnlen(pClass->wchText, 50))); pClass->SendNotifyValueChanged(10); // 10 for a return } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp index 4c615979c..15695fd6d 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp @@ -22,13 +22,13 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom if(ItemInfo.pwszText) { - dwLen1=(int)wcslen(ItemInfo.pwszText)*sizeof(WCHAR); + dwLen1=static_cast(wcslen(ItemInfo.pwszText))*sizeof(WCHAR); dwBytes+=dwLen1+sizeof(WCHAR); } if(ItemInfo.pwszImage) { - dwLen2=(int)(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR); + dwLen2=static_cast(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=(int)m_vListData.size()-iSortListFromIndex; + pItemInfo->iIndex=static_cast(m_vListData.size())-iSortListFromIndex; } else { - pItemInfo->iIndex=(int)m_vListData.size(); + pItemInfo->iIndex=static_cast(m_vListData.size()); } // added to force a sort order for DLC @@ -110,7 +110,7 @@ void CXuiCtrl4JList::RemoveAllData( ) { EnterCriticalSection(&m_AccessListData); - int iSize=(int)m_vListData.size(); + int iSize=static_cast(m_vListData.size()); for(int i=0;icItems = (int)m_vListData.size(); + pGetItemCountData->cItems = static_cast(m_vListData.size()); bHandled = TRUE; return S_OK; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp index 074b7300b..69f775d49 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp @@ -12,7 +12,7 @@ int CXuiCtrlBrewProgress::GetValue() if( pvUserData != NULL ) { - BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData; + BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(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 cc5d996f3..981f49960 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp @@ -10,7 +10,7 @@ int CXuiCtrlBubblesProgress::GetValue() if( pvUserData != NULL ) { - BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData; + BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(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 8e514094c..b618f8c6d 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp @@ -12,7 +12,7 @@ int CXuiCtrlBurnProgress::GetValue() if( pvUserData != NULL ) { - FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData; + FurnaceTileEntity *pFurnaceTileEntity = static_cast(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_EnchantButton.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp index 6c7876c9f..050fcdc41 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); HXUIOBJ parent = m_hObj; HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" ); @@ -34,7 +34,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHan VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = (CXuiSceneEnchant *)pObj; + m_containerScene = static_cast(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 8a56a0ead..584cbe661 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp @@ -30,10 +30,10 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() : Minecraft *pMinecraft=Minecraft::GetInstance(); ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys); - m_fScreenWidth=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); model = NULL; @@ -66,7 +66,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = (CXuiSceneEnchant *)pObj; + m_containerScene = static_cast(pObj); last = nullptr; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp index 60156a0af..a7700e79c 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); HXUIOBJ parent = m_hObj; HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiCtrlEnchantmentButton" ); @@ -44,7 +44,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& r VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_parentControl = (CXuiCtrlEnchantmentButton *)pObj; + m_parentControl = static_cast(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 = (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; + 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; 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 b125af39c..35b9d534e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp @@ -12,7 +12,7 @@ int CXuiCtrlFireProgress::GetValue() if( pvUserData != NULL ) { - FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData; + FurnaceTileEntity *pFurnaceTileEntity = static_cast(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 02ee7c938..7af2ea389 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); } //----------------------------------------------------------------------------- @@ -47,7 +47,7 @@ HRESULT CXuiCtrlMinecraftPlayer::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl VOID *pObj; XuiObjectFromHandle( parent, &pObj ); - m_containerScene = (CXuiSceneInventory *)pObj; + m_containerScene = static_cast(pObj); m_iPad = m_containerScene->getPad(); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp index 0acd250f2..ffa386a06 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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_customTextureUrl = L"default"; m_backupTexture = TN_MOB_CHAR; @@ -137,7 +137,7 @@ void CXuiCtrlMinecraftSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAn void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation() { - m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1); + m_currentAnimation = static_cast(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 = (ESkinPreviewAnimations)(m_currentAnimation - 1); - if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); + m_currentAnimation = static_cast(m_currentAnimation - 1); + if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast(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(-(float)m_xRot, 1, 0, 0); + glRotatef(-static_cast(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; @@ -294,7 +294,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do glPushMatrix(); glDisable(GL_CULL_FACE); - HumanoidModel *model = (HumanoidModel *)renderer->getModel(); + HumanoidModel *model = static_cast(renderer->getModel()); //getAttackAnim(mob, a); //if (armor != NULL) armor->attackTime = model->attackTime; @@ -329,7 +329,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do { m_swingTime = 0; } - model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3); + model->attackTime = m_swingTime / static_cast(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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 = (float) yd * 10; + float flap = static_cast(yd) * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = (float) (xd * xa + zd * za) * 100; - float lean2 = (float) (xd * za - zd * xa) * 100; + float lean = static_cast(xd * xa + zd * za) * 100; + float lean2 = static_cast(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 84273eb57..a61ca6459 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp @@ -62,8 +62,8 @@ CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() : if(pMinecraft != NULL) { - m_fScreenWidth=(float)pMinecraft->width_phys; - m_fScreenHeight=(float)pMinecraft->height_phys; + m_fScreenWidth=static_cast(pMinecraft->width_phys); + m_fScreenHeight=static_cast(pMinecraft->height_phys); m_bScreenWidthSetup = true; } } @@ -114,9 +114,9 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData, m_item = MsgGetSlotItem.item; m_iID = m_item->id; m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; + m_fAlpha = static_cast(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField); - m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; + m_fScale = static_cast(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 = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f; + m_fAlpha = static_cast(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 = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f; + m_fScale = static_cast(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); @@ -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 = (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; + 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; if(!m_bScreenWidthSetup) { Minecraft *pMinecraft=Minecraft::GetInstance(); if(pMinecraft != NULL) { - m_fScreenWidth=(float)pMinecraft->width_phys; - m_fScreenHeight=(float)pMinecraft->height_phys; + m_fScreenWidth=static_cast(pMinecraft->width_phys); + m_fScreenHeight=static_cast(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 / (float) Inventory::POP_TIME_DURATION; + float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); float sx = x; float sy = y; float sxoffs = 8 * scaleX; float syoffs = 12 * scaleY; - glTranslatef((float)(sx + sxoffs), (float)(sy + syoffs), 0); + glTranslatef(static_cast(sx + sxoffs), static_cast(sy + syoffs), 0); glScalef(1 / squeeze, (squeeze + 1) / 2, 1); - glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0); + glTranslatef(static_cast(-(sx + sxoffs)), static_cast(-(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= (int)(0.5f+((float)x)/scaleX); - int iY= (int)(0.5f+((float)y)/scaleY); + int iX= static_cast(0.5f + ((float)x) / scaleX); + int iY= static_cast(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, (int)x, (int)y, m_fAlpha); + m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, static_cast(x), static_cast(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 = (float)(iScale)/10.0f; + m_fScale = static_cast(iScale)/10.0f; //m_uiAlpha=uiAlpha; - m_fAlpha =((float)(uiAlpha)) / 255.0f; + m_fAlpha =static_cast(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 = (float)(iScale)/10.0f; - m_fAlpha =((float)(uiAlpha)) / 31; + m_fScale = static_cast(iScale)/10.0f; + m_fAlpha =static_cast(uiAlpha) / 31; m_bDecorations = bDecorations; m_bDirty = TRUE; XuiElementSetShow(m_hObj,bShow); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp index a4e9f6be3..d52d560e7 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 = (CXuiControl *)pObj; + m_pFocusSink = static_cast(pObj); XuiElementGetChildById(m_hObj,L"XuiSlider",&hObjChild); XuiObjectFromHandle( hObjChild, &pObj ); - m_pSlider = (CXuiSlider *)pObj; + m_pSlider = static_cast(pObj); m_sliderActive = false; m_bDisplayVal=true; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp index f8ceeb69d..5c820fb5f 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, (void *)pvUserData ); + hr = XuiElementSetUserData(hObj, static_cast(pvUserData) ); // 4J WESTY : Pointer Prototype : Added to support prototype only. m_bSkipDefaultNavigation = false; @@ -41,7 +41,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); if( pUserDataContainer->slot != NULL ) { @@ -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, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime); + pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, static_cast(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 = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); pUserDataContainer->slot = slot; } @@ -92,7 +92,7 @@ void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); pUserDataContainer->m_iPad = iPad; } @@ -102,7 +102,7 @@ void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); pUserDataContainer->m_fAlpha = fAlpha; } @@ -111,7 +111,7 @@ bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); if(pUserDataContainer->slot != NULL) { @@ -130,7 +130,7 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector(pvUserData); if(pUserDataContainer->slot != NULL) { @@ -181,7 +181,7 @@ shared_ptr CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); if(pUserDataContainer->slot != NULL) { @@ -200,7 +200,7 @@ Slot *CXuiCtrlSlotItemCtrlBase::getSlot( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); return pUserDataContainer->slot; } @@ -254,7 +254,7 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj ) { void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); int iCount = 0; @@ -294,7 +294,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj // Get the info on this item. void* pvThisUserData; XuiElementGetUserData( hThisObj, &pvThisUserData ); - SlotControlUserDataContainer* pThisUserDataContainer = (SlotControlUserDataContainer*)pvThisUserData; + SlotControlUserDataContainer* pThisUserDataContainer = static_cast(pvThisUserData); if(pThisUserDataContainer->slot != NULL) { @@ -322,7 +322,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj // Get the info on other item. void* pvOtherUserData; XuiElementGetUserData( hOtherObj, &pvOtherUserData ); - SlotControlUserDataContainer* pOtherUserDataContainer = (SlotControlUserDataContainer*)pvOtherUserData; + SlotControlUserDataContainer* pOtherUserDataContainer = static_cast(pvOtherUserData); if(pOtherUserDataContainer->slot != NULL) { @@ -363,7 +363,7 @@ int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) void* pvUserData; XuiElementGetUserData( hObj, &pvUserData ); - SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; + SlotControlUserDataContainer* pUserDataContainer = static_cast(pvUserData); int iCount = 0; int iMaxStackSize = 0; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp index 7e51c8850..67accbe25 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp @@ -226,6 +226,6 @@ void CXuiCtrlSlotList::GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListIt HXUIOBJ itemControl = this->GetItemControl(itemIndex); VOID *pObj; XuiObjectFromHandle( itemControl, &pObj ); - *CXuiCtrlSlotItem = (CXuiCtrlSlotItemListItem *)pObj; + *CXuiCtrlSlotItem = static_cast(pObj); } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp index 2e9717107..874edc6f0 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=(float)pMinecraft->width_phys; - m_fRawWidth=(float)ssc.rawWidth; - m_fScreenHeight=(float)pMinecraft->height_phys; - m_fRawHeight=(float)ssc.rawHeight; + 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); } //----------------------------------------------------------------------------- diff --git a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h index 888f8ad00..cd5e28652 100644 --- a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h +++ b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h @@ -39,7 +39,7 @@ 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,(XUIMessageData*) pData, sizeof(*pData)); + _XuiMessageExtra(pMsg,static_cast(pData), sizeof(*pData)); pData->item = nullptr; pData->iDataBitField = iDataBitField; pData->iItemBitField = iItemBitField; @@ -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,(XUIMessageData*) pData, sizeof(*pData)); + _XuiMessageExtra(pMsg,static_cast(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 bd05ca146..e65f5a923 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 = *(int *) pInitData->pvInitData; + iPad = *static_cast(pInitData->pvInitData); MapChildControls(); @@ -39,7 +39,7 @@ HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) VOID *pObj; XuiObjectFromHandle( xList, &pObj ); - list = (CXuiCtrl4JList *) pObj; + list = static_cast(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((eDLCMarketplaceType)iIndex, true); + app.AddDLCRequest(static_cast(iIndex), true); app.NavigateToScene(iPad,eUIScene_DLCOffersMenu, param); } return S_OK; @@ -182,7 +182,7 @@ HRESULT CScene_DLCMain::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled) //---------------------------------------------------------------------------------- HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - DLCOffersParam *param = (DLCOffersParam *) pInitData->pvInitData; + DLCOffersParam *param = static_cast(pInitData->pvInitData); m_iPad = param->iPad; m_iType = param->iType; m_iOfferC = app.GetDLCOffersCount(); @@ -226,7 +226,7 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_hXuiBrush=NULL; XuiObjectFromHandle( m_List, &pObj ); - m_pOffersList = (CXuiCtrl4JList *)pObj; + m_pOffersList = static_cast(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((eDLCMarketplaceType)m_iType)) + if(app.DLCContentRetrieved(static_cast(m_iType))) { m_bDLCRequiredIsRetrieved=true; @@ -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==(eDLCContentType)m_iType) + if(pDLC->eDLCType==static_cast(m_iType)) { if(xOffer.fUserHasPurchased) { @@ -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==(eDLCContentType)m_iType) + if(pDLC->eDLCType==static_cast(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=(int)pDLC->uiSortIndex; + pListInfo[iCount].iSortIndex=static_cast(pDLC->uiSortIndex); #ifdef _DEBUG app.DebugPrintf("Adding "); OutputDebugStringW(pListInfo[iCount].pwszText); @@ -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((eDLCMarketplaceType)m_iType)) + if(app.DLCContentRetrieved(static_cast(m_iType))) { m_bDLCRequiredIsRetrieved=true; diff --git a/Minecraft.Client/Common/XUI/XUI_Death.cpp b/Minecraft.Client/Common/XUI/XUI_Death.cpp index 83275c14c..e4c786f26 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); m_bIgnoreInput = false; @@ -107,7 +107,7 @@ HRESULT CScene_Death::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNoti int playTime = -1; if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); + playTime = static_cast(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 6b96a4e31..e4565acbf 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp @@ -14,7 +14,7 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle { MapChildControls(); - ItemEditorInput *initData = (ItemEditorInput *)pInitData->pvInitData; + ItemEditorInput *initData = static_cast(pInitData->pvInitData); m_iPad = initData->iPad; m_slot = initData->slot; m_menu = initData->menu; diff --git a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp index e6db6a805..7c3d491ca 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp @@ -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( (int)pMinecraft->gameRenderer->GetFovVal()); + m_setFov.SetValue( static_cast(pMinecraft->gameRenderer->GetFovVal())); XuiSetTimer(m_hObj,0,DEBUG_OVERLAY_UPDATE_TIME_PERIOD); @@ -266,7 +266,7 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify if( hObjSource == m_setFov ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->gameRenderer->SetFovVal((float)pNotifyValueChangedData->nValue); + pMinecraft->gameRenderer->SetFovVal(static_cast(pNotifyValueChangedData->nValue)); } return S_OK; } @@ -277,7 +277,7 @@ HRESULT CScene_DebugOverlay::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) if(pMinecraft->level != NULL) { m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 ); - m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal()); + m_setFov.SetValue( static_cast(pMinecraft->gameRenderer->GetFovVal())); } return S_OK; } @@ -286,9 +286,9 @@ void CScene_DebugOverlay::SetSpawnToPlayerPos() { Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->level->getLevelData()->setXSpawn((int)pMinecraft->player->x); - pMinecraft->level->getLevelData()->setYSpawn((int)pMinecraft->player->y); - pMinecraft->level->getLevelData()->setZSpawn((int)pMinecraft->player->z); + 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)); } #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp index f6335191b..90046c4e9 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp @@ -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((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_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_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()); + 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())); //fpp = new FreezePlayerParam(); //fpp->player = playerNo; diff --git a/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp b/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp index aaa3b06f6..e8091bcb3 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); m_bIgnoreInput = false; diff --git a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp index f66c0d70c..bfa953e89 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 = (LoadingInputParams *)pInitData->pvInitData; + LoadingInputParams *params = static_cast(pInitData->pvInitData); m_CompletionData = params->completionData; m_iPad=params->completionData->iPad; @@ -201,7 +201,7 @@ HRESULT CScene_FullscreenProgress::OnTransitionStart( XUIMessageTransition *pTra HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { int code = thread->GetExitCode(); - DWORD exitcode = *((DWORD *)&code); + DWORD exitcode = *static_cast(&code); //app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId); diff --git a/Minecraft.Client/Common/XUI/XUI_HUD.cpp b/Minecraft.Client/Common/XUI/XUI_HUD.cpp index 286f06a70..90b929686 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); MapChildControls(); @@ -145,7 +145,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) { int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel(); - int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel); + int progress = static_cast(pMinecraft->localplayers[m_iPad]->experienceProgress * xpNeededForNextLevel); m_ExperienceProgress.SetShow(TRUE); m_ExperienceProgress.SetRange(0,xpNeededForNextLevel); @@ -257,7 +257,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() float yo = 0; if (iHealth <= 4) { - yo = (float)m_random.nextInt(2) * (iGuiScale+1); + yo = static_cast(m_random.nextInt(2)) * (iGuiScale+1); } if (icon == heartOffsetIndex) { @@ -359,7 +359,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() { if ((m_tickCount % (food * 3 + 1)) == 0) { - yo = (float)(m_random.nextInt(3) - 1) * (iGuiScale+1); + yo = static_cast(m_random.nextInt(3) - 1) * (iGuiScale+1); } } @@ -391,8 +391,8 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(Material::water)) { m_airGroup.SetShow(TRUE); - 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; + 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; for (int icon = 0; icon < 10; icon++) { // Air bubbles diff --git a/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp b/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp index 9ba49e9d4..ce5750ede 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp @@ -12,7 +12,7 @@ //---------------------------------------------------------------------------------- HRESULT CScene_HelpAndOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); bool bNotInGame=(Minecraft::GetInstance()->level==NULL); MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp index e7a8b0ca0..5e72a8d1e 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp @@ -91,7 +91,7 @@ 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=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bSplitscreen=(app.GetLocalPlayerCount()>1); @@ -165,7 +165,7 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // fill out the layouts list VOID *pObj; XuiObjectFromHandle( m_SchemeList, &pObj ); - m_pLayoutList = (CXuiCtrl4JList *)pObj; + m_pLayoutList = static_cast(pObj); CXuiCtrl4JList::LIST_ITEM_INFO ListInfo[3]; ZeroMemory(ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*3); @@ -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,(unsigned char)( bIsChecked ) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,static_cast(bIsChecked) ); } else if ( hObjPressed == m_SouthPaw.m_hObj ) { BOOL bIsChecked = m_SouthPaw.IsChecked(); - app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,(unsigned char)( bIsChecked ) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,static_cast(bIsChecked) ); PositionAllText(m_iPad); } else if( hObjPressed == m_SchemeList) { // check what's been selected - app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)m_SchemeList.GetCurSel()); + app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast(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 4a6ce55f8..18435716c 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp @@ -386,7 +386,7 @@ static const int gs_aNumTextElements[ eNumTextTypes ] = //---------------------------------------------------------------------------------- HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - int iPad = *(int *)pInitData->pvInitData; + int iPad = *static_cast(pInitData->pvInitData); MapChildControls(); @@ -441,7 +441,7 @@ HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) VOID* pTextObj; XuiObjectFromHandle( text, &pTextObj ); - m_aTextTypes[ i ].m_appTextElements[ j ] = (CXuiControl *)pTextObj; + m_aTextTypes[ i ].m_appTextElements[ j ] = static_cast(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 5c750d030..b2d57f883 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 = ( size_t )( pInitData->pvInitData ); + size_t uiInitData = static_cast(pInitData->pvInitData); - m_iPad = ( int )( ( short )( uiInitData & 0xFFFF ) ); - EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1! + m_iPad = static_cast((short)(uiInitData & 0xFFFF)); + EHowToPlayPage eStartPage = static_cast((uiInitData >> 16) & 0xFFF); // Ignores MSB which is set to 1! - TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage); + TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, static_cast(eStartPage)); MapChildControls(); @@ -116,10 +116,10 @@ HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled case VK_PAD_A: { // Next page - int iNextPage = ( int )( m_eCurrPage ) + 1; + int iNextPage = static_cast(m_eCurrPage) + 1; if ( iNextPage != eHowToPlay_NumPages ) { - StartPage( ( EHowToPlayPage )( iNextPage ) ); + StartPage( static_cast(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 = ( int )( m_eCurrPage ) - 1; + int iPrevPage = static_cast(m_eCurrPage) - 1; if ( iPrevPage >= 0 ) { - StartPage( ( EHowToPlayPage )( iPrevPage ) ); + StartPage( static_cast(iPrevPage) ); CXuiSceneBase::PlayUISFX(eSFX_Press); } rfHandled = TRUE; diff --git a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp index 14046f203..8e5d21c44 100644 --- a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp @@ -65,7 +65,7 @@ unsigned int CScene_HowToPlayMenu::m_uiHTPSceneA[]= //---------------------------------------------------------------------------------- HRESULT CScene_HowToPlayMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bSplitscreen= app.GetLocalPlayerCount()>1; @@ -131,7 +131,7 @@ HRESULT CScene_HowToPlayMenu::OnGetSourceDataText(XUIMessageGetSourceText *pGetS { if( pGetSourceTextData->bItemData ) { - if( pGetSourceTextData->iItem < (int)eHTPButton_Max ) + if( pGetSourceTextData->iItem < static_cast(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() < (int)eHTPButton_Max) ) + if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < static_cast(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 ) | ( short )( m_iPad ) ); + uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | static_cast(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 f05617451..71125b685 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp index 4839013c9..7bd71336f 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); MapChildControls(); @@ -142,7 +142,7 @@ HRESULT CScene_InGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[playersList.GetCurSel()]); if( player != NULL ) { - PlayerUID xuid = ((NetworkPlayerXbox *)player)->GetUID(); + PlayerUID xuid = static_cast(player)->GetUID(); if( xuid != INVALID_XUID ) hr = XShowGamerCardUI(pInputData->UserIndex, xuid); } @@ -268,7 +268,7 @@ HRESULT CScene_InGameInfo::OnNotifySetFocus( HXUIOBJ hObjSource, XUINotifyFocus void CScene_InGameInfo::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - CScene_InGameInfo *scene = (CScene_InGameInfo *)callbackParam; + CScene_InGameInfo *scene = static_cast(callbackParam); bool playerFound = false; for(int i = 0; i < scene->m_playersCount; ++i) @@ -520,7 +520,7 @@ HRESULT CScene_InGameInfo::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; + BYTE smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) diff --git a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp index 156cd0925..bb3419678 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); - InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)pInitData->pvInitData; + InGamePlayerOptionsInitData *initData = static_cast(pInitData->pvInitData); m_iPad = initData->iPad; m_networkSmallId = initData->networkSmallId; m_playerPrivileges = initData->playerPrivileges; @@ -330,7 +330,7 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; + BYTE smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -353,13 +353,13 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor void CScene_InGamePlayerOptions::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { - CScene_InGamePlayerOptions *scene = (CScene_InGamePlayerOptions *)callbackParam; + CScene_InGamePlayerOptions *scene = static_cast(callbackParam); HXUIOBJ hBackScene = scene->GetBackScene(); CScene_InGameInfo* infoScene; VOID *pObj; XuiObjectFromHandle( hBackScene, &pObj ); - infoScene = (CScene_InGameInfo *)pObj; + infoScene = static_cast(pObj); if(infoScene != NULL) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving); if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) diff --git a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp index 428b3e88a..35fa6250c 100644 --- a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp @@ -75,7 +75,7 @@ const CScene_Leaderboards::LeaderboardDescriptor CScene_Leaderboards::LEADERBOAR HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled) { - m_iPad = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); MapChildControls(); m_bReady=false; @@ -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)/(float)iNumber; + fNewIconIncrement=(fIconSize*7.0f)/static_cast(iNumber); // reposition the title icons based on the number there are for(int i=0;iGetPosition(&vPos); - vPos.x=m_fTitleIconXPositions[0]+(((float)i)*fNewIconIncrement)+(fNewIconIncrement-fIconSize)/2.0f; + vPos.x=m_fTitleIconXPositions[0]+(static_cast(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)/(float)iNumber; + fNewTextIncrement=(fTextSize*7.0f)/static_cast(iNumber); // reposition the title icons based on the number there are for(int i=0;i(i)*fNewTextIncrement); XuiElementSetPosition(m_hTextEntryA[i],&vPos); // and change the size float fWidth,fHeight; @@ -222,7 +222,7 @@ void CScene_Leaderboards::UpdateTooltips() int iTooltipGamerCardOrProfile=-1; if( m_leaderboard.m_currentEntryCount > 0 ) { - unsigned int selection = (unsigned int)m_listGamers.GetCurSel(); + unsigned int selection = static_cast(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 > (int)m_leaderboard.m_totalEntryCount ) + if( m_newTop+10 > static_cast(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 = (unsigned int)m_listGamers.GetCurSel(); + unsigned int selection = static_cast(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 = (unsigned int)m_listGamers.GetCurSel(); + unsigned int selection = static_cast(m_listGamers.GetCurSel()); if( selection >= m_leaderboard.m_entryStartIndex-1 && selection < (m_leaderboard.m_entryStartIndex+m_leaderboard.m_currentEntryCount-1) ) { @@ -547,7 +547,7 @@ void CScene_Leaderboards::ReadStats(int startIndex) } else { - m_newEntryIndex = (unsigned int)startIndex; + m_newEntryIndex = static_cast(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, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(m_currentLeaderboard), m_newEntryIndex, m_newReadSize ); break; case LeaderboardManager::eFM_MyScore: LeaderboardManager::Instance()->ReadStats_MyScore( this, - m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(m_currentLeaderboard), INVALID_XUID/*ignored*/, m_newReadSize ); break; case LeaderboardManager::eFM_Friends: LeaderboardManager::Instance()->ReadStats_Friends( this, - m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_currentDifficulty, static_cast(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", ((float)m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); + 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); } } @@ -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 <= (int)m_leaderboard.m_totalEntryCount ); + assert( readIndex >= 1 && readIndex <= static_cast(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 <= (int)m_leaderboard.m_totalEntryCount ); + assert( readIndex >= 1 && readIndex <= static_cast(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 <= (unsigned int)(pGetSourceTextData->iData-3) ) + if( m_leaderboard.m_numColumns <= static_cast(pGetSourceTextData->iData - 3) ) pGetSourceTextData->szText = L""; else pGetSourceTextData->szText = m_leaderboard.m_entries[index].m_wcColumns[pGetSourceTextData->iData-3]; @@ -914,7 +914,7 @@ void CScene_Leaderboards::PopulateLeaderboard(bool noResults) hr=XuiElementGetChildById(visual,m_TitleIconNameA[i],&button); XuiObjectFromHandle( button, &pObj ); - m_pHTitleIconSlots[i] = (CXuiCtrlCraftIngredientSlot *)pObj; + m_pHTitleIconSlots[i] = static_cast(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); @@ -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", ((float)leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG - app.DebugPrintf("Display - %.1fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); + app.DebugPrintf("Display - %.1fkm\n", static_cast(leaderboardEntry->m_columns[i])/1000.f); #endif } else { // bigger than that, so no decimal point - swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", ((float)leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG - app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); + app.DebugPrintf("Display - %.0fkm\n", static_cast(leaderboardEntry->m_columns[i])/1000.f); #endif } } } //Is the player - if( statsRow->xuid == ((XboxLeaderboardManager*)LeaderboardManager::Instance())->GetMyXUID() ) + if( statsRow->xuid == static_cast(LeaderboardManager::Instance())->GetMyXUID() ) { leaderboardEntry->m_bPlayer = true; leaderboardEntry->m_bOnline = false; diff --git a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp index 7f32ff89e..55e967887 100644 --- a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp @@ -49,7 +49,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl WCHAR TempString[256]; - m_params = (LoadMenuInitData *)pInitData->pvInitData; + m_params = static_cast(pInitData->pvInitData); m_MoreOptionsParams.bGenerateOptions=FALSE; m_MoreOptionsParams.bPVP = TRUE; @@ -276,7 +276,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl if(dwImageBytes > 0 && pbImageData) { ListInfo.fEnabled = TRUE; - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; + DLCTexturePack *pDLCTexPack=static_cast(tp); if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -469,7 +469,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void) int CScene_LoadGameSettings::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(pParam); // results switched for this dialog if(result==C4JStorage::EMessage_ResultDecline) @@ -703,7 +703,7 @@ HRESULT CScene_LoadGameSettings::OnFontRendererChange() int CScene_LoadGameSettings::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { @@ -840,7 +840,7 @@ int CScene_LoadGameSettings::Progress(void *pParam,float fProgress) int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue) { - CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(pParam); if(bContinue==true) { @@ -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 = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(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 = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(pParam); app.SetCorruptSaveDeleted(true); app.NavigateBack(pClass->m_iPad); @@ -983,7 +983,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass, LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(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 = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pClass = static_cast(pParam); if(bContinue==true) { @@ -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( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); + swprintf( static_cast(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 = (CScene_LoadGameSettings*)pParam; + CScene_LoadGameSettings* pScene = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { @@ -1482,7 +1482,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(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=(DLCTexturePack *)tp; + DLCTexturePack *pDLCTexPack=static_cast(tp); if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -1635,7 +1635,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete() int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_LoadGameSettings *pClass = (CScene_LoadGameSettings *)pParam; + CScene_LoadGameSettings *pClass = static_cast(pParam); #ifdef _XBOX pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel(); // Exit with or without saving diff --git a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp index 7b9c1a56e..b5f722eb1 100644 --- a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp @@ -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( (int)m_splashes.size() - (eSplashRandomStart + 1) ); + int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast(m_splashes.size()) - (eSplashRandomStart + 1) ); // Override splash text on certain dates SYSTEMTIME LocalSysTime; @@ -457,7 +457,7 @@ HRESULT CScene_Main::OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) int CScene_Main::SignInReturned(void *pParam,bool bContinue) { - CScene_Main* pClass = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(pParam); if(bContinue==true) { @@ -915,7 +915,7 @@ void CScene_Main::LoadTrial(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 = (CScene_Main*)pParam; + CScene_Main* pClass = static_cast(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 b3608b068..4034f3c20 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp @@ -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 = (CreateWorldMenuInitData *)pInitData->pvInitData; + CreateWorldMenuInitData *params = static_cast(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((int)wWorldName.length()); + m_EditWorldName.SetCaretPosition(static_cast(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); @@ -190,7 +190,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle if(dwImageBytes > 0 && pbImageData) { ListInfo.fEnabled = TRUE; - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; + DLCTexturePack *pDLCTexPack=static_cast(tp); if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); @@ -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 = (CScene_MultiGameCreate*)pParam; + CScene_MultiGameCreate* pScene = static_cast(pParam); #ifdef _XBOX if(result==C4JStorage::EMessage_ResultAccept) { @@ -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 = (CScene_MultiGameCreate*)pParam; + CScene_MultiGameCreate* pScene = static_cast(pParam); pScene->m_bIgnoreInput = false; pScene->SetShow( TRUE ); bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pScene->m_MoreOptionsParams.bOnlineGame; @@ -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( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue])); + swprintf( static_cast(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue])); m_SliderDifficulty.SetText(TempString); } @@ -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 = (CScene_MultiGameCreate*)pParam; + CScene_MultiGameCreate* pClass = static_cast(pParam); if(result==C4JStorage::EMessage_ResultAccept) { @@ -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 = (CScene_MultiGameCreate*)pParam; + CScene_MultiGameCreate* pClass = static_cast(pParam); if(bContinue==true) { @@ -909,7 +909,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw if (wSeed.length() != 0) { __int64 value = 0; - unsigned int len = (unsigned int)wSeed.length(); + unsigned int len = static_cast(wSeed.length()); //Check if the input string contains a numerical value bool isNumber = true; @@ -979,7 +979,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); // Reset the autosave time app.SetAutosaveTimerTime(); @@ -1217,7 +1217,7 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack() int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameCreate *pClass = (CScene_MultiGameCreate *)pParam; + CScene_MultiGameCreate *pClass = static_cast(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 @@ -1295,7 +1295,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() ListInfo.fEnabled = TRUE; hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; + DLCTexturePack *pDLCTexPack=static_cast(tp); if(pDLCTexPack) { int id=pDLCTexPack->getDLCParentPackId(); diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp index bbfa243b2..671b9e8ee 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 = (JoinMenuInitData *)pInitData->pvInitData; + JoinMenuInitData *initData = static_cast(pInitData->pvInitData); m_selectedSession = initData->selectedSession; m_iPad = initData->iPad; // 4J-PB - don't delete this - it's part of the joinload structure @@ -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 = (CScene_MultiGameInfo*)pParam; + CScene_MultiGameInfo* pClass = static_cast(pParam); if(bContinue==true) { diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp index c5e2fe9af..83cb240f6 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -36,7 +36,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); m_bReady=false; MapChildControls(); @@ -95,10 +95,10 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand VOID *pObj; XuiObjectFromHandle( m_SavesList, &pObj ); - m_pSavesList = (CXuiCtrl4JList *)pObj; + m_pSavesList = static_cast(pObj); XuiObjectFromHandle( m_GamesList, &pObj ); - m_pGamesList = (CXuiCtrl4JList *)pObj; + m_pGamesList = static_cast(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) @@ -326,7 +326,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( ) if( savesDir.exists() ) { m_saves = savesDir.listFiles(); - uiSaveC = (unsigned int)m_saves->size(); + uiSaveC = static_cast(m_saves->size()); } // add the New Game and Tutorial after the saves list is retrieved, if there are any saves @@ -415,7 +415,7 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy() int CScene_MultiGameJoinLoad::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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,(void *)params); + app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_CreateWorldMenu,static_cast(params)); } else if(info.iData >= 0) { @@ -1113,7 +1113,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam) { if(lpParam != NULL) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; + CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); // check this there's no save transfer in progress if(!pClass->m_bSaveTransferInProgress) { @@ -1213,7 +1213,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() // Update the xui list displayed unsigned int xuiListSize = m_pGamesList->GetItemCount(); - unsigned int filteredListSize = (unsigned int)currentSessions.size(); + unsigned int filteredListSize = static_cast(currentSessions.size()); BOOL gamesListHasFocus = m_pGamesList->TreeHasFocus(); @@ -1528,7 +1528,7 @@ void CScene_MultiGameJoinLoad::SearchForGameCallback(void *param, DWORD dwNumRes int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); //HRESULT hr; if(bContinue==true) @@ -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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); if(bContinue==true) { @@ -1866,7 +1866,7 @@ void CScene_MultiGameJoinLoad::StartGameFromSave(CScene_MultiGameJoinLoad* pClas int CScene_MultiGameJoinLoad::DeleteSaveDataReturned(void *pParam,bool bSuccess) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); if(bSuccess==true) { @@ -1924,7 +1924,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(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 = (LPVOID)param; + loadingParams->lpParam = static_cast(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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 = (CScene_MultiGameJoinLoad *) lpParameter; + CScene_MultiGameJoinLoad* pClass = static_cast(lpParameter); Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE); @@ -2178,7 +2178,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char C4JStorage::TMS_FILETYPE_BINARY, C4JStorage::TMS_UGCTYPE_NONE, filename, - (CHAR *)data, + static_cast(data), size, &CScene_MultiGameJoinLoad::TransferComplete,pClass, 0, &CScene_MultiGameJoinLoad::Progress,pClass); @@ -2219,7 +2219,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad } Sleep(50); // update the progress - pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f)); + pMinecraft->progressRenderer->progressStagePercentage(static_cast(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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); app.DebugPrintf("Progress - %f\n",fProgress); pClass->m_fProgress=fProgress; @@ -2319,7 +2319,7 @@ int CScene_MultiGameJoinLoad::Progress(void *pParam,float fProgress) int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResult) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); delete [] pClass->m_pbSaveTransferData; pClass->m_pbSaveTransferData = NULL; @@ -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 = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); pClass->m_bTransferComplete=true; return 0; } int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); HRESULT hr = S_OK; // if the user has left the name empty, treat this as backing out @@ -2386,7 +2386,7 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bContinue) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(pParam); #ifdef _XBOX if(bContinue==true) { @@ -2428,7 +2428,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC int CScene_MultiGameJoinLoad::CopySaveReturned(void *pParam,bool bResult) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 = (CScene_MultiGameJoinLoad *)pParam; + CScene_MultiGameJoinLoad *pClass = static_cast(pParam); // Exit with or without saving // Decline means install full version of the texture pack in this dialog @@ -2510,7 +2510,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete() VOID *pObj; XuiObjectFromHandle( m_SavesList, &pObj ); - m_pSavesList = (CXuiCtrl4JList *)pObj; + m_pSavesList = static_cast(pObj); m_iChangingSaveGameInfoIndex = 0; @@ -2738,7 +2738,7 @@ int CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID lpParam,const bool) void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; + CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); StorageManager.TMSPP_CancelWriteFileWithProgress(pClass->m_iPad); @@ -2755,7 +2755,7 @@ void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam) void CScene_MultiGameJoinLoad::SaveUploadCompleteCallback(LPVOID lpParam) { - CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam; + CScene_MultiGameJoinLoad* pClass = static_cast(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 086561110..69f474d58 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 = (LaunchMoreOptionsMenuInitData *)pInitData->pvInitData; + m_params = static_cast(pInitData->pvInitData); if(m_params->bGenerateOptions) { diff --git a/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp b/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp index 49b524ffe..fa6da21e0 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 = *(int *) pInitData->pvInitData; + m_iPad = *static_cast(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 4de74d1f2..f6d71b07b 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full); @@ -319,7 +319,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* int playTime = -1; if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } if(StorageManager.GetSaveDisabled()) @@ -359,7 +359,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* int playTime = -1; if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited); @@ -377,7 +377,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* int playTime = -1; if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } // adjust the trial time played @@ -394,7 +394,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* int playTime = -1; if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) { - playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer(); + playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited); @@ -623,7 +623,7 @@ int UIScene_PauseMenu::DeviceSelectReturned(void *pParam,bool bContinue) return 0; } - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = static_cast(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 = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = static_cast(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 = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = static_cast(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 = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pScene = static_cast(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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(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]); @@ -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 = (UIScene_PauseMenu *)pParam; + UIScene_PauseMenu *pClass = static_cast(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=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(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 = (IUIScene_PauseMenu*)pParam; + IUIScene_PauseMenu* pClass = static_cast(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 = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = static_cast(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=(bool)lpParameter; + bool bAutosave=static_cast(lpParameter); if(bAutosave) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); diff --git a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp index c1e06c0d1..5f8b585cd 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); m_bIgnoreInput=false; MapChildControls(); @@ -283,7 +283,7 @@ HRESULT CScene_Reinstall::OnTransitionStart( XUIMessageTransition *pTransition, int CScene_Reinstall::DeviceSelectReturned(void *pParam,bool bContinue) { - CScene_Reinstall* pClass = (CScene_Reinstall*)pParam; + CScene_Reinstall* pClass = static_cast(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 = (CScene_Reinstall*)pParam; + CScene_Reinstall* pClass = static_cast(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 03e783f42..1ccc031cd 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp @@ -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 = ( ESceneSection )( iSection ); + ESceneSection eSection = static_cast(iSection); if(!IsSectionSlotList(eSection)) continue; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp index 4a8617b47..a10c101b0 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 = (AnvilScreenInput*)pInitData->pvInitData; + AnvilScreenInput* initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; m_inventory = initData->inventory; @@ -42,7 +42,7 @@ HRESULT CXuiSceneAnvil::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Anvil_Menu, this); } @@ -69,7 +69,7 @@ HRESULT CXuiSceneAnvil::OnDestroy() if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } @@ -89,8 +89,8 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue // strip leading spaces wstring b; - int start = (int)newValue.find_first_not_of(L" "); - int end = (int)newValue.find_last_not_of(L" "); + int start = static_cast(newValue.find_first_not_of(L" ")); + int end = static_cast(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 = (int)newValue.size()-1; + if( end == wstring::npos ) end = static_cast(newValue.size())-1; b = newValue.substr(start,(end-start)+1); newValue=b; } diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp index 03782c79c..217e68f90 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp @@ -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-(float)uiOpacityTimer)*fStep)); + float fVal=0.01f*(80.0f-((10.0f-static_cast(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-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -451,7 +451,7 @@ void CXuiSceneBase::_TickAllBaseScenes() } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else @@ -461,7 +461,7 @@ void CXuiSceneBase::_TickAllBaseScenes() { ucAlpha=15; } - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } XuiElementSetOpacity(app.GetCurrentHUDScene(i),fVal); @@ -627,8 +627,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { if(uiOpacityTimer<10) { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -637,7 +637,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else @@ -647,7 +647,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { ucAlpha=15; } - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } m_Buttons[iPad][tooltip].SetOpacity(fVal); @@ -678,8 +678,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo { if(uiOpacityTimer<10) { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -688,12 +688,12 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } XuiElementSetOpacity(m_hGamerTagA[iPad],fVal); } @@ -701,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*(float)ucAlpha); + XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast(ucAlpha)); } } } @@ -976,7 +976,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) { WCHAR wcTime[20]; - DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); + DWORD dwTimeTicks=static_cast(app.getTrialTimer()); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -1014,7 +1014,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) void CXuiSceneBase::_ReduceTrialTimerValue() { - DWORD dwTimeTicks=(int)app.getTrialTimer(); + DWORD dwTimeTicks=static_cast(app.getTrialTimer()); if(dwTimeTicks>m_dwTrialTimerLimitSecs) { @@ -1512,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*(float)ucAlpha); + XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast(ucAlpha)); } XuiElementSetPosition(m_hEmptyQuadrantLogo, &pos ); @@ -1638,8 +1638,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) { if(uiOpacityTimer<10) { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); + float fStep=(80.0f-static_cast(ucAlpha))/10.0f; + fVal=0.01f*(80.0f-((10.0f-static_cast(uiOpacityTimer))*fStep)); } else { @@ -1648,12 +1648,12 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } } else { - fVal=0.01f*(float)ucAlpha; + fVal=0.01f*static_cast(ucAlpha); } XuiElementSetOpacity(m_hGamerTagA[iPad],0.01f*fVal); } diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp index cf6009661..51a019cfd 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 = (BrewingScreenInput*)pInitData->pvInitData; + BrewingScreenInput* initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp index 39b836d2c..70eb7c3cf 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 = (ContainerScreenInput*)pInitData->pvInitData; + ContainerScreenInput* initData = static_cast(pInitData->pvInitData); XuiControlSetText(m_ChestText,app.GetString(initData->container->getName())); @@ -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 = (int)(vPos.y); + int iY = static_cast(vPos.y); iY &= 0xfffffffe; - vPos.y = (float)iY; + vPos.y = static_cast(iY); } this->SetPosition( &vPos ); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp index a5dc65849..cea213939 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 = (CraftingPanelScreenInput*)pInitData->pvInitData; + CraftingPanelScreenInput* pCraftingPanelData = static_cast(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); } XuiObjectFromHandle( m_hCraftOutput, &pObj ); - m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj; - m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping9GridA; - m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping3x3A; + m_pCraftingOutput = static_cast(pObj); + m_pGroupA=static_cast(&m_GroupTypeMapping9GridA); + m_pGroupTabA=static_cast(&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] = (CXuiCtrlCraftIngredientSlot *)pObj; + m_pCraftIngredientDescA[i] = static_cast(pObj); } } else @@ -113,13 +113,13 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle for(int i=0;i(pObj); } XuiObjectFromHandle( m_hCraftOutput, &pObj ); - m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj; - m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping4GridA; - m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping2x2A; + m_pCraftingOutput = static_cast(pObj); + m_pGroupA=static_cast(&m_GroupTypeMapping4GridA); + m_pGroupTabA=static_cast(&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] = (CXuiCtrlCraftIngredientSlot *)pObj; + m_pCraftIngredientDescA[i] = static_cast(pObj); } } diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp index 5b3c72261..6e5159b20 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 = (EnchantingScreenInput *) pInitData->pvInitData; + EnchantingScreenInput *initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp index 832d6b4ce..54f3591b9 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 = (FurnaceScreenInput*)pInitData->pvInitData; + FurnaceScreenInput* initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp index 6024b8d6e..a5532fefc 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 = (InventoryScreenInput *)pInitData->pvInitData; + InventoryScreenInput *initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -81,7 +81,7 @@ HRESULT CXuiSceneInventory::OnDestroy() if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } @@ -161,7 +161,7 @@ void CXuiSceneInventory::updateEffectsDisplay() vector *activeEffects = player->getActiveEffects(); // Work out how to arrange the effects - int effectCount = (int)activeEffects->size(); + int effectCount = static_cast(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 0793fc9e0..415d7b51e 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 = (InventoryScreenInput *)pInitData->pvInitData; + InventoryScreenInput *initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; @@ -139,10 +139,10 @@ CXuiControl* CXuiSceneInventoryCreative::GetSectionControl( ESceneSection eSecti switch( eSection ) { case eSectionInventoryCreativeUsing: - return (CXuiControl *)m_useRowControl; + return static_cast(m_useRowControl); break; case eSectionInventoryCreativeSelector: - return (CXuiControl *)m_containerControl; + return static_cast(m_containerControl); break; default: assert( false ); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp index 8738e683e..b6f3df50e 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 = (TradingScreenInput *)pInitData->pvInitData; + TradingScreenInput* initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; m_merchant = initData->trader; @@ -41,7 +41,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trading_Menu, this); } @@ -81,7 +81,7 @@ HRESULT CXuiSceneTrading::OnDestroy() if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp index 99dc6e4c4..4453185ea 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp @@ -22,7 +22,7 @@ HRESULT CXuiSceneTrap::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) Minecraft *pMinecraft = Minecraft::GetInstance(); - TrapScreenInput* initData = (TrapScreenInput*)pInitData->pvInitData; + TrapScreenInput* initData = static_cast(pInitData->pvInitData); m_iPad=initData->iPad; m_bSplitscreen=initData->bSplitscreen; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp index 19e6b0161..9c491be67 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(pInitData->pvInitData); m_bIgnoreInput = false; @@ -57,13 +57,13 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) noNoiseString = app.FormatHTMLString(m_iPad, noNoiseString, 0xff000000); Random random(8124371); - int found=(int)noNoiseString.find_first_of(L"{"); + int found=static_cast(noNoiseString.find_first_of(L"{")); int length; while (found!=string::npos) { length = random.nextInt(4) + 3; m_noiseLengths.push_back(length); - found=(int)noNoiseString.find_first_of(L"{",found+1); + found=static_cast(noNoiseString.find_first_of(L"{", found + 1)); } Minecraft *pMinecraft = Minecraft::GetInstance(); diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp index c6dc7118f..26219376e 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp @@ -10,7 +10,7 @@ HRESULT CScene_SettingsAll::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { //WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp index 0f0fe2e30..f654a3764 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp @@ -7,7 +7,7 @@ HRESULT CScene_SettingsAudio::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); @@ -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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),pNotifyValueChanged->nValue); + swprintf( static_cast(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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue); + swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_SOUND].SetText(TempString); } diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp index 7e2835a27..7bedc2fa2 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp @@ -10,7 +10,7 @@ HRESULT CScene_SettingsControl::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); @@ -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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),pNotifyValueChanged->nValue); + swprintf( static_cast(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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue); + swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INMENU].SetText(TempString); } diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp index 48a933e27..3ce414c57 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp @@ -10,7 +10,7 @@ HRESULT CScene_SettingsGraphics::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); @@ -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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),pNotifyValueChanged->nValue); + swprintf( static_cast(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( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue); + swprintf( static_cast(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue); m_SliderA[SLIDER_SETTINGS_INTERFACE_OPACITY].SetText(TempString); } diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp index 526847c7c..f8fb5ae98 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp @@ -26,7 +26,7 @@ int CScene_SettingsOptions::m_iDifficultyTitleSettingA[4]= HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; @@ -274,14 +274,14 @@ HRESULT CScene_SettingsOptions::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot else { app.SetAutosaveTimerTime(); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),pNotifyValueChanged->nValue*15, app.GetString( IDS_MINUTES )); + swprintf( static_cast(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( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue])); + swprintf( static_cast(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]); diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp index da95d084d..1dc837757 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp @@ -10,7 +10,7 @@ HRESULT CScene_SettingsUI::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { WCHAR TempString[256]; - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; @@ -115,7 +115,7 @@ HRESULT CScene_SettingsUI::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyVa // slider is 1 to 3 // is this different from the current value? - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),pNotifyValueChanged->nValue); + swprintf( static_cast(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( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),pNotifyValueChanged->nValue); + swprintf( static_cast(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) diff --git a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp index 378ac147b..32336cb72 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 = (SignEntryScreenInput*)pInitData->pvInitData; + SignEntryScreenInput* initData = static_cast(pInitData->pvInitData); m_sign = initData->sign; CXuiSceneBase::ShowDarkOverlay( initData->iPad, TRUE ); diff --git a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp index ee7066108..b2f2f0a39 100644 --- a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp @@ -26,7 +26,7 @@ WCHAR *CScene_SkinSelect::wchDefaultNamesA[]= //---------------------------------------------------------------------------------- HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 bool bNotInGame=(Minecraft::GetInstance()->level==NULL); m_bIgnoreInput=false; @@ -1021,7 +1021,7 @@ void CScene_SkinSelect::handlePackIndexChanged() DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId); if( ugcSkinIndex == 0 ) { - m_skinIndex = (EDefaultSkins) defaultSkinIndex; + m_skinIndex = static_cast(defaultSkinIndex); } } break; @@ -1311,7 +1311,7 @@ void CScene_SkinSelect::updateClipping() int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CScene_SkinSelect* pScene = (CScene_SkinSelect*)pParam; + CScene_SkinSelect* pScene = static_cast(pParam); #ifdef _XBOX if(result==C4JStorage::EMessage_ResultAccept) { diff --git a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp index f237e7d87..26dd220b7 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 = *(int *)pInitData->pvInitData; + m_iPad = *static_cast(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((int)wCaption.length()); - m_EditDesc.SetCaretPosition((int)wDesc.length()); + m_EditCaption.SetCaretPosition(static_cast(wCaption.length())); + m_EditDesc.SetCaretPosition(static_cast(wDesc.length())); BOOL bHasAllText = /*( wTitle.length()!=0) && */(wCaption.length()!=0) && (wDesc.length()!=0); diff --git a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp index 1d6ac3bf6..5b13a376e 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 = (TeleportMenuInitData *)pInitData->pvInitData; + TeleportMenuInitData *initParam = static_cast(pInitData->pvInitData); m_iPad = initParam->iPad; m_teleportToPlayer = initParam->teleportToPlayer; @@ -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 = (CScene_Teleport *)callbackParam; + CScene_Teleport *scene = static_cast(callbackParam); bool playerFound = false; for(int i = 0; i < scene->m_playersCount; ++i) diff --git a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp index 0369928b4..5eff65e8e 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 = (XuiTextInputParams *)pInitData->pvInitData; + XuiTextInputParams *params = static_cast(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 5a2e67b42..07304e604 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 = (LoadMenuInitData *)pInitData->pvInitData; + m_params = static_cast(pInitData->pvInitData); m_iPad=m_params->iPad; @@ -26,7 +26,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand VOID *pObj; XuiObjectFromHandle( m_SavesSlotList, &pObj ); - m_pSavesSlotList = (CXuiCtrl4JList *)pObj; + m_pSavesSlotList = static_cast(pObj); m_pbImageData=NULL; m_dwImageBytes=0; @@ -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 = (CScene_TransferToXboxOne *) pParam; + CScene_TransferToXboxOne* pClass = static_cast(pParam); pClass->m_bWaitingForWrite=false; return 0; @@ -97,7 +97,7 @@ int CScene_TransferToXboxOne::TMSPPWriteReturned(LPVOID pParam,int iPad,int iUse //---------------------------------------------------------------------------------- int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUserData) { - CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam; + CScene_TransferToXboxOne* pClass = static_cast(pParam); pClass->m_SavesSlotListTimer.SetShow(FALSE); pClass->m_bIgnoreInput=false; @@ -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 = (CScene_TransferToXboxOne *) pParam; + CScene_TransferToXboxOne* pClass = static_cast(pParam); unsigned int uiSlotListFileSlots=*((unsigned int *)pFileData->pbData); pClass->m_pbSlotListFile=pFileData->pbData; pClass->m_uiSlotListFileBytes=pFileData->dwSize; @@ -323,7 +323,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc; - loadingParams->lpParam = (LPVOID)this; + loadingParams->lpParam = static_cast(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 = (CScene_TransferToXboxOne *) lpParameter; + CScene_TransferToXboxOne* pClass = static_cast(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=((PCHAR)pClass->m_pvSaveMem)+i*uiChunkSize; + PCHAR pchData=static_cast(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 = (CScene_TransferToXboxOne*)pParam; + CScene_TransferToXboxOne* pClass = static_cast(pParam); if(bContinue==true) { diff --git a/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp b/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp index 511210999..d99df9985 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=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(pInitData->pvInitData); MapChildControls(); diff --git a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp index 98951d81a..9fe644e06 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 = (Tutorial *)pInitData->pvInitData; + tutorial = static_cast(pInitData->pvInitData); m_iPad = tutorial->getPad(); MapChildControls(); @@ -241,7 +241,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR SetBounds(fWidth, fHeight + heightDiff); m_description.GetBounds(&fWidth,&fHeight); - m_description.SetBounds(fWidth, (float)(contentDims.nPageHeight + heightDiff)); + m_description.SetBounds(fWidth, static_cast(contentDims.nPageHeight + heightDiff)); } return hr; } @@ -298,13 +298,13 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS { wstring openTag(L"{*ICON*}"); wstring closeTag(L"{*/ICON*}"); - int iconTagStartPos = (int)temp.find(openTag); - int iconStartPos = iconTagStartPos + (int)openTag.length(); - if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) + int iconTagStartPos = static_cast(temp.find(openTag)); + int iconStartPos = iconTagStartPos + static_cast(openTag.length()); + if( iconTagStartPos > 0 && iconStartPos < static_cast(temp.length()) ) { - int iconEndPos = (int)temp.find( closeTag, iconStartPos ); + int iconEndPos = static_cast(temp.find(closeTag, iconStartPos)); - if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) + if(iconEndPos > iconStartPos && iconEndPos < static_cast(temp.length()) ) { wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); @@ -443,13 +443,13 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc) wstring openTag(L"{*IMAGE*}"); wstring closeTag(L"{*/IMAGE*}"); - int imageTagStartPos = (int)desc.find(openTag); - int imageStartPos = imageTagStartPos + (int)openTag.length(); - if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) + int imageTagStartPos = static_cast(desc.find(openTag)); + int imageStartPos = imageTagStartPos + static_cast(openTag.length()); + if( imageTagStartPos > 0 && imageStartPos < static_cast(desc.length()) ) { - int imageEndPos = (int)desc.find( closeTag, imageStartPos ); + int imageEndPos = static_cast(desc.find(closeTag, imageStartPos)); - if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) + if(imageEndPos > imageStartPos && imageEndPos < static_cast(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, (void **) &pThis); + hr = XuiObjectFromHandle(hObj, static_cast(&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, (void **) &pThis); + hr = XuiObjectFromHandle(hObj, static_cast(&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 61b818a07..9aee38882 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=*(int *)pInitData->pvInitData; + m_iPad=*static_cast(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 = (CXuiCheckbox *)m_DebugCheckboxDataA[iCheckboxIndex].pvData; + pCheckbox = static_cast(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 = (CXuiControl *)m_DebugButtonDataA[iButtonIndex].pvData; + pButton = static_cast(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); pCheckbox->SetCheck( (uiDebugBitmask&(1<(m_DebugCheckboxDataA[i].pvData); uiDebugBitmask|=pCheckbox->IsChecked()?(1<x - x; double za = spawnPos->z - z; delete spawnPos; - yRot = (int)yRot % 360; + yRot = static_cast(yRot) % 360; rott = -((yRot - 90) * PI / 180 - atan2(za, xa)); if (!level->dimension->isNaturalDimension()) { @@ -80,7 +80,7 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double // 4J Stu - We share data with another texture if(m_dataTexture != NULL) { - int newFrame = (int) (((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = static_cast(((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 = (int) (((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size(); + int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size(); while (newFrame < 0) { newFrame = (newFrame + frames->size()) % frames->size(); diff --git a/Minecraft.Client/CreeperRenderer.cpp b/Minecraft.Client/CreeperRenderer.cpp index a9d16314f..bcec52150 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 ((int) (step * 10) % 2 == 0) return 0; + if (static_cast(step * 10) % 2 == 0) return 0; - 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 + 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 if (_a < 0) _a = 0; if (_a > 255) _a = 255; diff --git a/Minecraft.Client/CritParticle2.cpp b/Minecraft.Client/CritParticle2.cpp index 363e8f08d..fe64b91e4 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 = (float) (Math::random() * 0.3f + 0.6f); + rCol = gCol = bCol = static_cast(Math::random() * 0.3f + 0.6f); size *= 0.75f; size *= scale; oSize = size; - lifetime = (int) (6 / (Math::random() * 0.8 + 0.6)); + lifetime = static_cast(6 / (Math::random() * 0.8 + 0.6)); lifetime *= scale; noPhysics = false; diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index 553128d96..752b1cc27 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -36,7 +36,7 @@ DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")) { - DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"); + DLCLocalisationFile *localisationFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")); m_stringTable = localisationFile->getStringTable(); } @@ -51,7 +51,7 @@ void DLCTexturePack::loadIcon() { if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"icon.png")) { - DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png"); + DLCTextureFile *textureFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"icon.png")); m_iconData = textureFile->getData(m_iconSize); } else @@ -64,7 +64,7 @@ void DLCTexturePack::loadComparison() { if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_Texture, L"comparison.png")) { - DLCTextureFile *textureFile = (DLCTextureFile *)m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png"); + DLCTextureFile *textureFile = static_cast(m_dlcInfoPack->getFile(DLCManager::e_DLCType_Texture, L"comparison.png")); m_comparisonData = textureFile->getData(m_comparisonSize); } } @@ -166,7 +166,7 @@ void DLCTexturePack::loadColourTable() // Load the game colours if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) { - DLCColourTableFile *colourFile = (DLCColourTableFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col"); + DLCColourTableFile *colourFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col")); m_colourTable = colourFile->getColourTable(); m_bUsingDefaultColourTable = false; } @@ -274,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 = (DLCTexturePack *)pParam; + DLCTexturePack *texturePack = static_cast(pParam); texturePack->m_bLoadingData = false; if(dwErr!=ERROR_SUCCESS) { @@ -347,7 +347,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); for(int i = 0; i < gameRulesCount; ++i) { - DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); + DLCGameRulesHeader *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); if (!dlcFile->getGrfPath().empty()) { @@ -469,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 = (DLCAudioFile *) pack->getFile(DLCManager::e_DLCType_Audio, 0); + DLCAudioFile *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_Audio, 0)); texturePack->setHasAudio(true); // init the streaming sound ids for this texture pack int iOverworldStart, iNetherStart, iEndStart; @@ -589,7 +589,7 @@ wstring DLCTexturePack::getXuiRootPath() wstring path = L""; 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"); + DLCUIDataFile *dataFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")); DWORD dwSize = 0; PBYTE pbData = dataFile->getData(dwSize); diff --git a/Minecraft.Client/DragonBreathParticle.cpp b/Minecraft.Client/DragonBreathParticle.cpp index 0d0f75f33..3fd90806b 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 = (int) (20 / (Math::random() * 0.8 + 0.2)); - lifetime = (int) (lifetime * scale); + lifetime = static_cast(20 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(lifetime * scale); noPhysics = false; m_bHasHitGround = false; diff --git a/Minecraft.Client/DragonModel.cpp b/Minecraft.Client/DragonModel.cpp index 9e0499a9f..f1f36743a 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 + (float) (dragon->getHeadPartYOffset(i, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J replaced "p[1] - start[1]" with call to getHeadPartYOffset + 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->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 = (float) (dragon->getHeadPartYOffset(6, start, p)) * PI / 180.0f * rotScale * 5.0f; // 4J Added + head->xRot = static_cast(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 + (float) (p[1] - start[1]) * PI / 180 * rotScale * 5; + neck->xRot = rr + static_cast(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 (float) d; + return static_cast(d); } \ No newline at end of file diff --git a/Minecraft.Client/DripParticle.cpp b/Minecraft.Client/DripParticle.cpp index 9463976e6..d7202b078 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 = (int) (64 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(64 / (Math::random() * 0.8 + 0.2)); xd = yd = zd = 0; } diff --git a/Minecraft.Client/Durango/ApplicationView.cpp b/Minecraft.Client/Durango/ApplicationView.cpp index 2af864960..6c1959381 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 = *((XALLOC_ATTRIBUTES *)&dwAttributes); + attr = *static_cast(&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 / (float)qwTicksPerSec.QuadPart; + float fSecsPerTick = 1.0f / static_cast(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 * ((FLOAT)(qwDeltaTime.QuadPart)); + fElapsedTime = fSecsPerTick * static_cast(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 81b9d7cf1..463756bc9 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=(eMCLang)app.get_eMCLang(wchLocaleName); + eMCLang eLang=static_cast(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 59ac8ba0b..e58a57c12 100644 --- a/Minecraft.Client/Durango/Durango_App.cpp +++ b/Minecraft.Client/Durango/Durango_App.cpp @@ -221,7 +221,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D if(*pdwBytes!=0) { DWORD dwBytesRead; - PBYTE pbImageData=(PBYTE)malloc(*pdwBytes); + PBYTE pbImageData=static_cast(malloc(*pdwBytes)); if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,NULL)==FALSE) { @@ -299,7 +299,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); // Reset the autosave time app.SetAutosaveTimerTime(); @@ -454,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=(C4JStorage::PTMSPP_FILEDATA)lpvData; + C4JStorage::PTMSPP_FILEDATA pFileData=static_cast(lpvData); - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast(pParam); if(pFileData) { @@ -486,7 +486,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast(iUserData)); return 0; } @@ -555,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 = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast(pParam); app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); if(lpvData!=NULL) { - vector *pvTmsFileDetails=(vector *)lpvData; + vector *pvTmsFileDetails=static_cast *>(lpvData); if(pvTmsFileDetails->size()>0) { @@ -578,7 +578,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, } } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast(iUserData)); return 0; } @@ -586,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= (C4JStorage::PTMSPP_FILEDATA)lpvData; - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + C4JStorage::PTMSPP_FILEDATA pFileData= static_cast(lpvData); + CConsoleMinecraftApp* pClass = static_cast(pParam); #ifdef WRITE_DLCINFO if(0) @@ -698,14 +698,14 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i } // change the state to the next action - pClass->SetTMSAction(iPad,(eTMSAction)iUserData); + pClass->SetTMSAction(iPad,static_cast(iUserData)); return 0; } void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage::ESaveIncompleteType saveIncompleteType) { - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast(pParam); if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage ) @@ -740,7 +740,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; + CConsoleMinecraftApp* pClass = static_cast(pParam); switch(result) { diff --git a/Minecraft.Client/Durango/Durango_App.h b/Minecraft.Client/Durango/Durango_App.h index 6e0212329..4ae2a020c 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=(eTMSAction)0, bool bCallback=false) {} + virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false) {} // TMS++ void TMSPP_RetrieveFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,eTMSAction NextAction); diff --git a/Minecraft.Client/Durango/Durango_Minecraft.cpp b/Minecraft.Client/Durango/Durango_Minecraft.cpp index a563c9f3e..b8487aec9 100644 --- a/Minecraft.Client/Durango/Durango_Minecraft.cpp +++ b/Minecraft.Client/Durango/Durango_Minecraft.cpp @@ -582,7 +582,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,(LPVOID)&app, app.UpdateProductId,SERVICE_CONFIG_ID,TITLE_PRODUCT_ID); + 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.SetMaxSaves(99); @@ -595,21 +595,21 @@ void oldWinMainInit() app.GAME_DEFINED_PROFILE_DATA_BYTES*XUSER_MAX_COUNT, &app.uiGameDefinedDataChangedBitmask); - StorageManager.SetDefaultImages((PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); + StorageManager.SetDefaultImages(static_cast(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, (LPVOID)&app); + StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, static_cast(&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,(LPVOID)&app); - StorageManager.SetOptionsDataCallback(&CConsoleMinecraftApp::OptionsDataCallback,(LPVOID)&app); + StorageManager.SetDefaultOptionsCallback(&CConsoleMinecraftApp::DefaultOptionsCallback,static_cast(&app)); + StorageManager.SetOptionsDataCallback(&CConsoleMinecraftApp::OptionsDataCallback,static_cast(&app)); // Set a callback to deal with old profile versions needing updated to new versions - StorageManager.SetOldProfileVersionCallback(&CConsoleMinecraftApp::OldProfileVersionCallback,(LPVOID)&app); + StorageManager.SetOldProfileVersionCallback(&CConsoleMinecraftApp::OldProfileVersionCallback,static_cast(&app)); g_NetworkManager.Initialise(); diff --git a/Minecraft.Client/Durango/Durango_UIController.cpp b/Minecraft.Client/Durango/Durango_UIController.cpp index 446ab87e3..7c9313e61 100644 --- a/Minecraft.Client/Durango/Durango_UIController.cpp +++ b/Minecraft.Client/Durango/Durango_UIController.cpp @@ -169,7 +169,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId) ID3D11ShaderResourceView *tex = RenderManager.TextureGetTexture(textureId); ID3D11Resource *resource; tex->GetResource(&resource); - ID3D11Texture2D *tex2d = (ID3D11Texture2D *)resource; + ID3D11Texture2D *tex2d = static_cast(resource); D3D11_TEXTURE2D_DESC desc; tex2d->GetDesc(&desc); GDrawTexture *gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl index a60fa520c..11a197e67 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl @@ -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 != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(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; @@ -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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(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 = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(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 = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(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; diff --git a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp index 46b046068..e1d056a7d 100644 --- a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -428,7 +428,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationDisplayName->Data(), - LeaderboardManager::filterNames[ (int) filter ].c_str(), + LeaderboardManager::filterNames[ static_cast(filter) ].c_str(), lastResult->Rows->Size, lastResult->TotalRowCount, readCount ); @@ -480,10 +480,10 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationGamertag->Data(); m_scores[index].m_rank = row->Rank; - m_scores[index].m_uid = PlayerUID(row->XboxUserId->Data()); + m_scores[index].m_uid = static_cast(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 = (unsigned long) _fromString(row->Values->GetAt(0)->Data()); + m_scores[index].m_totalScore = static_cast(_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(PlayerUID(lastResult->Rows->GetAt(i)->XboxUserId->Data())); + xuids.push_back(static_cast(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 = (DurangoLeaderboardManager *)param; + DurangoLeaderboardManager *dlm = static_cast(param); app.DebugPrintf("[LeaderboardManager] GetProfilesCallback, profiles.size() == %d.\n", profiles.size()); diff --git a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp index dd07f3e96..18f4328c5 100644 --- a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp +++ b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp @@ -103,5 +103,5 @@ void GameProgress::updatePlayer(int iPad) float GameProgress::calcGameProgress(int achievementsUnlocked) { - return (float) achievementsUnlocked / 0.60f; + return static_cast(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 80b4e10a3..f81a0f1f1 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][(int)Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage+1]; + int m_chatVoicePacketsStatistic[2][static_cast(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 8d502d232..a054a716d 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp @@ -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(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(static_cast(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(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(static_cast(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); // TODO - could this add fail? if(AddRoomSyncPlayer( pPlayer, 0, userIndex)) @@ -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. - ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); + static_cast(GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); } else { - ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); + static_cast(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 = (int)(customValue->GetNumber()) & 255; + *smallId = static_cast(customValue->GetNumber()) & 255; } catch (Platform::COMException^ ex) { @@ -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 = (BYTE)(customValue->GetNumber()); + smallId = static_cast(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 = (BYTE)(customValue->GetNumber()); + smallIdMember = static_cast(customValue->GetNumber()); } catch (Platform::COMException^ ex) { @@ -1830,7 +1830,7 @@ int DQRNetworkManager::GetSessionIndexAndSmallIdForHost(unsigned char *smallId) } if( smallIdMember > 255 ) { - *smallId = (BYTE)(smallIdMember); + *smallId = static_cast(smallIdMember); return i; } } @@ -1877,7 +1877,7 @@ Platform::String^ DQRNetworkManager::GetNextSmallIdAsJsonString() int DQRNetworkManager::_HostGameThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(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(PlayerUID(user->XboxUserId->Data())); + pPlayer->SetUID(static_cast(user->XboxUserId->Data())); AddRoomSyncPlayer( pPlayer, localSessionAddress, i); @@ -2208,7 +2208,7 @@ int DQRNetworkManager::HostGameThreadProc() int DQRNetworkManager::_LeaveRoomThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(lpParameter); return pDQR->LeaveRoomThreadProc(); } @@ -2311,7 +2311,7 @@ int DQRNetworkManager::LeaveRoomThreadProc() int DQRNetworkManager::_TidyUpJoinThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(lpParameter); return pDQR->TidyUpJoinThreadProc(); } @@ -2416,7 +2416,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc() int DQRNetworkManager::_UpdateCustomSessionDataThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(lpParameter); return pDQR->UpdateCustomSessionDataThreadProc(); } @@ -2491,7 +2491,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc() int DQRNetworkManager::_CheckInviteThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(lpParameter); return pDQR->CheckInviteThreadProc(); } @@ -3026,8 +3026,8 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player) void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Services::Social::XboxUserProfile^ profile) { - DQRNetworkManager *dqnm = (DQRNetworkManager *)pParam; - dqnm->SetDisplayName(PlayerUID(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); + DQRNetworkManager *dqnm = static_cast(pParam); + dqnm->SetDisplayName(static_cast(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); } // Set player display name diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp index 3a14a2d59..86d37a6e0 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -71,7 +71,7 @@ void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchR int DQRNetworkManager::_GetFriendsThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(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] = PlayerUID(nameResolveVector[i]->GetAt(j)->XboxUserId->Data()); + m_sessionSearchResults[i].m_playerXuids[j] = static_cast(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(((GameSessionData *)gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends); + friendsOfFriends = app.GetGameHostOption(static_cast(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, (unsigned char *)gameSessionData, sizeof(GameSessionData) ); + base64_decode( customValueString, static_cast(gameSessionData), sizeof(GameSessionData) ); return true; } } diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp index 9232d0959..9494683d4 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp @@ -113,7 +113,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, case DQRConnectionInfo::ConnectionState_InternalAssignSmallId2: case DQRConnectionInfo::ConnectionState_InternalAssignSmallId3: { - int channel = ((int)connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0; + int channel = static_cast(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(PlayerUID(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); + pPlayer->SetUID(static_cast(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); HostGamertagResolveDetails *resolveDetails = new HostGamertagResolveDetails(); resolveDetails->m_pPlayer = pPlayer; @@ -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 = (unsigned char *)malloc(8191 + 2); + unsigned char *tempSendBuffer = static_cast(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 = (int)(dataEnd - data); + int bytesToSend = static_cast(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 c985a191f..29daa23e6 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 = (unsigned char *)malloc(rtsMessage.m_dataSize); + rtsMessage.m_pucData = static_cast(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 = (int)(pEndByte - pNextByte); + int bytesInBuffer = static_cast(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 = (DQRNetworkManager *)lpParameter; + DQRNetworkManager *pDQR = static_cast(lpParameter); return pDQR->RTSDoWorkThread(); } @@ -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 = (unsigned char *)malloc(dataSize); + message.m_pucData = static_cast(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 e2d82a902..a8140764c 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( ((int)chatUser->ParticipantType) & ((int)Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) + if( static_cast(chatUser->ParticipantType) & static_cast(Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) { return true; } diff --git a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp index fd2181df9..bfb3c9a84 100644 --- a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp @@ -14,12 +14,12 @@ unsigned char NetworkPlayerDurango::GetSmallId() void NetworkPlayerDurango::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority) { - m_dqrPlayer->SendData( ((NetworkPlayerDurango *)player)->m_dqrPlayer, pvData, dataSize ); + m_dqrPlayer->SendData( static_cast(player)->m_dqrPlayer, pvData, dataSize ); } bool NetworkPlayerDurango::IsSameSystem(INetworkPlayer *player) { - return m_dqrPlayer->IsSameSystem(((NetworkPlayerDurango *)player)->m_dqrPlayer); + return m_dqrPlayer->IsSameSystem(static_cast(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 753a71aca..4e1a7e611 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 != (int)Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty ) + if( ex->HResult != static_cast(Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty) ) { // LogCommentWithError( L"GetPartyView failed", ex->HResult ); } @@ -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(PlayerUID(eventArgs->RemovedMembers->GetAt(i)->Data())); + DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(static_cast(eventArgs->RemovedMembers->GetAt(i)->Data())); if( player ) { if( player->IsLocal() ) @@ -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( PlayerUID(player->XboxUserId->Data()) ) == NULL ) + if( m_pDQRNet->GetPlayerByXuid( static_cast(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( PlayerUID(memberXUID->Data()) ) == NULL ) ) // Or we're fully in, and this player isn't in it + ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast(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 (double)deltaTime / (double)tickPerSecond; + return static_cast(deltaTime) / static_cast(tickPerSecond); } \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp index 925a37a8e..7171895a1 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 = (NetworkPlayerDurango *)addNetworkPlayer(pDQRPlayer); + NetworkPlayerDurango *networkPlayer = static_cast(addNetworkPlayer(pDQRPlayer)); // Request full display name for this player m_pDQRNet->RequestDisplayName(pDQRPlayer); @@ -628,7 +628,7 @@ void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer int CPlatformNetworkManagerDurango::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; + INetworkPlayer *pNetworkPlayer = static_cast(lpParam); Socket *socket = pNetworkPlayer->GetSocket(); @@ -794,7 +794,7 @@ vector *CPlatformNetworkManagerDurango::GetSessionList(int vector *filteredList = new vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { - GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData; + GameSessionData *gameSessionData = static_cast(m_pSearchResults[i].m_extData); if( ( gameSessionData->netVersion == MINECRAFT_NET_VERSION ) && ( gameSessionData->isReadyToJoin ) ) { diff --git a/Minecraft.Client/Durango/Network/base64.cpp b/Minecraft.Client/Durango/Network/base64.cpp index c5af745c4..c916725f1 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++] = (unsigned char)(encoded_string->Data()[in_]); + char_array_4[i++] = static_cast(encoded_string->Data()[in_]); in_++; if (i ==4) { for (i = 0; i <4; i++) { - char_array_4[i] = (unsigned char )base64_chars.find(char_array_4[i]); + char_array_4[i] = static_cast(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] = (unsigned char )base64_chars.find(char_array_4[j]); + char_array_4[j] = static_cast(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 2386a3484..25ca46b28 100644 --- a/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp @@ -968,7 +968,7 @@ bool CDurangoTelemetryManager::RecordUnBanLevel(int iPad) DurangoStats *CDurangoTelemetryManager::durangoStats() { - return (DurangoStats*) GenericStats::getInstance(); + return static_cast(GenericStats::getInstance()); } wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) diff --git a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp index fc5aed08a..dea8c1859 100644 --- a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp @@ -69,8 +69,8 @@ VOID XMLParser::FillBuffer() } m_dwCharsConsumed += NChars; - __int64 iProgress = m_dwCharsTotal ? (( (__int64)m_dwCharsConsumed * 1000 ) / (__int64)m_dwCharsTotal) : 0; - m_pISAXCallback->SetParseProgress( (DWORD)iProgress ); + __int64 iProgress = m_dwCharsTotal ? (( static_cast<__int64>(m_dwCharsConsumed) * 1000 ) / static_cast<__int64>(m_dwCharsTotal)) : 0; + m_pISAXCallback->SetParseProgress( static_cast(iProgress) ); m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars + 1] = '\0'; @@ -198,7 +198,7 @@ HRESULT XMLParser::ConvertEscape() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); + EntityRefLen = static_cast(m_pWritePtr - pEntityRefVal); m_pWritePtr = pEntityRefVal; if ( EntityRefLen == 0 ) @@ -497,8 +497,8 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, - (UINT) ( m_pWritePtr - pEntityRefVal ) ) ) ) + if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, + static_cast(m_pWritePtr - pEntityRefVal)) ) ) return E_ABORT; if( FAILED( hr = ConsumeSpace() ) ) @@ -541,7 +541,7 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); + EntityRefLen = static_cast(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 = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName ); + Attributes[ NumAttrs ].NameLen = static_cast(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 = (UINT)( m_pWritePtr - - Attributes[ NumAttrs ].strValue ); + Attributes[ NumAttrs ].ValueLen = static_cast(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, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; } } - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; @@ -782,9 +782,9 @@ HRESULT XMLParser::MainParseLoop() { if( FAILED( AdvanceCharacter( TRUE ) ) ) { - if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) + if ( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -798,9 +798,9 @@ HRESULT XMLParser::MainParseLoop() if( m_Ch == '<' ) { - if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) + if( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -837,8 +837,8 @@ HRESULT XMLParser::MainParseLoop() { if( !bWhiteSpaceOnly ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, - ( UINT ) ( m_pWritePtr - m_pWriteBuf ), + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, + static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) { return E_ABORT; @@ -893,7 +893,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { LARGE_INTEGER iFileSize; GetFileSizeEx( m_hFile, &iFileSize ); - m_dwCharsTotal = (DWORD)iFileSize.QuadPart; + m_dwCharsTotal = static_cast(iFileSize.QuadPart); m_dwCharsConsumed = 0; hr = MainParseLoop(); } diff --git a/Minecraft.Client/EchantmentTableParticle.cpp b/Minecraft.Client/EchantmentTableParticle.cpp index 5af7ef365..95bd3dbc7 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 = (int) (Math::random() * 10) + 30; + lifetime = static_cast(Math::random() * 10) + 30; noPhysics = true; - setMiscTex( (int) (Math::random() * 26 + 1 + 14 * 16) ); + setMiscTex( static_cast(Math::random() * 26 + 1 + 14 * 16) ); } int EchantmentTableParticle::getLightColor(float a) { int br = Particle::getLightColor(a); - float pos = age / (float) lifetime; + float pos = age / static_cast(lifetime); pos = pos * pos; pos = pos * pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += (int) (pos * 15 * 16); + br2 += static_cast(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 / (float) lifetime; + float pos = age / static_cast(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 / (float) lifetime; + float pos = age / static_cast(lifetime); pos = 1 - pos; diff --git a/Minecraft.Client/EnchantTableRenderer.cpp b/Minecraft.Client/EnchantTableRenderer.cpp index ff539fcd5..e188529b9 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((float) x + 0.5f, (float) y + 12 / 16.0f, (float) z + 0.5f); + glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 12 / 16.0f, static_cast(z) + 0.5f); float tt = table->time + a; diff --git a/Minecraft.Client/EnderChestRenderer.cpp b/Minecraft.Client/EnderChestRenderer.cpp index 52fdede94..71804a5a1 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((float) x, (float) y + 1, (float) z + 1); + glTranslatef(static_cast(x), static_cast(y) + 1, static_cast(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 d2eba5e83..2dde12467 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 4119e5b9f..a0d66cb3e 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 = (DragonModel *) model; + dragonModel = static_cast(model); setArmor(model); // TODO: Make second constructor that assigns this. } @@ -96,9 +96,9 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do float hh = sin(tt * 0.2f) / 2 + 0.5f; hh = (hh * hh + hh) * 0.2f; - 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 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 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((float) x, (float) y + 2, (float) z); + glTranslatef(static_cast(x), static_cast(y) + 2, static_cast(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, (int) (255 * (1 - overDrive))); + t->color(0xffffff, static_cast(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 3889bf920..ee1a9c356 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 = (int) (Math::random()*10) + 40; + lifetime = static_cast(Math::random() * 10) + 40; noPhysics = true; - setMiscTex((int)(Math::random()*8)); + setMiscTex(static_cast(Math::random() * 8)); } void EnderParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / (float) lifetime; + float s = (age + a) / static_cast(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/(float)lifetime; + float pos = age/static_cast(lifetime); pos = pos*pos; pos = pos*pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += (int) (pos * 15 * 16); + br2 += static_cast(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/(float)lifetime; + float pos = age/static_cast(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/(float)lifetime; + float pos = age/static_cast(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 f6e5220a4..fc2b8952d 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 = (EndermanModel *) MobRenderer::model; + model = static_cast(MobRenderer::model); this->setArmor(model); } diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index 5bb98eadb..abfc2993e 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -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 = (float)(direction * 90 + 180); + playerRotY = static_cast(direction * 90 + 180); playerRotX = 0; } } else { diff --git a/Minecraft.Client/EntityRenderer.cpp b/Minecraft.Client/EntityRenderer.cpp index 9aa4ad7d9..4ead9f4a9 100644 --- a/Minecraft.Client/EntityRenderer.cpp +++ b/Minecraft.Client/EntityRenderer.cpp @@ -89,7 +89,7 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl Icon *fire2 = Tile::fire->getTextureLayer(1); glPushMatrix(); - glTranslatef((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); float s = e->bbWidth * 1.4f; glScalef(s, s, s); @@ -102,11 +102,11 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl float xo = 0.0f; float h = e->bbHeight / s; - float yo = (float) (e->y - e->bb->y0); + float yo = static_cast(e->y - e->bb->y0); glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0); - glTranslatef(0, 0, -0.3f + ((int) h) * 0.02f); + glTranslatef(0, 0, -0.3f + static_cast(h) * 0.02f); glColor4f(1, 1, 1, 1); float zo = 0; int ss = 0; @@ -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, (float) a); + t->color(1.0f, 1.0f, 1.0f, static_cast(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 = (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); + 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); // u0 = 0; // v0 = 0; // u1 = 1; // v1 = 1; - 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)); + 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)); } 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((float)xo, (float)yo, (float)zo); + t->offset(static_cast(xo), static_cast(yo), static_cast(zo)); t->normal(0, 0, -1); - 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(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->normal(0, 0, 1); - 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(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->normal(0, -1, 0); - 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(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->normal(0, 1, 0); - 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(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->normal(-1, 0, 0); - 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(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->normal(1, 0, 0); - 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->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->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((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->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->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 = (float) ((1 - dist / (16.0f * 16.0f)) * shadowStrength); + float pow = static_cast((1 - dist / (16.0f * 16.0f)) * shadowStrength); if (pow > 0) { renderShadow(entity, x, y, z, pow, a); diff --git a/Minecraft.Client/ExperienceOrbRenderer.cpp b/Minecraft.Client/ExperienceOrbRenderer.cpp index c0eae7560..691efadec 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 = (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 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 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 fa950a03a..e9d4687bc 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+(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; + 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; //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 = (int)(16/(random->nextFloat()*0.8+0.2))+2; + lifetime = static_cast(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 = (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 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 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 29865e400..5b620f052 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -309,7 +309,7 @@ void IQNet::ClientJoinGame() for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - m_player[i].m_smallId = (BYTE)i; + m_player[i].m_smallId = static_cast(i); m_player[i].m_isRemote = true; m_player[i].m_isHostPlayer = false; m_player[i].m_gamertag[0] = 0; @@ -323,7 +323,7 @@ void IQNet::EndGame() s_playerCount = 1; for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - m_player[i].m_smallId = (BYTE)i; + m_player[i].m_smallId = static_cast(i); m_player[i].m_isRemote = false; m_player[i].m_isHostPlayer = false; m_player[i].m_gamertag[0] = 0; @@ -505,7 +505,7 @@ void C_4JProfile::Initialise(DWORD dwTitleID, ZeroMemory(profileData[i], sizeof(byte) * iGameDefinedDataSizeX4 / 4); // Set some sane initial values! - GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)profileData[i]; + GAME_SETTINGS* pGameSettings = static_cast(profileData[i]); pGameSettings->ucMenuSensitivity = 100; //eGameSetting_Sensitivity_InMenu pGameSettings->ucInterfaceOpacity = 80; //eGameSetting_Sensitivity_InMenu pGameSettings->usBitmaskValues |= 0x0200; //eGameSetting_DisplaySplitscreenGamertags - on diff --git a/Minecraft.Client/FallingTileRenderer.cpp b/Minecraft.Client/FallingTileRenderer.cpp index 2d9f5daea..c46b83c5c 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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((AnvilTile *) tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); + tileRenderer->tesselateAnvilInWorld(static_cast(tt), Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); t->offset(0, 0, 0); t->end(); } diff --git a/Minecraft.Client/FireballRenderer.cpp b/Minecraft.Client/FireballRenderer.cpp index 3b1ab924f..24e59ff48 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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), (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->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->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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 = (float) (e->y - e->bb->y0); + float yo = static_cast(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), (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->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->end(); glPopMatrix(); diff --git a/Minecraft.Client/FireworksParticles.cpp b/Minecraft.Client/FireworksParticles.cpp index fd19b0114..9fdaebb92 100644 --- a/Minecraft.Client/FireworksParticles.cpp +++ b/Minecraft.Client/FireworksParticles.cpp @@ -17,7 +17,7 @@ FireworksParticles::FireworksStarter::FireworksStarter(Level *level, double x, d if (infoTag != NULL) { - explosions = (ListTag *)infoTag->getList(FireworksItem::TAG_EXPLOSIONS)->copy(); + explosions = static_cast *>(infoTag->getList(FireworksItem::TAG_EXPLOSIONS)->copy()); if (explosions->size() == 0) { explosions = NULL; @@ -186,9 +186,9 @@ void FireworksParticles::FireworksStarter::tick() } { int rgb = colors[0]; - 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 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 = shared_ptr(new FireworksParticles::FireworksOverlayParticle(level, x, y, z)); fireworksOverlayParticle->setColor(r, g, b); fireworksOverlayParticle->setAlpha(0.99f); // 4J added @@ -365,18 +365,18 @@ void FireworksParticles::FireworksSparkParticle::setFlicker(bool flicker) void FireworksParticles::FireworksSparkParticle::setColor(int rgb) { - 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 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 scale = 1.0f; Particle::setColor(r * scale, g * scale, b * scale); } void FireworksParticles::FireworksSparkParticle::setFadeColor(int rgb) { - fadeR = (float) ((rgb & 0xff0000) >> 16) / 255.0f; - fadeG = (float) ((rgb & 0x00ff00) >> 8) / 255.0f; - fadeB = (float) ((rgb & 0x0000ff) >> 0) / 255.0f; + fadeR = static_cast((rgb & 0xff0000) >> 16) / 255.0f; + fadeG = static_cast((rgb & 0x00ff00) >> 8) / 255.0f; + fadeB = static_cast((rgb & 0x0000ff) >> 0) / 255.0f; hasFade = true; } @@ -407,7 +407,7 @@ void FireworksParticles::FireworksSparkParticle::tick() if (age++ >= lifetime) remove(); if (age > lifetime / 2) { - setAlpha(1.0f - (((float) age - lifetime / 2) / (float) lifetime)); + setAlpha(1.0f - ((static_cast(age) - lifetime / 2) / static_cast(lifetime))); if (hasFade) { @@ -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(((float) age + a - 1.0f) * .25f * PI); - alpha = 0.6f - ((float) age + a - 1.0f) * .25f * .5f; + 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 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 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); t->color(rCol, gCol, bCol, alpha); diff --git a/Minecraft.Client/FishingHookRenderer.cpp b/Minecraft.Client/FishingHookRenderer.cpp index 9d60a9ace..6a55468db 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); glEnable(GL_RESCALE_NORMAL); glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f); int xi = 1; @@ -39,10 +39,10 @@ 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), (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->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->end(); glDisable(GL_RESCALE_NORMAL); @@ -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 = (float) (xp - xh); - double ya = (float) (yp - yh); - double za = (float) (zp - zh); + double xa = static_cast(xp - xh); + double ya = static_cast(yp - yh); + double za = static_cast(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 / (float) steps; - t->vertex((float)(x + xa * aa), (float)( y + ya * (aa * aa + aa) * 0.5 + 4 / 16.0f), (float)( z + za * aa)); + 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)); } t->end(); glEnable(GL_LIGHTING); diff --git a/Minecraft.Client/FlameParticle.cpp b/Minecraft.Client/FlameParticle.cpp index eb12dbfda..a242f7147 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 = (int)(8/(Math::random()*0.8+0.2))+4; + lifetime = static_cast(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) / (float) lifetime; + float s = (age + a) / static_cast(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 += (int) (l * 15 * 16); + br1 += static_cast(l * 15 * 16); if (br1 > 15 * 16) br1 = 15 * 16; return br1 | br2 << 16; } diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index 8a90711bf..cb2f56324 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -167,7 +167,7 @@ void Font::renderCharacter(wchar_t c) t->end(); #endif - xPos += (float) charWidths[c]; + xPos += static_cast(charWidths[c]); } void Font::drawShadow(const wstring& str, int x, int y, int color) @@ -201,7 +201,7 @@ void Font::draw(const wstring &str, bool dropShadow) bool noise = false; wstring cleanStr = sanitize(str); - for (int i = 0; i < (int)cleanStr.length(); ++i) + for (int i = 0; i < static_cast(cleanStr.length()); ++i) { // Map character wchar_t c = cleanStr.at(i); @@ -467,7 +467,7 @@ void Font::setBidirectional(bool bidirectional) bool Font::AllCharactersValid(const wstring &str) { - for (int i = 0; i < (int)str.length(); ++i) + for (int i = 0; i < static_cast(str.length()); ++i) { wchar_t c = str.at(i); diff --git a/Minecraft.Client/FootstepParticle.cpp b/Minecraft.Client/FootstepParticle.cpp index 300575eb1..b2bfc9893 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 = (float) (x - xOff); - float yy = (float) (y - yOff); - float zz = (float) (z - zOff); + float xx = static_cast(x - xOff); + float yy = static_cast(y - yOff); + float zz = static_cast(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), (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->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->end(); glDisable(GL_BLEND); diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index 390f114de..be2b5f0c1 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -230,7 +230,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst darkenWorldAmountO = darkenWorldAmount; if (BossMobGuiInfo::darkenWorld) { - darkenWorldAmount += 1.0f / ((float) SharedConstants::TICKS_PER_SECOND * 1); + darkenWorldAmount += 1.0f / (static_cast(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 / ((float) SharedConstants::TICKS_PER_SECOND * 4); + darkenWorldAmount -= 1.0f / (static_cast(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 @@ -475,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((float)direction * 90,0.0f, 1.0f, 0.0f); + glRotatef(static_cast(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); @@ -493,7 +493,7 @@ void GameRenderer::moveCameraToPlayer(float a) float rotationY = thirdRotationO + (thirdRotation - thirdRotationO) * a; float xRot = thirdTiltO + (thirdTilt - thirdTiltO) * a; - glTranslatef(0, 0, (float) -cameraDist); + glTranslatef(0, 0, static_cast(-cameraDist)); glRotatef(xRot, 1, 0, 0); glRotatef(rotationY, 0, 1, 0); } @@ -522,9 +522,9 @@ void GameRenderer::moveCameraToPlayer(float a) for (int i = 0; i < 8; i++) { - float xo = (float)((i & 1) * 2 - 1); - float yo = (float)(((i >> 1) & 1) * 2 - 1); - float zo = (float)(((i >> 2) & 1) * 2 - 1); + 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); xo *= 0.1f; yo *= 0.1f; @@ -540,7 +540,7 @@ void GameRenderer::moveCameraToPlayer(float a) } } - glTranslatef(0, 0, (float) -cameraDist); + glTranslatef(0, 0, static_cast(-cameraDist)); } } else @@ -595,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 / (float) mc->height; + aspect = mc->width / static_cast(mc->height); fov = getFov(a, applyEffects); if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP ) || @@ -614,7 +614,7 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool appl void GameRenderer::setupCamera(float a, int eye) { - renderDistance = (float)(16 * 16 >> (mc->options->viewDistance)); + renderDistance = static_cast(16 * 16 >> (mc->options->viewDistance)); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -627,7 +627,7 @@ void GameRenderer::setupCamera(float a, int eye) if (zoom != 1) { - glTranslatef((float) zoom_x, (float) -zoom_y, 0); + glTranslatef(static_cast(zoom_x), static_cast(-zoom_y), 0); glScaled(zoom, zoom, 1); } gluPerspective(fov, aspect, 0.05f, renderDistance * 2); @@ -710,7 +710,7 @@ void GameRenderer::renderItemInHand(float a, int eye) if (zoom != 1) { - glTranslatef((float) zoom_x, (float) -zoom_y, 0); + glTranslatef(static_cast(zoom_x), static_cast(-zoom_y), 0); glScaled(zoom, zoom, 1); } gluPerspective(fov, aspect, 0.05f, renderDistance * 2); @@ -822,8 +822,8 @@ void GameRenderer::turnOnLightLayer(double alpha) // 4J - change brought forward from 1.8.2 void GameRenderer::tickLightTexture() { - blrt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); - blgt += (float)((Math::random() - Math::random()) * Math::random() * Math::random()); + blrt += static_cast((Math::random() - Math::random()) * Math::random() * Math::random()); + blgt += static_cast((Math::random() - Math::random()) * Math::random() * Math::random()); blrt *= 0.9; blgt *= 0.9; blr += (blrt - blr) * 1; @@ -1649,7 +1649,7 @@ void GameRenderer::tickRain() double rainPosZ = 0; int rainPosSamples = 0; - int rainCount = (int) (100 * rainLevel * rainLevel); + int rainCount = static_cast(100 * rainLevel * rainLevel); if (mc->options->particles == 1) { rainCount >>= 1; @@ -1864,11 +1864,11 @@ void GameRenderer::renderSnowAndRain(float a) t->begin(); } float ra = (((_tick) & 511) + a) / 512.0f; - float uo = random->nextFloat() + time * 0.01f * (float) random->nextGaussian(); - float vo = random->nextFloat() + time * (float) random->nextGaussian() * 0.001f; + float uo = random->nextFloat() + time * 0.01f * static_cast(random->nextGaussian()); + float vo = random->nextFloat() + time * static_cast(random->nextGaussian()) * 0.001f; double xd = (x + 0.5f) - player->x; double zd = (z + 0.5f) - player->z; - float dd = (float) sqrt(xd * xd + zd * zd) / r; + float dd = static_cast(sqrt(xd * xd + zd * zd)) / r; float br = 1; t->offset(-xo * 1, -yo * 1, -zo * 1); #ifdef __PSVITA__ @@ -1910,7 +1910,7 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, (float)ssc.rawWidth, (float)ssc.rawHeight, 0, 1000, 3000); + glOrtho(0, static_cast(ssc.rawWidth), static_cast(ssc.rawHeight), 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1922,22 +1922,22 @@ void GameRenderer::setupClearColor(float a) shared_ptr player = mc->cameraTargetPlayer; float whiteness = 1.0f / (4 - mc->options->viewDistance); - whiteness = 1 - (float) pow((double)whiteness, 0.25); + whiteness = 1 - static_cast(pow((double)whiteness, 0.25)); Vec3 *skyColor = level->getSkyColor(mc->cameraTargetPlayer, a); - float sr = (float) skyColor->x; - float sg = (float) skyColor->y; - float sb = (float) skyColor->z; + float sr = static_cast(skyColor->x); + float sg = static_cast(skyColor->y); + float sb = static_cast(skyColor->z); Vec3 *fogColor = level->getFogColor(a); - fr = (float) fogColor->x; - fg = (float) fogColor->y; - fb = (float) fogColor->z; + fr = static_cast(fogColor->x); + fg = static_cast(fogColor->y); + fb = static_cast(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 = (float) player->getViewVector(a)->dot(sunAngle); + float d = static_cast(player->getViewVector(a)->dot(sunAngle)); if (d < 0) d = 0; if (d > 0) { @@ -1978,9 +1978,9 @@ void GameRenderer::setupClearColor(float a) if (isInClouds) { Vec3 *cc = level->getCloudColor(a); - fr = (float) cc->x; - fg = (float) cc->y; - fb = (float) cc->z; + fr = static_cast(cc->x); + fg = static_cast(cc->y); + fb = static_cast(cc->z); } else if (t != 0 && Tile::tiles[t]->material == Material::water) { @@ -1991,9 +1991,9 @@ void GameRenderer::setupClearColor(float a) byte greenComponent = ((colour>>8)&0xFF); byte blueComponent = ((colour)&0xFF); - fr = (float)redComponent/256 + clearness;//0.02f; - fg = (float)greenComponent/256 + clearness;//0.02f; - fb = (float)blueComponent/256 + clearness;//0.2f; + fr = static_cast(redComponent)/256 + clearness;//0.02f; + fg = static_cast(greenComponent)/256 + clearness;//0.02f; + fb = static_cast(blueComponent)/256 + clearness;//0.2f; } else if (t != 0 && Tile::tiles[t]->material == Material::lava) { @@ -2002,9 +2002,9 @@ void GameRenderer::setupClearColor(float a) byte greenComponent = ((colour>>8)&0xFF); byte blueComponent = ((colour)&0xFF); - fr = (float)redComponent/256;//0.6f; - fg = (float)greenComponent/256;//0.1f; - fb = (float)blueComponent/256;//0.00f; + fr = static_cast(redComponent)/256;//0.6f; + fg = static_cast(greenComponent)/256;//0.1f; + fb = static_cast(blueComponent)/256;//0.00f; } float brr = fogBrO + (fogBr - fogBrO) * a; @@ -2019,7 +2019,7 @@ void GameRenderer::setupClearColor(float a) int duration = player->getEffect(MobEffect::blindness)->getDuration(); if (duration < 20) { - yy = yy * (1.0f - (float) duration / 20.0f); + yy = yy * (1.0f - static_cast(duration) / 20.0f); } else { @@ -2124,7 +2124,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 - (float) duration / 20.0f); + distance = 5.0f + (renderDistance - 5.0f) * (1.0f - static_cast(duration) / 20.0f); } glFogi(GL_FOG_MODE, GL_LINEAR); @@ -2179,7 +2179,7 @@ void GameRenderer::setupFog(int i, float alpha) { if (yy < 0) yy = 0; yy = yy * yy; - float dist = 100 * (float) yy; + float dist = 100 * static_cast(yy); if (dist < 5) dist = 5; if (distance > dist) distance = dist; } @@ -2206,7 +2206,7 @@ void GameRenderer::setupFog(int i, float alpha) } */ - if (mc->level->dimension->isFoggyAt((int) player->x, (int) player->z)) + if (mc->level->dimension->isFoggyAt(static_cast(player->x), static_cast(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 14277c438..0a482e628 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 = (float)(31 + yoffs); + tentacles[i]->y = static_cast(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 1199c138e..44315340b 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -87,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 = (float) guiScale; // Keep static copy of scale so we know how gui coordinates map to physical pixels - this is also affected by the viewport + 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 switch(guiScale) { @@ -117,7 +117,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) iSafezoneYHalf = splitYOffset; iSafezoneTopYHalf = screenHeight/10; fScaleFactorWidth=0.5f; - iWidthOffset=(int)((float)screenWidth*(1.0f - fScaleFactorWidth)); + iWidthOffset=static_cast((float)screenWidth * (1.0f - fScaleFactorWidth)); iTooltipsYOffset=44; bTwoPlayerSplitscreen=true; currentGuiScaleFactor *= 0.5f; @@ -127,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=(int)((float)screenWidth*(1.0f - fScaleFactorWidth)); + iWidthOffset=static_cast((float)screenWidth * (1.0f - fScaleFactorWidth)); iTooltipsYOffset=44; bTwoPlayerSplitscreen=true; currentGuiScaleFactor *= 0.5f; @@ -697,7 +697,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) #endif glPushMatrix(); - glTranslatef((float)xo, (float)yo, 50); + glTranslatef(static_cast(xo), static_cast(yo), 50); float ss = 12; glScalef(-ss, ss, ss); glRotatef(180, 0, 0, 1); @@ -806,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 = (float) timer / (float) Player::SLEEP_DURATION; + float amount = static_cast(timer) / static_cast(Player::SLEEP_DURATION); if (amount > 1) { // waking up - amount = 1.0f - ((float) (timer - Player::SLEEP_DURATION) / (float) Player::WAKE_UP_DURATION); + amount = 1.0f - (static_cast(timer - Player::SLEEP_DURATION) / static_cast(Player::WAKE_UP_DURATION)); } - int color = (int) (220.0f * amount) << 24 | (0x101020); + int color = static_cast(220.0f * amount) << 24 | (0x101020); fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color); glEnable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); @@ -825,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 = (float) timer / (float) Player::DEATHFADE_DURATION; + float amount = static_cast(timer) / static_cast(Player::DEATHFADE_DURATION); - int color = (int) (220.0f * amount) << 24 | (0x200000); + int color = static_cast(220.0f * amount) << 24 | (0x200000); fill(0, 0, screenWidth/fScaleFactorWidth, screenHeight/fScaleFactorHeight, color); glEnable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); @@ -875,7 +875,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) wfeature[pFeatureData->eTerrainFeature] += itemInfo; } - for( int i = eTerrainFeature_Stronghold; i < (int) eTerrainFeature_Count; i++ ) + for( int i = eTerrainFeature_Stronghold; i < static_cast(eTerrainFeature_Count); i++ ) { font->drawShadow(wfeature[i], iSafezoneXHalf + 2, iYPos, 0xffffff); iYPos+=10; @@ -1135,10 +1135,10 @@ void Gui::renderPumpkin(int w, int h) MemSect(0); Tesselator *t = Tesselator::getInstance(); t->begin(); - 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->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->end(); glDepthMask(true); glEnable(GL_DEPTH_TEST); @@ -1199,10 +1199,10 @@ void Gui::renderTp(float br, int w, int h) float v1 = slot->getV1(); Tesselator *t = Tesselator::getInstance(); t->begin(); - 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->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->end(); glDepthMask(true); glEnable(GL_DEPTH_TEST); @@ -1220,10 +1220,10 @@ void Gui::renderSlot(int slot, int x, int y, float a) if (pop > 0) { glPushMatrix(); - float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION; - glTranslatef((float)(x + 8), (float)(y + 12), 0); + float squeeze = 1 + pop / static_cast(Inventory::POP_TIME_DURATION); + glTranslatef(static_cast(x + 8), static_cast(y + 12), 0); glScalef(1 / squeeze, (squeeze + 1) / 2, 1); - glTranslatef((float)-(x + 8), (float)-(y + 12), 0); + glTranslatef(static_cast(-(x + 8)), static_cast(-(y + 12)), 0); } itemRenderer->renderAndDecorateItem(minecraft->font, minecraft->textures, item, x, y); @@ -1362,7 +1362,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) { i++; } - int iLast=(int)string.find_last_of(L" ",i); + int iLast=static_cast(string.find_last_of(L" ", i)); switch(XGetLanguage()) { case XC_LANGUAGE_JAPANESE: @@ -1371,7 +1371,7 @@ void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage) iLast = maximumChars; break; default: - iLast=(int)string.find_last_of(L" ",i); + iLast=static_cast(string.find_last_of(L" ", i)); break; } @@ -1431,7 +1431,7 @@ float Gui::getOpacity(int iPad, DWORD index) float Gui::getJukeboxOpacity(int iPad) { float t = overlayMessageTime - lastTickA; - int alpha = (int) (t * 256 / 20); + int alpha = static_cast(t * 256 / 20); if (alpha > 255) alpha = 255; alpha /= 255; @@ -1465,7 +1465,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000); + glOrtho(0, static_cast(minecraft->width), static_cast(height), 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1496,8 +1496,8 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc __int64 aVal = dataA[i] / dataAScale; - 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)); + 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)); } if( dataB != NULL ) @@ -1513,8 +1513,8 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc __int64 bVal = dataB[i] / dataBScale; - 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->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->end(); @@ -1529,7 +1529,7 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, (float)minecraft->width, (float)height, 0, 1000, 3000); + glOrtho(0, static_cast(minecraft->width), static_cast(height), 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -1558,15 +1558,15 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int if( thisVal > 0 ) { - float vary = (float)source/dataSources; + float vary = static_cast(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), (float)( 0)); - t->vertex((float)(i + 0.5f), (float)( height - topVal + 0.5f), (float)( 0)); + 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)); topVal += thisVal; } @@ -1577,8 +1577,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int { t->color(0xff000000); - 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->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->end(); diff --git a/Minecraft.Client/Gui.h b/Minecraft.Client/Gui.h index 9352308f3..b6b15b13c 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 (int)guiMessages[iPad].size(); } + DWORD getMessagesCount(int iPad) { return static_cast(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/GuiComponent.cpp b/Minecraft.Client/GuiComponent.cpp index 92abf36db..5986c05d6 100644 --- a/Minecraft.Client/GuiComponent.cpp +++ b/Minecraft.Client/GuiComponent.cpp @@ -48,10 +48,10 @@ void GuiComponent::fill(int x0, int y0, int x1, int y1, int col) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(r, g, b, a); t->begin(); - t->vertex((float)(x0), (float)( y1), (float)( 0)); - t->vertex((float)(x1), (float)( y1), (float)( 0)); - t->vertex((float)(x1), (float)( y0), (float)( 0)); - t->vertex((float)(x0), (float)( y0), (float)( 0)); + t->vertex(static_cast(x0), static_cast(y1), static_cast(0)); + t->vertex(static_cast(x1), static_cast(y1), static_cast(0)); + t->vertex(static_cast(x1), static_cast(y0), static_cast(0)); + t->vertex(static_cast(x0), static_cast(y0), static_cast(0)); t->end(); glEnable(GL_TEXTURE_2D); glDisable(GL_BLEND); @@ -77,11 +77,11 @@ void GuiComponent::fillGradient(int x0, int y0, int x1, int y1, int col1, int co Tesselator *t = Tesselator::getInstance(); t->begin(); t->color(r1, g1, b1, a1); - t->vertex((float)(x1), (float)( y0), blitOffset); - t->vertex((float)(x0), (float)( y0), blitOffset); + t->vertex(static_cast(x1), static_cast(y0), blitOffset); + t->vertex(static_cast(x0), static_cast(y0), blitOffset); t->color(r2, g2, b2, a2); - t->vertex((float)(x0), (float)( y1), blitOffset); - t->vertex((float)(x1), (float)( y1), blitOffset); + t->vertex(static_cast(x0), static_cast(y1), blitOffset); + t->vertex(static_cast(x1), static_cast(y1), blitOffset); t->end(); glShadeModel(GL_FLAT); @@ -117,16 +117,16 @@ void GuiComponent::blit(int x, int y, int sx, int sy, int w, int h) const float extraShift = 0.75f; // 4J - subtracting extraShift (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 dx = ( extraShift * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys; + float dx = ( extraShift * static_cast(Minecraft::GetInstance()->width) ) / static_cast(Minecraft::GetInstance()->width_phys); // 4J - Also factor in the scaling from gui coordinate space to the screen. This varies based on user-selected gui scale, and whether we are in a viewport mode or not dx /= Gui::currentGuiScaleFactor; float dy = extraShift / Gui::currentGuiScaleFactor; // Ensure that the x/y, width and height are actually pixel aligned at our current scale factor - in particular, for split screen mode with the default (3X) // scale, we have an overall scale factor of 3 * 0.5 = 1.5, and so any odd pixels won't align - float fx = (floorf((float)x * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; - float fy = (floorf((float)y * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; - float fw = (floorf((float)w * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; - float fh = (floorf((float)h * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; + float fx = (floorf(static_cast(x) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; + float fy = (floorf(static_cast(y) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; + float fw = (floorf(static_cast(w) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; + float fh = (floorf(static_cast(h) * Gui::currentGuiScaleFactor)) / Gui::currentGuiScaleFactor; t->vertexUV(fx + 0 - dx, fy + fh - dy, (float)( blitOffset), (float)( (sx + 0) * us), (float)( (sy + h) * vs)); t->vertexUV(fx + fw - dx, fy + fh - dy, (float)( blitOffset), (float)( (sx + w) * us), (float)( (sy + h) * vs)); diff --git a/Minecraft.Client/GuiParticle.cpp b/Minecraft.Client/GuiParticle.cpp index 25859c707..1e6bcc708 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 = (int) (10.0 / (random->nextDouble() * 2 + 0.1)); + lifeTime = static_cast(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 / (double) lifeTime) * 2; + a = 2 - (life / static_cast(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 2a104c19e..276b1d160 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 - (float) xa * 0.5f; + size = 1 - static_cast(xa) * 0.5f; } void HugeExplosionParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - int tex = (int) ((life + a) * 15 / lifeTime); + int tex = static_cast((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 = (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 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); // 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 7514cc44f..67d68d460 100644 --- a/Minecraft.Client/HugeExplosionSeedParticle.cpp +++ b/Minecraft.Client/HugeExplosionSeedParticle.cpp @@ -24,7 +24,7 @@ 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 / (float) lifeTime, 0, 0); + level->addParticle(eParticleType_largeexplode, xx, yy, zz, life / static_cast(lifeTime), 0, 0); } Minecraft::GetInstance()->animateTickLevel = NULL; life++; diff --git a/Minecraft.Client/HumanoidMobRenderer.cpp b/Minecraft.Client/HumanoidMobRenderer.cpp index 5329f2d9c..2d513875c 100644 --- a/Minecraft.Client/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/HumanoidMobRenderer.cpp @@ -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 = (float) ((color >> 16) & 0xFF) / 0xFF; - float green = (float) ((color >> 8) & 0xFF) / 0xFF; - float blue = (float) (color & 0xFF) / 0xFF; + float red = static_cast((color >> 16) & 0xFF) / 0xFF; + float green = static_cast((color >> 8) & 0xFF) / 0xFF; + float blue = static_cast(color & 0xFF) / 0xFF; glColor3f(brightness * red, brightness * green, brightness * blue); if (itemInstance->isEnchanted()) return 0x1f; diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index 05d132fae..1e76f45a6 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -37,7 +37,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) if(pNewBox) { - if((pNewBox->getfU()!=(int)pBox->fU) || (pNewBox->getfV()!=(int)pBox->fV)) + if((pNewBox->getfU()!=static_cast(pBox->fU)) || (pNewBox->getfV()!=static_cast(pBox->fV))) { app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Box geometry was found, but with different uvs\n"); pNewBox=NULL; @@ -47,7 +47,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) { //app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Adding box to model part\n"); - pNewBox = new ModelPart(this, (int)pBox->fU, (int)pBox->fV); + pNewBox = new ModelPart(this, static_cast(pBox->fU), static_cast(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. diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index 1fd676836..cbcd317f6 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -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)*(((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame))/100.0f); // apply sensitivity to look + tx = InputManager.GetJoypadStick_RX(iPad)*(static_cast(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)*(((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame))/100.0f); // apply sensitivity to look + ty = InputManager.GetJoypadStick_RY(iPad)*(static_cast(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 = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f; + float mouseSensitivity = static_cast(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 726a5e8dc..b6728533c 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 = (float)xm; - this->yMouse = (float)ym; + this->xMouse = static_cast(xm); + this->yMouse = static_cast(ym); } void InventoryScreen::renderBg(float a) diff --git a/Minecraft.Client/ItemFrameRenderer.cpp b/Minecraft.Client/ItemFrameRenderer.cpp index 2d7493ecb..54633deb3 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 = (float) (itemFrame->x - x) - 0.5f; - float yOffs = (float) (itemFrame->y - y) - 0.5f; - float zOffs = (float) (itemFrame->z - z) - 0.5f; + 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; int xt = itemFrame->xTile + Direction::STEP_X[itemFrame->dir]; int yt = itemFrame->yTile; int zt = itemFrame->zTile + Direction::STEP_Z[itemFrame->dir]; - glTranslatef((float) xt - xOffs, (float) yt - yOffs, (float) zt - zOffs); + glTranslatef(static_cast(xt) - xOffs, static_cast(yt) - yOffs, static_cast(zt) - zOffs); drawFrame(itemFrame); drawItem(itemFrame); @@ -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( (float)(180 + entity->dir * 90) ), false, true); + ct->updateFromPosition(entity->level, entity->x, entity->z, Mth::wrapDegrees( static_cast(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 782537051..b7aa4f8b5 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -481,13 +481,13 @@ void ItemInHandRenderer::render(float a) glPushMatrix(); glTranslatef(-0.0f, -0.6f, 1.1f * flip); - glRotatef((float)(-45 * flip), 1, 0, 0); + glRotatef(static_cast(-45 * flip), 1, 0, 0); glRotatef(-90, 0, 0, 1); glRotatef(59, 0, 0, 1); - glRotatef((float)(-65 * flip), 0, 1, 0); + glRotatef(static_cast(-65 * flip), 0, 1, 0); EntityRenderer *er = EntityRenderDispatcher::instance->getRenderer(minecraft->player); - PlayerRenderer *playerRenderer = (PlayerRenderer *) er; + PlayerRenderer *playerRenderer = static_cast(er); float ss = 1; glScalef(ss, ss, ss); @@ -530,10 +530,10 @@ void ItemInHandRenderer::render(float a) t->begin(); int vo = 7; t->normal(0,0,-1); - 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->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->end(); shared_ptr data = Item::map->getSavedData(item, minecraft->level); @@ -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 / (float) (BowItem::MAX_DRAW_DURATION); + float pow = timeHeld / static_cast(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 = (PlayerRenderer *) er; + PlayerRenderer *playerRenderer = static_cast(er); float ss = 1; glScalef(ss, ss, ss); MemSect(31); diff --git a/Minecraft.Client/ItemRenderer.cpp b/Minecraft.Client/ItemRenderer.cpp index 6fb7e633d..849195a65 100644 --- a/Minecraft.Client/ItemRenderer.cpp +++ b/Minecraft.Client/ItemRenderer.cpp @@ -77,7 +77,7 @@ 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((float) x, (float) y + bob, (float) z); + glTranslatef(static_cast(x), static_cast(y) + bob, static_cast(z)); glEnable(GL_RESCALE_NORMAL); Tile *tile = Tile::tiles[item->id]; @@ -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), (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->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->end(); glPopMatrix(); @@ -416,7 +416,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr(x), static_cast(y), fillingIcon, 16, 16); } } glEnable(GL_LIGHTING); @@ -462,7 +462,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr(x), static_cast(y), itemIcon, 16, 16); } glEnable(GL_LIGHTING); PIXEndNamedEvent(); @@ -475,7 +475,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, int x, int y) { - renderGuiItem(font, textures, item, (float)x, (float)y, 1.0f, 1.0f ); + renderGuiItem(font, textures, item, static_cast(x), static_cast(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 @@ -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, (float)x, (float)y, 1.0f, 1.0f, item->isFoil() ); + renderAndDecorateItem( font, textures, item, static_cast(x), static_cast(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 = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; - float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; + 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 xx0 = x * sfx; float xx1 = ( x + w ) * sfx; float yy0 = y * sfy; @@ -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 |(((unsigned int)(fAlpha * 0xff))<<24)); + font->drawShadow(amount, x + 19 - 2 - font->width(amount), y + 6 + 3, 0xffffff |(static_cast(fAlpha * 0xff)<<24)); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); } if (item->isDamaged()) { - 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()); + 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())); 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((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->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->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 = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; - float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; + 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 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 * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys; + float f = ( 0.5f * static_cast(Minecraft::GetInstance()->width) ) / static_cast(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 = (float)Minecraft::GetInstance()->width / (float)Minecraft::GetInstance()->width_phys; - float sfy = (float)Minecraft::GetInstance()->height / (float)Minecraft::GetInstance()->height_phys; + 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 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 * (float)Minecraft::GetInstance()->width ) / (float)Minecraft::GetInstance()->width_phys; + float f = ( 0.5f * static_cast(Minecraft::GetInstance()->width) ) / static_cast(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 5f1c7089b..b8a4a3770 100644 --- a/Minecraft.Client/ItemSpriteRenderer.cpp +++ b/Minecraft.Client/ItemSpriteRenderer.cpp @@ -29,7 +29,7 @@ void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double glPushMatrix(); - glTranslatef((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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), (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->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->end(); } diff --git a/Minecraft.Client/JoinMultiplayerScreen.cpp b/Minecraft.Client/JoinMultiplayerScreen.cpp index a98e7bee1..7ef19663c 100644 --- a/Minecraft.Client/JoinMultiplayerScreen.cpp +++ b/Minecraft.Client/JoinMultiplayerScreen.cpp @@ -55,7 +55,7 @@ void JoinMultiplayerScreen::buttonClicked(Button *button) vector parts = stringSplit(ip,L'L'); if (ip[0]==L'[') { - int pos = (int)ip.find(L"]"); + int pos = static_cast(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 ac0608e59..0ff9b1b06 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 = (int) (16 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(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) / (float) lifetime; + float s = (age + a) / static_cast(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 / (float) lifetime; + float odds = age / static_cast(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 052850f81..0f9d6a435 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 + (float)i, -4.0f, 8, 1, 8); + bodyCubes[i]->addBox(-4.0f, 16.0f + static_cast(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 e828a353b..3d5858eae 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 = ((LavaSlimeModel *) model)->getModelVersion(); + this->modelVersion = static_cast(model)->getModelVersion(); } ResourceLocation *LavaSlimeRenderer::getTextureLocation(shared_ptr mob) diff --git a/Minecraft.Client/LeashKnotRenderer.cpp b/Minecraft.Client/LeashKnotRenderer.cpp index b210379fc..3c58ce522 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); float scale = 1 / 16.0f; glEnable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 051ad8921..109fab3f5 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -184,16 +184,16 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) float yy; int s = 64; int d = 256 / s + 2; - yy = (float) 16; + yy = static_cast(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((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->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->end(); } } @@ -201,16 +201,16 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) darkList = starList + 2; glNewList(darkList, GL_COMPILE); - yy = -(float) 16; + yy = -static_cast(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((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->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->end(); @@ -312,7 +312,7 @@ void LevelRenderer::renderStars() double yo = _yo; double zo = _zo * ySin + _xo * yCos; - t->vertex((float)(xp + xo), (float)( yp + yo), (float)( zp + zo)); + t->vertex(static_cast(xp + xo), static_cast(yp + yo), static_cast(zp + zo)); } } } @@ -427,7 +427,7 @@ void LevelRenderer::allChanged(int playerIndex) lastViewDistance = mc->options->viewDistance; // Calculate size of area we can render based on number of players we need to render for - int dist = (int)sqrtf( (float)PLAYER_RENDER_AREA / (float)activePlayers() ); + int dist = static_cast(sqrtf((float)PLAYER_RENDER_AREA / (float)activePlayers())); // AP - poor little Vita just can't cope with such a big area #ifdef __PSVITA__ @@ -531,7 +531,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 = (int)entities.size(); + totalEntities = static_cast(entities.size()); for (auto& entity : level[playerIndex]->globalEntities) { @@ -729,7 +729,7 @@ int LevelRenderer::render(shared_ptr player, int layer, double alp } Lighting::turnOff(); - int count = renderChunks(0, (int)chunks[playerIndex].length, layer, alpha); + int count = renderChunks(0, static_cast(chunks[playerIndex].length), layer, alpha); return count; @@ -765,7 +765,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) double zOff = player->zOld + (player->z - player->zOld) * alpha; glPushMatrix(); - glTranslatef((float)-xOff, (float)-yOff, (float)-zOff); + glTranslatef(static_cast(-xOff), static_cast(-yOff), static_cast(-zOff)); #ifdef __PSVITA__ // AP - also set the camera position so we can work out if a chunk is fogged or not @@ -990,9 +990,9 @@ void LevelRenderer::renderSky(float alpha) int playerIndex = mc->player->GetXboxPad(); Vec3 *sc = level[playerIndex]->getSkyColor(mc->cameraTargetPlayer, alpha); - float sr = (float) sc->x; - float sg = (float) sc->y; - float sb = (float) sc->z; + float sr = static_cast(sc->x); + float sg = static_cast(sc->y); + float sb = static_cast(sc->z); if (mc->options->anaglyph3d) { @@ -1055,7 +1055,7 @@ void LevelRenderer::renderSky(float alpha) t->begin(GL_TRIANGLE_FAN); t->color(r, g, b, c[3]); - t->vertex((float)(0), (float)( 100), (float)( 0)); + t->vertex(static_cast(0), static_cast(100), static_cast(0)); int steps = 16; t->color(c[0], c[1], c[2], 0.0f); for (int i = 0; i <= steps; i++) @@ -1089,10 +1089,10 @@ void LevelRenderer::renderSky(float alpha) textures->bindTexture(&SUN_LOCATION); MemSect(0); t->begin(); - 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->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->end(); ss = 20; @@ -1137,7 +1137,7 @@ void LevelRenderer::renderSky(float alpha) if (yy < 0) { glPushMatrix(); - glTranslatef(0, -(float) (-12), 0); + glTranslatef(0, -static_cast(-12), 0); glCallList(darkList); glPopMatrix(); @@ -1188,7 +1188,7 @@ void LevelRenderer::renderSky(float alpha) glColor3f(sr, sg, sb); } glPushMatrix(); - glTranslatef(0, -(float) (yy - 16), 0); + glTranslatef(0, -static_cast(yy - 16), 0); glCallList(darkList); glPopMatrix(); glEnable(GL_TEXTURE_2D); @@ -1209,9 +1209,9 @@ void LevelRenderer::renderHaloRing(float alpha) int playerIndex = mc->player->GetXboxPad(); Vec3 *sc = level[playerIndex]->getSkyColor(mc->cameraTargetPlayer, alpha); - float sr = (float) sc->x; - float sg = (float) sc->y; - float sb = (float) sc->z; + float sr = static_cast(sc->x); + float sg = static_cast(sc->y); + float sb = static_cast(sc->z); // Rough lumninance calculation float Y = (sr+sr+sb+sg+sg+sg)/6; @@ -1274,7 +1274,7 @@ void LevelRenderer::renderClouds(float alpha) } } glDisable(GL_CULL_FACE); - float yOffs = (float) (mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); + float yOffs = static_cast(mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); int s = 32; int d = 256 / s; Tesselator *t = Tesselator::getInstance(); @@ -1284,9 +1284,9 @@ void LevelRenderer::renderClouds(float alpha) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Vec3 *cc = level[playerIndex]->getCloudColor(alpha); - float cr = (float) cc->x; - float cg = (float) cc->y; - float cb = (float) cc->z; + float cr = static_cast(cc->x); + float cg = static_cast(cc->y); + float cb = static_cast(cc->z); if (mc->options->anaglyph3d) { @@ -1312,8 +1312,8 @@ void LevelRenderer::renderClouds(float alpha) zo -= zOffs * 2048; float yy = (float) (level[playerIndex]->dimension->getCloudHeight() - yOffs + 0.33f); - float uo = (float) (xo * scale); - float vo = (float) (zo * scale); + float uo = static_cast(xo * scale); + float vo = static_cast(zo * scale); t->begin(); t->color(cr, cg, cb, 0.8f); @@ -1321,10 +1321,10 @@ void LevelRenderer::renderClouds(float alpha) { for (int zz = -s * d; zz < +s * d; zz += s) { - 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->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->end(); @@ -1371,13 +1371,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(0.7f, 0.7f, 0.7f, 0.8f); t->normal(0, -1, 0); @@ -1396,13 +1396,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(1.0f, 1.0f, 1.0f, 0.8f); t->normal(0, 1, 0); @@ -1421,13 +1421,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(0.9f, 0.9f, 0.9f, 0.8f); t->normal(-1, 0, 0); @@ -1446,13 +1446,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(0.9f, 0.9f, 0.9f, 0.8f); t->normal(1, 0, 0); @@ -1471,13 +1471,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(0.8f, 0.8f, 0.8f, 0.8f); t->normal(-1, 0, 0); @@ -1496,13 +1496,13 @@ void LevelRenderer::createCloudMesh() { for( int xt = 0; xt < D; xt++ ) { - float u = (((float) xt ) + 0.5f ) / 256.0f; - float v = (((float) zt ) + 0.5f ) / 256.0f; - float x0 = (float)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 x1 = x0 + 1.0f; float y0 = 0; float y1 = h; - float z0 = (float)zt; + float z0 = static_cast(zt); float z1 = z0 + 1.0f; t->color(0.8f, 0.8f, 0.8f, 0.8f); t->normal(1, 0, 0); @@ -1527,7 +1527,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 = (float) (mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); + float yOffs = static_cast(mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * alpha); Tesselator *t = Tesselator::getInstance(); int playerIndex = mc->player->GetXboxPad(); @@ -1577,9 +1577,9 @@ void LevelRenderer::renderAdvancedClouds(float alpha) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Vec3 *cc = level[playerIndex]->getCloudColor(alpha); - float cr = (float) cc->x; - float cg = (float) cc->y; - float cb = (float) cc->z; + float cr = static_cast(cc->x); + float cg = static_cast(cc->y); + float cb = static_cast(cc->z); if (mc->options->anaglyph3d) { @@ -1592,19 +1592,19 @@ void LevelRenderer::renderAdvancedClouds(float alpha) cb = cbb; } - float uo = (float) (xo * 0); - float vo = (float) (zo * 0); + float uo = static_cast(xo * 0); + float vo = static_cast(zo * 0); float scale = 1 / 256.0f; - uo = (float) (Mth::floor(xo)) * scale; - vo = (float) (Mth::floor(zo)) * scale; + uo = static_cast(Mth::floor(xo)) * scale; + vo = static_cast(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 = (float) (xo - Mth::floor(xo)); - float zoffs = (float) (zo - Mth::floor(zo)); + float xoffs = static_cast(xo - Mth::floor(xo)); + float zoffs = static_cast(zo - Mth::floor(zo)); int D = 8; @@ -1634,8 +1634,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 = (float)(xPos * D); - float zz = (float)(zPos * D); + float xx = static_cast(xPos * D); + float zz = static_cast(zPos * D); float xp = xx - xoffs; float zp = zz - zoffs; @@ -1828,7 +1828,7 @@ bool LevelRenderer::updateDirtyChunks() } throttle++; */ - PIXAddNamedCounter(((float)memAlloc)/(1024.0f*1024.0f),"Command buffer allocations"); + PIXAddNamedCounter(static_cast(memAlloc)/(1024.0f*1024.0f),"Command buffer allocations"); bool onlyRebuild = ( memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS ); EnterCriticalSection(&m_csDirtyChunks); @@ -1930,9 +1930,9 @@ bool LevelRenderer::updateDirtyChunks() if( chunks[p].data == NULL ) continue; if( level[p] == NULL ) continue; if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue; - int px = (int)player->x; - int py = (int)player->y; - int pz = (int)player->z; + int px = static_cast(player->x); + int py = static_cast(player->y); + int pz = static_cast(player->z); // app.DebugPrintf("!! %d %d %d, %d %d %d {%d,%d} ",px,py,pz,stackChunkDirty,nonStackChunkDirty,onlyRebuild, xChunks, zChunks); @@ -2221,7 +2221,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((float)-xo, (float)-yo,(float) -zo); + t->offset(static_cast(-xo), static_cast(-yo),static_cast(-zo)); #endif t->noColor(); @@ -2298,30 +2298,30 @@ void LevelRenderer::render(AABB *b) Tesselator *t = Tesselator::getInstance(); t->begin(GL_LINE_STRIP); - 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->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->end(); t->begin(GL_LINE_STRIP); - 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->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->end(); t->begin(GL_LINES); - 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->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->end(); } @@ -2527,7 +2527,7 @@ void LevelRenderer::cull(Culler *culler, float a) #endif // __PS3__ - FrustumCuller *fc = (FrustumCuller *)culler; + FrustumCuller *fc = static_cast(culler); FrustumData *fd = fc->frustum; float fdraw[6 * 4]; for( int i = 0; i < 6; i++ ) @@ -2535,10 +2535,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] = (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 )); + 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)); } ClipChunk *pClipChunk = chunks[playerIndex].data; @@ -2577,7 +2577,7 @@ void LevelRenderer::playStreamingMusic(const wstring& name, int x, int y, int z) { mc->gui->setNowPlaying(L"C418 - " + name); } - mc->soundEngine->playStreaming(name, (float) x, (float) y, (float) z, 1, 1); + mc->soundEngine->playStreaming(name, static_cast(x), static_cast(y), static_cast(z), 1, 1); } void LevelRenderer::playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist) @@ -2777,8 +2777,8 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle } else { - float fStart=((float)(cStart&0xFF)); - float fDiff=(float)((cEnd-cStart)&0xFF); + float fStart=static_cast(cStart & 0xFF); + float fDiff=static_cast((cEnd - cStart) & 0xFF); float fCol = (fStart + (Math::random() * fDiff))/255.0f; particle->setColor( fCol, fCol, fCol ); @@ -2810,12 +2810,12 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle break; case eParticleType_mobSpell: particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); - particle->setColor((float) xa, (float) ya, (float) za); + particle->setColor(static_cast(xa), static_cast(ya), static_cast(za)); break; case eParticleType_mobSpellAmbient: particle = shared_ptr(new SpellParticle(lev, x, y, z, 0, 0, 0)); particle->setAlpha(0.15f); - particle->setColor((float) xa, (float) ya, (float) za); + particle->setColor(static_cast(xa), static_cast(ya), static_cast(za)); break; case eParticleType_spell: particle = shared_ptr( new SpellParticle(lev, x, y, z, xa, ya, za) ); @@ -2863,7 +2863,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle particle = shared_ptr( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) ); break; case eParticleType_reddust: - particle = shared_ptr( new RedDustParticle(lev, x, y, z, (float) xa, (float) ya, (float) za) ); + particle = shared_ptr( new RedDustParticle(lev, x, y, z, static_cast(xa), static_cast(ya), static_cast(za)) ); break; case eParticleType_snowballpoof: particle = shared_ptr( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) ); @@ -3110,9 +3110,9 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y int colorValue = Item::potion->getColor(data); - float red = (float) ((colorValue >> 16) & 0xff) / 255.0f; - float green = (float) ((colorValue >> 8) & 0xff) / 255.0f; - float blue = (float) ((colorValue >> 0) & 0xff) / 255.0f; + 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; ePARTICLE_TYPE particleName = eParticleType_spell; if (Item::potion->hasInstantenousEffects(data)) @@ -3133,7 +3133,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y { float randBrightness = 0.75f + random->nextFloat() * 0.25f; spellParticle->setColor(red * randBrightness, green * randBrightness, blue * randBrightness); - spellParticle->setPower((float) dist); + spellParticle->setPower(static_cast(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); @@ -3159,7 +3159,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y if (acidParticle != NULL) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; - acidParticle->setPower((float) dist); + acidParticle->setPower(static_cast(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); @@ -3550,7 +3550,7 @@ 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((float)x, (float)y, (float)z, (float)(x+1), (float)(y+1), (float)(z+1)); + 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)); Tile *tile = Tile::tiles[level->getTile(x, y, z)]; if (tile != NULL) diff --git a/Minecraft.Client/Lighting.cpp b/Minecraft.Client/Lighting.cpp index 50529d516..ef9feaa14 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((float) a, (float) b, (float) c, (float) d); + return getBuffer(static_cast(a), static_cast(b), static_cast(c), static_cast(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 d02ea7f71..46b628dfb 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((float)(xx2 + xo0), (float)( y + (h) * 16), (float)( zz2 + zo0)); - t->vertex((float)(xx1 + xo1), (float)( y + (h + 1) * 16), (float)( zz1 + zo1)); + 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)); } diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index 757948a37..f713c20e5 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); } void LivingEntityRenderer::setupRotations(shared_ptr mob, float bob, float bodyRot, float a) @@ -405,7 +405,7 @@ void LivingEntityRenderer::renderName(shared_ptr mob, double x, do Font *font = getFont(); glPushMatrix(); - glTranslatef((float) x + 0, (float) y + mob->bbHeight + 0.5f, (float) z); + glTranslatef(static_cast(x) + 0, static_cast(y) + mob->bbHeight + 0.5f, static_cast(z)); glNormal3f(0, 1, 0); glRotatef(-entityRenderDispatcher->playerRotY, 0, 1, 0); @@ -595,10 +595,10 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst { t->color(0.0f, 0.0f, 0.0f, 0.25f); } - 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(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->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((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->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->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((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->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->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 = ( ( (int)(textOpacity*255) << 24 ) | 0xffffff ); + int textColor = ( ( static_cast(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 77306621f..c0050075c 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -420,11 +420,11 @@ void LocalPlayer::aiStep() jumpRidingTicks++; if (jumpRidingTicks < 10) { - jumpRidingScale = (float) jumpRidingTicks * .1f; + jumpRidingScale = static_cast(jumpRidingTicks) * .1f; } else { - jumpRidingScale = .8f + (2.f / ((float) (jumpRidingTicks - 9))) * .1f; + jumpRidingScale = .8f + (2.f / static_cast(jumpRidingTicks - 9)) * .1f; } } } @@ -458,9 +458,9 @@ void LocalPlayer::aiStep() #ifdef _DEBUG_MENUS_ENABLED if(abilities.debugflying) { - flyX = (float)viewVector->x * input->ya; - flyY = (float)viewVector->y * input->ya; - flyZ = (float)viewVector->z * input->ya; + flyX = static_cast(viewVector->x) * input->ya; + flyY = static_cast(viewVector->y) * input->ya; + flyZ = static_cast(viewVector->z) * input->ya; } else #endif @@ -468,11 +468,11 @@ void LocalPlayer::aiStep() if( isSprinting() ) { // Accelrate up to full speed if we are sprinting, moving in the direction of the view vector - flyX = (float)viewVector->x * input->ya; - flyY = (float)viewVector->y * input->ya; - flyZ = (float)viewVector->z * input->ya; + flyX = static_cast(viewVector->x) * input->ya; + flyY = static_cast(viewVector->y) * input->ya; + flyZ = static_cast(viewVector->z) * input->ya; - float scale = ((float)(SPRINT_DURATION - sprintTime))/10.0f; + float scale = static_cast(SPRINT_DURATION - sprintTime)/10.0f; scale = scale * scale; if ( scale > 1.0f ) scale = 1.0f; flyX *= scale; @@ -575,7 +575,7 @@ float LocalPlayer::getFieldOfViewModifier() if (isUsingItem() && getUseItem()->id == Item::bow->id) { int ticksHeld = getTicksUsingItem(); - float scale = (float) ticksHeld / BowItem::MAX_DRAW_DURATION; + float scale = static_cast(ticksHeld) / BowItem::MAX_DRAW_DURATION; if (scale > 1) { scale = 1; @@ -785,7 +785,7 @@ void LocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damageSource) if( this->getHealth() <= 0) { - int deathTime = (int)(level->getGameTime() % Level::TICKS_PER_DAY)/1000; + int deathTime = static_cast(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); @@ -835,7 +835,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) if (stat->isAchievement()) { - Achievement *ach = (Achievement *) stat; + Achievement *ach = static_cast(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)) @@ -861,7 +861,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) } // 4J-JEV: To stop spamming trophies. - unsigned long long achBit = ((unsigned long long)1) << ach->getAchievementID(); + unsigned long long achBit = static_cast(1) << ach->getAchievementID(); if ( !(achBit & m_awardedThisSession) ) { ProfileManager.Award(m_iPad, ach->getAchievementID()); @@ -1248,7 +1248,7 @@ void LocalPlayer::onCrafted(shared_ptr item) { if( minecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_iPad]); gameMode->getTutorial()->onCrafted(item); } } @@ -1270,8 +1270,8 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) int cx = this->xChunk; int cz = this->zChunk; - int pZ = ((int) floor(this->z)) %16; - int pX = ((int) floor(this->x)) %16; + int pZ = static_cast(floor(this->z)) %16; + int pX = static_cast(floor(this->x)) %16; cout<<"player in chunk ("<x<<","<y<<","<z<<")\n"; @@ -1359,9 +1359,9 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed) } // Get distance from last click point in each axis - float dX = (float)x - lastClickX; - float dY = (float)y - lastClickY; - float dZ = (float)z - lastClickZ; + float dX = static_cast(x) - lastClickX; + float dY = static_cast(y) - lastClickY; + float dZ = static_cast(z) - lastClickZ; bool newClick = false; float ddx = dX - lastClickdX; @@ -1467,9 +1467,9 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed) else { // First click - just record position & handle - lastClickX = (float)x; - lastClickY = (float)y; - lastClickZ = (float)z; + lastClickX = static_cast(x); + lastClickY = static_cast(y); + lastClickZ = static_cast(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 @@ -1713,7 +1713,7 @@ void LocalPlayer::handleCollectItem(shared_ptr item) } } } - TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_iPad]); gameMode->getTutorial()->onTake(item, itemCountAnyAux, itemCountThisAux); } diff --git a/Minecraft.Client/MinecartModel.cpp b/Minecraft.Client/MinecartModel.cpp index 8a1ce0d7f..0cb0764fb 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((float)(-w / 2), (float)(-h / 2), -1, w, h, 2, 0); - cubes[0]->setPos(0, (float)(0 + yOff), 0); + 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[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[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[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[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[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[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[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[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[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[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[0]->xRot = PI / 2; cubes[1]->yRot = PI / 2 * 3; diff --git a/Minecraft.Client/MinecartRenderer.cpp b/Minecraft.Client/MinecartRenderer.cpp index fd907019e..29b97b7ea 100644 --- a/Minecraft.Client/MinecartRenderer.cpp +++ b/Minecraft.Client/MinecartRenderer.cpp @@ -60,11 +60,11 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub else { dir = dir->normalize(); - rot = (float) (atan2(dir->z, dir->x) * 180 / PI); - xRot = (float) (atan(dir->y) * 73); + rot = static_cast(atan2(dir->z, dir->x) * 180 / PI); + xRot = static_cast(atan(dir->y) * 73); } } - glTranslatef((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); glRotatef(180 - rot, 0, 1, 0); glRotatef(-xRot, 0, 0, 1); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index b197638cf..643a0bef3 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -483,10 +483,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((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->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->end(); } @@ -1198,7 +1198,7 @@ void Minecraft::applyFrameMouseLook() g_KBMInput.ConsumeMouseDelta(rawDx, rawDy); if (rawDx == 0.0f && rawDy == 0.0f) continue; - float mouseSensitivity = ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; + float mouseSensitivity = static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; float mdx = rawDx * mouseSensitivity; float mdy = -rawDy * mouseSensitivity; if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook)) @@ -1279,7 +1279,7 @@ void Minecraft::run_middle() if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack(); @@ -1910,7 +1910,7 @@ void Minecraft::run_middle() if( setLocalPlayerIdx(i) ) { PIXBeginNamedEvent(0,"Game render player idx %d",i); - RenderManager.StateSetViewport((C4JRender::eViewportType)player->m_iScreenSection); + RenderManager.StateSetViewport(static_cast(player->m_iScreenSection)); gameRenderer->render(timer->a, bFirst); bFirst = false; PIXEndNamedEvent(); @@ -1938,7 +1938,7 @@ void Minecraft::run_middle() if( unoccupiedQuadrant > -1 ) { // render a logo - RenderManager.StateSetViewport((C4JRender::eViewportType)(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant)); + RenderManager.StateSetViewport(static_cast(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2097,7 +2097,7 @@ void Minecraft::renderFpsMeter(__int64 tickTime) glMatrixMode(GL_PROJECTION); glEnable(GL_COLOR_MATERIAL); glLoadIdentity(); - glOrtho(0, (float)width, (float)height, 0, 1000, 3000); + glOrtho(0, static_cast(width), static_cast(height), 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -2000); @@ -2108,16 +2108,16 @@ void Minecraft::renderFpsMeter(__int64 tickTime) t->begin(GL_QUADS); int hh1 = (int) (nsPer60Fps / 200000); t->color(0x20000000); - 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->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->color(0x20200000); - 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->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->end(); __int64 totalTime = 0; @@ -2125,13 +2125,13 @@ void Minecraft::renderFpsMeter(__int64 tickTime) { totalTime += Minecraft::frameTimes[i]; } - int hh = (int) (totalTime / 200000 / Minecraft::frameTimes_length); + int hh = static_cast(totalTime / 200000 / Minecraft::frameTimes_length); t->begin(GL_QUADS); t->color(0x20400000); - 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->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->end(); t->begin(GL_LINES); for (int i = 0; i < Minecraft::frameTimes_length; i++) @@ -2153,16 +2153,16 @@ void Minecraft::renderFpsMeter(__int64 tickTime) __int64 time = Minecraft::frameTimes[i] / 200000; __int64 time2 = Minecraft::tickTimes[i] / 200000; - 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)); + 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)); // 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), (float)( 0)); - t->vertex((float)(i + 0.5f), (float)( height - (time - time2) + 0.5f), (float)( 0)); + 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->end(); @@ -2223,7 +2223,7 @@ void Minecraft::verify() void Minecraft::levelTickUpdateFunc(void* pParam) { - Level* pLevel = (Level*)pParam; + Level* pLevel = static_cast(pParam); pLevel->tick(); } @@ -2499,7 +2499,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Item::spiderEye_Id: // Check that we are actually hungry so will eat this item { - FoodItem *food = (FoodItem *)itemInstance->getItem(); + FoodItem *food = static_cast(itemInstance->getItem()); if (food != NULL && food->canEat(player)) { *piUse=IDS_TOOLTIPS_EAT; @@ -3329,7 +3329,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_ZOMBIE: { shared_ptr zomb = dynamic_pointer_cast(hitResult->entity); - static GoldenAppleItem *goldapple = (GoldenAppleItem *) Item::apple_gold; + static GoldenAppleItem *goldapple = static_cast(Item::apple_gold); //zomb->hasEffect(MobEffect::weakness) - not present on client. if ( zomb->isVillager() && zomb->isWeakened() && (heldItemId == Item::apple_gold_Id) && !goldapple->isFoil(heldItem) ) @@ -4397,8 +4397,8 @@ void Minecraft::prepareLevel(int title) Pos *spawnPos = level->getSharedSpawnPos(); if (player != NULL) { - spawnPos->x = (int) player->x; - spawnPos->z = (int) player->z; + spawnPos->x = static_cast(player->x); + spawnPos->z = static_cast(player->z); } #if 0 @@ -5008,7 +5008,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 = (Minecraft*)pParam; + Minecraft* pMinecraftClass = static_cast(pParam); if(g_NetworkManager.IsInSession()) { diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 012ae19bd..f469c8b11 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -767,7 +767,7 @@ int MinecraftServer::runPostUpdate(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::ePostProcessThread); - MinecraftServer *server = (MinecraftServer *)lpParam; + MinecraftServer *server = static_cast(lpParam); Entity::useSmallIds(); // This thread can end up spawning entities as resources IntCache::CreateNewThreadStorage(); AABB::CreateNewThreadStorage(); @@ -1401,7 +1401,7 @@ void MinecraftServer::Suspend() LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; float fElapsedTime = 0.0f; QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; + float fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); // Save the start time QueryPerformanceCounter( &qwTime ); if(m_bLoaded && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled())) @@ -1428,7 +1428,7 @@ void MinecraftServer::Suspend() QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); + fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); // 4J-JEV: Flush stats and call PlayerSessionExit. for (int iPad = 0; iPad < XUSER_MAX_COUNT; iPad++) @@ -1702,7 +1702,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) bool findSeed = false; if(lpParameter != NULL) { - initData = (NetworkGameInitData *)lpParameter; + initData = static_cast(lpParameter); initSettings = app.GetGameHostOption(eGameHostOption_All); findSeed = initData->findSeed; m_texturePackId = initData->texturePackId; @@ -1917,7 +1917,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) case eXuiServerAction_SpawnMob: { shared_ptr player = players->players.at(0); - eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); + eINSTANCEOF factory = static_cast((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) @@ -1963,7 +1963,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) if( !s_bServerHalted ) { - ConsoleSchematicFile::XboxSchematicInitParam *initData = (ConsoleSchematicFile::XboxSchematicInitParam *)param; + ConsoleSchematicFile::XboxSchematicInitParam *initData = static_cast(param); #ifdef _XBOX File targetFileDir(File::pathRoot + File::pathSeparator + L"Schematics"); #else @@ -1989,7 +1989,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) case eXuiServerAction_SetCameraLocation: #ifndef _CONTENT_PACKAGE { - DebugSetCameraPosition *pos = (DebugSetCameraPosition *)param; + DebugSetCameraPosition *pos = static_cast(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", @@ -2122,7 +2122,7 @@ void MinecraftServer::tick() static __int64 stc = 0; __int64 st0 = System::currentTimeMillis(); PIXBeginNamedEvent(0,"Level tick %d",i); - ((Level *)level)->tick(); + static_cast(level)->tick(); __int64 st1 = System::currentTimeMillis(); PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Update lights %d",i); diff --git a/Minecraft.Client/Minimap.cpp b/Minecraft.Client/Minimap.cpp index 65c6d5f2c..9e07dbdf2 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), (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->vertexUV((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->end(); glEnable(GL_ALPHA_TEST); glDisable(GL_BLEND); @@ -182,10 +182,10 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrbegin(); - 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->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->end(); glPopMatrix(); fIconZ-=0.01f; @@ -218,10 +218,10 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrbegin(); - 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->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->end(); glPopMatrix(); fIconZ-=0.01f; diff --git a/Minecraft.Client/MobRenderer.cpp b/Minecraft.Client/MobRenderer.cpp index ee5125302..4976f8a61 100644 --- a/Minecraft.Client/MobRenderer.cpp +++ b/Minecraft.Client/MobRenderer.cpp @@ -61,9 +61,9 @@ void MobRenderer::renderLeash(shared_ptr entity, double x, double y, double x += rotOffCos; z += rotOffSin; - double dx = (float) (endX - startX); - double dy = (float) (endY - startY); - double dz = (float) (endZ - startZ); + double dx = static_cast(endX - startX); + double dy = static_cast(endY - startY); + double dz = static_cast(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 = (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)); + 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)); } 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 = (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); + 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); } tessellator->end(); diff --git a/Minecraft.Client/MobSpawnerRenderer.cpp b/Minecraft.Client/MobSpawnerRenderer.cpp index 02aac27fd..9b6e6a0e2 100644 --- a/Minecraft.Client/MobSpawnerRenderer.cpp +++ b/Minecraft.Client/MobSpawnerRenderer.cpp @@ -16,7 +16,7 @@ void MobSpawnerRenderer::render(shared_ptr _spawner, double x, doubl void MobSpawnerRenderer::render(BaseMobSpawner *spawner, double x, double y, double z, float a) { glPushMatrix(); - glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); + glTranslatef(static_cast(x) + 0.5f, static_cast(y), static_cast(z) + 0.5f); shared_ptr e = spawner->getDisplayEntity(); if (e != NULL) @@ -24,7 +24,7 @@ void MobSpawnerRenderer::render(BaseMobSpawner *spawner, double x, double y, dou e->setLevel(spawner->getLevel()); float s = 7 / 16.0f; glTranslatef(0, 0.4f, 0); - glRotatef((float) (spawner->oSpin + (spawner->spin - spawner->oSpin) * a) * 10, 0, 1, 0); + glRotatef(static_cast(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 5a4b6f2e8..305c5a0a1 100644 --- a/Minecraft.Client/Model.h +++ b/Minecraft.Client/Model.h @@ -23,7 +23,7 @@ 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((int)cubes.size()));} + virtual ModelPart *getRandomModelPart(Random random) {return cubes.at(random.nextInt(static_cast(cubes.size())));} virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} void setMapTex(wstring id, int x, int y); diff --git a/Minecraft.Client/ModelPart.cpp b/Minecraft.Client/ModelPart.cpp index c59a821c7..57424bc66 100644 --- a/Minecraft.Client/ModelPart.cpp +++ b/Minecraft.Client/ModelPart.cpp @@ -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, (float)tex)); + cubes.push_back(new Cube(this, xTexOffs, yTexOffs, x0, y0, z0, w, h, d, static_cast(tex))); } void ModelPart::setPos(float x, float y, float z) @@ -307,8 +307,8 @@ void ModelPart::compile(float scale) ModelPart *ModelPart::setTexSize(int xs, int ys) { - this->xTexSize = (float)xs; - this->yTexSize = (float)ys; + this->xTexSize = static_cast(xs); + this->yTexSize = static_cast(ys); return this; } diff --git a/Minecraft.Client/MultiPlayerChunkCache.cpp b/Minecraft.Client/MultiPlayerChunkCache.cpp index a4c200bed..4a9ca59ae 100644 --- a/Minecraft.Client/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/MultiPlayerChunkCache.cpp @@ -65,7 +65,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level) { if( y >= 3 ) { - ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); + static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); } } } @@ -77,11 +77,11 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level) { if( y >= ( level->getSeaLevel() - 1 ) ) { - ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); + static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15); } else { - ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2); + static_cast(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2); } } } @@ -294,7 +294,7 @@ void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chun wstring MultiPlayerChunkCache::gatherStats() { EnterCriticalSection(&m_csLoadCreate); - int size = (int)loadedChunkList.size(); + int size = static_cast(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 9c4b07959..7657039c7 100644 --- a/Minecraft.Client/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/MultiPlayerGameMode.cpp @@ -163,7 +163,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, (int)(destroyProgress * 10) - 1); + minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, static_cast(destroyProgress * 10) - 1); } } @@ -235,7 +235,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) destroyDelay = 5; } - minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, (int)(destroyProgress * 10) - 1); + minecraft->level->destroyTileProgress(minecraft->player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, static_cast(destroyProgress * 10) - 1); } else { @@ -292,9 +292,9 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha { ensureHasSentCarriedItem(); } - float clickX = (float) hit->x - x; - float clickY = (float) hit->y - y; - float clickZ = (float) hit->z - z; + float clickX = static_cast(hit->x) - x; + float clickY = static_cast(hit->y) - y; + float clickZ = static_cast(hit->z) - z; bool didSomething = false; if (!player->isSneaking() || player->getCarriedItem() == NULL) diff --git a/Minecraft.Client/MultiPlayerLevel.cpp b/Minecraft.Client/MultiPlayerLevel.cpp index 86b2914f2..4b74bbf17 100644 --- a/Minecraft.Client/MultiPlayerLevel.cpp +++ b/Minecraft.Client/MultiPlayerLevel.cpp @@ -770,11 +770,11 @@ 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, (float) x, (float) y, (float) z, volume, pitch, (int) Math::round(delayInSeconds * SharedConstants::TICKS_PER_SECOND)); + minecraft->soundEngine->schedule(iSound, static_cast(x), static_cast(y), static_cast(z), volume, pitch, static_cast(Math::round(delayInSeconds * SharedConstants::TICKS_PER_SECOND))); } else { - minecraft->soundEngine->play(iSound, (float) x, (float) y, (float) z, volume, pitch); + minecraft->soundEngine->play(iSound, static_cast(x), static_cast(y), static_cast(z), volume, pitch); } } } diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/MultiPlayerLocalPlayer.cpp index 25bf06bf1..3c3c34310 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp @@ -213,7 +213,7 @@ void MultiplayerLocalPlayer::completeUsingItem() Minecraft *pMinecraft = Minecraft::GetInstance(); if(useItem != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); tutorial->completeUsingItem(useItem); } @@ -225,7 +225,7 @@ void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance *effect) Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -238,7 +238,7 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance *effect, bool doR Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -251,7 +251,7 @@ void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); tutorial->onEffectChanged(MobEffect::effects[effect->getId()],true); } @@ -324,7 +324,7 @@ bool MultiplayerLocalPlayer::isLocalPlayer() void MultiplayerLocalPlayer::sendRidingJump() { - connection->send(shared_ptr(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, (int) (getJumpRidingScale() * 100.0f)))); + connection->send(shared_ptr(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, static_cast(getJumpRidingScale() * 100.0f)))); } void MultiplayerLocalPlayer::sendOpenInventory() @@ -372,7 +372,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(wasRiding && !isRiding) { gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Gameplay); diff --git a/Minecraft.Client/MushroomCowRenderer.cpp b/Minecraft.Client/MushroomCowRenderer.cpp index b5f9ba9f8..277e05d8a 100644 --- a/Minecraft.Client/MushroomCowRenderer.cpp +++ b/Minecraft.Client/MushroomCowRenderer.cpp @@ -42,7 +42,7 @@ void MushroomCowRenderer::additionalRendering(shared_ptr _mob, flo glPopMatrix(); glPushMatrix(); - ((QuadrupedModel *) model)->head->translateTo(1 / 16.0f); + static_cast(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/NetherPortalParticle.cpp b/Minecraft.Client/NetherPortalParticle.cpp index 4b70d38f5..9dcdd4ce5 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 = (int) (Math::random()*10) + 40; + lifetime = static_cast(Math::random() * 10) + 40; noPhysics = true; - setMiscTex((int)(Math::random()*8)); + setMiscTex(static_cast(Math::random() * 8)); } void NetherPortalParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) { - float s = (age + a) / (float) lifetime; + float s = (age + a) / static_cast(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/(float)lifetime; + float pos = age/static_cast(lifetime); pos = pos*pos; pos = pos*pos; int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br2 += (int) (pos * 15 * 16); + br2 += static_cast(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/(float)lifetime; + float pos = age/static_cast(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/(float)lifetime; + float pos = age/static_cast(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 2e2320c8a..6d2a31cdb 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 = (int) floor(0.5 + (xa*24.0)) + (int) eMinecraftColour_Particle_Note_00; - unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( (eMinecraftColour) note ); + 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) ); 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 729d26f92..0a93fa921 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 = (float) xOff; - this->yOff = (float) yOff; - this->zOff = (float) zOff; + this->xOff = static_cast(xOff); + this->yOff = static_cast(yOff); + this->zOff = static_cast(zOff); } bool OffsettedRenderList::isAt(int x, int y, int z) diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index fac7fe13e..d7e032fc6 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 (int)(this-options); + return static_cast(this - options); } wstring Options::Option::getCaptionId() const @@ -417,7 +417,7 @@ void Options::load() // 4J - removed try/catch // try { wstring cmds[2]; - int splitpos = (int)line.find(L":"); + int splitpos = static_cast(line.find(L":")); if( splitpos == wstring::npos ) { cmds[0] = line; diff --git a/Minecraft.Client/OptionsScreen.cpp b/Minecraft.Client/OptionsScreen.cpp index b5c2f5e60..197d74763 100644 --- a/Minecraft.Client/OptionsScreen.cpp +++ b/Minecraft.Client/OptionsScreen.cpp @@ -49,7 +49,7 @@ void OptionsScreen::buttonClicked(Button *button) if (!button->active) return; if (button->id < 100 && (dynamic_cast(button) != NULL)) { - options->toggle(((SmallButton *) button)->getOption(), 1); + options->toggle(static_cast(button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); } if (button->id == VIDEO_BUTTON_ID) diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl index a6b7dda24..b0bf146dc 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl @@ -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 != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(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; @@ -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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(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 = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(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 = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(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; diff --git a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp index 7f7c62d68..b9c4a6ed1 100644 --- a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp @@ -108,7 +108,7 @@ void SonyHttp_Orbis::printSslCertInfo(int libsslCtxId,SceSslCert *sslCert) app.DebugPrintf("sceSslGetSerialNumber() returns 0x%x\n", ret); } else { - sboData = (SceUChar8*)malloc(sboLen); + sboData = static_cast(malloc(sboLen)); if ( sboData != NULL ) { ret = sceSslGetSerialNumber(libsslCtxId, sslCert, sboData, &sboLen); if (ret < 0){ @@ -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", (*(SceInt32*)(userArg)) ); + app.DebugPrintf("\tbase tmpl[%x]\n", (*static_cast(userArg)) ); if (verifyErr != 0){ - printSslError((SceInt32)SCE_HTTPS_ERROR_CERT, verifyErr); + printSslError(static_cast(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, (void*)&tmplId); + ret = sceHttpsSetSslCallback(tmplId, sslCallback, static_cast(&tmplId)); if (ret < 0) { app.DebugPrintf("sceHttpsSetSslCallback() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp index e248f602c..0af059a90 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) { - ((SonyRemoteStorage_Orbis*)userData)->internalCallback(event, retCode); + static_cast(userData)->internalCallback(event, retCode); } void SonyRemoteStorage_Orbis::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) { diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl index 811f524a9..c8a3b42ea 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl @@ -274,23 +274,23 @@ static int pshader_basic_econst[28] = { static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { { { 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_1 }, { NULL }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, + { { pshader_basic_2 }, { NULL }, { -1, 7, -1, static_cast((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_4 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_5 }, { NULL }, { 0, 7, -1, static_cast((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_7 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_8 }, { NULL }, { 0, 7, -1, static_cast((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_10 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 8)), -1, } }, + { { pshader_basic_11 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 10)), -1, } }, + { { pshader_basic_12 }, { NULL }, { 0, 7, -1, -1, static_cast((intptr_t)(pshader_basic_econst + 12)), } }, + { { pshader_basic_13 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 16)), static_cast((intptr_t)(pshader_basic_econst + 18)), } }, + { { pshader_basic_14 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 22)), static_cast((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, } }, + { { pshader_basic_16 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_17 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, }; static unsigned char pshader_exceptional_blend_1[368] = { @@ -537,18 +537,18 @@ static int pshader_exceptional_blend_econst[4] = { static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { { { 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), } }, + { { pshader_exceptional_blend_1 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_2 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_3 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_4 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_5 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_6 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_7 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_8 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_9 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_10 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_11 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, + { { pshader_exceptional_blend_12 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, }; static unsigned char pshader_filter_0[416] = { @@ -1121,34 +1121,34 @@ static int pshader_filter_econst[90] = { }; static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { { 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, } }, + { { pshader_filter_0 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { -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 }, { NULL }, { -1, -1, static_cast((intptr_t)(pshader_filter_econst + 27)), -1, -1, -1, -1, -1, } }, + { { pshader_filter_10 }, { NULL }, { 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 }, { NULL }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 29)), 2, static_cast((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, } }, + { { pshader_filter_16 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 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 }, { NULL }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((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, } }, @@ -1562,14 +1562,14 @@ static int pshader_blur_econst[256] = { static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { { { 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), } }, + { { pshader_blur_2 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 0)), static_cast((intptr_t)(pshader_blur_econst + 13)), } }, + { { pshader_blur_3 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 18)), static_cast((intptr_t)(pshader_blur_econst + 33)), } }, + { { pshader_blur_4 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 40)), static_cast((intptr_t)(pshader_blur_econst + 57)), } }, + { { pshader_blur_5 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 66)), static_cast((intptr_t)(pshader_blur_econst + 85)), } }, + { { pshader_blur_6 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 96)), static_cast((intptr_t)(pshader_blur_econst + 117)), } }, + { { pshader_blur_7 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 130)), static_cast((intptr_t)(pshader_blur_econst + 153)), } }, + { { pshader_blur_8 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 168)), static_cast((intptr_t)(pshader_blur_econst + 193)), } }, + { { pshader_blur_9 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 210)), static_cast((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 }, { NULL }, { 0, (int) (intptr_t) (pshader_color_matrix_econst + 0), } }, + { { pshader_color_matrix_0 }, { NULL }, { 0, static_cast((intptr_t)(pshader_color_matrix_econst + 0)), } }, }; static unsigned char vshader_vsps3_0[272] = { diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl index 86293ab6d..639b4c921 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl @@ -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 != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(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; @@ -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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(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 = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(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 = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(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; diff --git a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp index d38a1bc93..5f804051e 100644 --- a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp @@ -27,7 +27,7 @@ bool SonyHttp_PS3::loadCerts(size_t *numBufPtr, CellHttpsData **caListPtr) int ret = 0; char *buf = NULL; - caList = (CellHttpsData *)malloc(sizeof(CellHttpsData)*2); + caList = static_cast(malloc(sizeof(CellHttpsData) * 2)); if (NULL == caList) { app.DebugPrintf("failed to malloc cert data"); return false; @@ -39,7 +39,7 @@ bool SonyHttp_PS3::loadCerts(size_t *numBufPtr, CellHttpsData **caListPtr) return ret; } - buf = (char*)malloc(size); + buf = static_cast(malloc(size)); if (NULL == buf) { app.DebugPrintf("failed to malloc cert buffer"); free(caList); @@ -244,7 +244,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) } int bufferSize = length; - char* buffer = (char*)malloc(bufferSize+1); + char* buffer = static_cast(malloc(bufferSize + 1)); recvd = 0; diff --git a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp index bdd58e17c..a1f6c7fde 100644 --- a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -86,7 +86,7 @@ int SonyRemoteStorage_PS3::initPreconditions() void SonyRemoteStorage_PS3::staticInternalCallback(const SceRemoteStorageEvent event, int32_t retCode, void * userData) { - ((SonyRemoteStorage_PS3*)userData)->internalCallback(event, retCode); + static_cast(userData)->internalCallback(event, retCode); } void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) @@ -430,20 +430,20 @@ void SonyRemoteStorage_PS3::runCallback() int SonyRemoteStorage_PS3::SaveCompressCallback(LPVOID lpParam,bool bRes) { - SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)lpParam; + SonyRemoteStorage_PS3* pRS = static_cast(lpParam); pRS->m_compressedSaveState = e_state_Idle; return 0; } int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bool bIsOwner) { - SonyRemoteStorage_PS3* pRS = (SonyRemoteStorage_PS3*)pParam; + SonyRemoteStorage_PS3* pRS = static_cast(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(*((int*)pOrigSaveData) != 0) + if(*static_cast(pOrigSaveData) != 0) { app.DebugPrintf("compressing save data\n"); @@ -451,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 = (byte *)malloc( compLength ); + byte *compData = static_cast(malloc(compLength)); Compression::UseDefaultThreadStorage(); Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize); ZeroMemory(compData,8); diff --git a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp index 03d916ab4..a07646047 100644 --- a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp +++ b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp @@ -17,7 +17,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) } l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len ); - uint8_t *strUtf8=(uint8_t *)malloc(dst_len); + uint8_t *strUtf8=static_cast(malloc(dst_len)); memset(strUtf8,0,dst_len); result = l10n_convert_str( cd, wchString, &src_len, strUtf8, &dst_len ); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index 1cb5e2eec..9aa7978a2 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] = (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(); + 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()); 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, ((ThinFenceTile*)Tile::ironFence)->getEdgeTexture()); - setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, ((ThinFenceTile*)Tile::thinGlass)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.ironFence_EdgeTexture, static_cast(Tile::ironFence)->getEdgeTexture()); + setIconSPUFromIcon(&m_tileData.thinGlass_EdgeTexture, static_cast(Tile::thinGlass)->getEdgeTexture()); //FarmTile - setIconSPUFromIcon(&m_tileData.farmTile_Dry, ((FarmTile*)Tile::farmland)->iconDry); - setIconSPUFromIcon(&m_tileData.farmTile_Wet, ((FarmTile*)Tile::farmland)->iconWet); + setIconSPUFromIcon(&m_tileData.farmTile_Dry, static_cast(Tile::farmland)->iconDry); + setIconSPUFromIcon(&m_tileData.farmTile_Wet, static_cast(Tile::farmland)->iconWet); // DoorTile for(int i=0;i<8; i++) { - setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], ((DoorTile*)Tile::door_wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.doorTile_Icons[i], static_cast(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], ((SandStoneTile*)Tile::sandStone)->icons[i]); - setIconSPUFromIcon(&m_tileData.sandStone_iconTop, ((SandStoneTile*)Tile::sandStone)->iconTop); - setIconSPUFromIcon(&m_tileData.sandStone_iconBottom, ((SandStoneTile*)Tile::sandStone)->iconBottom); + 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); // WoodTile // assert(WoodTile_SPU::WOOD_NAMES_LENGTH == 4); for(int i=0;i<4; i++) - setIconSPUFromIcon(&m_tileData.woodTile_icons[i], ((WoodTile*)Tile::wood)->icons[i]); + setIconSPUFromIcon(&m_tileData.woodTile_icons[i], static_cast(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], ((TreeTile*)Tile::treeTrunk)->icons[i]); - setIconSPUFromIcon(&m_tileData.treeTile_iconTop, ((TreeTile*)Tile::treeTrunk)->iconTop); + setIconSPUFromIcon(&m_tileData.treeTile_icons[i], static_cast(Tile::treeTrunk)->icons[i]); + setIconSPUFromIcon(&m_tileData.treeTile_iconTop, static_cast(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], ((CropTile*)Tile::crops)->icons[i]); + setIconSPUFromIcon(&m_tileData.cropTile_icons[i], static_cast(Tile::crops)->icons[i]); // FurnaceTile - 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); + 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); //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], ((Sapling*)Tile::sapling)->icons[i]); + setIconSPUFromIcon(&m_tileData.sapling_icons[i], static_cast(Tile::sapling)->icons[i]); - m_tileData.glassTile_allowSame = ((GlassTile*)Tile::glass)->allowSame; - m_tileData.iceTile_allowSame = ((IceTile*)Tile::ice)->allowSame; + m_tileData.glassTile_allowSame = static_cast(Tile::glass)->allowSame; + m_tileData.iceTile_allowSame = static_cast(Tile::ice)->allowSame; // DispenserTile - 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); + 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); // RailTile - setIconSPUFromIcon(&m_tileData.railTile_iconTurn, ((RailTile*)Tile::rail)->iconTurn); - setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, ((RailTile*)Tile::goldenRail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurn, static_cast(Tile::rail)->iconTurn); + setIconSPUFromIcon(&m_tileData.railTile_iconTurnGolden, static_cast(Tile::goldenRail)->iconTurn); for(int i=0;i<2;i++) - setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], ((DetectorRailTile*)Tile::detectorRail)->icons[i]); + setIconSPUFromIcon(&m_tileData.detectorRailTile_icons[i], static_cast(Tile::detectorRail)->icons[i]); // tntTile - setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, ((TntTile*)Tile::tnt)->iconBottom); - setIconSPUFromIcon(&m_tileData.tntTile_iconTop, ((TntTile*)Tile::tnt)->iconTop); + setIconSPUFromIcon(&m_tileData.tntTile_iconBottom, static_cast(Tile::tnt)->iconBottom); + setIconSPUFromIcon(&m_tileData.tntTile_iconTop, static_cast(Tile::tnt)->iconTop); // workbenchTile - setIconSPUFromIcon(&m_tileData.workBench_iconFront, ((WorkbenchTile*)Tile::workBench)->iconFront); - setIconSPUFromIcon(&m_tileData.workBench_iconTop, ((WorkbenchTile*)Tile::workBench)->iconTop); + setIconSPUFromIcon(&m_tileData.workBench_iconFront, static_cast(Tile::workBench)->iconFront); + setIconSPUFromIcon(&m_tileData.workBench_iconTop, static_cast(Tile::workBench)->iconTop); // cactusTile - setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, ((CactusTile*)Tile::cactus)->iconTop); - setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, ((CactusTile*)Tile::cactus)->iconBottom); + setIconSPUFromIcon(&m_tileData.cactusTile_iconTop, static_cast(Tile::cactus)->iconTop); + setIconSPUFromIcon(&m_tileData.cactusTile_iconBottom, static_cast(Tile::cactus)->iconBottom); // recordPlayer - setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, ((RecordPlayerTile*)Tile::recordPlayer)->iconTop); + setIconSPUFromIcon(&m_tileData.recordPlayer_iconTop, static_cast(Tile::recordPlayer)->iconTop); // pumpkin - 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); + 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); // cakeTile - 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); + 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); // SmoothStoneBrickTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], ((SmoothStoneBrickTile*)Tile::stoneBrickSmooth)->icons[i]); + setIconSPUFromIcon(&m_tileData.smoothStoneBrick_icons[i], static_cast(Tile::stoneBrickSmooth)->icons[i]); // HugeMushroomTile for(int i=0;i<2;i++) - 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); + 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); // MelonTile - setIconSPUFromIcon(&m_tileData.melonTile_iconTop, ((MelonTile*)Tile::melon)->iconTop); + setIconSPUFromIcon(&m_tileData.melonTile_iconTop, static_cast(Tile::melon)->iconTop); // StemTile - setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, ((StemTile*)Tile::melonStem)->iconAngled); + setIconSPUFromIcon(&m_tileData.stemTile_iconAngled, static_cast(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], ((NetherStalkTile*)Tile::netherStalk)->icons[i]); + setIconSPUFromIcon(&m_tileData.netherStalk_icons[i], static_cast(Tile::netherStalk)->icons[i]); // EnchantmentTableTile - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, ((EnchantmentTableTile*)Tile::enchantTable)->iconTop); - setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, ((EnchantmentTableTile*)Tile::enchantTable)->iconBottom); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconTop, static_cast(Tile::enchantTable)->iconTop); + setIconSPUFromIcon(&m_tileData.enchantmentTable_iconBottom, static_cast(Tile::enchantTable)->iconBottom); //BrewingStandTile - setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, ((BrewingStandTile*)Tile::brewingStand)->iconBase); + setIconSPUFromIcon(&m_tileData.brewingStand_iconBase, static_cast(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, ((StoneSlabTile*)(Tile::stoneSlab))->iconSide); + setIconSPUFromIcon(&m_tileData.stoneSlab_iconSide, static_cast(Tile::stoneSlab)->iconSide); for(int i=0;i<16;i++) - setIconSPUFromIcon(&m_tileData.clothTile_icons[i], ((ClothTile*)Tile::cloth)->icons[i]); + setIconSPUFromIcon(&m_tileData.clothTile_icons[i], static_cast(Tile::cloth)->icons[i]); // CarrotTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.carrot_icons[i], ((CarrotTile*)Tile::carrots)->icons[i]); + setIconSPUFromIcon(&m_tileData.carrot_icons[i], static_cast(Tile::carrots)->icons[i]); // PotatoTile for(int i=0;i<4;i++) - setIconSPUFromIcon(&m_tileData.potato_icons[i], ((PotatoTile*)Tile::potatoes)->icons[i]); + setIconSPUFromIcon(&m_tileData.potato_icons[i], static_cast(Tile::potatoes)->icons[i]); // AnvilTile for(int i=0;i<3;i++) - setIconSPUFromIcon(&m_tileData.anvil_icons[i], ((AnvilTile*)Tile::anvil)->icons[i]); + setIconSPUFromIcon(&m_tileData.anvil_icons[i], static_cast(Tile::anvil)->icons[i]); // QuartzBlockTile for(int i=0;i<5;i++) - setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], ((QuartzBlockTile*)Tile::quartzBlock)->icons[i]); + setIconSPUFromIcon(&m_tileData.quartzBlock_icons[i], static_cast(Tile::quartzBlock)->icons[i]); - 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); + 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); } // extern int g_lastHitBlockX; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Icon_SPU.h index f4ba6ccfa..0597c1fc2 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 = (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)); + 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)); } void flipHorizontal() { int16_t temp = x0; x0 = x1; x1 = temp; } void flipVertical() { int16_t temp = y0; y0 = y1; y1 = temp; } - float getU0() const { return (float(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); } - float getU1() const { return (float(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); } + 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 getU(double offset) const { float diff = getU1() - getU0(); - return getU0() + (diff * ((float) offset / 16));//SharedConstants::WORLD_RESOLUTION)); + return getU0() + (diff * (static_cast(offset) / 16));//SharedConstants::WORLD_RESOLUTION)); } - 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 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 getV(double offset) const { float diff = getV1() - getV0(); - return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION)); + return getV0() + (diff * (static_cast(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 7f13fd4f9..fa075e716 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 = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); + flow = static_cast(tRef.getPtr())->getFlow(level, x, y, z); } if (m->getID() == Material_SPU::lava_Id) { TileRef_SPU tRef(Tile_SPU::lava_Id); - flow = ((LiquidTile_SPU*)tRef.getPtr())->getFlow(level, x, y, z); + flow = static_cast(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/Tesselator_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp index 3d1007af1..7772aba9f 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 = (unsigned short)(x >> 31); + unsigned int sign = static_cast(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 = (((hfloat)sign) << 15) | (hfloat)(HALF_FLOAT_MAX_BIASED_EXP) | - (hfloat)(mantissa >> 13); + hf = (static_cast(sign) << 15) | static_cast(HALF_FLOAT_MAX_BIASED_EXP) | + static_cast(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 = (((hfloat)sign) << 15) | (hfloat)(mantissa); + hf = (static_cast(sign) << 15) | static_cast(mantissa); } else { - hf = (((hfloat)sign) << 15) | - (hfloat)((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | - (hfloat)(mantissa >> 13); + hf = (static_cast(sign) << 15) | + static_cast((exp - HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP) >> 13) | + static_cast(mantissa >> 13); } return hf; @@ -115,8 +115,8 @@ hfloat convertFloatToHFloat(float f) float convertHFloatToFloat(hfloat hf) { - unsigned int sign = (unsigned int)(hf >> 15); - unsigned int mantissa = (unsigned int)(hf & ((1 << 10) - 1)); + unsigned int sign = static_cast(hf >> 15); + unsigned int mantissa = static_cast(hf & ((1 << 10) - 1)); unsigned int exp = (unsigned int)(hf & HALF_FLOAT_MAX_BIASED_EXP); unsigned int f; @@ -329,12 +329,12 @@ void Tesselator_SPU::tex2(int tex2) void Tesselator_SPU::color(float r, float g, float b) { - color((int) (r * 255), (int) (g * 255), (int) (b * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255)); } void Tesselator_SPU::color(float r, float g, float b, float a) { - color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), static_cast(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 = (unsigned int)col; + unsigned int ucol = static_cast(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 = ((int)packedcol) & 0xffff; // 0 to 65535 range + int ipackedcol = static_cast(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] = (((int)((x + xo ) * 1024.0f))&0xffff); - pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff); - pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff); + 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[3] = ipackedcol; - pShortData[4] = (((int)(uu * 8192.0f))&0xffff); - pShortData[5] = (((int)(v * 8192.0f))&0xffff); + pShortData[4] = (static_cast(uu * 8192.0f)&0xffff); + pShortData[5] = (static_cast(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 = (byte) (x * 127); - byte yy = (byte) (y * 127); - byte zz = (byte) (z * 127); + byte xx = static_cast(x * 127); + byte yy = static_cast(y * 127); + byte zz = static_cast(z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp index ab9b2c94c..fd9421af0 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp @@ -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( (WaterlilyTile_SPU*)tt, x, y, z ); + retVal = tesselateLilypadInWorld( static_cast(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( (FireTile_SPU *)tt, x, y, z ); + retVal = tesselateFireInWorld( static_cast(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( ( RailTile_SPU* )tt, x, y, z ); + retVal = tesselateRailInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_STAIRS: - retVal = tesselateStairsInWorld( (StairTile_SPU *)tt, x, y, z ); + retVal = tesselateStairsInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_EGG: - retVal = tesselateEggInWorld((EggTile_SPU*) tt, x, y, z); + retVal = tesselateEggInWorld(static_cast(tt), x, y, z); break; case Tile_SPU::SHAPE_FENCE: - retVal = tesselateFenceInWorld( ( FenceTile_SPU* )tt, x, y, z ); + retVal = tesselateFenceInWorld( static_cast(tt), x, y, z ); break; case Tile_SPU::SHAPE_WALL: - retVal = tesselateWallInWorld( (WallTile_SPU *) tt, x, y, z); + retVal = tesselateWallInWorld( static_cast(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( (DiodeTile_SPU *)tt, x, y, z ); + retVal = tesselateDiodeInWorld( static_cast(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( ( FenceGateTile_SPU* )tt, x, y, z ); + retVal = tesselateFenceGateInWorld( static_cast(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((BrewingStandTile_SPU* ) tt, x, y, z); + retVal = tesselateBrewingStandInWorld(static_cast(tt), x, y, z); break; case Tile_SPU::SHAPE_PORTAL_FRAME: retVal = tesselateAirPortalFrameInWorld((TheEndPortalFrameTile *)tt, 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, (float)x - r2, (float)y + h, (float)z, -r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) - r2, static_cast(y) + h, static_cast(z), -r, 0.0f, 0 ); } else if ( dir == 2 ) { - tesselateTorch( tt, (float)x + r2, (float)y + h, (float)z, +r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) + r2, static_cast(y) + h, static_cast(z), +r, 0.0f, 0 ); } else if ( dir == 3 ) { - tesselateTorch( tt, (float)x, (float)y + h, z - r2, 0.0f, -r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, z - r2, 0.0f, -r, 0 ); } else if ( dir == 4 ) { - tesselateTorch( tt, (float)x, (float)y + h, (float)z + r2, 0.0f, +r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, static_cast(z) + r2, 0.0f, +r, 0 ); } else { - tesselateTorch( tt, (float)x, (float)y, (float)z, 0.0f, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y), static_cast(z), 0.0f, 0.0f, 0 ); } return true; @@ -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 ), ( 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 )( 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 )( 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 ) ); + 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 ) ); 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( ( 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 + 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 + 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 ) ); + 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 ) ); 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 ), ( 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 )( 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 )( 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 ) ); + 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 ) ); 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( ( 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 + 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 + 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 ) ); + 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 ) ); } 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( ( 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( 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 - 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 ), ( 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 ) ); + 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 ) ); 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 ), ( float )( z + - 0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + - 0 ), ( float )( u0 ), ( float )( v0 ) ); + 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 ) ); } else { @@ -2789,15 +2789,15 @@ bool TileRenderer_SPU::tesselateRailInWorld( RailTile_SPU* tt, int x, int y, int float r = 1 / 16.0f; - float x0 = ( float )( x + 1 ); - float x1 = ( float )( x + 1 ); - float x2 = ( float )( x + 0 ); - float x3 = ( float )( x + 0 ); + 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 z0 = ( float )( z + 0 ); - float z1 = ( float )( z + 1 ); - float z2 = ( float )( z + 1 ); - float z3 = ( float )( z + 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 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 = ( float )( x + 1 ); - x1 = x2 = ( float )( x + 0 ); - z0 = z1 = ( float )( z + 1 ); - z2 = z3 = ( float )( z + 0 ); + x0 = x3 = static_cast(x + 1); + x1 = x2 = static_cast(x + 0); + z0 = z1 = static_cast(z + 1); + z2 = z3 = static_cast(z + 0); } else if ( data == 8 ) { - x0 = x1 = ( float )( x + 0 ); - x2 = x3 = ( float )( x + 1 ); - z0 = z3 = ( float )( z + 1 ); - z1 = z2 = ( float )( z + 0 ); + x0 = x1 = static_cast(x + 0); + x2 = x3 = static_cast(x + 1); + z0 = z3 = static_cast(z + 1); + z1 = z2 = static_cast(z + 0); } else if ( data == 9 ) { - x0 = x3 = ( float )( x + 0 ); - x1 = x2 = ( float )( x + 1 ); - z0 = z1 = ( float )( z + 0 ); - z2 = z3 = ( float )( z + 1 ); + x0 = x3 = static_cast(x + 0); + x1 = x2 = static_cast(x + 1); + z0 = z1 = static_cast(z + 0); + z2 = z3 = static_cast(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 = (float)x; - float yt = (float)y; - float zt = (float)z; + float xt = static_cast(x); + float yt = static_cast(y); + float zt = static_cast(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 = ( StemTile_SPU* )_tt; + StemTile_SPU* tt = static_cast(_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 = (int) ((seed >> 16) & 0x3); + int dir = static_cast((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 = ( float )LiquidTile_SPU::getSlopeAngle( level, x, y, z, m ); + float angle = static_cast(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 = ( float )( x ); - x1 = ( float )( x + 1 ); + x0 = static_cast(x); + x1 = static_cast(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 = ( float )( x + 1 ); - x1 = ( float )( x ); + x0 = static_cast(x + 1); + x1 = static_cast(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 = ( float )( z + 1 ); - z1 = ( float )( z ); + z0 = static_cast(z + 1); + z1 = static_cast(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 = ( float )( z ); - z1 = ( float )( z + 1 ); + z0 = static_cast(z); + z1 = static_cast(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 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + 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 ) ); } @@ -4786,7 +4786,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4g *= ll4; c4b *= ll4; - renderFaceDown( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 0 ) ); + renderFaceDown( tt, static_cast(pX), static_cast(pY), static_cast(pZ), getTexture( tt, level, pX, pY, pZ, 0 ) ); } if ( faceFlags & 0x02 ) { @@ -4878,7 +4878,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti c4b *= ll4; - renderFaceUp( tt, ( float )pX, ( float )pY, ( float )pZ, getTexture( tt, level, pX, pY, pZ, 1 ) ); + renderFaceUp( tt, static_cast(pX), static_cast(pY), static_cast(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 = (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)); + 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)); 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, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(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, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderNorth( tt, static_cast(pX), static_cast(pY), static_cast(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 = (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)); + 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)); 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, ( float )pX, ( float )pY, ( float )pZ, 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 ) ); 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, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderSouth( tt, static_cast(pX), static_cast(pY), static_cast(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 = (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); + 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); 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, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderWest( tt, static_cast(pX), static_cast(pY), static_cast(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, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderWest( tt, static_cast(pX), static_cast(pY), static_cast(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 = (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); + 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); 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, ( float )pX, ( float )pY, ( float )pZ, tex ); + renderEast( tt, static_cast(pX), static_cast(pY), static_cast(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, ( float )pX, ( float )pY, ( float )pZ, GrassTile_SPU::getSideTextureOverlay() ); + renderEast( tt, static_cast(pX), static_cast(pY), static_cast(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 = (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; + 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; return (top << 16) | bottom; } diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl index 4fae9c12c..ab78cd93a 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl @@ -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 != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(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; @@ -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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(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 = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(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 = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(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; diff --git a/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp index 9110edf55..fd311fa7b 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", (SceInt32)userArg); + app.DebugPrintf("\tbase tmpl[%x]\n", static_cast(userArg)); if (verifyErr != 0){ - printSslError((SceInt32)SCE_HTTPS_ERROR_CERT, verifyErr); + printSslError(static_cast(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, (void*)&tmplId); + ret = sceHttpsSetSslCallback(tmplId, sslCallback, static_cast(&tmplId)); if (ret < 0) { app.DebugPrintf("sceHttpsSetSslCallback() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp index c103b32fd..ed7fa5ccb 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) { - ((SonyRemoteStorage_Vita*)userData)->internalCallback(event, retCode); + static_cast(userData)->internalCallback(event, retCode); } void SonyRemoteStorage_Vita::internalCallback(const SceRemoteStorageEvent event, int32_t retCode) @@ -299,7 +299,7 @@ bool SonyRemoteStorage_Vita::setDataInternal() snprintf(m_saveFilename, sizeof(m_saveFilename), "%s:%s/GAMEDATA.bin", "savedata0", m_setDataSaveInfo->UTF8SaveFilename); SceFiosSize outSize = sceFiosFileGetSizeSync(NULL, m_saveFilename); - m_uploadSaveSize = (int)outSize; + m_uploadSaveSize = static_cast(outSize); strcpy(m_saveFileDesc, m_setDataSaveInfo->UTF8SaveTitle); m_status = e_setDataInProgress; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp b/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp index 1327a6d6f..9203c30d0 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp @@ -9,7 +9,7 @@ CustomMap::CustomMap() m_NodePoolIndex = 0; m_HashSize = 1024; - m_HashTable = (SCustomMapNode**) malloc(m_HashSize * sizeof(SCustomMapNode)); + m_HashTable = static_cast(malloc(m_HashSize * sizeof(SCustomMapNode))); clear(); } @@ -115,16 +115,16 @@ void CustomMap::resize() SCustomMapNode **NodePool; if( m_NodePool ) { - NodePool = (SCustomMapNode**) realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomMapNode)); + NodePool = static_cast(realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomMapNode))); } else { - NodePool = (SCustomMapNode**) malloc(m_NodePoolSize * sizeof(SCustomMapNode)); + NodePool = static_cast(malloc(m_NodePoolSize * sizeof(SCustomMapNode))); } for( int i = 0;i < m_NodePoolSize - OldPoolSize;i += 1 ) { - NodePool[i + OldPoolSize] = (SCustomMapNode*) malloc(sizeof(SCustomMapNode)); + NodePool[i + OldPoolSize] = static_cast(malloc(sizeof(SCustomMapNode))); } m_NodePool = NodePool; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp index 6538a2360..108425931 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp @@ -9,7 +9,7 @@ CustomSet::CustomSet() m_NodePoolIndex = 0; m_HashSize = 1024; - m_HashTable = (SCustomSetNode**) malloc(m_HashSize * sizeof(SCustomSetNode)); + m_HashTable = static_cast(malloc(m_HashSize * sizeof(SCustomSetNode))); clear(); } @@ -113,16 +113,16 @@ void CustomSet::resize() SCustomSetNode **NodePool; if( m_NodePool ) { - NodePool = (SCustomSetNode**) realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomSetNode)); + NodePool = static_cast(realloc(m_NodePool, m_NodePoolSize * sizeof(SCustomSetNode))); } else { - NodePool = (SCustomSetNode**) malloc(m_NodePoolSize * sizeof(SCustomSetNode)); + NodePool = static_cast(malloc(m_NodePoolSize * sizeof(SCustomSetNode))); } for( int i = 0;i < m_NodePoolSize - OldPoolSize;i += 1 ) { - NodePool[i + OldPoolSize] = (SCustomSetNode*) malloc(sizeof(SCustomSetNode)); + NodePool[i + OldPoolSize] = static_cast(malloc(sizeof(SCustomSetNode))); } m_NodePool = NodePool; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h index 201030185..e480ed198 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 (uint32_t)(rl >> 32); + return static_cast(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 = (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 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 x0y0_hi = libdivide__mullhi_u32(x0, y0); - const uint64_t x0y1 = x0 * (uint64_t)y1; - const uint64_t x1y0 = x1 * (uint64_t)y0; - const uint64_t x1y1 = x1 * (uint64_t)y1; + const uint64_t x0y1 = x0 * static_cast(y1); + const uint64_t x1y0 = x1 * static_cast(y0); + const uint64_t x1y1 = x1 * static_cast(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 = (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 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 x0y0_hi = libdivide__mullhi_u32(x0, y0); - 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); + 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); #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((uint32_t)(val >> 32)); + return 32 + libdivide__count_trailing_zeros32(static_cast(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 = (((uint64_t)u1) << 32) | u0; - uint32_t result = (uint32_t)(n / v); - *r = (uint32_t)(n - result * (uint64_t)v); + uint64_t n = (static_cast(u1) << 32) | u0; + uint32_t result = static_cast(n / v); + *r = static_cast(n - result * (uint64_t)v); return result; } #endif @@ -479,8 +479,8 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, if (u1 >= v) { // If overflow, set rem. if (r != NULL) // to an impossible value, - *r = (uint64_t)(-1); // and return the largest - return (uint64_t)(-1);} // possible quotient. + *r = static_cast(-1); // and return the largest + return static_cast(-1);} // possible quotient. /* count leading zeros */ s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. @@ -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 (int32_t)(rl >> 32); //needs to be arithmetic shift + return static_cast(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 = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick + uint32_t absD = static_cast(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 ? -(int32_t)proposed_m : (int32_t)proposed_m); + result.magic = (d < 0 ? -static_cast(proposed_m) : static_cast(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 = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend + int32_t shiftMask = static_cast(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 = (int8_t)more >> 7; //must be arithmetic shift and then sign extend + int32_t sign = static_cast(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 = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick + const uint64_t absD = static_cast(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 ? -(int64_t)proposed_m : (int64_t)proposed_m); + result.magic = (d < 0 ? -static_cast(proposed_m) : static_cast(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 = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend + int64_t shiftMask = static_cast(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 = (int8_t)more >> 7; //must be arithmetic shift and then sign extend + int64_t sign = static_cast(more) >> 7; //must be arithmetic shift and then sign extend q += ((numer ^ sign) - sign); } q >>= more & LIBDIVIDE_64_SHIFT_MASK; @@ -1141,8 +1141,8 @@ 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 *(uint32_t *)NULL; } - uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *(uint64_t *)NULL; } + uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *static_cast(NULL); } + uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *static_cast(NULL); } #if LIBDIVIDE_USE_SSE2 __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; } diff --git a/Minecraft.Client/PaintingRenderer.cpp b/Minecraft.Client/PaintingRenderer.cpp index f5e09dbd2..b51ab0f48 100644 --- a/Minecraft.Client/PaintingRenderer.cpp +++ b/Minecraft.Client/PaintingRenderer.cpp @@ -21,7 +21,7 @@ void PaintingRenderer::render(shared_ptr _painting, double x, double y, random->setSeed(187); glPushMatrix(); - glTranslatef((float)x, (float)y, (float)z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 1091a26aa..25ec2ec4c 100644 --- a/Minecraft.Client/Particle.cpp +++ b/Minecraft.Client/Particle.cpp @@ -35,7 +35,7 @@ void Particle::_init(Level *level, double x, double y, double z) size = (random->nextFloat() * 0.5f + 0.5f) * 2; - lifetime = (int) (4 / (random->nextFloat() * 0.9f + 0.1f)); + lifetime = static_cast(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 + (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; + 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; float dd = (float) (Mth::sqrt(xd * xd + yd * yd + zd * zd)); xd = xd / dd * speed * 0.4f; @@ -164,9 +164,9 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa v1 = tex->getV1(); } - 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 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 br = 1.0f; // 4J - change brought forward from 1.8.2 if( !SharedConstants::TEXTURE_LIGHTING ) diff --git a/Minecraft.Client/PauseScreen.cpp b/Minecraft.Client/PauseScreen.cpp index 18d066b5a..791d819b5 100644 --- a/Minecraft.Client/PauseScreen.cpp +++ b/Minecraft.Client/PauseScreen.cpp @@ -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 = (int) (255 * col); + int br = static_cast(255 * col); drawString(font, L"Saving level..", 8, height - 16, br << 16 | br << 8 | br); } diff --git a/Minecraft.Client/PistonPieceRenderer.cpp b/Minecraft.Client/PistonPieceRenderer.cpp index c51d2e0f8..ca7294fc8 100644 --- a/Minecraft.Client/PistonPieceRenderer.cpp +++ b/Minecraft.Client/PistonPieceRenderer.cpp @@ -35,7 +35,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl t->begin(); - t->offset((float) x - entity->x + entity->getXOff(a), (float) y - entity->y + entity->getYOff(a), (float) z - entity->z + entity->getZOff(a)); + 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->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(((PistonBaseTile *) tile)->getPlatformTexture()); + Tile::pistonExtension->setOverrideTopTexture(static_cast(tile)->getPlatformTexture()); tileRenderer->tesselatePistonArmNoCulling(Tile::pistonExtension, entity->x, entity->y, entity->z, entity->getProgress(a) < 0.5f, entity->getData()); Tile::pistonExtension->clearOverrideTopTexture(); - t->offset((float) x - entity->x, (float) y - entity->y, (float) z - entity->z); + t->offset(static_cast(x) - entity->x, static_cast(y) - entity->y, static_cast(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 ae81bd699..01d1b8fdb 100644 --- a/Minecraft.Client/PlayerChunkMap.cpp +++ b/Minecraft.Client/PlayerChunkMap.cpp @@ -187,7 +187,7 @@ void PlayerChunkMap::PlayerChunk::tileChanged(int x, int y, int z) if (changes < MAX_CHANGES_BEFORE_RESEND) { - short id = (short) ((x << 12) | (z << 8) | (y)); + short id = static_cast((x << 12) | (z << 8) | (y)); for (int i = 0; i < changes; i++) { @@ -365,7 +365,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( shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (byte)changes, level) ) ); + broadcast( shared_ptr( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, static_cast(changes), level) ) ); for (int i = 0; i < changes; i++) { int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); @@ -544,8 +544,8 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) if( addRequests.size() ) { // Find the nearest chunk request to the player - int px = (int)player->x; - int pz = (int)player->z; + int px = static_cast(player->x); + int pz = static_cast(player->z); int minDistSq = -1; auto itNearest = addRequests.end(); @@ -621,8 +621,8 @@ void PlayerChunkMap::add(shared_ptr player) { static int direction[4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, {0, -1} }; - int xc = (int) player->x >> 4; - int zc = (int) player->z >> 4; + int xc = static_cast(player->x) >> 4; + int zc = static_cast(player->z) >> 4; player->lastMoveX = player->x; player->lastMoveZ = player->z; @@ -724,8 +724,8 @@ void PlayerChunkMap::add(shared_ptr player) void PlayerChunkMap::remove(shared_ptr player) { - int xc = ((int) player->lastMoveX) >> 4; - int zc = ((int) player->lastMoveZ) >> 4; + int xc = static_cast(player->lastMoveX) >> 4; + int zc = static_cast(player->lastMoveZ) >> 4; for (int x = xc - radius; x <= xc + radius; x++) for (int z = zc - radius; z <= zc + radius; z++) @@ -767,16 +767,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 = ((int) player->x) >> 4; - int zc = ((int) player->z) >> 4; + int xc = static_cast(player->x) >> 4; + int zc = static_cast(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 = ((int) player->lastMoveX) >> 4; - int last_zc = ((int) player->lastMoveZ) >> 4; + int last_xc = static_cast(player->lastMoveX) >> 4; + int last_zc = static_cast(player->lastMoveZ) >> 4; int xd = xc - last_xc; int zd = zc - last_zc; @@ -841,8 +841,8 @@ void PlayerChunkMap::setRadius(int newRadius) shared_ptr player = players->players[i]; if( player->level == level ) { - int xc = ((int) player->x) >> 4; - int zc = ((int) player->z) >> 4; + int xc = static_cast(player->x) >> 4; + int zc = static_cast(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 6976fbab9..5132dfc6b 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 - (float) (Math::random() * 0.3f); + rCol = gCol = bCol = 1 - static_cast(Math::random() * 0.3f); size *= 0.75f; size *= scale; oSize = size; - lifetime = (int) (8 / (Math::random() * 0.8 + 0.3)); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.3)); lifetime *= scale; noPhysics = false; } diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index 266cae361..234a7bfa6 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -195,7 +195,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) yLastOk = player->y; zLastOk = player->z; } - ((Level *)level)->tick(player); + static_cast(level)->tick(player); return; } @@ -204,7 +204,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) { player->doTick(false); player->absMoveTo(xLastOk, yLastOk, zLastOk, player->yRot, player->xRot); - ((Level *)level)->tick(player); + static_cast(level)->tick(player); return; } @@ -1185,8 +1185,8 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrx / scale) * scale); - int centreZC = (int) (Math::round(player->z / scale) * scale); + int centreXC = static_cast(Math::round(player->x / scale) * scale); + int centreZC = static_cast(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; @@ -1210,7 +1210,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrx = centreXC; data->z = centreZC; - data->dimension = (byte) player->level->dimension->id; + data->dimension = static_cast(player->level->dimension->id); data->setDirty(); } @@ -1313,7 +1313,7 @@ void PlayerConnection::handleKeepAlive(shared_ptr packet) { if (packet->id == lastKeepAliveId) { - int time = (int) (System::nanoTime() / 1000000 - lastKeepAliveTime); + int time = static_cast(System::nanoTime() / 1000000 - lastKeepAliveTime); player->latency = (player->latency * 3 + time) / 4; } } @@ -1489,7 +1489,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo AbstractContainerMenu *menu = player->containerMenu; if (dynamic_cast(menu)) { - ((MerchantMenu *) menu)->setSelectionHint(selection); + static_cast(menu)->setSelectionHint(selection); } } else if (CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET.compare(customPayloadPacket->identifier) == 0) @@ -1531,7 +1531,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo int primary = input.readInt(); int secondary = input.readInt(); - BeaconMenu *beaconMenu = (BeaconMenu *) player->containerMenu; + BeaconMenu *beaconMenu = static_cast(player->containerMenu); Slot *slot = beaconMenu->getSlot(0); if (slot->hasItem()) { @@ -1600,7 +1600,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } else if (pTempItemInst->id == Item::fireworksCharge_Id || pTempItemInst->id == Item::fireworks_Id) { - CraftingMenu *menu = (CraftingMenu *)player->containerMenu; + CraftingMenu *menu = static_cast(player->containerMenu); player->openFireworks(menu->getX(), menu->getY(), menu->getZ() ); } else @@ -1697,7 +1697,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) { if (player->containerMenu->containerId == packet->containerId) { - MerchantMenu *menu = (MerchantMenu *)player->containerMenu; + MerchantMenu *menu = static_cast(player->containerMenu); MerchantRecipeList *offers = menu->getMerchant()->getOffers(player); diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index c1ccfe148..d1bde2079 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -85,7 +85,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr bool newPlayer = playerTag == NULL; player->setLevel(server->getLevel(player->dimension)); - player->gameMode->setLevel((ServerLevel *)player->level); + player->gameMode->setLevel(static_cast(player->level)); // Make sure these privileges are always turned off for the host player INetworkPlayer *networkPlayer = connection->getSocket()->getPlayer(); @@ -108,7 +108,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifdef _WINDOWS64 if (networkPlayer != NULL && !networkPlayer->IsLocal()) { - NetworkPlayerXbox* nxp = (NetworkPlayerXbox*)networkPlayer; + NetworkPlayerXbox* nxp = static_cast(networkPlayer); IQNetPlayer* qnp = nxp->GetQNetPlayer(); wcsncpy_s(qnp->m_gamertag, 32, player->name.c_str(), _TRUNCATE); } @@ -151,8 +151,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr int mapScale = 3; #ifdef _LARGE_WORLDS int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale); - int centreXC = (int) (Math::round(player->x / scale) * scale); - int centreZC = (int) (Math::round(player->z / scale) * scale); + int centreXC = static_cast(Math::round(player->x / scale) * scale); + int centreZC = static_cast(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; @@ -226,8 +226,8 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr addPlayerToReceiving( player ); 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) getMaxPlayers(), - level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), + static_cast(level->dimension->id), static_cast(level->getMaxBuildHeight()), static_cast(getMaxPlayers()), + level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), static_cast(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)) ); @@ -329,7 +329,7 @@ void PlayerList::changeDimension(shared_ptr player, ServerLevel *f if (from != NULL) from->getChunkMap()->remove(player); to->getChunkMap()->add(player); - to->cache->create(((int) player->x) >> 4, ((int) player->z) >> 4); + to->cache->create(static_cast(player->x) >> 4, static_cast(player->z) >> 4); } int PlayerList::getMaxRange() @@ -506,7 +506,7 @@ if (player->riding != NULL) shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) { #ifdef _WINDOWS64 - if (players.size() >= (unsigned int)MINECRAFT_NET_MAX_PLAYERS) + if (players.size() >= static_cast(MINECRAFT_NET_MAX_PLAYERS)) #else if (players.size() >= (unsigned int)maxPlayers) #endif @@ -682,14 +682,14 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay } // Ensure the area the player is spawning in is loaded! - level->cache->create(((int) player->x) >> 4, ((int) player->z) >> 4); + level->cache->create(static_cast(player->x) >> 4, static_cast(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( (char) player->dimension, player->level->getSeed(), player->level->getMaxBuildHeight(), + player->connection->send( std::make_shared( static_cast(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); @@ -806,7 +806,7 @@ 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( shared_ptr( new RespawnPacket((char) player->dimension, newLevel->getSeed(), newLevel->getMaxBuildHeight(), + player->connection->send( shared_ptr( new RespawnPacket(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()) ) ); @@ -905,8 +905,8 @@ void PlayerList::repositionAcrossDimension(shared_ptr entity, int lastDi if (lastDimension != 1) { - 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); + 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)); if (entity->isAlive()) { newLevel->addEntity(entity); @@ -1314,7 +1314,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 != NULL) progressListener->progressStagePercentage((i * 100)/ ((int)players.size())); + if(progressListener != NULL) progressListener->progressStagePercentage((i * 100)/ static_cast(players.size())); } playerIo->clearOldPlayerFiles(); playerIo->saveMapIdLookup(); @@ -1363,7 +1363,7 @@ void PlayerList::sendAllPlayerInfo(shared_ptr player) int PlayerList::getPlayerCount() { - return (int)players.size(); + return static_cast(players.size()); } int PlayerList::getPlayerCount(ServerLevel *level) diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 71c05067b..09d754183 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -32,7 +32,7 @@ ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f ) { - humanoidModel = (HumanoidModel *) model; + humanoidModel = static_cast(model); armorParts1 = new HumanoidModel(1.0f); armorParts2 = new HumanoidModel(0.5f); @@ -87,9 +87,9 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, fl if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) { int color = armorItem->getColor(itemInstance); - float red = (float) ((color >> 16) & 0xFF) / 0xFF; - float green = (float) ((color >> 8) & 0xFF) / 0xFF; - float blue = (float) (color & 0xFF) / 0xFF; + float red = static_cast((color >> 16) & 0xFF) / 0xFF; + float green = static_cast((color >> 8) & 0xFF) / 0xFF; + float blue = static_cast(color & 0xFF) / 0xFF; glColor3f(brightness * red, brightness * green, brightness * blue); if (itemInstance->isEnchanted()) return 0x1f; @@ -120,7 +120,7 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, in if (dynamic_cast(item)) { ArmorItem *armorItem = dynamic_cast(item); - bindTexture(HumanoidMobRenderer::getArmorLocation((ArmorItem *)item, layer, true)); + bindTexture(HumanoidMobRenderer::getArmorLocation(static_cast(item), layer, true)); float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); glColor3f(brightness, brightness, brightness); @@ -316,11 +316,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 = (float) yd * 10; + float flap = static_cast(yd) * 10; if (flap < -6) flap = -6; if (flap > 32) flap = 32; - float lean = (float) (xd * xa + zd * za) * 100; - float lean2 = (float) (xd * za - zd * xa) * 100; + float lean = static_cast(xd * xa + zd * za) * 100; + float lean2 = static_cast(xd * za - zd * xa) * 100; if (lean < 0) lean = 0; float pow = mob->oBob + (mob->bob - mob->oBob) * a; @@ -550,5 +550,5 @@ void PlayerRenderer::bindTexture(shared_ptr entity) ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr entity) { shared_ptr player = dynamic_pointer_cast(entity); - return new ResourceLocation((_TEXTURE_NAME)player->getTexture()); + return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture())); } \ No newline at end of file diff --git a/Minecraft.Client/Polygon.cpp b/Minecraft.Client/Polygon.cpp index 00176511f..05cf9b077 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(-(float)n->x, -(float)n->y, -(float)n->z); + t->normal(-static_cast(n->x), -static_cast(n->y), -static_cast(n->z)); } else { - t->normal((float)n->x, (float)n->y, (float)n->z); + t->normal(static_cast(n->x), static_cast(n->y), static_cast(n->z)); } for (int i = 0; i < 4; i++) { Vertex *v = vertices[i]; - t->vertexUV((float)(v->pos->x * scale), (float)( v->pos->y * scale), (float)( v->pos->z * scale), (float)( v->u), (float)( v->v)); + 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->end(); } diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index eeccb6285..5a98b3462 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -30,7 +30,7 @@ PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, cons stitchResult = NULL; m_mipMap = mipmap; - missingPosition = (StitchedTexture *)(new SimpleIcon(NAME_MISSING_TEXTURE,NAME_MISSING_TEXTURE,0,0,1,1)); + missingPosition = static_cast(new SimpleIcon(NAME_MISSING_TEXTURE, NAME_MISSING_TEXTURE, 0, 0, 1, 1)); } void PreStitchedTextureMap::stitch() diff --git a/Minecraft.Client/QuadrupedModel.cpp b/Minecraft.Client/QuadrupedModel.cpp index ea0419104..23d1758b4 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, (float)(12 + 6 - legSize), -6); + head->setPos(0, static_cast(12 + 6 - legSize), -6); body = new ModelPart(this, 28, 8); body->addBox(-5, -10, -7, 10, 16, 8, g); // Body - body->setPos(0, (float)(11 + 6 - legSize), 2); + body->setPos(0, static_cast(11 + 6 - legSize), 2); leg0 = new ModelPart(this, 0, 16); leg0->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg0 - leg0->setPos(-3, (float)(18 + 6 - legSize), 7); + leg0->setPos(-3, static_cast(18 + 6 - legSize), 7); leg1 = new ModelPart(this, 0, 16); leg1->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg1 - leg1->setPos(3, (float)(18 + 6 - legSize), 7); + leg1->setPos(3, static_cast(18 + 6 - legSize), 7); leg2 = new ModelPart(this, 0, 16); leg2->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg2 - leg2->setPos(-3, (float)(18 + 6 - legSize), -5); + leg2->setPos(-3, static_cast(18 + 6 - legSize), -5); leg3 = new ModelPart(this, 0, 16); leg3->addBox(-2, 0, -2, 4, legSize, 4, g); // Leg3 - leg3->setPos(3, (float)(18 + 6 - legSize), -5); + leg3->setPos(3, static_cast(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/RedDustParticle.cpp b/Minecraft.Client/RedDustParticle.cpp index 6a6ad1e1b..69eb225a0 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 = (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; + 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; size *= 0.75f; size *= scale; oSize = size; - lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); - lifetime = (int)(lifetime * scale); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(lifetime * scale); noPhysics = false; } diff --git a/Minecraft.Client/RemotePlayer.cpp b/Minecraft.Client/RemotePlayer.cpp index bea128428..ea946db02 100644 --- a/Minecraft.Client/RemotePlayer.cpp +++ b/Minecraft.Client/RemotePlayer.cpp @@ -103,8 +103,8 @@ void RemotePlayer::aiStep() while (yrd >= 180) yrd -= 360; - yRot += (float)((yrd) / lSteps); - xRot += (float)((lxr - xRot) / lSteps); + yRot += static_cast((yrd) / lSteps); + xRot += static_cast((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 = (float) atan(-yd * 0.2f) * 15.0f; + float tTilt = static_cast(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/ResourceLocation.h b/Minecraft.Client/ResourceLocation.h index f53c46c87..1274b25ab 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] = (_TEXTURE_NAME)textures[i]; + m_texture[i] = static_cast<_TEXTURE_NAME>(textures[i]); } m_preloaded = true; } diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 131cf0134..3e632f0b6 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -140,10 +140,10 @@ void Screen::updateEvents() else if (vk == VK_TAB) mappedKey = Keyboard::KEY_TAB; else if (vk >= 'A' && vk <= 'Z') { - ch = (wchar_t)(vk - 'A' + L'a'); - if (g_KBMInput.IsKeyDown(VK_LSHIFT) || g_KBMInput.IsKeyDown(VK_RSHIFT)) ch = (wchar_t)vk; + ch = static_cast(vk - 'A' + L'a'); + if (g_KBMInput.IsKeyDown(VK_LSHIFT) || g_KBMInput.IsKeyDown(VK_RSHIFT)) ch = static_cast(vk); } - else if (vk >= '0' && vk <= '9') ch = (wchar_t)vk; + else if (vk >= '0' && vk <= '9') ch = static_cast(vk); else if (vk == VK_SPACE) ch = L' '; if (mappedKey != -1) keyPressed(ch, mappedKey); diff --git a/Minecraft.Client/ScreenSizeCalculator.cpp b/Minecraft.Client/ScreenSizeCalculator.cpp index 32e942a79..38aa75a83 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 / (double) scale; - rawHeight = h / (double) scale; - w = (int) ceil(rawWidth); - h = (int) ceil(rawHeight); + rawWidth = w / static_cast(scale); + rawHeight = h / static_cast(scale); + w = static_cast(ceil(rawWidth)); + h = static_cast(ceil(rawHeight)); } int ScreenSizeCalculator::getWidth() diff --git a/Minecraft.Client/ScrolledSelectionList.cpp b/Minecraft.Client/ScrolledSelectionList.cpp index 9b7367ce0..953695ab9 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 + (int) yo - 4); + int clickSlotPos = (y - y0 - headerHeight + static_cast(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 = (float)max; + if (yo > max) yo = static_cast(max); } void ScrolledSelectionList::buttonClicked(Button *button) diff --git a/Minecraft.Client/SelectWorldScreen.cpp b/Minecraft.Client/SelectWorldScreen.cpp index 0481f1e53..75ccc268c 100644 --- a/Minecraft.Client/SelectWorldScreen.cpp +++ b/Minecraft.Client/SelectWorldScreen.cpp @@ -235,7 +235,7 @@ SelectWorldScreen::WorldSelectionList::WorldSelectionList(SelectWorldScreen *sws int SelectWorldScreen::WorldSelectionList::getNumberOfItems() { - return (int)this->parent->levelList->size(); + return static_cast(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 (int)parent->levelList->size() * 36; + return static_cast(parent->levelList->size()) * 36; } void SelectWorldScreen::WorldSelectionList::renderBackground() diff --git a/Minecraft.Client/ServerChunkCache.cpp b/Minecraft.Client/ServerChunkCache.cpp index 3af98ca66..2f79c6caa 100644 --- a/Minecraft.Client/ServerChunkCache.cpp +++ b/Minecraft.Client/ServerChunkCache.cpp @@ -995,7 +995,7 @@ void ServerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ) int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) { - SaveThreadData *params = (SaveThreadData *)lpParam; + SaveThreadData *params = static_cast(lpParam); if(params->useSharedThreadStorage) { diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index 1e00b591f..265a1428c 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -315,7 +315,7 @@ Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); if (mobList == NULL || mobList->empty()) return NULL; - return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (vector *)mobList); + return static_cast(WeighedRandom::getRandomItem(random, (vector *)mobList)); } void ServerLevel::updateSleepingPlayerList() @@ -640,8 +640,8 @@ void ServerLevel::resetEmptyTime() bool ServerLevel::tickPendingTicks(bool force) { EnterCriticalSection(&m_tickNextTickCS); - int count = (int)tickNextTickList.size(); - int count2 = (int)tickNextTickSet.size(); + int count = static_cast(tickNextTickList.size()); + int count2 = static_cast(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 = (int)tickNextTickList.size(); - int count4 = (int)tickNextTickSet.size(); + int count3 = static_cast(tickNextTickList.size()); + int count4 = static_cast(tickNextTickSet.size()); bool retval = tickNextTickList.size() != 0; LeaveCriticalSection(&m_tickNextTickCS); @@ -1024,7 +1024,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave) if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); DLCPack * pDLCPack=pDLCTexPack->getDLCInfoParentPack(); @@ -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, (float) x, (float) y, (float) z, (float) xDist, (float) yDist, (float) zDist, (float) speed, count ); + 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 ); for(auto& it : players) { diff --git a/Minecraft.Client/ServerLevelListener.cpp b/Minecraft.Client/ServerLevelListener.cpp index c191b1a95..3884b4696 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 = (double) x - p->x; - double yd = (double) y - p->y; - double zd = (double) z - p->z; + double xd = static_cast(x) - p->x; + double yd = static_cast(y) - p->y; + double zd = static_cast(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 76332358c..898e4a66f 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -1087,7 +1087,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget, const wstring containerMenu = new MerchantMenu(inventory, traderTarget, level); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); - shared_ptr container = ((MerchantMenu *) containerMenu)->getTradeContainer(); + shared_ptr container = static_cast(containerMenu)->getTradeContainer(); connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty()?L"":name, container->getContainerSize(), !name.empty()))); @@ -1559,7 +1559,7 @@ void ServerPlayer::onUpdateAbilities() ServerLevel *ServerPlayer::getLevel() { - return (ServerLevel *) level; + return static_cast(level); } void ServerPlayer::setGameMode(GameType *mode) diff --git a/Minecraft.Client/ServerPlayerGameMode.cpp b/Minecraft.Client/ServerPlayerGameMode.cpp index 2e6bca35e..4495c4da8 100644 --- a/Minecraft.Client/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/ServerPlayerGameMode.cpp @@ -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 = (int) (destroyProgress * 10); + int state = static_cast(destroyProgress * 10); if (state != lastSentState) { @@ -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 = (int) (destroyProgress * 10); + int state = static_cast(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 = (int) (progress * 10); + int state = static_cast(progress * 10); level->destroyTileProgress(player->entityId, x, y, z, state); lastSentState = state; } diff --git a/Minecraft.Client/Settings.cpp b/Minecraft.Client/Settings.cpp index 658d641db..ca0520f4e 100644 --- a/Minecraft.Client/Settings.cpp +++ b/Minecraft.Client/Settings.cpp @@ -40,9 +40,9 @@ Settings::Settings(File *file) line.erase(line.size() - 1); if (line.size() >= 3 && - (unsigned char)line[0] == 0xEF && - (unsigned char)line[1] == 0xBB && - (unsigned char)line[2] == 0xBF) + static_cast(line[0]) == 0xEF && + static_cast(line[1]) == 0xBB && + static_cast(line[2]) == 0xBF) { line.erase(0, 3); } diff --git a/Minecraft.Client/SheepRenderer.cpp b/Minecraft.Client/SheepRenderer.cpp index 5a3580bce..434505781 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) / (float) colorDuration; + float subStep = ((sheep->tickCount % colorDuration) + a) / static_cast(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 5f764a92a..3f0b21757 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((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f); + glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 0.75f * size, static_cast(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((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f); + glTranslatef(static_cast(x) + 0.5f, static_cast(y) + 0.75f * size, static_cast(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 ce8b8254a..7058d1870 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 - (float)BODY_SIZES[i][1], placement); + bodyParts[i]->setPos(0.0f, 24.0f - static_cast(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((int)i - 2)); - bodyParts[i]->x = Mth::sin(bob * .9f + i * .15f * PI) * PI * .2f * abs((int)i - 2); + 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); } bodyLayers[0]->yRot = bodyParts[2]->yRot; diff --git a/Minecraft.Client/SkullTileRenderer.cpp b/Minecraft.Client/SkullTileRenderer.cpp index 32d216cd6..e7b610bf1 100644 --- a/Minecraft.Client/SkullTileRenderer.cpp +++ b/Minecraft.Client/SkullTileRenderer.cpp @@ -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((float) x, (float) y, (float) z, skull->getData() & SkullTile::PLACEMENT_MASK, skull->getRotation() * 360 / 16.0f, skull->getSkullType(), skull->getExtraType()); + renderSkull(static_cast(x), static_cast(y), static_cast(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 0da24515a..0c7735af6 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)) / (float) (w - 8); + value = (xm - (x + 4)) / static_cast(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 + (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); + 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); } bool SlideButton::clicked(Minecraft *minecraft, int mx, int my) { if (Button::clicked(minecraft, mx, my)) { - value = (mx - (x + 4)) / (float) (w - 8); + value = (mx - (x + 4)) / static_cast(w - 8); if (value < 0) value = 0; if (value > 1) value = 1; minecraft->options->set(option, value); diff --git a/Minecraft.Client/SlimeRenderer.cpp b/Minecraft.Client/SlimeRenderer.cpp index f3f64aed4..ca5e51916 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 = (float) slime->getSize(); + float size = static_cast(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/SmokeParticle.cpp b/Minecraft.Client/SmokeParticle.cpp index a88558851..b48978f09 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 = (int) (8 / (Math::random() * 0.8 + 0.2)); - lifetime = (int) (lifetime * scale); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(lifetime * scale); noPhysics = false; } diff --git a/Minecraft.Client/SnowManRenderer.cpp b/Minecraft.Client/SnowManRenderer.cpp index 1e258f3c6..11855fe37 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 = (SnowManModel *) MobRenderer::model; + model = static_cast(MobRenderer::model); this->setArmor(model); } diff --git a/Minecraft.Client/SnowShovelParticle.cpp b/Minecraft.Client/SnowShovelParticle.cpp index 4417cb5d8..cf63a7309 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 - (float) (Math::random() * 0.3f); + rCol = gCol = bCol = 1 - static_cast(Math::random() * 0.3f); size *= 0.75f; size *= scale; oSize = size; - lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); - lifetime = (int) ( lifetime * scale ); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(lifetime * scale); noPhysics = false; } diff --git a/Minecraft.Client/SpellParticle.cpp b/Minecraft.Client/SpellParticle.cpp index ce8b975f1..cd0797ace 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 = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(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 739677e43..0cdc14cae 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, (float)(0+yo), -3); + head->setPos(0, static_cast(0 + yo), -3); body0 = new ModelPart(this, 0, 0); body0->addBox(-3, -3, -3, 6, 6, 6, g); // Body - body0->setPos(0,(float)(yo), 0); + body0->setPos(0,static_cast(yo), 0); body1 = new ModelPart(this, 0, 12); body1->addBox(-5, -4, -6, 10, 8, 12, g); // Body - body1->setPos(0, (float)(0+yo), 3 + 6); + body1->setPos(0, static_cast(0 + yo), 3 + 6); leg0 = new ModelPart(this, 18, 0); leg0->addBox(-15, -1, -1, 16, 2, 2, g); // Leg0 - leg0->setPos(-4, (float)(0+yo), 2); + leg0->setPos(-4, static_cast(0 + yo), 2); leg1 = new ModelPart(this, 18, 0); leg1->addBox(-1, -1, -1, 16, 2, 2, g); // Leg1 - leg1->setPos(4, (float)(0+yo), 2); + leg1->setPos(4, static_cast(0 + yo), 2); leg2 = new ModelPart(this, 18, 0); leg2->addBox(-15, -1, -1, 16, 2, 2, g); // Leg2 - leg2->setPos(-4, (float)(0+yo), 1); + leg2->setPos(-4, static_cast(0 + yo), 1); leg3 = new ModelPart(this, 18, 0); leg3->addBox(-1, -1, -1, 16, 2, 2, g); // Leg3 - leg3->setPos(4, (float)(0+yo), 1); + leg3->setPos(4, static_cast(0 + yo), 1); leg4 = new ModelPart(this, 18, 0); leg4->addBox(-15, -1, -1, 16, 2, 2, g); // Leg0 - leg4->setPos(-4, (float)(0+yo), 0); + leg4->setPos(-4, static_cast(0 + yo), 0); leg5 = new ModelPart(this, 18, 0); leg5->addBox(-1, -1, -1, 16, 2, 2, g); // Leg1 - leg5->setPos(4, (float)(0+yo), 0); + leg5->setPos(4, static_cast(0 + yo), 0); leg6 = new ModelPart(this, 18, 0); leg6->addBox(-15, -1, -1, 16, 2, 2, g); // Leg2 - leg6->setPos(-4, (float)(0+yo), -1); + leg6->setPos(-4, static_cast(0 + yo), -1); leg7 = new ModelPart(this, 18, 0); leg7->addBox(-1, -1, -1, 16, 2, 2, g); // Leg3 - leg7->setPos(4, (float)(0+yo), -1); + leg7->setPos(4, static_cast(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 0152418f2..0ee2501d6 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 / (double) TENTACLES_LENGTH; // 4J - 8 was tentacles.length - float xo = Mth::cos((float)angle) * 5; - float yo = Mth::sin((float)angle) * 5; + 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; tentacles[i]->addBox(-1, 0, -1, 2, 18, 2); tentacles[i]->x = xo; tentacles[i]->z = yo; - tentacles[i]->y = (float)(31 + yoffs); + tentacles[i]->y = static_cast(31 + yoffs); - angle = i * PI * -2.0 / (double) TENTACLES_LENGTH + PI * .5; // 4J - 8 was tentacles.length - tentacles[i]->yRot = (float) angle; + angle = i * PI * -2.0 / static_cast(TENTACLES_LENGTH) + PI * .5; // 4J - 8 was tentacles.length + tentacles[i]->yRot = static_cast(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 b75625e9d..8f930fcf9 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=(PBYTE)data; + PBYTE pbData=static_cast(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 = (PBYTE)ProfileManager.GetGameDefinedProfileData(player); + PBYTE pbData = static_cast(ProfileManager.GetGameDefinedProfileData(player)); #endif pbData+=sizeof(GAME_SETTINGS); diff --git a/Minecraft.Client/StatsScreen.cpp b/Minecraft.Client/StatsScreen.cpp index 01d041f0e..6c42532db 100644 --- a/Minecraft.Client/StatsScreen.cpp +++ b/Minecraft.Client/StatsScreen.cpp @@ -107,7 +107,7 @@ StatsScreen::GeneralStatisticsList::GeneralStatisticsList(StatsScreen *ss) : Scr int StatsScreen::GeneralStatisticsList::getNumberOfItems() { - return (int)Stats::generalStats->size(); + return static_cast(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 (int)statItemList.size(); + return static_cast(statItemList.size()); } ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot) diff --git a/Minecraft.Client/StitchedTexture.cpp b/Minecraft.Client/StitchedTexture.cpp index 64ab2f365..29e3e4bd7 100644 --- a/Minecraft.Client/StitchedTexture.cpp +++ b/Minecraft.Client/StitchedTexture.cpp @@ -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 / (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; + 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; #ifndef _CONTENT_PACKAGE bool addBreakpoint = false; @@ -112,8 +112,8 @@ void StitchedTexture::init(Texture *source, vector *frames, int x, in } #endif - this->widthTranslation = width / (float) SharedConstants::WORLD_RESOLUTION; - this->heightTranslation = height / (float) SharedConstants::WORLD_RESOLUTION; + this->widthTranslation = width / static_cast(SharedConstants::WORLD_RESOLUTION); + this->heightTranslation = height / static_cast(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 * ((float) offset / SharedConstants::WORLD_RESOLUTION)); + return getU0(adjust) + (diff * (static_cast(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 * ((float) offset / SharedConstants::WORLD_RESOLUTION)); + return getV0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); } wstring StitchedTexture::getName() const diff --git a/Minecraft.Client/SuspendedParticle.cpp b/Minecraft.Client/SuspendedParticle.cpp index 70702de0f..b7305207a 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 = (int) (16 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(16 / (Math::random() * 0.8 + 0.2)); } void SuspendedParticle::tick() diff --git a/Minecraft.Client/SuspendedTownParticle.cpp b/Minecraft.Client/SuspendedTownParticle.cpp index a24bbc42a..4c31b0c0b 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 = (int) (20 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(20 / (Math::random() * 0.8 + 0.2)); this->noPhysics = true; } diff --git a/Minecraft.Client/TakeAnimationParticle.cpp b/Minecraft.Client/TakeAnimationParticle.cpp index c9530b0a0..f629363e1 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, (float)xx, (float)yy, (float)zz, item->yRot, a); + EntityRenderDispatcher::instance->render(item, static_cast(xx), static_cast(yy), static_cast(zz), item->yRot, a); } diff --git a/Minecraft.Client/TerrainParticle.cpp b/Minecraft.Client/TerrainParticle.cpp index 811ba840b..cec8df8fb 100644 --- a/Minecraft.Client/TerrainParticle.cpp +++ b/Minecraft.Client/TerrainParticle.cpp @@ -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 = (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 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); // 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 7bae7aca9..b70ec983e 100644 --- a/Minecraft.Client/Tesselator.cpp +++ b/Minecraft.Client/Tesselator.cpp @@ -28,7 +28,7 @@ DWORD Tesselator::tlsIdx = TlsAlloc(); Tesselator *Tesselator::getInstance() { - return (Tesselator *)TlsGetValue(tlsIdx); + return static_cast(TlsGetValue(tlsIdx)); } void Tesselator::CreateNewThreadStorage(int bytes) @@ -179,18 +179,18 @@ void Tesselator::end() } #else - RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_COMPRESSED, C4JRender::PIXEL_SHADER_TYPE_STANDARD); + RenderManager.DrawVertices(static_cast(mode),vertexCount,_array->data,C4JRender::VERTEX_TYPE_COMPRESSED, C4JRender::PIXEL_SHADER_TYPE_STANDARD); #endif } else { if( useProjectedTexturePixelShader ) { - RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION); + RenderManager.DrawVertices(static_cast(mode),vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, C4JRender::PIXEL_SHADER_TYPE_PROJECTION); } else { - RenderManager.DrawVertices((C4JRender::ePrimitiveType)mode,vertexCount,_array->data,C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, C4JRender::PIXEL_SHADER_TYPE_STANDARD); + RenderManager.DrawVertices(static_cast(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((int) (r * 255), (int) (g * 255), (int) (b * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255)); } void Tesselator::color(float r, float g, float b, float a) { - color((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); + color(static_cast(r * 255), static_cast(g * 255), static_cast(b * 255), static_cast(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 = (unsigned int)col; + unsigned int ucol = static_cast(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 = ((int)packedcol) & 0xffff; // 0 to 65535 range + int ipackedcol = static_cast(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] = (((int)((x + xo ) * 1024.0f))&0xffff); - pShortData[1] = (((int)((y + yo ) * 1024.0f))&0xffff); - pShortData[2] = (((int)((z + zo ) * 1024.0f))&0xffff); + 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[3] = ipackedcol; - pShortData[4] = (((int)(uu * 8192.0f))&0xffff); - pShortData[5] = (((int)(v * 8192.0f))&0xffff); + pShortData[4] = (static_cast(uu * 8192.0f)&0xffff); + pShortData[5] = (static_cast(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 = (byte) (x * 127); - byte yy = (byte) (y * 127); - byte zz = (byte) (z * 127); + byte xx = static_cast(x * 127); + byte yy = static_cast(y * 127); + byte zz = static_cast(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 9537b969c..6b14ce5d1 100644 --- a/Minecraft.Client/TextEditScreen.cpp +++ b/Minecraft.Client/TextEditScreen.cpp @@ -82,7 +82,7 @@ void TextEditScreen::render(int xm, int ym, float a) drawCenteredString(font, title, width / 2, 40, 0xffffff); glPushMatrix(); - glTranslatef((float)width / 2, (float)height / 2, 50); + glTranslatef(static_cast(width) / 2, static_cast(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 809f606aa..dd1804d7a 100644 --- a/Minecraft.Client/Texture.cpp +++ b/Minecraft.Client/Texture.cpp @@ -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, (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)); + 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)); } } delete myRect; @@ -530,10 +530,10 @@ void Texture::transferFromBuffer(intArray buffer) { int texel = column + x * 4; data[0]->position(0); - 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)); + 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)); } } } @@ -589,10 +589,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - 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); + 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); } } @@ -641,10 +641,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - 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); + 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); } } } @@ -676,10 +676,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - 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); + 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); } } @@ -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 = (int) (((c0 & 0xff000000) >> 24)) & 0xff; - int a1 = (int) (((c1 & 0xff000000) >> 24)) & 0xff; + int a0 = static_cast(((c0 & 0xff000000) >> 24)) & 0xff; + int a1 = static_cast(((c1 & 0xff000000) >> 24)) & 0xff; int a = 255; if (a0 + a1 < 255) diff --git a/Minecraft.Client/TextureHolder.cpp b/Minecraft.Client/TextureHolder.cpp index 0f10272cf..11c8fb96b 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((int) (height * scale)) : smallestFittingMinTexel((int) (width * scale)); + return rotated ? smallestFittingMinTexel(static_cast(height * scale)) : smallestFittingMinTexel(static_cast(width * scale)); } int TextureHolder::getHeight() const { - return rotated ? smallestFittingMinTexel((int) (width * scale)) : smallestFittingMinTexel((int) (height * scale)); + return rotated ? smallestFittingMinTexel(static_cast(width * scale)) : smallestFittingMinTexel(static_cast(height * scale)); } void TextureHolder::rotate() @@ -52,7 +52,7 @@ void TextureHolder::setForcedScale(int targetSize) return; } - scale = (float) targetSize / min(width, height); + scale = static_cast(targetSize) / min(width, height); } //@Override diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index cd6e0bae1..e864a2f49 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((TEXTURE_NAME)i, wstring(preLoaded[i]) + L".png"); + preLoadedIdx[i] = loadTexture(static_cast(i), wstring(preLoaded[i]) + L".png"); } } @@ -451,7 +451,7 @@ void Textures::bindTextureLayers(ResourceLocation *resource) for( int i = 0; i < layers; i++ ) { TEXTURE_NAME textureName = resource->getTexture(i); - if( textureName == (_TEXTURE_NAME)-1 ) + if( textureName == static_cast<_TEXTURE_NAME>(-1) ) { continue; } @@ -500,10 +500,10 @@ void Textures::bindTextureLayers(ResourceLocation *resource) float srcFactor = srcAlpha / outAlpha; float dstFactor = (dstAlpha * (1.0f - srcAlpha)) / outAlpha; - 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); + 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); mergedPixels[p] = (outA << 24) | (outR << 16) | (outG << 8) | outB; } } @@ -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] = (byte) r; - newPixels[i * 4 + 1] = (byte) g; - newPixels[i * 4 + 2] = (byte) b; - newPixels[i * 4 + 3] = (byte) a; + 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); #endif } // 4J - now creating a buffer of the size we require dynamically @@ -901,10 +901,10 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) b = bb; } - newPixels[i * 4 + 0] = (byte) r; - newPixels[i * 4 + 1] = (byte) g; - newPixels[i * 4 + 2] = (byte) b; - newPixels[i * 4 + 3] = (byte) a; + 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); } ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically pixels->put(newPixels); diff --git a/Minecraft.Client/TheEndPortalRenderer.cpp b/Minecraft.Client/TheEndPortalRenderer.cpp index 98c7e7cc5..c709cfd18 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 = (float) tileEntityRenderDispatcher->xPlayer; - float yy = (float) tileEntityRenderDispatcher->yPlayer; - float zz = (float) tileEntityRenderDispatcher->zPlayer; + float xx = static_cast(tileEntityRenderDispatcher->xPlayer); + float yy = static_cast(tileEntityRenderDispatcher->yPlayer); + float zz = static_cast(tileEntityRenderDispatcher->zPlayer); glDisable(GL_LIGHTING); @@ -50,12 +50,12 @@ void TheEndPortalRenderer::render(shared_ptr _table, double x, doubl sscale = 1 / 2.0f; } - float dd = (float) -(y + hoff); + float dd = static_cast(-(y + hoff)); { float ss1 = (float) (dd + Camera::yPlayerOffs); float ss2 = (float) (dd + dist + Camera::yPlayerOffs); float s = ss1 / ss2; - s = (float) (y + hoff) + s; + s = static_cast(y + hoff) + s; glTranslatef(xx, s, zz); } diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index 2acc6170a..acf6a57b6 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -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 = (int)ucTileId; + tileId = static_cast(ucTileId); } } int ret = tt->getLightColor(level, x, y, z, tileId); @@ -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( (FireTile *)tt, x, y, z ); + retVal = tesselateFireInWorld( static_cast(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( ( RailTile* )tt, x, y, z ); + retVal = tesselateRailInWorld( static_cast(tt), x, y, z ); break; case Tile::SHAPE_STAIRS: - retVal = tesselateStairsInWorld( (StairTile *)tt, x, y, z ); + retVal = tesselateStairsInWorld( static_cast(tt), x, y, z ); break; case Tile::SHAPE_EGG: - retVal = tesselateEggInWorld((EggTile*) tt, x, y, z); + retVal = tesselateEggInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_FENCE: - retVal = tesselateFenceInWorld( ( FenceTile* )tt, x, y, z ); + retVal = tesselateFenceInWorld( static_cast(tt), x, y, z ); break; case Tile::SHAPE_WALL: - retVal = tesselateWallInWorld( (WallTile *) tt, x, y, z); + retVal = tesselateWallInWorld( static_cast(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((RepeaterTile *)tt, x, y, z); + retVal = tesselateRepeaterInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_DIODE: - retVal = tesselateDiodeInWorld( (DiodeTile *)tt, x, y, z ); + retVal = tesselateDiodeInWorld( static_cast(tt), x, y, z ); break; case Tile::SHAPE_COMPARATOR: - retVal = tesselateComparatorInWorld((ComparatorTile *)tt, x, y, z); + retVal = tesselateComparatorInWorld(static_cast(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( ( ThinFenceTile* )tt, x, y, z ); + retVal = tesselateThinFenceInWorld( static_cast(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( ( FenceGateTile* )tt, x, y, z ); + retVal = tesselateFenceGateInWorld( static_cast(tt), x, y, z ); break; case Tile::SHAPE_CAULDRON: - retVal = tesselateCauldronInWorld((CauldronTile* ) tt, x, y, z); + retVal = tesselateCauldronInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_FLOWER_POT: - retVal = tesselateFlowerPotInWorld((FlowerPotTile *) tt, x, y, z); + retVal = tesselateFlowerPotInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_ANVIL: - retVal = tesselateAnvilInWorld((AnvilTile *) tt, x, y, z); + retVal = tesselateAnvilInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_BREWING_STAND: - retVal = tesselateBrewingStandInWorld((BrewingStandTile* ) tt, x, y, z); + retVal = tesselateBrewingStandInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_PORTAL_FRAME: - retVal = tesselateAirPortalFrameInWorld((TheEndPortalFrameTile *)tt, x, y, z); + retVal = tesselateAirPortalFrameInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_COCOA: - retVal = tesselateCocoaInWorld((CocoaTile *)tt, x, y, z); + retVal = tesselateCocoaInWorld(static_cast(tt), x, y, z); break; case Tile::SHAPE_BEACON: retVal = tesselateBeaconInWorld(tt, 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, (float)x - r2, (float)y + h, (float)z, -r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) - r2, static_cast(y) + h, static_cast(z), -r, 0.0f, 0 ); } else if ( dir == 2 ) { - tesselateTorch( tt, (float)x + r2, (float)y + h, (float)z, +r, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x) + r2, static_cast(y) + h, static_cast(z), +r, 0.0f, 0 ); } else if ( dir == 3 ) { - tesselateTorch( tt, (float)x, (float)y + h, z - r2, 0.0f, -r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, z - r2, 0.0f, -r, 0 ); } else if ( dir == 4 ) { - tesselateTorch( tt, (float)x, (float)y + h, (float)z + r2, 0.0f, +r, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y) + h, static_cast(z) + r2, 0.0f, +r, 0 ); } else { - tesselateTorch( tt, (float)x, (float)y, (float)z, 0.0f, 0.0f, 0 ); + tesselateTorch( tt, static_cast(x), static_cast(y), static_cast(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 + (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); + 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)); 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 - ((PistonBaseTile *) tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); + static_cast(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; - ((PistonBaseTile *) tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); + static_cast(tt)->updateShape((float) tileShapeX0, (float) tileShapeY0, (float) tileShapeZ0, (float) tileShapeX1, (float) tileShapeY1, (float) tileShapeZ1); } else { @@ -1961,10 +1961,10 @@ bool TileRenderer::tesselateLeverInWorld( Tile* tt, int x, int y, int z ) c2 = corners[7]; c3 = corners[4]; } - 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 ) ); + 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 ) ); } return true; @@ -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 ), ( 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 )( 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 )( 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 ) ); + 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 ) ); 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( ( 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 + 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 + 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 ) ); + 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 ) ); 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 ), ( 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 )( 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 )( 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 ) ); + 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 ) ); 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( ( 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 + 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 + 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 ) ); + 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 ) ); } 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( ( 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( 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 - 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( ( 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 ) ); + 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 ) ); 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( ( 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 ) ); + 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 ) ); } else { t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) ); + h ), static_cast(z1_), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - 0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + 0.0f ), static_cast(z1), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - 0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) ); + 0.0f ), static_cast(z1), ( float )( u0 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) ); + h ), static_cast(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 ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) ); + h ), static_cast(z0_), ( float )( u1 ), ( float )( v0 ) ); t->vertexUV( ( float )( x + 1.0f ), ( float )( y + - 0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) ); + 0.0f ), static_cast(z0), ( float )( u1 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - 0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + 0.0f ), static_cast(z0), ( float )( u0 ), ( float )( v1 ) ); t->vertexUV( ( float )( x + 0.0f ), ( float )( y + - h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) ); + h ), static_cast(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 / (float) SharedConstants::WORLD_RESOLUTION; + if (!w) x0 += cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); if (!w) u0 += cutDistance; - if (!e) x1 -= cutDistance / (float) SharedConstants::WORLD_RESOLUTION; + if (!e) x1 -= cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); if (!e) u1 -= cutDistance; - if (!n) z0 += cutDistance / (float) SharedConstants::WORLD_RESOLUTION; + if (!n) z0 += cutDistance / static_cast(SharedConstants::WORLD_RESOLUTION); if (!n) v0 += cutDistance; - if (!s) z1 -= cutDistance / (float) SharedConstants::WORLD_RESOLUTION; + if (!s) z1 -= cutDistance / static_cast(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 ), ( 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->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->color( br, br, br ); - 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) ); + 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) ); } 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 ), ( 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->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->color( br, br, br ); - 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) ); + 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) ); } 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( ( 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->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->color( br, br, br ); - 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) ); + 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) ); } 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( ( 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->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->color( br, br, br ); - 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) ); + 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) ); } } @@ -2982,15 +2982,15 @@ bool TileRenderer::tesselateRailInWorld( RailTile* tt, int x, int y, int z ) float r = 1 / 16.0f; - float x0 = ( float )( x + 1 ); - float x1 = ( float )( x + 1 ); - float x2 = ( float )( x + 0 ); - float x3 = ( float )( x + 0 ); + 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 z0 = ( float )( z + 0 ); - float z1 = ( float )( z + 1 ); - float z2 = ( float )( z + 1 ); - float z3 = ( float )( z + 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 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 = ( float )( x + 1 ); - x1 = x2 = ( float )( x + 0 ); - z0 = z1 = ( float )( z + 1 ); - z2 = z3 = ( float )( z + 0 ); + x0 = x3 = static_cast(x + 1); + x1 = x2 = static_cast(x + 0); + z0 = z1 = static_cast(z + 1); + z2 = z3 = static_cast(z + 0); } else if ( data == 8 ) { - x0 = x1 = ( float )( x + 0 ); - x2 = x3 = ( float )( x + 1 ); - z0 = z3 = ( float )( z + 1 ); - z1 = z2 = ( float )( z + 0 ); + x0 = x1 = static_cast(x + 0); + x2 = x3 = static_cast(x + 1); + z0 = z3 = static_cast(z + 1); + z1 = z2 = static_cast(z + 0); } else if ( data == 9 ) { - x0 = x3 = ( float )( x + 0 ); - x1 = x2 = ( float )( x + 1 ); - z0 = z1 = ( float )( z + 0 ); - z2 = z3 = ( float )( z + 1 ); + x0 = x3 = static_cast(x + 0); + x1 = x2 = static_cast(x + 1); + z0 = z1 = static_cast(z + 0); + z2 = z3 = static_cast(z + 1); } if ( data == 2 || data == 4 ) @@ -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) ? ((StainedGlassPaneBlock *) tt)->getEdgeTexture(data) : ((ThinFenceTile *) tt)->getEdgeTexture(); + edgeTex = (stained) ? static_cast(tt)->getEdgeTexture(data) : static_cast(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) ? ((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)); + 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)); 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 = (float)x; + float x0 = static_cast(x); float x1 = x + 0.5f; float x2 = x + 1.0f; - float z0 = (float)z; + float z0 = static_cast(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 = (float)x; - float yt = (float)y; - float zt = (float)z; + float xt = static_cast(x); + float yt = static_cast(y); + float zt = static_cast(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 = ( StemTile* )_tt; + StemTile* tt = static_cast(_tt); Tesselator* t = Tesselator::getInstance(); float br; @@ -4409,7 +4409,7 @@ bool TileRenderer::tesselateLilypadInWorld(Tile *tt, int x, int y, int z) __int64 seed = (x * 3129871) ^ (z * 116129781l) ^ (y); seed = seed * seed * 42317861 + seed * 11; - int dir = (int) ((seed >> 16) & 0x3); + int dir = static_cast((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 = ( float )LiquidTile::getSlopeAngle( level, x, y, z, m ); + float angle = static_cast(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 = ( float )( x ); - x1 = ( float )( x + 1 ); + x0 = static_cast(x); + x1 = static_cast(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 = ( float )( x + 1 ); - x1 = ( float )( x ); + x0 = static_cast(x + 1); + x1 = static_cast(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 = ( float )( z + 1 ); - z1 = ( float )( z ); + z0 = static_cast(z + 1); + z1 = static_cast(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 = ( float )( z ); - z1 = ( float )( z + 1 ); + z0 = static_cast(z); + z1 = static_cast(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 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); - t->vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + 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 ) ); } @@ -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 = (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)); + 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)); 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 = (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)); + 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)); 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 = (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); + 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); 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 = (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); + 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); 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 = (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; + 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; 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( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u01), static_cast(v01) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); } else { - 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 ) ); + 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 ) ); } } @@ -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( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), ( float )( u11 ), ( float )( v11 ) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), ( float )( u01 ), ( float )( v01 ) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), ( float )( u00 ), ( float )( v00 ) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), ( float )( u10 ), ( float )( v10 ) ); } else { - 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 ) ); + 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 ) ); } } @@ -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( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); } else { - 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 ) ); + 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) ); } } @@ -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( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); } else { - 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 ) ); + 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) ); } } @@ -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( ( float )( x0 ), ( float )( y1 ), ( float )( z1 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z1), static_cast(u01), static_cast(v01) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x0 ), ( float )( y1 ), ( float )( z0 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x0), static_cast(y1), static_cast(z0), static_cast(u00), static_cast(v00) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z0 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z0), static_cast(u10), static_cast(v10) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x0 ), ( float )( y0 ), ( float )( z1 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x0), static_cast(y0), static_cast(z1), static_cast(u11), static_cast(v11) ); } else { - 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 ) ); + 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) ); } } @@ -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( ( float )( x1 ), ( float )( y0 ), ( float )( z1 ), ( float )( u10 ), ( float )( v10 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z1), static_cast(u10), static_cast(v10) ); t->color( c2r, c2g, c2b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc2 ); - t->vertexUV( ( float )( x1 ), ( float )( y0 ), ( float )( z0 ), ( float )( u11 ), ( float )( v11 ) ); + t->vertexUV( static_cast(x1), static_cast(y0), static_cast(z0), static_cast(u11), static_cast(v11) ); t->color( c3r, c3g, c3b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc3 ); - t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z0 ), ( float )( u01 ), ( float )( v01 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z0), static_cast(u01), static_cast(v01) ); t->color( c4r, c4g, c4b ); if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( tc4 ); - t->vertexUV( ( float )( x1 ), ( float )( y1 ), ( float )( z1 ), ( float )( u00 ), ( float )( v00 ) ); + t->vertexUV( static_cast(x1), static_cast(y1), static_cast(z1), static_cast(u00), static_cast(v00) ); } else { - 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 ) ); + 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) ); } } @@ -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((AnvilTile *) tile, 0, 0, 0, data << 2, true); + tesselateAnvilInWorld(static_cast(tile), 0, 0, 0, data << 2, true); glTranslatef(0.5f, 0.5f, 0.5f); } else if ( shape == Tile::SHAPE_PORTAL_FRAME ) diff --git a/Minecraft.Client/Timer.cpp b/Minecraft.Client/Timer.cpp index 15a2c2f13..100322ba7 100644 --- a/Minecraft.Client/Timer.cpp +++ b/Minecraft.Client/Timer.cpp @@ -40,10 +40,10 @@ void Timer::advanceTime() accumMs += passedMs; if (accumMs > 1000) { - __int64 msSysTime = (__int64)(now * 1000.0); + __int64 msSysTime = static_cast<__int64>(now * 1000.0); __int64 passedMsSysTime = msSysTime - lastMsSysTime; - double adjustTimeT = accumMs / (double) passedMsSysTime; + double adjustTimeT = accumMs / static_cast(passedMsSysTime); adjustTime += (adjustTimeT - adjustTime) * 0.2f; lastMsSysTime = msSysTime; @@ -51,7 +51,7 @@ void Timer::advanceTime() } if (accumMs < 0) { - lastMsSysTime = (__int64)(now * 1000.0); + lastMsSysTime = static_cast<__int64>(now * 1000.0); } } lastMs = nowMs; @@ -62,9 +62,9 @@ void Timer::advanceTime() if (passedSeconds < 0) passedSeconds = 0; if (passedSeconds > 1) passedSeconds = 1; - passedTime = (float)( passedTime + (passedSeconds * timeScale * ticksPerSecond)); + passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = (int) passedTime; + ticks = static_cast(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 = (double) MAX_TICKS_PER_UPDATE / (double) ticksPerSecond; + double passedSeconds = static_cast(MAX_TICKS_PER_UPDATE) / static_cast(ticksPerSecond); - passedTime = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = (int) passedTime; + passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); + ticks = static_cast(passedTime); passedTime -= ticks; a = passedTime; @@ -110,7 +110,7 @@ void Timer::skipTime() { __int64 passedMsSysTime = msSysTime - lastMsSysTime; - double adjustTimeT = accumMs / (double) passedMsSysTime; + double adjustTimeT = accumMs / static_cast(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 = (float)(passedTime + (passedSeconds * timeScale * ticksPerSecond)); + passedTime = static_cast(passedTime + (passedSeconds * timeScale * ticksPerSecond)); - ticks = (int) 0; + ticks = static_cast(0); if (ticks > MAX_TICKS_PER_UPDATE) ticks = MAX_TICKS_PER_UPDATE; passedTime -= ticks; diff --git a/Minecraft.Client/TntRenderer.cpp b/Minecraft.Client/TntRenderer.cpp index 52e2877dc..848a456c1 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(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 0a5a02bff..74cfbca32 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -152,7 +152,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ) { teleportDelay = 0; - packet = shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, (byte) yRotn, (byte) xRotn) ); + packet = shared_ptr( new TeleportEntityPacket(e->entityId, xn, yn, zn, static_cast(yRotn), static_cast(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 = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, 0 ) ); + packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), static_cast(yRota), 0 ) ); c0a++; } else { - packet = shared_ptr( new MoveEntityPacket::PosRot(e->entityId, (char) xa, (char) ya, (char) za, (char) yRota, (char) xRota) ); + packet = shared_ptr( new MoveEntityPacket::PosRot(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), static_cast(yRota), static_cast(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 = shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = shared_ptr( new MoveEntityPacketSmall::Pos(e->entityId, static_cast(xa), static_cast(ya), static_cast(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 = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, (char) xa, (char) ya, (char) za, 0, 0 )); + packet = shared_ptr( new MoveEntityPacketSmall::PosRot(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), 0, 0 )); c1b++; } else { - packet = shared_ptr( new MoveEntityPacket::Pos(e->entityId, (char) xa, (char) ya, (char) za) ); + packet = shared_ptr( new MoveEntityPacket::Pos(e->entityId, static_cast(xa), static_cast(ya), static_cast(za)) ); c1c++; } } @@ -231,13 +231,13 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl yRota = 15; yRotn = yRotp + yRota; } - packet = shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, (char) yRota, 0) ); + packet = shared_ptr( new MoveEntityPacketSmall::Rot(e->entityId, static_cast(yRota), 0) ); c2a++; } else { // printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn); - packet = shared_ptr( new MoveEntityPacket::Rot(e->entityId, (char) yRota, (char) xRota) ); + packet = shared_ptr( new MoveEntityPacket::Rot(e->entityId, static_cast(yRota), static_cast(xRota)) ); c2b++; } } @@ -291,7 +291,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (rot) { // 4J: Changed this to use deltas - broadcast( shared_ptr( new MoveEntityPacket::Rot(e->entityId, (byte) yRota, (byte) xRota)) ); + broadcast( shared_ptr( new MoveEntityPacket::Rot(e->entityId, static_cast(yRota), static_cast(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(shared_ptr( new RotateHeadPacket(e->entityId, (byte) yHeadRot))); + broadcast(shared_ptr( new RotateHeadPacket(e->entityId, static_cast(yHeadRot)))); yHeadRotp = yHeadRot; } @@ -337,7 +337,7 @@ void TrackedEntity::sendDirtyEntityData() if ( e->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(e); - ServersideAttributeMap *attributeMap = (ServersideAttributeMap *) living->getAttributes(); + ServersideAttributeMap *attributeMap = static_cast(living->getAttributes()); unordered_set *attributes = attributeMap->getDirtyAttributes(); if (!attributes->empty()) @@ -545,7 +545,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrinstanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(e); - ServersideAttributeMap *attributeMap = (ServersideAttributeMap *) living->getAttributes(); + ServersideAttributeMap *attributeMap = static_cast(living->getAttributes()); unordered_set *attributes = attributeMap->getSyncableAttributes(); if (!attributes->empty()) @@ -736,9 +736,9 @@ shared_ptr TrackedEntity::getAddEntityPacket() { aep = shared_ptr( new AddEntityPacket(e, type, 0, yRotp, xRotp, xp, yp, zp) ); } - aep->xa = (int) (fb->xPower * 8000); - aep->ya = (int) (fb->yPower * 8000); - aep->za = (int) (fb->zPower * 8000); + aep->xa = static_cast(fb->xPower * 8000); + aep->ya = static_cast(fb->yPower * 8000); + aep->za = static_cast(fb->zPower * 8000); return aep; } else if (e->instanceof(eTYPE_THROWNEGG)) @@ -784,9 +784,9 @@ shared_ptr TrackedEntity::getAddEntityPacket() { shared_ptr knot = dynamic_pointer_cast(e); 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); + 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); return packet; } else if (e->instanceof(eTYPE_EXPERIENCEORB)) diff --git a/Minecraft.Client/VideoSettingsScreen.cpp b/Minecraft.Client/VideoSettingsScreen.cpp index 5c948cdd1..2fefe9298 100644 --- a/Minecraft.Client/VideoSettingsScreen.cpp +++ b/Minecraft.Client/VideoSettingsScreen.cpp @@ -48,7 +48,7 @@ void VideoSettingsScreen::buttonClicked(Button *button) if (!button->active) return; if (button->id < 100 && (dynamic_cast(button) != NULL)) { - options->toggle(((SmallButton *) button)->getOption(), 1); + options->toggle(static_cast(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 5d6809784..0b62435b2 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 = (VillagerGolemModel *) model; + golemModel = static_cast(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 ac885747c..0b54a70b7 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 = (VillagerModel *) model; + villagerModel = static_cast(model); } int VillagerRenderer::prepareArmor(shared_ptr villager, int layer, float a) diff --git a/Minecraft.Client/WaterDropParticle.cpp b/Minecraft.Client/WaterDropParticle.cpp index 90035243e..065738af9 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 = (float) Math::random() * 0.2f + 0.1f; + yd = static_cast(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 = (int) (8 / (Math::random() * 0.8 + 0.2)); + lifetime = static_cast(8 / (Math::random() * 0.8 + 0.2)); } void WaterDropParticle::tick() diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl index df42488c6..6e14791c4 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -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 = (U8 *) map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0); + ptr = static_cast(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 @@ -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 = (GDrawHandle *) p->p0; + GDrawHandle *t = static_cast(p->p0); D3D1X_(SUBRESOURCE_DATA) mipdata[24]; S32 i, w, h, nmips, bpp; HRESULT hr = S_OK; @@ -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 = (GDrawHandle *) p->p0; + GDrawHandle *vb = static_cast(p->p0); HRESULT hr; D3D1X_(BUFFER_DESC) vbdesc = { static_cast(p->vertex_data_length), D3D1X_(USAGE_IMMUTABLE), D3D1X_(BIND_VERTEX_BUFFER), 0U, 0U }; @@ -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 = { (ViewCoord) x, (ViewCoord) y, (ViewCoord) w, (ViewCoord) h, 0.0f, 1.0f }; + D3D1X_(VIEWPORT) vp = { static_cast(x), static_cast(y), static_cast(w), static_cast(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)/(F32)(x0-x1); - gdraw->projection[3] = (y1+y0)/(F32)(y0-y1); + gdraw->projection[2] = (x1+x0)/static_cast(x0 - x1); + gdraw->projection[3] = (y1+y0)/static_cast(y0 - y1); set_projection_base(); } @@ -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 = (S32) (t - gdraw->rendertargets.handle); + S32 k = static_cast(t - gdraw->rendertargets.handle); if (region) { gswf_recti r; @@ -1284,7 +1284,7 @@ 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 - ((F32) id + 1.0f) / MAX_DEPTH_VALUE; + return 1.0f - (static_cast(id) + 1.0f) / MAX_DEPTH_VALUE; } static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap) @@ -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 = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) { + if (VertexVars *vvars = static_cast(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); @@ -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 = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) { + if (PixelCommonVars *pvars = static_cast(map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true))) { memcpy(pvars->color_mul, r->color, 4*sizeof(float)); if (r->cxf_add) { @@ -1481,10 +1481,10 @@ static int vertsize[GDRAW_vformat__basic_count] = { 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; - if (r2) ((GDrawHandle *) r2)->fence.value = now; - if (r3) ((GDrawHandle *) r3)->fence.value = now; - if (r4) ((GDrawHandle *) r4)->fence.value = now; + 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; } 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 = (UINT) (UINTa) p->vertices; + UINT offs = static_cast((UINTa)p->vertices); d3d->IASetVertexBuffers(0, 1, &vb->handle.vbuf.verts, &stride, &offs); - d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, (UINT) (UINTa) p->indices); + d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, static_cast((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 = (F32) s->x0, py0 = (F32) s->y0, px1 = (F32) s->x1, py1 = (F32) s->y1; + F32 px0 = static_cast(s->x0), py0 = static_cast(s->y0), px1 = static_cast(s->x1), py1 = static_cast(s->y1); // generate vertex data - gswf_vertex_xyst *vert = (gswf_vertex_xyst *) start_write_dyn(&gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst)); + gswf_vertex_xyst *vert = static_cast(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 = (VertexVars *) map_buffer(gdraw->d3d_context, gdraw->cb_vertex, true)) { + if (VertexVars *vvars = static_cast(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 = (PixelCommonVars *) map_buffer(gdraw->d3d_context, gdraw->cb_ps_common, true)) { + if (PixelCommonVars *pvars = static_cast(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 = (PixelParaBlur *) start_ps_constants(gdraw->cb_blur); + PixelParaBlur *para = static_cast(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); @@ -1660,7 +1660,7 @@ static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDr set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); set_pixel_shader(gdraw->d3d_context, gdraw->colormatrix.pshader); - PixelParaColorMatrix *para = (PixelParaColorMatrix *) start_ps_constants(gdraw->cb_colormatrix); + PixelParaColorMatrix *para = static_cast(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 = (S32) (h - gdraw->rendertargets.handle); + S32 n = static_cast(h - gdraw->rendertargets.handle); assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH+1); return &gdraw->rt_valid[n]; } @@ -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 = (PixelParaFilter *) start_ps_constants(gdraw->cb_filter); + PixelParaFilter *para = static_cast(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] / (F32)gdraw->frametex_width, -r->shader_data[5] / (F32)gdraw->frametex_height, r->shader_data[6], 0); + 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); 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) / (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; + 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); // clear to known render state d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); @@ -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 / (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; + 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); } else { D3D1X_(BOX) box = { 0,0,0,0,0,1 }; S32 dx = 0, dy = 0; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl index a60fa520c..11a197e67 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl @@ -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 != (U32) new_state); // code should never call "transition" if it's not transitioning! + assert(t->state != static_cast(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; @@ -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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, draw_bounds, tc, static_cast(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, (F32) c->h / c->frametex_height, clamp, gstats); + c->BlurPass(r, taps, data, &z, tc, static_cast(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 = ((S32) ceil((blur_width-1)/2))*2+1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + S32 w = static_cast(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 = (S32) ceil(linear_remap(w, MAX_TAPS+1, MAX_TAPS*MAX_TAPS, 2, MAX_TAPS)); + S32 w_mip = static_cast(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; diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index fe3c39194..d3e408065 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -257,8 +257,8 @@ bool KeyboardMouseInput::IsMouseButtonReleased(int button) const void KeyboardMouseInput::ConsumeMouseDelta(float &dx, float &dy) { - dx = (float)m_mouseDeltaAccumX; - dy = (float)m_mouseDeltaAccumY; + dx = static_cast(m_mouseDeltaAccumX); + dy = static_cast(m_mouseDeltaAccumY); m_mouseDeltaAccumX = 0; m_mouseDeltaAccumY = 0; } @@ -375,12 +375,12 @@ float KeyboardMouseInput::GetMoveY() const float KeyboardMouseInput::GetLookX(float sensitivity) const { - return (float)m_mouseDeltaX * sensitivity; + return static_cast(m_mouseDeltaX) * sensitivity; } float KeyboardMouseInput::GetLookY(float sensitivity) const { - return (float)(-m_mouseDeltaY) * sensitivity; + return static_cast(-m_mouseDeltaY) * sensitivity; } void KeyboardMouseInput::OnChar(wchar_t c) diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index ca1d62af7..fde78e308 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -189,7 +189,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, (int)result->ai_addrlen); + iResult = ::bind(s_listenSocket, result->ai_addr, static_cast(result->ai_addrlen)); freeaddrinfo(result); if (iResult == SOCKET_ERROR) { @@ -267,7 +267,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, (int)result->ai_addrlen); + iResult = connect(s_hostConnectionSocket, result->ai_addr, static_cast(result->ai_addrlen)); if (iResult == SOCKET_ERROR) { int err = WSAGetLastError(); @@ -318,10 +318,10 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize) EnterCriticalSection(&s_sendLock); BYTE header[4]; - header[0] = (BYTE)((dataSize >> 24) & 0xFF); - header[1] = (BYTE)((dataSize >> 16) & 0xFF); - header[2] = (BYTE)((dataSize >> 8) & 0xFF); - header[3] = (BYTE)(dataSize & 0xFF); + 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); int totalSent = 0; int toSend = 4; @@ -339,7 +339,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void* data, int dataSize) totalSent = 0; while (totalSent < dataSize) { - int sent = send(sock, (const char*)data + totalSent, dataSize - totalSent, 0); + int sent = send(sock, static_cast(data) + totalSent, dataSize - totalSent, 0); if (sent == SOCKET_ERROR || sent == 0) { LeaveCriticalSection(&s_sendLock); @@ -477,7 +477,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) EnterCriticalSection(&s_connectionsLock); s_connections.push_back(conn); - int connIdx = (int)s_connections.size() - 1; + int connIdx = static_cast(s_connections.size()) - 1; LeaveCriticalSection(&s_connectionsLock); app.DebugPrintf("Win64 LAN: Client connected, assigned smallId=%d\n", assignedSmallId); @@ -495,7 +495,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) HANDLE hThread = CreateThread(NULL, 0, RecvThreadProc, threadParam, 0, NULL); EnterCriticalSection(&s_connectionsLock); - if (connIdx < (int)s_connections.size()) + if (connIdx < static_cast(s_connections.size())) s_connections[connIdx].recvThread = hThread; LeaveCriticalSection(&s_connectionsLock); } @@ -504,11 +504,11 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) { - DWORD connIdx = *(DWORD*)param; - delete (DWORD*)param; + DWORD connIdx = *static_cast(param); + delete static_cast(param); EnterCriticalSection(&s_connectionsLock); - if (connIdx >= (DWORD)s_connections.size()) + if (connIdx >= static_cast(s_connections.size())) { LeaveCriticalSection(&s_connectionsLock); return 0; @@ -530,10 +530,10 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) } int packetSize = - ((uint32_t)header[0] << 24) | - ((uint32_t)header[1] << 16) | - ((uint32_t)header[2] << 8) | - ((uint32_t)header[3]); + (static_cast(header[0]) << 24) | + (static_cast(header[1]) << 16) | + (static_cast(header[2]) << 8) | + static_cast(header[3]); if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE) { @@ -544,7 +544,7 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) break; } - if ((int)recvBuf.size() < packetSize) + if (static_cast(recvBuf.size()) < packetSize) { recvBuf.resize(packetSize); app.DebugPrintf("Win64 LAN: Resized host recv buffer to %d bytes for client smallId=%d\n", packetSize, clientSmallId); @@ -643,7 +643,7 @@ DWORD WINAPI WinsockNetLayer::ClientRecvThreadProc(LPVOID param) break; } - if ((int)recvBuf.size() < packetSize) + if (static_cast(recvBuf.size()) < packetSize) { recvBuf.resize(packetSize); app.DebugPrintf("Win64 LAN: Resized client recv buffer to %d bytes\n", packetSize); @@ -671,7 +671,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 = (WORD)gamePort; + s_advertiseData.gamePort = static_cast(gamePort); wcsncpy_s(s_advertiseData.hostName, 32, hostName, _TRUNCATE); s_advertiseData.playerCount = 1; s_advertiseData.maxPlayers = MINECRAFT_NET_MAX_PLAYERS; @@ -846,7 +846,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) continue; } - if (recvLen < (int)sizeof(Win64LANBroadcast)) + if (recvLen < static_cast(sizeof(Win64LANBroadcast))) continue; Win64LANBroadcast* broadcast = (Win64LANBroadcast*)recvBuf; @@ -864,7 +864,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 == (int)broadcast->gamePort) + s_discoveredSessions[i].hostPort == static_cast(broadcast->gamePort)) { s_discoveredSessions[i].netVersion = broadcast->netVersion; wcsncpy_s(s_discoveredSessions[i].hostName, 32, broadcast->hostName, _TRUNCATE); @@ -885,7 +885,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 = (int)broadcast->gamePort; + session.hostPort = static_cast(broadcast->gamePort); session.netVersion = broadcast->netVersion; wcsncpy_s(session.hostName, 32, broadcast->hostName, _TRUNCATE); session.playerCount = broadcast->playerCount; diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index ad9e1f24a..70e61f035 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -125,7 +125,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; + loadingParams->lpParam = static_cast(param); // Reset the autosave time app.SetAutosaveTimerTime(); diff --git a/Minecraft.Client/Windows64/Windows64_App.h b/Minecraft.Client/Windows64/Windows64_App.h index bff916ec7..af3192e2f 100644 --- a/Minecraft.Client/Windows64/Windows64_App.h +++ b/Minecraft.Client/Windows64/Windows64_App.h @@ -25,7 +25,7 @@ public: virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG); // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} + virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false) {} C4JStringTable *GetStringTable() { return NULL;} diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 2eef5f737..ed62daa13 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -121,14 +121,14 @@ static void CopyWideArgToAnsi(LPCWSTR source, char* dest, size_t destSize) if (source == NULL) return; - WideCharToMultiByte(CP_ACP, 0, source, -1, dest, (int)destSize, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, source, -1, dest, static_cast(destSize), NULL, NULL); dest[destSize - 1] = 0; } // ---------- Persistent options (options.txt next to exe) ---------- static void GetOptionsFilePath(char *out, size_t outSize) { - GetModuleFileNameA(NULL, out, (DWORD)outSize); + GetModuleFileNameA(NULL, out, static_cast(outSize)); char *p = strrchr(out, '\\'); if (p) *(p + 1) = '\0'; strncat_s(out, outSize, "options.txt", _TRUNCATE); @@ -251,9 +251,9 @@ static Win64LaunchOptions ParseLaunchOptions() if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535) { if (options.serverMode) - g_Win64DedicatedServerPort = (int)port; + g_Win64DedicatedServerPort = static_cast(port); else - g_Win64MultiplayerPort = (int)port; + g_Win64MultiplayerPort = static_cast(port); } } } @@ -568,13 +568,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_CHAR: // Buffer typed characters so UIScene_Keyboard can dispatch them to the Iggy Flash player if (wParam >= 0x20 || wParam == 0x08 || wParam == 0x0D) // printable chars + backspace + enter - g_KBMInput.OnChar((wchar_t)wParam); + g_KBMInput.OnChar(static_cast(wParam)); break; case WM_KEYDOWN: case WM_SYSKEYDOWN: { - int vk = (int)wParam; + int vk = static_cast(wParam); if (lParam & 0x40000000) break; // ignore auto-repeat if (vk == VK_SHIFT) vk = (MapVirtualKey((lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX) == VK_RSHIFT) ? VK_RSHIFT : VK_LSHIFT; @@ -588,7 +588,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_KEYUP: case WM_SYSKEYUP: { - int vk = (int)wParam; + int vk = static_cast(wParam); if (vk == VK_SHIFT) vk = (MapVirtualKey((lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX) == VK_RSHIFT) ? VK_RSHIFT : VK_LSHIFT; else if (vk == VK_CONTROL) @@ -871,8 +871,8 @@ HRESULT InitDevice() // Setup the viewport D3D11_VIEWPORT vp; - vp.Width = (FLOAT)width; - vp.Height = (FLOAT)height; + vp.Width = static_cast(width); + vp.Height = static_cast(height); vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; @@ -975,7 +975,7 @@ static Minecraft* InitialiseMinecraftRuntime() for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - IQNet::m_player[i].m_smallId = (BYTE)i; + IQNet::m_player[i].m_smallId = static_cast(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); @@ -1200,7 +1200,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, char buf[128] = {}; if (fgets(buf, sizeof(buf), f)) { - int len = (int)strlen(buf); + int len = static_cast(strlen(buf)); while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r' || buf[len - 1] == ' ')) { buf[--len] = '\0'; diff --git a/Minecraft.Client/Windows64/Windows64_UIController.cpp b/Minecraft.Client/Windows64/Windows64_UIController.cpp index 10ae20aff..b76b724a2 100644 --- a/Minecraft.Client/Windows64/Windows64_UIController.cpp +++ b/Minecraft.Client/Windows64/Windows64_UIController.cpp @@ -163,7 +163,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId) ID3D11ShaderResourceView *tex = RenderManager.TextureGetTexture(textureId); ID3D11Resource *resource; tex->GetResource(&resource); - ID3D11Texture2D *tex2d = (ID3D11Texture2D *)resource; + ID3D11Texture2D *tex2d = static_cast(resource); D3D11_TEXTURE2D_DESC desc; tex2d->GetDesc(&desc); GDrawTexture *gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); diff --git a/Minecraft.Client/WitherBossRenderer.cpp b/Minecraft.Client/WitherBossRenderer.cpp index 254a00bc7..e358c6dab 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 - (((float) inTicks - a) / (SharedConstants::TICKS_PER_SECOND * 11)) * .5f; + float scale = 2.0f - ((static_cast(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 878735740..5f08b5b67 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((float) x, (float) y, (float) z); + glTranslatef(static_cast(x), static_cast(y), static_cast(z)); float scale = 1 / 16.0f; glEnable(GL_RESCALE_NORMAL); diff --git a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp index b088150c9..97eb0658e 100644 --- a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp @@ -420,7 +420,7 @@ void SoundEngine::XACTNotificationCallback( const XACT_NOTIFICATION* pNotificati { if(pNotification->type==XACTNOTIFICATIONTYPE_WAVEBANKPREPARED) { - SoundEngine *pSoundEngine=(SoundEngine *)pNotification->pvContext; + SoundEngine *pSoundEngine=static_cast(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] = (char)c; + buf[i] = static_cast(c); } buf[name.length()] = 0; return buf; @@ -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 = (eSOUND_TYPE)iSound; + info->eSoundID = static_cast(iSound); info->iSoundBank = bSoundbank1?0:1; info->x = x; info->y = y; @@ -578,7 +578,7 @@ void SoundEngine::playUI(int iSound, float, float) } wstring name = wchSoundNames[iSound]; - char *xboxName = (char *)ConvertSoundPathToName(name); + char *xboxName = static_cast(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 = (eSOUND_TYPE)0; + info->eSoundID = static_cast(0); info->iSoundBank = bSoundBank1?0:1; info->idx =idx; info->x = 0.0f; @@ -701,7 +701,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, else { // get the dlc texture pack - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; + DLCTexturePack *pDLCTexPack=static_cast(pTexPack); pSoundBank=pDLCTexPack->m_pSoundBank; // check we can play the sound @@ -999,9 +999,9 @@ void SoundEngine::tick(shared_ptr *players, float a) { float yRot = players[i]->yRotO + (players[i]->yRot - players[i]->yRotO) * a; - 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 + 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 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/Font/XUI_Font.cpp b/Minecraft.Client/Xbox/Font/XUI_Font.cpp index 8b1a624be..f4ae9d069 100644 --- a/Minecraft.Client/Xbox/Font/XUI_Font.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_Font.cpp @@ -244,21 +244,21 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, { if(RenderManager.IsWidescreen()) { - int iScaleX=(int)m_fXScaleFactor; + int iScaleX=static_cast(m_fXScaleFactor); int iOriginX; if(iScaleX%2==0) { - iOriginX=(int)fOriginX; + iOriginX=static_cast(fOriginX); if(iOriginX%2==1) { fOriginX+=1.0f; } } - int iScaleY=(int)m_fYScaleFactor; + int iScaleY=static_cast(m_fYScaleFactor); int iOriginY; if(iScaleY%2==0) { - iOriginY=(int)fOriginY; + iOriginY=static_cast(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=(int)fOriginY; + int iOriginY=static_cast(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 * ( FLOAT )sChar.getOffset(); - FLOAT fAdvance = m_fXScaleFactor * ( FLOAT )sChar.getWAdvance(); + FLOAT fOffset = m_fXScaleFactor * static_cast(sChar.getOffset()); + FLOAT fAdvance = m_fXScaleFactor * static_cast(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() / (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(); + 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()); 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 7a70cdfbb..d8d87547c 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 (float) m_parent->m_fontData->getFontData()->m_uiGlyphWidth; + return static_cast(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 (float) m_parent->m_fontData->getWidth(m_glyphId); + return static_cast(m_parent->m_fontData->getWidth(m_glyphId)); } int XUI_FontData::SChar::getGlyphId() diff --git a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp index d708af791..5fff04db6 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp @@ -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 = (int)(fXuiSize * 4.0f); + int xuiSize = static_cast(fXuiSize * 4.0f); if( xuiSize < 1 ) xuiSize = 8; // 4J Stu - We have fonts based on multiples of 8 or 12 @@ -101,13 +101,13 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font->IncRefCount(); - *phFont = (HFONTOBJ)font; + *phFont = static_cast(font); return S_OK; } VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont ) { - XUI_Font *xuiFont = (XUI_Font*) hFont; + XUI_Font *xuiFont = static_cast(hFont); if (xuiFont != NULL) { xuiFont->DecRefCount(); @@ -125,7 +125,7 @@ HRESULT XUI_FontRenderer::GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontM { if( hFont == 0 || pFontMetrics == 0 ) return E_INVALIDARG; - XUI_Font *font = (XUI_Font *)hFont; + XUI_Font *font = static_cast(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 = (XUI_Font *)hFont; + XUI_Font *font = static_cast(hFont); XUI_FontData::SChar sChar = font->m_fontData->getChar(wch); pCharMetrics->fMinX = sChar.getMinX() * font->m_fYScaleFactor; @@ -169,7 +169,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat DWORD SamplerStateA[5]; XMVECTOR vconsts[20]; XMVECTOR pconsts[20]; - XUI_Font *font = (XUI_Font *)hFont; + XUI_Font *font = static_cast(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 = (float)(iWorldX & -2); + pWorldViewProj->_41 = static_cast(iWorldX & -2); } if(iScaleY%2==0) { int iWorldY=pWorldViewProj->_42; - pWorldViewProj->_42 = (float)(iWorldY & -2); + pWorldViewProj->_42 = static_cast(iWorldY & -2); } } else { // make x an even number for 480 4:3 int iWorldX=pWorldViewProj->_41; - pWorldViewProj->_41 = (float)(iWorldX & -2); + pWorldViewProj->_41 = static_cast(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 efa8a3dae..76fca0e48 100644 --- a/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp +++ b/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp @@ -192,7 +192,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) INetworkPlayer *player = g_NetworkManager.GetPlayerByXuid(m_myXUID); if(player != NULL) { - ret = ((NetworkPlayerXbox *)player)->GetQNetPlayer()->WriteStats(viewCount,views); + ret = static_cast(player)->GetQNetPlayer()->WriteStats(viewCount,views); //printf("Wrote stats to QNet player\n"); } else @@ -376,10 +376,10 @@ 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[(int)type][difficulty].m_viewId; - m_spec[0].dwNumColumnIds = LEADERBOARD_DESCRIPTORS[(int)type][difficulty].m_columnCount; + m_spec[0].dwViewId = LEADERBOARD_DESCRIPTORS[static_cast(type)][difficulty].m_viewId; + m_spec[0].dwNumColumnIds = LEADERBOARD_DESCRIPTORS[static_cast(type)][difficulty].m_columnCount; for (unsigned int i=0; i(type)][difficulty].m_columnIds[i]; return true; } @@ -431,7 +431,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() int XboxLeaderboardManager::FriendSortFunction(const void* a, const void* b) { - return ((int)((XUSER_STATS_ROW*)a)->dwRank) - ((int)((XUSER_STATS_ROW*)b)->dwRank); + return static_cast(((XUSER_STATS_ROW *)a)->dwRank) - static_cast(((XUSER_STATS_ROW *)b)->dwRank); } void XboxLeaderboardManager::SortFriendStats() diff --git a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp index 386a0206a..ea9ef39ea 100644 --- a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp +++ b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp @@ -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(((NetworkPlayerXbox *)player)->m_qnetPlayer, pvData, dataSize, flags); + m_qnetPlayer->SendData(static_cast(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(((NetworkPlayerXbox *)player)->m_qnetPlayer) == TRUE ); + return ( m_qnetPlayer->IsSameSystem(static_cast(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 ? ((NetworkPlayerXbox *)player)->m_qnetPlayer : NULL , flags); + return m_qnetPlayer->GetSendQueueSize(player ? static_cast(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 ? ((NetworkPlayerXbox *)player)->m_qnetPlayer : NULL , flags); + return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : NULL , flags); } int NetworkPlayerXbox::GetCurrentRtt() @@ -138,5 +138,5 @@ int NetworkPlayerXbox::GetTimeSinceLastChunkPacket_ms() } __int64 currentTime = System::currentTimeMillis(); - return (int)( currentTime - m_lastChunkPacketTime ); + return static_cast(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 473171463..882137eb8 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 = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); + NetworkPlayerXbox *networkPlayer = static_cast(addNetworkPlayer(pQNetPlayer)); if( pQNetPlayer->IsLocal() ) { @@ -380,7 +380,7 @@ VOID CPlatformNetworkManagerXbox::NotifyReadinessChanged( __in BOOL bReady ) { - app.DebugPrintf( "Player 0x%p readiness is now %i.\n", pQNetPlayer, (int) bReady ); + app.DebugPrintf( "Player 0x%p readiness is now %i.\n", pQNetPlayer, static_cast(bReady) ); } @@ -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] = ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID(); + m_hostGameSessionData.players[i] = static_cast(pNetworkPlayer)->GetUID(); char *temp; temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() ); @@ -965,7 +965,7 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN } } - m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); + m_hostGameSessionData.hostPlayerUID = static_cast(GetHostPlayer())->GetQNetPlayer()->GetXuid(); m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); HRESULT hr = S_OK; @@ -978,7 +978,7 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerXbox::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; + INetworkPlayer *pNetworkPlayer = static_cast(lpParam); Socket *socket = pNetworkPlayer->GetSocket(); @@ -1099,8 +1099,8 @@ bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerXbox::GatherStats() { - 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 ) ); + return L"Queue messages: " + std::to_wstring(static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( static_cast(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 = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = static_cast(GetPlayerByIndex(i))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -1386,7 +1386,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) { - SearchForGamesData *threadData = (SearchForGamesData *)lpParameter; + SearchForGamesData *threadData = static_cast(lpParameter); DWORD sessionIDCount = threadData->sessionIDCount; diff --git a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp index 5d2b97631..327e094c9 100644 --- a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp +++ b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp @@ -43,7 +43,7 @@ void MinecraftDynamicConfigurations::UpdateNextConfiguration() { if(!s_bUpdatedConfigs[i]) { - update = (EDynamic_Configs)i; + update = static_cast(i); break; } } diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientResource.h index e8405d5e1..b749a1640 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 = (INT32)SenResourceType_Invalid << 24, + SenResourceID_Invalid = static_cast(SenResourceType_Invalid) << 24, /// This is the first VIP reward costume and there is one for each title. - SenResourceID_Superstar_0 = (INT32)SenResourceType_Avatar << 24, + SenResourceID_Superstar_0 = static_cast(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 = (INT32)SenResourceType_BoxArt << 24, + SenResourceID_BoxArt_0 = static_cast(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 = (INT32)SenResourceType_Config << 24, + SenResourceID_Config_0 = static_cast(SenResourceType_Config) << 24, /// This is used for server-supplied help files/text. /// At the moment, this is not supported. - SenResourceID_Help_0 = (INT32)SenResourceType_Help << 24, + SenResourceID_Help_0 = static_cast(SenResourceType_Help) << 24, }; diff --git a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp index aade06bca..bf48c400a 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 = (Sentient::SenSysTitleID)TITLEID_MINECRAFT; + sentitleID = static_cast(TITLEID_MINECRAFT); HRESULT hr = SentientInitialize( sentitleID ); @@ -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, (INT)app.getDeploymentType() ); + return SenStatPlayerSessionStart( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetTitleBuildId(), 0, 0, 0, static_cast(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(), (INT)levelDuration ); + return SenStatLevelExit( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), levelExitStatus, GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast(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(), (INT)levelDuration, saveOrCheckPointID, saveSizeInBytes ); + return SenStatLevelSaveOrCheckpoint( dwUserId, GetSecondsSinceInitialize(), GetMode(dwUserId), GetSubMode(dwUserId), GetLevelId(dwUserId), GetSubLevelId(dwUserId), GetLevelInstanceID(), GetMultiplayerInstanceID(), GetLevelExitProgressStat1(), GetLevelExitProgressStat2(), static_cast(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 (INT)(app.getAppTime() - m_initialiseTime); + return static_cast(app.getAppTime() - m_initialiseTime); } /* @@ -263,15 +263,15 @@ INT CSentientManager::GetMode(DWORD dwUserId) if (gameType->isSurvival()) { - mode = (INT)eTelem_ModeId_Survival; + mode = static_cast(eTelem_ModeId_Survival); } else if (gameType->isCreative()) { - mode = (INT)eTelem_ModeId_Creative; + mode = static_cast(eTelem_ModeId_Creative); } else { - mode = (INT)eTelem_ModeId_Undefined; + mode = static_cast(eTelem_ModeId_Undefined); } } return mode; @@ -290,11 +290,11 @@ INT CSentientManager::GetSubMode(DWORD dwUserId) if(Minecraft::GetInstance()->isTutorial()) { - subMode = (INT)eTelem_SubModeId_Tutorial; + subMode = static_cast(eTelem_SubModeId_Tutorial); } else { - subMode = (INT)eTelem_SubModeId_Normal; + subMode = static_cast(eTelem_SubModeId_Normal); } return subMode; @@ -312,7 +312,7 @@ INT CSentientManager::GetLevelId(DWORD dwUserId) { INT levelId = (INT)eTelem_LevelId_Undefined; - levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel; + levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); return levelId; } @@ -334,13 +334,13 @@ INT CSentientManager::GetSubLevelId(DWORD dwUserId) switch(pMinecraft->localplayers[dwUserId]->dimension) { case 0: - subLevelId = (INT)eTelem_SubLevelId_Overworld; + subLevelId = static_cast(eTelem_SubLevelId_Overworld); break; case -1: - subLevelId = (INT)eTelem_SubLevelId_Nether; + subLevelId = static_cast(eTelem_SubLevelId_Nether); break; case 1: - subLevelId = (INT)eTelem_SubLevelId_End; + subLevelId = static_cast(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 (INT)m_levelInstanceID; + return static_cast(m_levelInstanceID); } /* @@ -403,19 +403,19 @@ INT CSentientManager::GetSingleOrMultiplayer() if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Single_Player); } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); } else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); } else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) { - singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live; + singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); } return singleOrMultiplayer; @@ -432,16 +432,16 @@ INT CSentientManager::GetDifficultyLevel(INT diff) switch(diff) { case 0: - difficultyLevel = (INT)eSen_DifficultyLevel_Easiest; + difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); break; case 1: - difficultyLevel = (INT)eSen_DifficultyLevel_Easier; + difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); break; case 2: - difficultyLevel = (INT)eSen_DifficultyLevel_Normal; + difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); break; case 3: - difficultyLevel = (INT)eSen_DifficultyLevel_Harder; + difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); break; } @@ -461,11 +461,11 @@ INT CSentientManager::GetLicense() if(ProfileManager.IsFullVersion()) { - license = (INT)eSen_License_Full_Purchased_Title; + license = static_cast(eSen_License_Full_Purchased_Title); } else { - license = (INT)eSen_License_Trial_or_Demo; + license = static_cast(eSen_License_Trial_or_Demo); } return license; } @@ -500,15 +500,15 @@ INT CSentientManager::GetAudioSettings(DWORD dwUserId) if(volume == 0) { - audioSettings = (INT)eSen_AudioSettings_Off; + audioSettings = static_cast(eSen_AudioSettings_Off); } else if(volume == DEFAULT_VOLUME_LEVEL) { - audioSettings = (INT)eSen_AudioSettings_On_Default; + audioSettings = static_cast(eSen_AudioSettings_On_Default); } else { - audioSettings = (INT)eSen_AudioSettings_On_CustomSetting; + audioSettings = static_cast(eSen_AudioSettings_On_CustomSetting); } } return audioSettings; diff --git a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp index 5366e721f..96b6bfc83 100644 --- a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp @@ -69,8 +69,8 @@ VOID XMLParser::FillBuffer() } m_dwCharsConsumed += NChars; - __int64 iProgress = m_dwCharsTotal ? (( (__int64)m_dwCharsConsumed * 1000 ) / (__int64)m_dwCharsTotal) : 0; - m_pISAXCallback->SetParseProgress( (DWORD)iProgress ); + __int64 iProgress = m_dwCharsTotal ? (( static_cast<__int64>(m_dwCharsConsumed) * 1000 ) / static_cast<__int64>(m_dwCharsTotal)) : 0; + m_pISAXCallback->SetParseProgress( static_cast(iProgress) ); m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars + 1] = '\0'; @@ -198,7 +198,7 @@ HRESULT XMLParser::ConvertEscape() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); + EntityRefLen = static_cast(m_pWritePtr - pEntityRefVal); m_pWritePtr = pEntityRefVal; if ( EntityRefLen == 0 ) @@ -497,8 +497,8 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, - (UINT) ( m_pWritePtr - pEntityRefVal ) ) ) ) + if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, + static_cast(m_pWritePtr - pEntityRefVal)) ) ) return E_ABORT; if( FAILED( hr = ConsumeSpace() ) ) @@ -541,7 +541,7 @@ HRESULT XMLParser::AdvanceElement() if( FAILED( hr = AdvanceName() ) ) return hr; - EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); + EntityRefLen = static_cast(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 = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName ); + Attributes[ NumAttrs ].NameLen = static_cast(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 = (UINT)( m_pWritePtr - - Attributes[ NumAttrs ].strValue ); + Attributes[ NumAttrs ].ValueLen = static_cast(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, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; } } - if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; m_pWritePtr = m_pWriteBuf; @@ -782,9 +782,9 @@ HRESULT XMLParser::MainParseLoop() { if( FAILED( AdvanceCharacter( TRUE ) ) ) { - if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) + if ( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -798,9 +798,9 @@ HRESULT XMLParser::MainParseLoop() if( m_Ch == '<' ) { - if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) + if( ( static_cast(m_pWritePtr - m_pWriteBuf) != 0 ) && ( !bWhiteSpaceOnly ) ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, static_cast(m_pWritePtr - m_pWriteBuf), FALSE ) ) ) return E_ABORT; bWhiteSpaceOnly = TRUE; @@ -837,8 +837,8 @@ HRESULT XMLParser::MainParseLoop() { if( !bWhiteSpaceOnly ) { - if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, - ( UINT ) ( m_pWritePtr - m_pWriteBuf ), + if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, + static_cast(m_pWritePtr - m_pWriteBuf), TRUE ) ) ) { return E_ABORT; @@ -888,7 +888,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { LARGE_INTEGER iFileSize; GetFileSizeEx( m_hFile, &iFileSize ); - m_dwCharsTotal = (DWORD)iFileSize.QuadPart; + m_dwCharsTotal = static_cast(iFileSize.QuadPart); m_dwCharsConsumed = 0; hr = MainParseLoop(); } diff --git a/Minecraft.Client/Xbox/Xbox_App.h b/Minecraft.Client/Xbox/Xbox_App.h index f64e71423..79ee28f97 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=(eTMSAction)0, bool bCallback=false); + void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false); // void ReadXuidsFileFromTMS(int iPad,eTMSAction NextAction,bool bCallback); // void ReadDLCFileFromTMS(int iPad,eTMSAction NextAction, bool bCallback); diff --git a/Minecraft.Client/ZombieRenderer.cpp b/Minecraft.Client/ZombieRenderer.cpp index 7fd2d2015..9db758075 100644 --- a/Minecraft.Client/ZombieRenderer.cpp +++ b/Minecraft.Client/ZombieRenderer.cpp @@ -98,7 +98,7 @@ void ZombieRenderer::swapArmor(shared_ptr mob) armorParts2 = defaultArmorParts2; } - humanoidModel = (HumanoidModel *) model; + humanoidModel = static_cast(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 += (float) (cos(mob->tickCount * 3.25) * PI * .25f); + bodyRot += static_cast(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 a356e674c..9c3c8559d 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((float)x,(float)y,(float)z); + RenderManager.MatrixScale(static_cast(x),static_cast(y),static_cast(z)); } void glGetFloat(int type, FloatBuffer *buff) diff --git a/Minecraft.World/AABB.cpp b/Minecraft.World/AABB.cpp index f8e134971..6610bc27e 100644 --- a/Minecraft.World/AABB.cpp +++ b/Minecraft.World/AABB.cpp @@ -41,7 +41,7 @@ void AABB::UseDefaultThreadStorage() void AABB::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); AABB *thisAABB = &tls->pool[tls->poolPointer]; thisAABB->set(x0, y0, z0, x1, y1, z1); tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE; diff --git a/Minecraft.World/AbstractContainerMenu.cpp b/Minecraft.World/AbstractContainerMenu.cpp index 57b0b1775..2cbea246d 100644 --- a/Minecraft.World/AbstractContainerMenu.cpp +++ b/Minecraft.World/AbstractContainerMenu.cpp @@ -29,7 +29,7 @@ AbstractContainerMenu::~AbstractContainerMenu() Slot *AbstractContainerMenu::addSlot(Slot *slot) { - slot->index = (int)slots.size(); + slot->index = static_cast(slots.size()); slots.push_back(slot); lastSlots.push_back(nullptr); return slot; @@ -722,7 +722,7 @@ void AbstractContainerMenu::getQuickCraftSlotCount(unordered_set *quickC switch (quickCraftingType) { case QUICKCRAFT_TYPE_CHARITABLE: - item->count = Mth::floor(item->count / (float) quickCraftSlots->size()); + item->count = Mth::floor(item->count / static_cast(quickCraftSlots->size())); break; case QUICKCRAFT_TYPE_GREEDY: item->count = 1; @@ -749,7 +749,7 @@ int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr if (item != NULL) { - totalPct += item->count / (float) min(container->getMaxStackSize(), item->getMaxStackSize()); + totalPct += item->count / static_cast(min(container->getMaxStackSize(), item->getMaxStackSize())); count++; } } diff --git a/Minecraft.World/AbstractContainerMenu.h b/Minecraft.World/AbstractContainerMenu.h index 5ac115de3..3365593cf 100644 --- a/Minecraft.World/AbstractContainerMenu.h +++ b/Minecraft.World/AbstractContainerMenu.h @@ -95,7 +95,7 @@ public: virtual bool stillValid(shared_ptr player) = 0; // 4J Stu Added for UI - unsigned int getSize() { return (unsigned int)slots.size(); } + unsigned int getSize() { return static_cast(slots.size()); } protected: diff --git a/Minecraft.World/AddEntityPacket.cpp b/Minecraft.World/AddEntityPacket.cpp index 6231537d6..f70082b89 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 = (int) (xd * 8000.0); - ya = (int) (yd * 8000.0); - za = (int) (zd * 8000.0); + xa = static_cast(xd * 8000.0); + ya = static_cast(yd * 8000.0); + za = static_cast(zd * 8000.0); } } diff --git a/Minecraft.World/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index 878e2ee72..d224b2931 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/AddMobPacket.cpp @@ -29,7 +29,7 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i { id = mob->entityId; - type = (byte) EntityIO::getId(mob); + type = static_cast(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,9 +54,9 @@ 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 = (int) (xd * 8000.0); - this->yd = (int) (yd * 8000.0); - this->zd = (int) (zd * 8000.0); + this->xd = static_cast(xd * 8000.0); + this->yd = static_cast(yd * 8000.0); + this->zd = static_cast(zd * 8000.0); // printf("%d: New add mob rot %d\n",id,yRot); diff --git a/Minecraft.World/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index 939843679..6b3e26365 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/AddPlayerPacket.cpp @@ -55,7 +55,7 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, Play this->xuid = xuid; this->OnlineXuid = OnlineXuid; - m_playerIndex = (BYTE)player->getPlayerIndex(); + m_playerIndex = static_cast(player->getPlayerIndex()); m_skinId = player->getCustomSkin(); m_capeId = player->getCustomCape(); m_uiGamePrivileges = player->getAllPlayerGamePrivileges(); diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index ecda8fc53..77048d06d 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -72,7 +72,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) { double xd = target->x - x; double zd = target->z - z; - yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; + yRot = static_cast(atan2(zd, xd) * 180 / PI) - 90; holdGround = true; } diff --git a/Minecraft.World/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index c2f681fa9..c55cbc592 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -66,9 +66,9 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrhasCustomColor(item)) { int color = armor->getColor(target); - float red = (float) ((color >> 16) & 0xFF) / 0xFF; - float green = (float) ((color >> 8) & 0xFF) / 0xFF; - float blue = (float) (color & 0xFF) / 0xFF; + float red = static_cast((color >> 16) & 0xFF) / 0xFF; + float green = static_cast((color >> 8) & 0xFF) / 0xFF; + float blue = static_cast(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 = (int) (Sheep::COLOR[tileData][0] * 0xFF); - int green = (int) (Sheep::COLOR[tileData][1] * 0xFF); - int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF); + 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); intensityTotal += max(red, max(green, blue)); @@ -110,13 +110,13 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr(intensityTotal) / colourCounts; + float resultIntensity = static_cast(max(red, max(green, blue))); // System.out.println(averageIntensity + ", " + resultIntensity); - red = (int) ((float) red * averageIntensity / resultIntensity); - green = (int) ((float) green * averageIntensity / resultIntensity); - blue = (int) ((float) blue * averageIntensity / resultIntensity); + red = static_cast((float)red * averageIntensity / resultIntensity); + green = static_cast((float)green * averageIntensity / resultIntensity); + blue = static_cast((float)blue * averageIntensity / resultIntensity); int rgb = red; rgb = (rgb << 8) + green; diff --git a/Minecraft.World/Arrow.cpp b/Minecraft.World/Arrow.cpp index ab942aac6..e6ee4b9cc 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)); double xdn = xd / sd; double zdn = zd / sd; moveTo(mob->x + xdn, y, mob->z + zdn, yRot, xRot); heightOffset = 0; - float yo = (float) sd * 0.2f; + float yo = static_cast(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, (byte) 0); + entityData->define(ID_FLAGS, static_cast(0)); } void Arrow::shoot(double xd, double yd, double zd, float pow, float uncertainty) { - float dist = (float) sqrt(xd * xd + yd * yd + zd * zd); + float dist = static_cast(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 = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(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 = (float) (atan2( xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2( yd, sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(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 = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); } @@ -289,7 +289,7 @@ void Arrow::tick() if (res->entity != NULL) { float pow = Mth::sqrt(xd * xd + yd * yd + zd * zd); - int dmg = (int) Mth::ceil((float)(pow * baseDamage)); + int dmg = (int) Mth::ceil(static_cast(pow * baseDamage)); if(isCritArrow()) dmg += random->nextInt(dmg / 2 + 2); @@ -376,10 +376,10 @@ void Arrow::tick() zTile = res->z; lastTile = level->getTile(xTile, yTile, zTile); lastData = level->getData(xTile, yTile, zTile); - 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); + 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)); // 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 = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, sd) * 180 / PI); + yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRot = static_cast(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", (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->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->putDouble(L"damage", baseDamage); } @@ -548,11 +548,11 @@ void Arrow::setCritArrow(bool critArrow) byte flags = entityData->getByte(ID_FLAGS); if (critArrow) { - entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT)); + entityData->set(ID_FLAGS, static_cast(flags | FLAG_CRIT)); } else { - entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT)); + entityData->set(ID_FLAGS, static_cast(flags & ~FLAG_CRIT)); } } diff --git a/Minecraft.World/AttributeModifier.cpp b/Minecraft.World/AttributeModifier.cpp index c479853d8..6c45c4ac6 100644 --- a/Minecraft.World/AttributeModifier.cpp +++ b/Minecraft.World/AttributeModifier.cpp @@ -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"-"), (int) displayAmount, (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute))); + swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), static_cast(displayAmount), (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute))); return HtmlString(formatted, color); } \ No newline at end of file diff --git a/Minecraft.World/BaseMobSpawner.cpp b/Minecraft.World/BaseMobSpawner.cpp index 0e37e4447..743427dae 100644 --- a/Minecraft.World/BaseMobSpawner.cpp +++ b/Minecraft.World/BaseMobSpawner.cpp @@ -78,7 +78,7 @@ void BaseMobSpawner::tick() if (spawnDelay > 0) spawnDelay--; oSpin = spin; - spin = (int)(spin + 1000 / (spawnDelay + 200.0f)) % 360; + spin = static_cast(spin + 1000 / (spawnDelay + 200.0f)) % 360; } else { @@ -202,7 +202,7 @@ void BaseMobSpawner::delay() if ( (spawnPotentials != NULL) && (spawnPotentials->size() > 0) ) { - setNextSpawnData( (SpawnData*) WeighedRandom::getRandomItem((Random*)getLevel()->random, (vector*)spawnPotentials) ); + setNextSpawnData( static_cast(WeighedRandom::getRandomItem((Random *)getLevel()->random, (vector *)spawnPotentials)) ); } broadcastEvent(EVENT_SPAWN); @@ -261,17 +261,17 @@ void BaseMobSpawner::load(CompoundTag *tag) void BaseMobSpawner::save(CompoundTag *tag) { tag->putString(L"EntityId", getEntityId()); - 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); + 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)); if (getNextSpawnData() != NULL) { - tag->putCompound(L"SpawnData", (CompoundTag *) getNextSpawnData()->tag->copy()); + tag->putCompound(L"SpawnData", static_cast(getNextSpawnData()->tag->copy())); } if (getNextSpawnData() != NULL || (spawnPotentials != NULL && spawnPotentials->size() > 0)) diff --git a/Minecraft.World/BaseRailTile.cpp b/Minecraft.World/BaseRailTile.cpp index db854bb33..c08c2860e 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 (((BaseRailTile *) Tile::tiles[id])->usesDataBit) + if (static_cast(Tile::tiles[id])->usesDataBit) { usesDataBit = true; direction = direction & ~RAIL_DATA_BIT; diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index 01f10cb3d..f98b4dcb0 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -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 = (int) (height * trunkHeightScale); + trunkHeight = static_cast(height * trunkHeightScale); if (trunkHeight >= height) trunkHeight = height - 1; - int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2)); + int clustersPerY = static_cast(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] = (int) (checkStart[1] - branchHeight); + checkBranchBase[1] = static_cast(checkStart[1] - branchHeight); } // Now check the branch path if (checkLine(checkBranchBase, checkStart) == -1) @@ -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 = (int) (radius + 0.618); + int rad = static_cast(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 < (((float) height) * 0.3)) return (float) -1.618; - float radius = ((float) height) / ((float) 2.0); - float adjacent = (((float) height) / ((float) 2.0)) - y; + 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; float distance; if (adjacent == 0) distance = radius; - else if (abs(adjacent) >= radius) distance = (float) 0.0; - else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2)); + else if (abs(adjacent) >= radius) distance = static_cast(0.0); + else distance = static_cast(sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2))); // Alter this factor to change the overall width of the tree. - distance *= (float) 0.5; + distance *= static_cast(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 (float) -1; - else if ((y == 0) || (y == (foliageHeight - 1))) return (float) 2; - else return (float) 3; + 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); } 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 = ((double) delta[secidx1]) / ((double) delta[primidx]); - double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]); + double secfac1 = static_cast(delta[secidx1]) / static_cast(delta[primidx]); + double secfac2 = static_cast(delta[secidx2]) / static_cast(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 = ((double) delta[secidx1]) / ((double) delta[primidx]); - double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]); + double secfac1 = static_cast(delta[secidx1]) / static_cast(delta[primidx]); + double secfac2 = static_cast(delta[secidx2]) / static_cast(delta[primidx]); // Initialize the coordinates. int coordinate[] = { 0, 0, 0 }; // Loop through each crossection along the primary axis, from start to end @@ -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 = (int) (heightInit * 12); + heightVariance = static_cast(heightInit * 12); if (heightInit > 0.5) foliageHeight = 5; widthScale = widthInit; foliageDensity = foliageDensityInit; diff --git a/Minecraft.World/Bat.cpp b/Minecraft.World/Bat.cpp index d3bd35214..dbb003026 100644 --- a/Minecraft.World/Bat.cpp +++ b/Minecraft.World/Bat.cpp @@ -90,11 +90,11 @@ void Bat::setResting(bool value) char current = entityData->getByte(DATA_ID_FLAGS); if (value) { - entityData->set(DATA_ID_FLAGS, (char) (current | FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, static_cast(current | FLAG_RESTING)); } else { - entityData->set(DATA_ID_FLAGS, (char) (current & ~FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, static_cast(current & ~FLAG_RESTING)); } } @@ -128,10 +128,10 @@ void Bat::newServerAiStep() if (isResting()) { - if (!level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z))) + if (!level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); } else { @@ -144,7 +144,7 @@ void Bat::newServerAiStep() if (level->getNearestPlayer(shared_from_this(), 4.0f) != NULL) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); } } } @@ -156,10 +156,10 @@ void Bat::newServerAiStep() delete targetPosition; targetPosition = NULL; } - if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr((int) x, (int) y, (int) z) < 4) + if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast(x), static_cast(y), static_cast(z)) < 4) { delete targetPosition; - 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)); + 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)); } 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 = (float) (atan2(zd, xd) * 180 / PI) - 90; + float yRotD = static_cast(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), (int) y + 1, Mth::floor(z))) + if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) { setResting(true); } diff --git a/Minecraft.World/BeachBiome.cpp b/Minecraft.World/BeachBiome.cpp index 50e7cc1ca..475f8468f 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 = (byte) Tile::sand_Id; - material = (byte) Tile::sand_Id; + topMaterial = static_cast(Tile::sand_Id); + material = static_cast(Tile::sand_Id); decorator->treeCount = -999; decorator->deadBushCount = 0; diff --git a/Minecraft.World/BeaconTileEntity.cpp b/Minecraft.World/BeaconTileEntity.cpp index d80eb9068..17f64723f 100644 --- a/Minecraft.World/BeaconTileEntity.cpp +++ b/Minecraft.World/BeaconTileEntity.cpp @@ -163,18 +163,18 @@ float BeaconTileEntity::getAndUpdateClientSideScale() return 0; } - int renderDelta = (int) (level->getGameTime() - clientSideRenderTick); + int renderDelta = static_cast(level->getGameTime() - clientSideRenderTick); clientSideRenderTick = level->getGameTime(); if (renderDelta > 1) { - clientSideRenderScale -= ((float) renderDelta / (float) SCALE_TIME); + clientSideRenderScale -= (static_cast(renderDelta) / static_cast(SCALE_TIME)); if (clientSideRenderScale < 0) { clientSideRenderScale = 0; } } - clientSideRenderScale += (1.0f / (float) SCALE_TIME); + clientSideRenderScale += (1.0f / static_cast(SCALE_TIME)); if (clientSideRenderScale > 1) { clientSideRenderScale = 1; diff --git a/Minecraft.World/BedItem.cpp b/Minecraft.World/BedItem.cpp index a55f277ed..c8765b749 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 = (BedTile *) Tile::bed; + BedTile *tile = static_cast(Tile::bed); int dir = ( Mth::floor(player->yRot * 4 / (360) + 0.5f) ) & 3; int xra = 0; diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 169db77e6..f8ac2107d 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -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 = (byte) Tile::grass_Id; - material = (byte) Tile::dirt_Id; + topMaterial = static_cast(Tile::grass_Id); + material = static_cast(Tile::dirt_Id); leafColor = 0x4EE031; _hasRain = true; depth = 0.1f; @@ -261,12 +261,12 @@ float Biome::getCreatureProbability() int Biome::getDownfallInt() { - return (int) (downfall * 65536); + return static_cast(downfall * 65536); } int Biome::getTemperatureInt() { - return (int) (temperature * 65536); + return static_cast(temperature * 65536); } // 4J - brought forward from 1.2.3 diff --git a/Minecraft.World/BiomeCache.cpp b/Minecraft.World/BiomeCache.cpp index b93ce32e1..f5469c595 100644 --- a/Minecraft.World/BiomeCache.cpp +++ b/Minecraft.World/BiomeCache.cpp @@ -85,7 +85,7 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z) EnterCriticalSection(&m_CS); x >>= ZONE_SIZE_BITS; z >>= ZONE_SIZE_BITS; - __int64 slot = (((__int64) x) & 0xffffffffl) | ((((__int64) z) & 0xffffffffl) << 32l); + __int64 slot = (static_cast<__int64>(x) & 0xffffffffl) | ((static_cast<__int64>(z) & 0xffffffffl) << 32l); auto it = cached.find(slot); Block *block = NULL; if (it == cached.end()) @@ -137,7 +137,7 @@ void BiomeCache::update() if (time > DECAY_TIME || time < 0) { it = all.erase(it); - __int64 slot = (((__int64) block->x) & 0xffffffffl) | ((((__int64) block->z) & 0xffffffffl) << 32l); + __int64 slot = (static_cast<__int64>(block->x) & 0xffffffffl) | ((static_cast<__int64>(block->z) & 0xffffffffl) << 32l); cached.erase(slot); delete block; } diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 8e2a56809..d2454f4a6 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -97,7 +97,7 @@ void BiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, i intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - float d = (float) Biome::biomes[result[i]]->getDownfallInt() / 65536.0f; + float d = static_cast(Biome::biomes[result[i]]->getDownfallInt()) / 65536.0f; if (d > 1) d = 1; downfalls[i] = d; } @@ -141,7 +141,7 @@ void BiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, in intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - float t = (float) Biome::biomes[result[i]]->getTemperatureInt() / 65536.0f; + float t = static_cast(Biome::biomes[result[i]]->getTemperatureInt()) / 65536.0f; if (t > 1) t = 1; temperatures[i] = t; } @@ -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] = (byte)result[i]; + biomeIndices[i] = static_cast(result[i]); } } @@ -553,7 +553,7 @@ void BiomeSource::getFracs(intArray indices, float *fracs) for( int i = 0; i < Biome::BIOME_COUNT; i++ ) { - fracs[i] /= (float)(indices.length); + fracs[i] /= static_cast(indices.length); } } diff --git a/Minecraft.World/Blaze.cpp b/Minecraft.World/Blaze.cpp index d87a83b2d..652aa673b 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, (byte) 0); + entityData->define(DATA_FLAGS_ID, static_cast(0)); } int Blaze::getAmbientSound() @@ -84,7 +84,7 @@ void Blaze::aiStep() if (nextHeightOffsetChangeTick <= 0) { nextHeightOffsetChangeTick = SharedConstants::TICKS_PER_SECOND * 5; - allowedHeightOffset = .5f + (float) random->nextGaussian() * 3; + allowedHeightOffset = .5f + static_cast(random->nextGaussian()) * 3; } if (getAttackTarget() != NULL && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) @@ -149,7 +149,7 @@ void Blaze::checkHurtTarget(shared_ptr target, float d) { float sqd = sqrt(d) * .5f; - level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, static_cast(x), static_cast(y), static_cast(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 = shared_ptr( new SmallFireball(level, dynamic_pointer_cast( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) ); @@ -162,7 +162,7 @@ void Blaze::checkHurtTarget(shared_ptr target, float d) } } - yRot = (float) (atan2(zd, xd) * 180 / PI) - 90; + yRot = static_cast(atan2(zd, xd) * 180 / PI) - 90; holdGround = true; } diff --git a/Minecraft.World/BlockReplacements.cpp b/Minecraft.World/BlockReplacements.cpp index 7b8aee511..ac31b3d2e 100644 --- a/Minecraft.World/BlockReplacements.cpp +++ b/Minecraft.World/BlockReplacements.cpp @@ -8,7 +8,7 @@ void BlockReplacements::staticCtor() { for (int i = 0; i < 256; i++) { - byte b = (byte) i; + byte b = static_cast(i); if (b != 0 && Tile::tiles[b & 0xff] == NULL) { b = 0; diff --git a/Minecraft.World/Boat.cpp b/Minecraft.World/Boat.cpp index 1811c2094..b1cfa5331 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/Boat.cpp @@ -245,8 +245,8 @@ void Boat::tick() double yrd = Mth::wrapDegrees(lyr - yRot); - yRot += (float) ( (yrd) / lSteps ); - xRot += (float) ( (lxr - xRot) / lSteps ); + yRot += static_cast((yrd) / lSteps); + xRot += static_cast((lxr - xRot) / lSteps); lSteps--; setPos(xt, yt, zt); @@ -390,7 +390,7 @@ void Boat::tick() double zDiff = zo - z; if (xDiff * xDiff + zDiff * zDiff > 0.001) { - yRotT = (float) (atan2(zDiff, xDiff) * 180 / PI); + yRotT = static_cast(atan2(zDiff, xDiff) * 180 / PI); } double rotDiff = Mth::wrapDegrees(yRotT - yRot); @@ -398,7 +398,7 @@ void Boat::tick() if (rotDiff > 20) rotDiff = 20; if (rotDiff < -20) rotDiff = -20; - yRot += (float) rotDiff; + yRot += static_cast(rotDiff); setRot(yRot, xRot); if(level->isClientSide) return; diff --git a/Minecraft.World/BottleItem.cpp b/Minecraft.World/BottleItem.cpp index 0f8e3c357..7a666752d 100644 --- a/Minecraft.World/BottleItem.cpp +++ b/Minecraft.World/BottleItem.cpp @@ -40,11 +40,11 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, itemInstance->count--; if (itemInstance->count <= 0) { - return shared_ptr( new ItemInstance( (Item *)Item::potion) ); + return shared_ptr( new ItemInstance( static_cast(Item::potion)) ); } else { - if (!player->inventory->add(shared_ptr( new ItemInstance( (Item *)Item::potion) ))) + if (!player->inventory->add(shared_ptr( new ItemInstance( static_cast(Item::potion)) ))) { player->drop( shared_ptr( new ItemInstance(Item::potion_Id, 1, 0) )); } diff --git a/Minecraft.World/BowItem.cpp b/Minecraft.World/BowItem.cpp index 949b71e73..ef55a8a5c 100644 --- a/Minecraft.World/BowItem.cpp +++ b/Minecraft.World/BowItem.cpp @@ -25,7 +25,7 @@ void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, if (infiniteArrows || player->inventory->hasResource(Item::arrow_Id)) { int timeHeld = getUseDuration(itemInstance) - durationLeft; - float pow = timeHeld / (float) MAX_DRAW_DURATION; + float pow = timeHeld / static_cast(MAX_DRAW_DURATION); pow = ((pow * pow) + pow * 2) / 3; if (pow < 0.1) return; if (pow > 1) pow = 1; @@ -35,7 +35,7 @@ void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance); if (damageBonus > 0) { - arrow->setBaseDamage(arrow->getBaseDamage() + (double) damageBonus * .5 + .5); + arrow->setBaseDamage(arrow->getBaseDamage() + static_cast(damageBonus) * .5 + .5); } int knockbackBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowKnockback->id, itemInstance); if (knockbackBonus > 0) diff --git a/Minecraft.World/BreakDoorGoal.cpp b/Minecraft.World/BreakDoorGoal.cpp index f63b4eb00..ea00f500d 100644 --- a/Minecraft.World/BreakDoorGoal.cpp +++ b/Minecraft.World/BreakDoorGoal.cpp @@ -47,7 +47,7 @@ void BreakDoorGoal::tick() breakTime++; - int progress = (int) (breakTime / (float) DOOR_BREAK_TIME * 10); + int progress = static_cast(breakTime / (float)DOOR_BREAK_TIME * 10); if (progress != lastBreakProgress) { mob->level->destroyTileProgress(mob->entityId, doorX, doorY, doorZ, progress); diff --git a/Minecraft.World/BrewingStandTile.cpp b/Minecraft.World/BrewingStandTile.cpp index 1aeb52d8f..afb324ce0 100644 --- a/Minecraft.World/BrewingStandTile.cpp +++ b/Minecraft.World/BrewingStandTile.cpp @@ -106,12 +106,12 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d 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 = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 5bc6fd27d..2c535a0e7 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/BrewingStandTileEntity.cpp @@ -322,7 +322,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BrewTime", (short) (brewTime)); + base->putShort(L"BrewTime", static_cast(brewTime)); ListTag *listTag = new ListTag(); for (int i = 0; i < items.length; i++) @@ -330,7 +330,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/BufferedOutputStream.cpp b/Minecraft.World/BufferedOutputStream.cpp index 19fc95aff..4f9edbf65 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++] = (byte) b; + buf[count++] = static_cast(b); if( count == buf.length ) { flush(); diff --git a/Minecraft.World/ButtonTile.cpp b/Minecraft.World/ButtonTile.cpp index 045d5597d..f3387e20b 100644 --- a/Minecraft.World/ButtonTile.cpp +++ b/Minecraft.World/ButtonTile.cpp @@ -302,7 +302,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z) bool shouldBePressed; updateShape(data); - Tile::ThreadStorage *tls = (Tile::ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + Tile::ThreadStorage *tls = static_cast(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/ByteArrayOutputStream.cpp b/Minecraft.World/ByteArrayOutputStream.cpp index 9296fe5ea..afb8c719a 100644 --- a/Minecraft.World/ByteArrayOutputStream.cpp +++ b/Minecraft.World/ByteArrayOutputStream.cpp @@ -33,7 +33,7 @@ void ByteArrayOutputStream::write(unsigned int b) if( count + 1 >= buf.length ) buf.resize( buf.length * 2 ); - buf[count] = (byte) b; + buf[count] = static_cast(b); count++; } diff --git a/Minecraft.World/ByteArrayTag.h b/Minecraft.World/ByteArrayTag.h index 598515ac8..ce701fdbf 100644 --- a/Minecraft.World/ByteArrayTag.h +++ b/Minecraft.World/ByteArrayTag.h @@ -40,7 +40,7 @@ public: { if (Tag::equals(obj)) { - ByteArrayTag *o = (ByteArrayTag *) obj; + ByteArrayTag *o = static_cast(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 6b319c0bb..ef2364720 100644 --- a/Minecraft.World/ByteTag.h +++ b/Minecraft.World/ByteTag.h @@ -23,7 +23,7 @@ public: { if (Tag::equals(obj)) { - ByteTag *o = (ByteTag *) obj; + ByteTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index d0794f064..0582abb8f 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -240,7 +240,7 @@ SceInt32 C4JThread::entryPoint(SceSize argSize, void *pArgBlock) #else DWORD WINAPI C4JThread::entryPoint(LPVOID lpParam) { - C4JThread* pThread = (C4JThread*)lpParam; + C4JThread* pThread = static_cast(lpParam); SetThreadName(-1, pThread->m_threadName); pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_isRunning = false; @@ -1029,7 +1029,7 @@ void C4JThread::EventQueue::waitForFinish() int C4JThread::EventQueue::threadFunc( void* lpParam ) { - EventQueue* p = (EventQueue*)lpParam; + EventQueue* p = static_cast(lpParam); p->threadPoll(); return 0; } diff --git a/Minecraft.World/CanyonFeature.cpp b/Minecraft.World/CanyonFeature.cpp index 6d1dda64c..6fddd5ccf 100644 --- a/Minecraft.World/CanyonFeature.cpp +++ b/Minecraft.World/CanyonFeature.cpp @@ -141,11 +141,11 @@ void CanyonFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray bloc { if (yy < 10) { - blocks[p] = (byte) Tile::lava_Id; + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = (byte) 0; + blocks[p] = static_cast(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,(int)(xCave/16.0),(int)(yCave/16.0)); + app.AddTerrainFeaturePosition(eTerrainFeature_Ravine,static_cast(xCave / 16.0),static_cast(yCave / 16.0)); } } \ No newline at end of file diff --git a/Minecraft.World/CaveFeature.cpp b/Minecraft.World/CaveFeature.cpp index adb5d4462..c460d8634 100644 --- a/Minecraft.World/CaveFeature.cpp +++ b/Minecraft.World/CaveFeature.cpp @@ -46,9 +46,9 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z) } } - 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++) + 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++) { 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 2988962e7..44e1fedb7 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 = (EChatPacketMessage) dis->readShort(); + m_messageType = static_cast(dis->readShort()); short packedCounts = dis->readShort(); int stringCount = (packedCounts >> 4) & 0xF; diff --git a/Minecraft.World/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index 11178b8a3..06e57d7d2 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/ChestTile.cpp @@ -235,12 +235,12 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) newItem->set4JData( item->get4JData() ); shared_ptr itemEntity = shared_ptr(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; - itemEntity->xd = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } level->addEntity(itemEntity); diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index b8f323f4f..bdffb05cc 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -157,7 +157,7 @@ void ChestTileEntity::save(CompoundTag *base) if (items->data[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items->data[i]->save(tag); listTag->add(tag); } @@ -254,7 +254,7 @@ bool ChestTileEntity::isSameChest(int x, int y, int z) { Tile *tile = Tile::tiles[level->getTile(x, y, z)]; if (tile == NULL || !(dynamic_cast(tile) != NULL)) return false; - return ((ChestTile *) tile)->type == getType(); + return static_cast(tile)->type == getType(); } void ChestTileEntity::tick() @@ -391,7 +391,7 @@ int ChestTileEntity::getType() { if (level != NULL && dynamic_cast( getTile() ) != NULL) { - type = ((ChestTile *) getTile())->type; + type = static_cast(getTile())->type; } else { diff --git a/Minecraft.World/ChunkPos.cpp b/Minecraft.World/ChunkPos.cpp index ff1c34f0a..434062c18 100644 --- a/Minecraft.World/ChunkPos.cpp +++ b/Minecraft.World/ChunkPos.cpp @@ -16,8 +16,8 @@ __int64 ChunkPos::hashCode(int x, int z) int ChunkPos::hashCode() { __int64 hash = hashCode(x, z); - int h1 = (int) (hash); - int h2 = (int) (hash >> 32l); + int h1 = static_cast(hash); + int h2 = static_cast(hash >> 32l); return h1 ^ h2; } diff --git a/Minecraft.World/ChunkStorageProfileDecorator.cpp b/Minecraft.World/ChunkStorageProfileDecorator.cpp index 76ffddbc1..52b78260a 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 * (double) timeSpentLoading / (double) loadCount, loadCount); + sprintf(buf,"Average load time: %f (%I64d)",0.000001 * static_cast(timeSpentLoading) / static_cast(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 * (double) timeSpentSaving / (double) loadCount, loadCount); + sprintf(buf,"Average save time: %f (%I64d)",0.000001 * static_cast(timeSpentSaving) / static_cast(loadCount), loadCount); #endif app.DebugPrintf(buf); #endif diff --git a/Minecraft.World/ChunkTilesUpdatePacket.cpp b/Minecraft.World/ChunkTilesUpdatePacket.cpp index d90e6b2f0..de5abea16 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] = (byte) levelChunk->getTile(x, y, z); - data[i] = (byte) levelChunk->getData(x, y, z); + blocks[i] = static_cast(levelChunk->getTile(x, y, z)); + data[i] = static_cast(levelChunk->getData(x, y, z)); } levelIdx = ( ( level->dimension->id == 0 ) ? 0 : ( (level->dimension->id == -1) ? 1 : 2 ) ); } diff --git a/Minecraft.World/Color.cpp b/Minecraft.World/Color.cpp index 256e9017f..554ee3792 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) | ( (int)(r*255)<<16 ) | ( (int)(g*255)<<8 ) | ( (int)(b*255) ) ); + colour = ( (0xFF<<24) | ( static_cast(r * 255)<<16 ) | ( static_cast(g * 255)<<8 ) | static_cast(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 = (int) (brightness * 255.0f + 0.5f); + r = g = b = static_cast(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 ((int) h) + switch (static_cast(h)) { case 0: - r = (int) (brightness * 255.0f + 0.5f); - g = (int) (t * 255.0f + 0.5f); - b = (int) (p * 255.0f + 0.5f); + r = static_cast(brightness * 255.0f + 0.5f); + g = static_cast(t * 255.0f + 0.5f); + b = static_cast(p * 255.0f + 0.5f); break; case 1: - r = (int) (q * 255.0f + 0.5f); - g = (int) (brightness * 255.0f + 0.5f); - b = (int) (p * 255.0f + 0.5f); + r = static_cast(q * 255.0f + 0.5f); + g = static_cast(brightness * 255.0f + 0.5f); + b = static_cast(p * 255.0f + 0.5f); break; case 2: - r = (int) (p * 255.0f + 0.5f); - g = (int) (brightness * 255.0f + 0.5f); - b = (int) (t * 255.0f + 0.5f); + r = static_cast(p * 255.0f + 0.5f); + g = static_cast(brightness * 255.0f + 0.5f); + b = static_cast(t * 255.0f + 0.5f); break; case 3: - r = (int) (p * 255.0f + 0.5f); - g = (int) (q * 255.0f + 0.5f); - b = (int) (brightness * 255.0f + 0.5f); + r = static_cast(p * 255.0f + 0.5f); + g = static_cast(q * 255.0f + 0.5f); + b = static_cast(brightness * 255.0f + 0.5f); break; case 4: - r = (int) (t * 255.0f + 0.5f); - g = (int) (p * 255.0f + 0.5f); - b = (int) (brightness * 255.0f + 0.5f); + r = static_cast(t * 255.0f + 0.5f); + g = static_cast(p * 255.0f + 0.5f); + b = static_cast(brightness * 255.0f + 0.5f); break; case 5: - r = (int) (brightness * 255.0f + 0.5f); - g = (int) (p * 255.0f + 0.5f); - b = (int) (q * 255.0f + 0.5f); + r = static_cast(brightness * 255.0f + 0.5f); + g = static_cast(p * 255.0f + 0.5f); + b = static_cast(q * 255.0f + 0.5f); break; } } diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index f3a711d2d..e08706449 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -123,7 +123,7 @@ public: void putBoolean(const wstring &name, bool val) { - putByte(name, val?(byte)1:0); + putByte(name, val?static_cast(1):0); } Tag *get(const wstring &name) @@ -141,67 +141,67 @@ public: byte getByte(const wstring &name) { if (tags.find(name) == tags.end()) return (byte)0; - return ((ByteTag *) tags[name])->data; + return static_cast(tags[name])->data; } short getShort(const wstring &name) { if (tags.find(name) == tags.end()) return (short)0; - return ((ShortTag *) tags[name])->data; + return static_cast(tags[name])->data; } int getInt(const wstring &name) { if (tags.find(name) == tags.end()) return (int)0; - return ((IntTag *) tags[name])->data; + return static_cast(tags[name])->data; } __int64 getLong(const wstring &name) { if (tags.find(name) == tags.end()) return (__int64)0; - return ((LongTag *) tags[name])->data; + return static_cast(tags[name])->data; } float getFloat(const wstring &name) { - if (tags.find(name) == tags.end()) return (float)0; - return ((FloatTag *) tags[name])->data; + if (tags.find(name) == tags.end()) return static_cast(0); + return static_cast(tags[name])->data; } double getDouble(const wstring &name) { if (tags.find(name) == tags.end()) return (double)0; - return ((DoubleTag *) tags[name])->data; + return static_cast(tags[name])->data; } wstring getString(const wstring &name) { if (tags.find(name) == tags.end()) return wstring( L"" ); - return ((StringTag *) tags[name])->data; + return static_cast(tags[name])->data; } byteArray getByteArray(const wstring &name) { if (tags.find(name) == tags.end()) return byteArray(); - return ((ByteArrayTag *) tags[name])->data; + return static_cast(tags[name])->data; } intArray getIntArray(const wstring &name) { if (tags.find(name) == tags.end()) return intArray(); - return ((IntArrayTag *) tags[name])->data; + return static_cast(tags[name])->data; } CompoundTag *getCompound(const wstring &name) { if (tags.find(name) == tags.end()) return new CompoundTag(name); - return (CompoundTag *) tags[name]; + return static_cast(tags[name]); } ListTag *getList(const wstring &name) { if (tags.find(name) == tags.end()) return new ListTag(name); - return (ListTag *) tags[name]; + return static_cast *>(tags[name]); } bool getBoolean(const wstring &string) @@ -271,7 +271,7 @@ public: { if (Tag::equals(obj)) { - CompoundTag *o = (CompoundTag *) obj; + CompoundTag *o = static_cast(obj); if(tags.size() == o->tags.size()) { diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index 12c1ba3b7..8a999a0a6 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -55,7 +55,7 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage *copyFrom) allocatedSize = copyFrom->allocatedSize; if(allocatedSize > 0) { - indicesAndData = (unsigned char *)XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc(allocatedSize); + indicesAndData = static_cast(XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc(allocatedSize); XMemCpy(indicesAndData, copyFrom->indicesAndData, allocatedSize); } else @@ -75,7 +75,7 @@ CompressedTileStorage::CompressedTileStorage(byteArray initFrom, unsigned int in 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 = (unsigned char *)XPhysicalAlloc(32768+4096, MAXULONG_PTR, 4096, PAGE_READWRITE); + indicesAndData = static_cast(XPhysicalAlloc(32768 + 4096, MAXULONG_PTR, 4096, PAGE_READWRITE)); unsigned short *indices = (unsigned short *)indicesAndData; unsigned char *data = indicesAndData + 1024; @@ -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 = (unsigned char *)XPhysicalAlloc(4096, MAXULONG_PTR, 4096, PAGE_READWRITE); + indicesAndData = static_cast(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 = (unsigned char *)XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc( memToAlloc ); + unsigned char *newIndicesAndData = static_cast(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 | (((unsigned short)data[getIndex(i,0)]) << INDEX_TILE_SHIFT); + newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (static_cast(data[getIndex(i, 0)]) << INDEX_TILE_SHIFT); } else { @@ -738,7 +738,7 @@ int CompressedTileStorage::setDataRegion(byteArray dataIn, int x0, int y0, int } ptrdiff_t count = pucIn - &dataIn.data[offset]; - return (int)count; + return static_cast(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 (int)count; + return static_cast(count); } void CompressedTileStorage::staticCtor() @@ -1049,7 +1049,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) if( needsCompressed ) { memToAlloc += 1024; // For the indices - unsigned char *newIndicesAndData = (unsigned char *)XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE);//(unsigned char *)malloc( memToAlloc ); + unsigned char *newIndicesAndData = static_cast(XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc( memToAlloc ); if( newIndicesAndData == NULL ) { DWORD lastError = GetLastError(); @@ -1165,7 +1165,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) { if( _blockIndices[i] & INDEX_TYPE_0_BIT_FLAG ) { - newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (((unsigned short)unpacked_data[0]) << INDEX_TILE_SHIFT); + newIndices[i] = INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG | (static_cast(unpacked_data[0]) << INDEX_TILE_SHIFT); } else { @@ -1339,7 +1339,7 @@ void CompressedTileStorage::read(DataInputStream *dis) { XPhysicalFree(indicesAndData); } - indicesAndData = (unsigned char *)XPhysicalAlloc(allocatedSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + indicesAndData = static_cast(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 09f72be09..807ef1d98 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -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, (void*)this, readThreadName, READ_STACK_SIZE); + readThread = new C4JThread(runRead, static_cast(this), readThreadName, READ_STACK_SIZE); writeThread = new C4JThread(runWrite, this, writeThreadName, WRITE_STACK_SIZE); readThread->SetProcessor(CPU_CORE_CONNECTIONS); writeThread->SetProcessor(CPU_CORE_CONNECTIONS ); @@ -558,14 +558,14 @@ void Connection::sendAndQuit() int Connection::countDelayedPackets() { - return (int)outgoing_slow.size(); + return static_cast(outgoing_slow.size()); } int Connection::runRead(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::eConnectionReadThreads); - Connection *con = (Connection *)lpParam; + Connection *con = static_cast(lpParam); if (con == NULL) { @@ -615,7 +615,7 @@ int Connection::runRead(void* lpParam) int Connection::runWrite(void* lpParam) { ShutdownManager::HasStarted(ShutdownManager::eConnectionWriteThreads); - Connection *con = dynamic_cast((Connection *) lpParam); + Connection *con = dynamic_cast(static_cast(lpParam)); if (con == NULL) { @@ -660,7 +660,7 @@ int Connection::runWrite(void* lpParam) int Connection::runClose(void* lpParam) { - Connection *con = dynamic_cast((Connection *) lpParam); + Connection *con = dynamic_cast(static_cast(lpParam)); if (con == NULL) return 0; @@ -683,7 +683,7 @@ int Connection::runClose(void* lpParam) int Connection::runSendAndQuit(void* lpParam) { - Connection *con = dynamic_cast((Connection *) lpParam); + Connection *con = dynamic_cast(static_cast(lpParam)); // printf("Con:0x%x runSendAndQuit\n",con); if (con == NULL) return 0; diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index 3a2b5ef11..f2bd522fb 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -141,10 +141,10 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID #else void* pvSourceData = pvSaveMem; #endif - int compressed = *(int*)pvSourceData; + int compressed = *static_cast(pvSourceData); if( compressed == 0 ) { - unsigned int decompSize = *( (int*)pvSourceData+1 ); + unsigned int decompSize = *( static_cast(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, (unsigned char *)pvSourceData+8, fileSize-8 ); + Compression::VitaVirtualDecompress(buf, &decompSize, static_cast(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, (unsigned char *)pvSourceData+8, fileSize-8 ); + Compression::getCompression()->Decompress(buf, &decompSize, static_cast(pvSourceData)+8, fileSize-8 ); Compression::getCompression()->SetDecompressionType(SAVE_FILE_PLATFORM_LOCAL); // and then set the decompression back to the local machine's standard type } @@ -248,18 +248,18 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) DWORD bufferDataSize = 0; - char *readStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); + char *readStartOffset = static_cast(pvSaveMem) + file->data.startOffset + file->getFileSize(); - char *writeStartOffset = (char *)pvSaveMem + file->data.startOffset; + char *writeStartOffset = static_cast(pvSaveMem) + file->data.startOffset; - char *endOfDataOffset = (char *)pvSaveMem + header.GetStartOfNextData(); + char *endOfDataOffset = static_cast(pvSaveMem) + header.GetStartOfNextData(); while(true) { // Fill buffer from file if( readStartOffset + bufferSize > endOfDataOffset ) { - amountToRead = (int)(endOfDataOffset - readStartOffset); + amountToRead = static_cast(endOfDataOffset - readStartOffset); } else { @@ -349,7 +349,7 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD PrepareForWrite( file, nNumberOfBytesToWrite ); - char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; + char *writeStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); #ifdef __PSVITA__ @@ -386,7 +386,7 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr PrepareForWrite( file, nNumberOfBytesToWrite ); - char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; + char *writeStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); #ifdef __PSVITA__ @@ -422,7 +422,7 @@ BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, LPVOID lpBuffer, DWORD LockSaveAccess(); - char *readStartOffset = (char *)pvSaveMem + file->currentFilePointer; + char *readStartOffset = static_cast(pvSaveMem) + file->currentFilePointer; //printf("Read: pvSaveMem = %0xd, currentFilePointer = %d, readStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, readStartOffset); assert( nNumberOfBytesToRead <= file->getFileSize() ); @@ -498,13 +498,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 = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); + char *spaceStartOffset = static_cast(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 = (char *)pvSaveMem + header.GetStartOfNextData(); + char *beginEndOfDataOffset = static_cast(pvSaveMem) + header.GetStartOfNextData(); // This is where the end of the data is going to be char *finishEndOfDataOffset = beginEndOfDataOffset + nNumberOfBytesToWrite; @@ -530,8 +530,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 & ~((uintptr_t)4095); - uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~((uintptr_t)4095); + uintptr_t uiFromStartChunk = uiFromStart & ~static_cast(4095); + uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~static_cast(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 ) @@ -570,7 +570,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt // Fill buffer 1 from file if( (readStartOffset - bufferSize) < spaceStartOffset ) { - amountToRead = (DWORD)(readStartOffset - spaceStartOffset); + amountToRead = static_cast(readStartOffset - spaceStartOffset); } else { @@ -652,7 +652,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; float fElapsedTime = 0.0f; QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; + float fSecsPerTick = 1.0f / static_cast(qwTicksPerSec.QuadPart); unsigned int fileSize = header.GetFileSize(); @@ -671,7 +671,7 @@ 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 = (byte *)StorageManager.AllocateSaveData( compLength ); + byte *compData = static_cast(StorageManager.AllocateSaveData(compLength)); #ifdef __PSVITA__ // AP - make sure we always allocate just what is needed so it will only SAVE what is needed. @@ -699,7 +699,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); + fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -709,7 +709,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) compLength = compLength+8; // Attempt to allocate the required memory - compData = (byte *)StorageManager.AllocateSaveData( compLength ); + compData = static_cast(StorageManager.AllocateSaveData(compLength)); } #endif @@ -730,7 +730,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) QueryPerformanceCounter( &qwNewTime ); qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); + fElapsedTime = fSecsPerTick * static_cast(qwDeltaTime.QuadPart); app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -819,7 +819,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) { - ConsoleSaveFile *pClass=(ConsoleSaveFile *)lpParam; + ConsoleSaveFile *pClass=static_cast(lpParam); return 0; } @@ -1066,5 +1066,5 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() void *ConsoleSaveFileOriginal::getWritePointer(FileEntry *file) { - return (char *)pvSaveMem + file->currentFilePointer;; + return static_cast(pvSaveMem) + file->currentFilePointer;; } diff --git a/Minecraft.World/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/ConsoleSaveFileOutputStream.cpp index 3d8bb3f7c..27b46df08 100644 --- a/Minecraft.World/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileOutputStream.cpp @@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = (byte) b; + byte value = static_cast(b); BOOL result = m_saveFile->writeFile( m_file, diff --git a/Minecraft.World/ContainerMenu.cpp b/Minecraft.World/ContainerMenu.cpp index b1fd4d6bd..83c2db2ec 100644 --- a/Minecraft.World/ContainerMenu.cpp +++ b/Minecraft.World/ContainerMenu.cpp @@ -53,7 +53,7 @@ shared_ptr ContainerMenu::quickMoveStack(shared_ptr player if (slotIndex < containerRows * 9) { - if(!moveItemStackTo(stack, containerRows * 9, (int)slots.size(), true)) + if(!moveItemStackTo(stack, containerRows * 9, static_cast(slots.size()), true)) { // 4J Stu - Brought forward from 1.2 return nullptr; diff --git a/Minecraft.World/ContainerSetContentPacket.cpp b/Minecraft.World/ContainerSetContentPacket.cpp index 13cfebd7c..079ed59e2 100644 --- a/Minecraft.World/ContainerSetContentPacket.cpp +++ b/Minecraft.World/ContainerSetContentPacket.cpp @@ -20,7 +20,7 @@ ContainerSetContentPacket::ContainerSetContentPacket() ContainerSetContentPacket::ContainerSetContentPacket(int containerId, vector > *newItems) { this->containerId = containerId; - items = ItemInstanceArray((int)newItems->size()); + items = ItemInstanceArray(static_cast(newItems->size())); for (unsigned int i = 0; i < items.length; i++) { shared_ptr item = newItems->at(i); diff --git a/Minecraft.World/ControlledByPlayerGoal.cpp b/Minecraft.World/ControlledByPlayerGoal.cpp index cea227cda..ecda01b35 100644 --- a/Minecraft.World/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/ControlledByPlayerGoal.cpp @@ -42,7 +42,7 @@ bool ControlledByPlayerGoal::canUse() void ControlledByPlayerGoal::tick() { shared_ptr player = dynamic_pointer_cast(mob->rider.lock()); - PathfinderMob *pig = (PathfinderMob *)mob; + PathfinderMob *pig = static_cast(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((float) boostTime / boostTimeTotal * PI); + moveSpeed += moveSpeed * 1.15f * Mth::sin(static_cast(boostTime) / boostTimeTotal * PI); } float friction = 0.91f; diff --git a/Minecraft.World/Creeper.cpp b/Minecraft.World/Creeper.cpp index 29be2c0ca..15d84f409 100644 --- a/Minecraft.World/Creeper.cpp +++ b/Minecraft.World/Creeper.cpp @@ -66,7 +66,7 @@ int Creeper::getMaxFallDistance() { if (getTarget() == NULL) return 3; // As long as they survive the fall they should try. - return 3 + (int) (getHealth() - 1); + return 3 + static_cast(getHealth() - 1); } void Creeper::causeFallDamage(float distance) @@ -81,22 +81,22 @@ void Creeper::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_SWELL_DIR, (byte) -1); - entityData->define(DATA_IS_POWERED, (byte) 0); + entityData->define(DATA_SWELL_DIR, static_cast(-1)); + entityData->define(DATA_IS_POWERED, static_cast(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", (short) maxSwell); - entityTag->putByte(L"ExplosionRadius", (byte) explosionRadius); + entityTag->putShort(L"Fuse", static_cast(maxSwell)); + entityTag->putByte(L"ExplosionRadius", static_cast(explosionRadius)); } void Creeper::readAdditionalSaveData(CompoundTag *tag) { Monster::readAdditionalSaveData(tag); - entityData->set(DATA_IS_POWERED, (byte) (tag->getBoolean(L"powered") ? 1 : 0)); + entityData->set(DATA_IS_POWERED, static_cast(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"); } @@ -177,16 +177,16 @@ int Creeper::getDeathLoot() int Creeper::getSwellDir() { - return (int) (char) entityData->getByte(DATA_SWELL_DIR); + return (int) static_cast(entityData->getByte(DATA_SWELL_DIR)); } void Creeper::setSwellDir(int dir) { - entityData->set(DATA_SWELL_DIR, (byte) dir); + entityData->set(DATA_SWELL_DIR, static_cast(dir)); } void Creeper::thunderHit(const LightningBolt *lightningBolt) { Monster::thunderHit(lightningBolt); - entityData->set(DATA_IS_POWERED, (byte) 1); + entityData->set(DATA_IS_POWERED, static_cast(1)); } diff --git a/Minecraft.World/CropTile.cpp b/Minecraft.World/CropTile.cpp index 0df719246..a339d3e3c 100644 --- a/Minecraft.World/CropTile.cpp +++ b/Minecraft.World/CropTile.cpp @@ -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((int) (25 / growthSpeed) + 1) == 0) + if (random->nextInt(static_cast(25 / growthSpeed) + 1) == 0) { age++; level->setData(x, y, z, age, Tile::UPDATE_CLIENTS); diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index 613162992..df3877441 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -196,7 +196,7 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) if( emin < falloffStart ) { int falloff = falloffStart - emin; - comp = ((float)falloff / (float)falloffStart ) * falloffMax; + comp = (static_cast(falloff) / static_cast(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 = (byte) Tile::stone_Id; + tileId = static_cast(Tile::stone_Id); } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = (byte) Tile::calmWater_Id; + tileId = static_cast(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 = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = static_cast(depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); int run = -1; @@ -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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -307,7 +307,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = (byte) Tile::stone_Id; + material = static_cast(Tile::stone_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { @@ -321,8 +321,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = (byte) Tile::ice_Id; - else top = (byte) Tile::calmWater_Id; + if (temp < 0.15f) top = static_cast(Tile::ice_Id); + else top = static_cast(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 = (byte) Tile::sandStone_Id; + material = static_cast(Tile::sandStone_Id); } } } @@ -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 = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/CustomPayloadPacket.cpp b/Minecraft.World/CustomPayloadPacket.cpp index 29e2828ee..81ec45766 100644 --- a/Minecraft.World/CustomPayloadPacket.cpp +++ b/Minecraft.World/CustomPayloadPacket.cpp @@ -57,7 +57,7 @@ void CustomPayloadPacket::read(DataInputStream *dis) void CustomPayloadPacket::write(DataOutputStream *dos) { writeUtf(identifier, dos); - dos->writeShort((short) length); + dos->writeShort(static_cast(length)); if (data.data != NULL) { dos->write(data); diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp index 97721c944..f7d15841e 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 (byte) stream->read(); + return static_cast(stream->read()); } unsigned char DataInputStream::readUnsignedByte() { - return (unsigned char) stream->read(); + return static_cast(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 (wchar_t)((a << 8) | (b & 0xff)); + return static_cast((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 (short)((a << 8) | (b & 0xff)); + return static_cast((a << 8) | (b & 0xff)); } unsigned short DataInputStream::readUnsignedShort() { int a = stream->read(); int b = stream->read(); - return (unsigned short)((a << 8) | (b & 0xff)); + return static_cast((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 = (unsigned short) (((a & 0xff) << 8) | (b & 0xff)); + unsigned short UTFLength = static_cast(((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 = (wchar_t)firstByte; + wchar_t readChar = static_cast(firstByte); outputString.push_back( readChar ); continue; } @@ -374,7 +374,7 @@ wstring DataInputStream::readUTF() break; } - wchar_t readChar = (wchar_t)( ((firstByte& 0x1F) << 6) | (secondByte & 0x3F) ); + wchar_t readChar = static_cast(((firstByte & 0x1F) << 6) | (secondByte & 0x3F)); outputString.push_back( readChar ); continue; } @@ -422,7 +422,7 @@ wstring DataInputStream::readUTF() break; } - wchar_t readChar = (wchar_t)(((firstByte & 0x0F) << 12) | ((secondByte & 0x3F) << 6) | (thirdByte & 0x3F)); + wchar_t readChar = static_cast(((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 a5e7d0881..81e9ddc2e 100644 --- a/Minecraft.World/DataLayer.cpp +++ b/Minecraft.World/DataLayer.cpp @@ -40,10 +40,10 @@ void DataLayer::set(int x, int y, int z, int val) if (part == 0) { - data[slot] = (byte) ((data[slot] & 0xf0) | (val & 0xf)); + data[slot] = static_cast((data[slot] & 0xf0) | (val & 0xf)); } else { - data[slot] = (byte) ((data[slot] & 0x0f) | ((val & 0xf) << 4)); + data[slot] = static_cast((data[slot] & 0x0f) | ((val & 0xf) << 4)); } } @@ -54,7 +54,7 @@ bool DataLayer::isValid() void DataLayer::setAll(int br) { - byte val = (byte) (br & (br << 4)); + byte val = static_cast(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 8d350f0b5..89f1f5d7c 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 ? (byte)1 : (byte)0 ); + stream->write( b ? static_cast(1) : static_cast(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 = (int)str.length(); + int strlen = static_cast(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++] = (byte) ((utflen >> 8) & 0xFF); - bytearr[count++] = (byte) ((utflen >> 0) & 0xFF); + bytearr[count++] = static_cast((utflen >> 8) & 0xFF); + bytearr[count++] = static_cast((utflen >> 0) & 0xFF); int i=0; for (i=0; i= 0x0001) && (c <= 0x007F))) break; - bytearr[count++] = (byte) c; + bytearr[count++] = static_cast(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++] = (byte) c; + bytearr[count++] = static_cast(c); } else if (c > 0x07FF) { - bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); - bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); - bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast(0xE0 | ((c >> 12) & 0x0F)); + bytearr[count++] = static_cast(0x80 | ((c >> 6) & 0x3F)); + bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); } else { - bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); - bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast(0xC0 | ((c >> 6) & 0x1F)); + bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); } } write(bytearr, 0, utflen+2); diff --git a/Minecraft.World/DaylightDetectorTile.cpp b/Minecraft.World/DaylightDetectorTile.cpp index 1bc9943e4..396daec6d 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((float) target * Mth::cos(sunAngle)); + target = Math::round(static_cast(target) * Mth::cos(sunAngle)); if (target < 0) { target = 0; diff --git a/Minecraft.World/DaylightDetectorTileEntity.cpp b/Minecraft.World/DaylightDetectorTileEntity.cpp index 5a3294131..8f57b0040 100644 --- a/Minecraft.World/DaylightDetectorTileEntity.cpp +++ b/Minecraft.World/DaylightDetectorTileEntity.cpp @@ -14,7 +14,7 @@ void DaylightDetectorTileEntity::tick() tile = getTile(); if (tile != NULL && dynamic_cast(tile) != NULL) { - ((DaylightDetectorTile *) tile)->updateSignalStrength(level, x, y, z); + static_cast(tile)->updateSignalStrength(level, x, y, z); } } } diff --git a/Minecraft.World/DebugOptionsPacket.cpp b/Minecraft.World/DebugOptionsPacket.cpp index f287efcd2..e62fb2eb9 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 = (unsigned int)dis->readInt(); + m_uiVal = static_cast(dis->readInt()); } void DebugOptionsPacket::write(DataOutputStream *dos) // throws IOException { - dos->writeInt((int)m_uiVal); + dos->writeInt(static_cast(m_uiVal)); } int DebugOptionsPacket::getEstimatedSize() diff --git a/Minecraft.World/DesertBiome.cpp b/Minecraft.World/DesertBiome.cpp index c36b09081..e67faef57 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 = (BYTE) Tile::sand_Id; - material = (BYTE) Tile::sand_Id; + topMaterial = static_cast(Tile::sand_Id); + material = static_cast(Tile::sand_Id); decorator->treeCount = -999; decorator->deadBushCount = 2; diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index 697da010b..75e225b3c 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 / (float) (Level::MAX_BRIGHTNESS)); + float v = (1 - i / static_cast(Level::MAX_BRIGHTNESS)); brightnessRamp[i] = ((1 - v) / (v * 3 + 1)) * (1 - ambientLight) + ambientLight; } } @@ -115,7 +115,7 @@ bool Dimension::isValidSpawn(int x, int z) const float Dimension::getTimeOfDay(__int64 time, float a) const { - int dayStep = (int) (time % Level::TICKS_PER_DAY); + int dayStep = static_cast(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 time, float a) const int Dimension::getMoonPhase(__int64 time) const { - return ((int) (time / Level::TICKS_PER_DAY)) % 8; + return static_cast(time / Level::TICKS_PER_DAY) % 8; } bool Dimension::isNaturalDimension() @@ -197,7 +197,7 @@ Dimension *Dimension::getNew(int id) float Dimension::getCloudHeight() { - return (float)Level::genDepth; + return static_cast(Level::genDepth); } bool Dimension::hasGround() diff --git a/Minecraft.World/Direction.cpp b/Minecraft.World/Direction.cpp index f758798b4..c9ac93c76 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((float) xd) > Mth::abs((float) zd)) + if (Mth::abs(static_cast(xd)) > Mth::abs(static_cast(zd))) { if (xd > 0) { diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index facd949af..73c841e0f 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -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) { - __int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + __int64 index = ( static_cast<__int64>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<__int64>(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,7 +120,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int //__int64 zShifted = zMasked << 34; //__int64 xShifted = xMasked << 5; //app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); - __int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); + __int64 index = ( static_cast<__int64>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<__int64>(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); auto it = m_mappings.find(index); if(it != m_mappings.end()) { diff --git a/Minecraft.World/DisconnectPacket.cpp b/Minecraft.World/DisconnectPacket.cpp index da20686a0..0b6f6bf80 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 = (eDisconnectReason)dis->readInt(); + reason = static_cast(dis->readInt()); } void DisconnectPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/DispenserTile.cpp b/Minecraft.World/DispenserTile.cpp index 8758b3c52..2e141948b 100644 --- a/Minecraft.World/DispenserTile.cpp +++ b/Minecraft.World/DispenserTile.cpp @@ -207,12 +207,12 @@ void DispenserTile::onRemove(Level *level, int x, int y, int z, int id, int data newItem->set4JData( item->get4JData() ); shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) ); float pow = 0.05f; - itemEntity->xd = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index 3e743e22e..2a00f4cd5 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -189,7 +189,7 @@ void DispenserTileEntity::save(CompoundTag *base) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/DoorInfo.cpp b/Minecraft.World/DoorInfo.cpp index 0c61b6356..177b88858 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 (int) sqrt((float)distanceToSqr(x2, y2, z2)); + return static_cast(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 1e3bfe11b..fc4a9a68e 100644 --- a/Minecraft.World/DoorInteractGoal.cpp +++ b/Minecraft.World/DoorInteractGoal.cpp @@ -50,14 +50,14 @@ bool DoorInteractGoal::canContinueToUse() void DoorInteractGoal::start() { passed = false; - doorOpenDirX = (float) (doorX + 0.5f - mob->x); - doorOpenDirZ = (float) (doorZ + 0.5f - mob->z); + doorOpenDirX = static_cast(doorX + 0.5f - mob->x); + doorOpenDirZ = static_cast(doorZ + 0.5f - mob->z); } void DoorInteractGoal::tick() { - float newDoorDirX = (float) (doorX + 0.5f - mob->x); - float newDoorDirZ = (float) (doorZ + 0.5f - mob->z); + float newDoorDirX = static_cast(doorX + 0.5f - mob->x); + float newDoorDirZ = static_cast(doorZ + 0.5f - mob->z); float dot = doorOpenDirX * newDoorDirX + doorOpenDirZ * newDoorDirZ; if (dot < 0) { @@ -69,5 +69,5 @@ DoorTile *DoorInteractGoal::getDoorTile(int x, int y, int z) { int tileId = mob->level->getTile(x, y, z); if (tileId != Tile::door_wood_Id) return NULL; - return (DoorTile *) Tile::tiles[tileId]; + return static_cast(Tile::tiles[tileId]); } \ No newline at end of file diff --git a/Minecraft.World/DoubleTag.h b/Minecraft.World/DoubleTag.h index 1f768d5bf..60e5808a4 100644 --- a/Minecraft.World/DoubleTag.h +++ b/Minecraft.World/DoubleTag.h @@ -29,7 +29,7 @@ public: { if (Tag::equals(obj)) { - DoubleTag *o = (DoubleTag *) obj; + DoubleTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/DragonFireball.cpp b/Minecraft.World/DragonFireball.cpp index 335b345f4..348bc53e4 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, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); + level->levelEvent(LevelEvent::ENDERDRAGON_FIREBALL_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); remove(); } diff --git a/Minecraft.World/DungeonFeature.cpp b/Minecraft.World/DungeonFeature.cpp index 6c7dc6733..8c9abbe5e 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] = (byte) Tile::lava_Id; + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = (byte) 0; - if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) Tile::grass_Id; + blocks[p] = static_cast(0); + if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = static_cast(Tile::grass_Id); } } } diff --git a/Minecraft.World/DurangoStats.cpp b/Minecraft.World/DurangoStats.cpp index 6e50fd20d..7ec808bc6 100644 --- a/Minecraft.World/DurangoStats.cpp +++ b/Minecraft.World/DurangoStats.cpp @@ -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((eINSTANCEOF)entityId) }; + Param param = { interactionId, EntityIO::eTypeToIoid(static_cast(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, (eMethod) i, param_cache[iPad][i] ); + write( player, static_cast(i), param_cache[iPad][i] ); param_cache[iPad][i] = 0; } } @@ -1093,25 +1093,25 @@ bool DurangoStats::enhancedAchievement(eAward achievementId) void DurangoStats::generatePlayerSession() { - DurangoStats *dsInstance = (DurangoStats *) GenericStats::getInstance(); + DurangoStats *dsInstance = static_cast(GenericStats::getInstance()); CoCreateGuid( &dsInstance->playerSessionId ); } LPCGUID DurangoStats::getPlayerSession() { - DurangoStats *dsInstance = (DurangoStats *) GenericStats::getInstance(); + DurangoStats *dsInstance = static_cast(GenericStats::getInstance()); LPCGUID lpcguid = &dsInstance->playerSessionId; return lpcguid; } void DurangoStats::setMultiplayerCorrelationId(Platform::String^ mcpId) { - ((DurangoStats*)GenericStats::getInstance())->multiplayerCorrelationId = mcpId; + static_cast(GenericStats::getInstance())->multiplayerCorrelationId = mcpId; } LPCWSTR DurangoStats::getMultiplayerCorrelationId() { - return ((DurangoStats*)GenericStats::getInstance())->multiplayerCorrelationId->Data(); + return static_cast(GenericStats::getInstance())->multiplayerCorrelationId->Data(); } LPCWSTR DurangoStats::getUserId(shared_ptr player) diff --git a/Minecraft.World/DurangoStats.h b/Minecraft.World/DurangoStats.h index 1b2f7723c..b2f24643c 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 (DurangoStats*) GenericStats::getInstance(); } + static DurangoStats *getInstance() { return static_cast(GenericStats::getInstance()); } protected: enum { diff --git a/Minecraft.World/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index b4ab86fa3..81faf63fc 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -177,7 +177,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { - if (level->random->nextFloat() < 0.45) ((Sapling *) Tile::sapling)->advanceTree(level, x, y, z, level->random); + if (level->random->nextFloat() < 0.45) static_cast(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) ((Mushroom *) Tile::tiles[tile])->growTree(level, x, y, z, level->random); + if (level->random->nextFloat() < 0.4) static_cast(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) { - ((StemTile *) Tile::tiles[tile])->growCrops(level, x, y, z); + static_cast(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) { - ((CropTile *) Tile::tiles[tile])->growCrops(level, x, y, z); + static_cast(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) { - ((CropTile *) Tile::tiles[tile])->growCrops(level, x, y, z); + static_cast(Tile::tiles[tile])->growCrops(level, x, y, z); itemInstance->count--; } } diff --git a/Minecraft.World/EnchantedBookItem.cpp b/Minecraft.World/EnchantedBookItem.cpp index 88776c18d..590c8bda6 100644 --- a/Minecraft.World/EnchantedBookItem.cpp +++ b/Minecraft.World/EnchantedBookItem.cpp @@ -40,7 +40,7 @@ ListTag *EnchantedBookItem::getEnchantments(shared_ptr(); } - return (ListTag *) item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str()); + return static_cast *>(item->tag->get((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())); } void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced) @@ -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, (short) enchantment->level); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast(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, (short) enchantment->enchantment->id); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short) enchantment->level); + 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)); enchantments->add(tag); } diff --git a/Minecraft.World/EnchantmentCategory.cpp b/Minecraft.World/EnchantmentCategory.cpp index 7fb44481e..b7460f58e 100644 --- a/Minecraft.World/EnchantmentCategory.cpp +++ b/Minecraft.World/EnchantmentCategory.cpp @@ -19,7 +19,7 @@ bool EnchantmentCategory::canEnchant(Item *item) const if (dynamic_cast( item ) != NULL) { if (this == armor) return true; - ArmorItem *ai = (ArmorItem *) item; + ArmorItem *ai = static_cast(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; diff --git a/Minecraft.World/EnchantmentHelper.cpp b/Minecraft.World/EnchantmentHelper.cpp index 7abc9856e..8f4f4ed19 100644 --- a/Minecraft.World/EnchantmentHelper.cpp +++ b/Minecraft.World/EnchantmentHelper.cpp @@ -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, (short) id); - tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, (short)(int)it.second); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_ID, static_cast(id)); + tag->putShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL, static_cast((int)it.second)); list->add(tag); @@ -348,7 +348,7 @@ 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 = (int) ((float) enchantmentValue * (1.0f + deviation) + .5f); + int realValue = static_cast((float)enchantmentValue * (1.0f + deviation) + .5f); if (realValue < 1) { realValue = 1; @@ -364,7 +364,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand { values.push_back(it.second); } - EnchantmentInstance *instance = (EnchantmentInstance *) WeighedRandom::getRandomItem(random, &values); + EnchantmentInstance *instance = static_cast(WeighedRandom::getRandomItem(random, &values)); values.clear(); if (instance) @@ -409,7 +409,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand { values.push_back(it.second); } - EnchantmentInstance *nextInstance = (EnchantmentInstance *) WeighedRandom::getRandomItem(random, &values); + EnchantmentInstance *nextInstance = static_cast(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 } diff --git a/Minecraft.World/EnchantmentInstance.cpp b/Minecraft.World/EnchantmentInstance.cpp index 973cd2200..89a8bdd2f 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, (int)level); + return new EnchantmentInstance((Enchantment *)enchantment, static_cast(level)); } \ No newline at end of file diff --git a/Minecraft.World/EnchantmentTableEntity.cpp b/Minecraft.World/EnchantmentTableEntity.cpp index 15131aa29..0b722680b 100644 --- a/Minecraft.World/EnchantmentTableEntity.cpp +++ b/Minecraft.World/EnchantmentTableEntity.cpp @@ -51,7 +51,7 @@ void EnchantmentTableEntity::tick() double xd = player->x - (x + 0.5f); double zd = player->z - (z + 0.5f); - tRot = (float) atan2(zd, xd); + tRot = static_cast(atan2(zd, xd)); open += 0.1f; diff --git a/Minecraft.World/EnderDragon.cpp b/Minecraft.World/EnderDragon.cpp index e1dea1725..608f0cd59 100644 --- a/Minecraft.World/EnderDragon.cpp +++ b/Minecraft.World/EnderDragon.cpp @@ -220,7 +220,7 @@ void EnderDragon::aiStep() checkCrystals(); float flapSpeed = 0.2f / (sqrt(xd * xd + zd * zd) * 10.0f + 1); - flapSpeed *= (float) pow(2.0, yd); + flapSpeed *= static_cast(pow(2.0, yd)); if ( getSynchedAction() == e_EnderdragonAction_Sitting_Flaming || getSynchedAction() == e_EnderdragonAction_Sitting_Scanning || getSynchedAction() == e_EnderdragonAction_Sitting_Attacking) @@ -468,7 +468,7 @@ void EnderDragon::aiStep() { 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 = (float)dir->dot(aim); + float dot = static_cast(dir->dot(aim)); float angleDegs = acos(dot)*180/PI; angleDegs = angleDegs + 0.5f; @@ -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 = (float) (dir->dot(aim) + 0.5f) / 1.5f; + float dot = static_cast(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 = (float) (2.0f / (distToTarget + 1)); + float span = static_cast(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 = (float) (actual->dot(dir) + 1) / 2.0f; + float slide = static_cast(actual->dot(dir) + 1) / 2.0f; slide = 0.8f + 0.15f * slide; @@ -722,7 +722,7 @@ void EnderDragon::aiStep() 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 = (float)dir->dot(aim); + float dot = static_cast(dir->dot(aim)); float angleDegs = acos(dot)*180/PI; angleDegs = angleDegs + 0.5f; @@ -738,7 +738,7 @@ 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, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, static_cast(x), static_cast(y), static_cast(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; @@ -1063,7 +1063,7 @@ float EnderDragon::rotWrap(double d) d -= 360; while (d < -180) d += 360; - return (float) d; + return static_cast(d); } bool EnderDragon::checkWalls(AABB *bb) @@ -1219,7 +1219,7 @@ void EnderDragon::tickDeath() } if (dragonDeathTime == 1) { - level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, (int) x, (int) y, (int) z, 0); + level->globalLevelEvent(LevelEvent::SOUND_DRAGON_DEATH, static_cast(x), static_cast(y), static_cast(z), 0); } } move(0, 0.1f, 0); @@ -1458,14 +1458,14 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, bool force /*= fal EnderDragon::EEnderdragonAction EnderDragon::getSynchedAction() { - return (EEnderdragonAction)entityData->getInteger(DATA_ID_SYNCHED_ACTION); + return static_cast(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 = (int)crystals->size() - 1; + m_remainingCrystalsCount = static_cast(crystals->size()) - 1; if(m_remainingCrystalsCount < 0) m_remainingCrystalsCount = 0; delete crystals; @@ -1641,7 +1641,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) { float closestDist = 100.0f; int closestIndex = 0; - Node *currentPos = new Node((int) floor(tX), (int) floor(tY), (int) floor(tZ)); + Node *currentPos = new Node(static_cast(floor(tX)), static_cast(floor(tY)), static_cast(floor(tZ))); int startIndex = 0; if(m_remainingCrystalsCount <= 0) { @@ -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( (EEnderdragonAction)tag->getInt(L"DragonState"), true); + if(tag->contains(L"DragonState")) setSynchedAction( static_cast(tag->getInt(L"DragonState")), true); Mob::readAdditionalSaveData(tag); } diff --git a/Minecraft.World/EnderEyeItem.cpp b/Minecraft.World/EnderEyeItem.cpp index 063e1408f..a0c3dad37 100644 --- a/Minecraft.World/EnderEyeItem.cpp +++ b/Minecraft.World/EnderEyeItem.cpp @@ -212,7 +212,7 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le 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, (int) player->x, (int) player->y, (int) player->z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_LAUNCH, static_cast(player->x), static_cast(player->y), static_cast(player->z), 0); if (!player->abilities.instabuild) { instance->count--; diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index d099911c0..d21f62d76 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, (byte) 0); - entityData->define(DATA_CARRY_ITEM_DATA, (byte) 0); - entityData->define(DATA_CREEPY, (byte) 0); + 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)); } void EnderMan::addAdditonalSaveData(CompoundTag *tag) { Monster::addAdditonalSaveData(tag); - tag->putShort(L"carried", (short) getCarryingTile()); - tag->putShort(L"carriedData", (short) getCarryingData()); + tag->putShort(L"carried", static_cast(getCarryingTile())); + tag->putShort(L"carriedData", static_cast(getCarryingData())); } void EnderMan::readAdditionalSaveData(CompoundTag *tag) @@ -202,7 +202,7 @@ void EnderMan::aiStep() float br = getBrightness(1); if (br > 0.5f) { - if (level->canSeeSky(Mth::floor(x), (int)floor( y + 0.5 ), Mth::floor(z)) && random->nextFloat() * 30 < (br - 0.4f) * 2) + if (level->canSeeSky(Mth::floor(x), static_cast(floor(y + 0.5)), Mth::floor(z)) && random->nextFloat() * 30 < (br - 0.4f) * 2) { attackTarget = nullptr; setCreepy(false); @@ -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, (byte) (carryingTile & 0xff)); + entityData->set(DATA_CARRY_ITEM_ID, static_cast(carryingTile & 0xff)); } int EnderMan::getCarryingTile() @@ -395,7 +395,7 @@ int EnderMan::getCarryingTile() void EnderMan::setCarryingData(int carryingData) { - entityData->set(DATA_CARRY_ITEM_DATA, (byte) (carryingData & 0xff)); + entityData->set(DATA_CARRY_ITEM_DATA, static_cast(carryingData & 0xff)); } int EnderMan::getCarryingData() @@ -435,5 +435,5 @@ bool EnderMan::isCreepy() void EnderMan::setCreepy(bool creepy) { - entityData->set(DATA_CREEPY, (byte)(creepy ? 1 : 0)); + entityData->set(DATA_CREEPY, static_cast(creepy ? 1 : 0)); } \ No newline at end of file diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index e82331402..6a8107302 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -362,7 +362,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter if( entityData ) { - entityData->define(DATA_SHARED_FLAGS_ID, (byte) 0); + entityData->define(DATA_SHARED_FLAGS_ID, static_cast(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. } @@ -907,7 +907,7 @@ void Entity::move(double xa, double ya, double za, bool noEntityCubes) // 4J - if (moveDist > nextStep && t > 0) { - nextStep = (int) moveDist + 1; + nextStep = static_cast(moveDist) + 1; if (isInWater()) { float speed = Mth::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) * 0.35f; @@ -1023,7 +1023,7 @@ void Entity::checkFallDamage(double ya, bool onGround) } else { - if (ya < 0) fallDistance -= (float) ya; + if (ya < 0) fallDistance -= static_cast(ya); } } @@ -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 = (float) Mth::floor(bb->y0); + float yt = static_cast(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 = (float) (x - e->x); - float yd = (float) (y - e->y); - float zd = (float) (z - e->z); + float xd = static_cast(x - e->x); + float yd = static_cast(y - e->y); + float zd = static_cast(z - e->z); return sqrt(xd * xd + yd * yd + zd * zd); } @@ -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", (short) onFire); - entityTag->putShort(L"Air", (short) getAirSupply()); + entityTag->putShort(L"Fire", static_cast(onFire)); + entityTag->putShort(L"Air", static_cast(getAirSupply())); entityTag->putBoolean(L"OnGround", onGround); entityTag->putInt(L"Dimension", dimension); entityTag->putBoolean(L"Invulnerable", invulnerable); @@ -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, (byte) (currentValue | (1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue | (1 << flag))); } else { - entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue & ~(1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, static_cast(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, (short) supply); + entityData->set(DATA_AIR_SUPPLY_ID, static_cast(supply)); } void Entity::thunderHit(const LightningBolt *lightningBolt) diff --git a/Minecraft.World/EntityHorse.cpp b/Minecraft.World/EntityHorse.cpp index 90c2a6b99..9636c9892 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, (byte) 0); + entityData->define(DATA_ID_TYPE, static_cast(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, (byte) i); + entityData->set(DATA_ID_TYPE, static_cast(i)); clearLayeredTextureInfo(); } @@ -202,7 +202,7 @@ float EntityHorse::getFoalScale() { return 1.0f; } - return .5f + (float) (BABY_START_AGE - age) / (float) BABY_START_AGE * .5f; + return .5f + static_cast(BABY_START_AGE - age) / static_cast(BABY_START_AGE) * .5f; } @@ -995,7 +995,7 @@ bool EntityHorse::mobInteract(shared_ptr player) } doPlayerRide(player); - app.DebugPrintf(" Horse speed: %f\n", (float) (getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + app.DebugPrintf(" Horse speed: %f\n", static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); return true; } @@ -1098,7 +1098,7 @@ int EntityHorse::nameYOffset() } else { - return (int) (-5 - getFoalScale() * 80.0f); + return static_cast(-5 - getFoalScale() * 80.0f); } } @@ -1407,7 +1407,7 @@ void EntityHorse::travel(float xa, float ya) flyingSpeed = getSpeed() * .1f; if (!level->isClientSide) { - setSpeed((float) (getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + setSpeed(static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); Animal::travel(xa, ya); } @@ -1459,7 +1459,7 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) { CompoundTag *compoundTag = new CompoundTag(); - compoundTag->putByte(L"Slot", (byte) i); + compoundTag->putByte(L"Slot", static_cast(i)); stack->save(compoundTag); listTag->add(compoundTag); @@ -1639,8 +1639,8 @@ MobGroupData *EntityHorse::finalizeMobSpawn(MobGroupData *groupData, int extraDa if ( dynamic_cast(groupData) != NULL ) { - type = ((HorseGroupData *) groupData)->horseType; - variant = ((HorseGroupData *) groupData)->horseVariant & 0xff | (random->nextInt(MARKINGS) << 8); + type = static_cast(groupData)->horseType; + variant = static_cast(groupData)->horseVariant & 0xff | (random->nextInt(MARKINGS) << 8); } else { @@ -1744,7 +1744,7 @@ void EntityHorse::onPlayerJump(int jumpAmount) } else { - playerJumpPendingScale = .4f + .4f * (float) jumpAmount / 90.0f; + playerJumpPendingScale = .4f + .4f * static_cast(jumpAmount) / 90.0f; } } } diff --git a/Minecraft.World/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp index 9fed6d71b..9aad00086 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 = (float) (Math::random() * 360); + yRot = static_cast(Math::random() * 360); - 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; + 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; value = count; } @@ -70,7 +70,7 @@ int ExperienceOrb::getLightColor(float a) int br1 = (br) & 0xff; int br2 = (br >> 16) & 0xff; - br1 += (int) (l * 15 * 16); + br1 += static_cast(l * 15 * 16); if (br1 > 15 * 16) br1 = 15 * 16; // br2 = 15*16; return br1 | br2 << 16; @@ -176,9 +176,9 @@ bool ExperienceOrb::hurt(DamageSource *source, float damage) void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", (byte) health); - entityTag->putShort(L"Age", (short) age); - entityTag->putShort(L"Value", (short) value); + entityTag->putShort(L"Health", static_cast(health)); + entityTag->putShort(L"Age", static_cast(age)); + entityTag->putShort(L"Value", static_cast(value)); } void ExperienceOrb::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/ExplodePacket.cpp b/Minecraft.World/ExplodePacket.cpp index 30d09e464..07626161f 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 = (float) knockback->x; - knockbackY = (float) knockback->y; - knockbackZ = (float) knockback->z; + knockbackX = static_cast(knockback->x); + knockbackY = static_cast(knockback->y); + knockbackZ = static_cast(knockback->z); } } @@ -52,14 +52,14 @@ void ExplodePacket::read(DataInputStream *dis) //throws IOException r = dis->readFloat(); int count = dis->readInt(); - int xp = (int)x; - int yp = (int)y; - int zp = (int)z; + int xp = static_cast(x); + int yp = static_cast(y); + int zp = static_cast(z); for (int i=0; ireadByte())+xp; - int yy = ((signed char)dis->readByte())+yp; - int zz = ((signed char)dis->readByte())+zp; + int xx = static_cast(dis->readByte())+xp; + int yy = static_cast(dis->readByte())+yp; + int zz = static_cast(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((int)toBlow.size()); + dos->writeInt(static_cast(toBlow.size())); - int xp = (int)x; - int yp = (int)y; - int zp = (int)z; + int xp = static_cast(x); + int yp = static_cast(y); + int zp = static_cast(z); for ( const TilePos& tp : toBlow ) { @@ -108,7 +108,7 @@ void ExplodePacket::handle(PacketListener *listener) int ExplodePacket::getEstimatedSize() { - return 8*3+4+4+(int)toBlow.size()*3+12; + return 8*3+4+4+static_cast(toBlow.size())*3+12; } float ExplodePacket::getKnockbackX() diff --git a/Minecraft.World/Explosion.cpp b/Minecraft.World/Explosion.cpp index ab305a026..3fc085bec 100644 --- a/Minecraft.World/Explosion.cpp +++ b/Minecraft.World/Explosion.cpp @@ -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), (int) ((pow * pow + pow) / 2 * 8 * r + 1)); + if(canDamage) e->hurt(DamageSource::explosion(this), static_cast((pow * pow + pow) / 2 * 8 * r + 1)); double kbPower = ProtectionEnchantment::getExplosionKnockbackAfterDampener(e, pow); e->xd += xa *kbPower; @@ -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 = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; + int fraction = static_cast(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--) diff --git a/Minecraft.World/EyeOfEnderSignal.cpp b/Minecraft.World/EyeOfEnderSignal.cpp index 95747a894..ad2d48fc8 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 = (float) sqrt(xd * xd + zd * zd); - yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + 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); } } @@ -97,9 +97,9 @@ void EyeOfEnderSignal::tick() y += yd; z += zd; - float sd = (float) sqrt(xd * xd + zd * zd); - yRot = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + 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); 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 = (float) sqrt(dx * dx + dz * dz); - float angle = (float) atan2(dz, dx); + float tdist = static_cast(sqrt(dx * dx + dz * dz)); + float angle = static_cast(atan2(dz, dx)); double tspeed = (sd + (tdist - sd) * .0025); if (tdist < 1) { @@ -167,7 +167,7 @@ void EyeOfEnderSignal::tick() } else { - level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); + level->levelEvent(LevelEvent::PARTICLES_EYE_OF_ENDER_DEATH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); } } } diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index c0eb7d226..aec50d9be 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -212,10 +212,10 @@ void FallingTile::causeFallDamage(float distance) void FallingTile::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Tile", (byte) tile); + tag->putByte(L"Tile", static_cast(tile)); tag->putInt(L"TileID", tile); - tag->putByte(L"Data", (byte) data); - tag->putByte(L"Time", (byte) time); + tag->putByte(L"Data", static_cast(data)); + tag->putByte(L"Time", static_cast(time)); tag->putBoolean(L"DropItem", dropItem); tag->putBoolean(L"HurtEntities", hurtEntities); tag->putFloat(L"FallHurtAmount", fallDamageAmount); diff --git a/Minecraft.World/FastNoise.cpp b/Minecraft.World/FastNoise.cpp index 91d039b3f..65f8d7ecc 100644 --- a/Minecraft.World/FastNoise.cpp +++ b/Minecraft.World/FastNoise.cpp @@ -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 = (int) zz; + int Z = static_cast(zz); if (zz < Z) Z -= 1; - int zl = (int) ((zz - Z) * 65536); + int zl = static_cast((zz - Z) * 65536); for (int yp = 0; yp < ySize; yp++) { double yy = (y + yp) * yScale; - int Y = (int) yy; + int Y = static_cast(yy); if (yy < Y) Y -= 1; - int yl = (int) ((yy - Y) * 65536); + int yl = static_cast((yy - Y) * 65536); for (int xp = 0; xp < xSize; xp++) { double xx = (x + xp) * xScale; - int X = (int) xx; + int X = static_cast(xx); if (xx < X) X -= 1; - int xl = (int) ((xx - X) * 65536); + int xl = static_cast((xx - X) * 65536); int X0 = (X + 0) * AA; int X1 = (X + 1) * AA; diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 82e593dc2..ca13f228f 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -673,7 +673,7 @@ const std::wstring File::getPath() const std::wstring File::getName() const { - unsigned int sep = (unsigned int )(m_abstractPathName.find_last_of( this->pathSeparator )); + unsigned int sep = static_cast(m_abstractPathName.find_last_of(this->pathSeparator)); return m_abstractPathName.substr( sep + 1, m_abstractPathName.length() ); } diff --git a/Minecraft.World/FileHeader.cpp b/Minecraft.World/FileHeader.cpp index 0a47e043e..01687628f 100644 --- a/Minecraft.World/FileHeader.cpp +++ b/Minecraft.World/FileHeader.cpp @@ -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 = (int)(fileTable.size()); + unsigned int headerSize = static_cast(fileTable.size()); //DWORD numberOfBytesWritten = 0; // Write the offset of the header //assert(numberOfBytesWritten == 4); - int *begin = (int *)saveMem; + int *begin = static_cast(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 = (char *)saveMem + headerOffset; + char *headerPosition = static_cast(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 = (int *)saveMem; + int *begin = static_cast(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 = (char *)saveMem + headerOffset; + char *headerPosition = static_cast(saveMem) + headerOffset; switch( m_saveVersion ) { @@ -321,7 +321,7 @@ unsigned int FileHeader::GetStartOfNextData() unsigned int FileHeader::GetFileSize() { - return GetStartOfNextData() + ( sizeof(FileEntrySaveData) * (unsigned int)fileTable.size() ); + return GetStartOfNextData() + ( sizeof(FileEntrySaveData) * static_cast(fileTable.size()) ); } void FileHeader::AdjustStartOffsets(FileEntry *file, DWORD nNumberOfBytesToWrite, bool subtract /*= false*/) diff --git a/Minecraft.World/FileOutputStream.cpp b/Minecraft.World/FileOutputStream.cpp index 557ba812d..e554ccf59 100644 --- a/Minecraft.World/FileOutputStream.cpp +++ b/Minecraft.World/FileOutputStream.cpp @@ -61,7 +61,7 @@ void FileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = (byte) b; + byte value = static_cast(b); BOOL result = WriteFile( m_fileHandle, // handle to file diff --git a/Minecraft.World/Fireball.cpp b/Minecraft.World/Fireball.cpp index 2a538b064..2bd740ad3 100644 --- a/Minecraft.World/Fireball.cpp +++ b/Minecraft.World/Fireball.cpp @@ -130,7 +130,7 @@ void Fireball::tick() //if (!level->isClientSide && (owner == NULL || owner->removed)) if (!level->isClientSide) { - if((owner != NULL && owner->removed) || !level->hasChunkAt((int) x, (int) y, (int) z)) + if((owner != NULL && owner->removed) || !level->hasChunkAt(static_cast(x), static_cast(y), static_cast(z))) { app.DebugPrintf("Fireball removed - owner is null or removed is true for owner\n"); remove(); @@ -237,8 +237,8 @@ void Fireball::tick() z += zd; double sd = sqrt(xd * xd + zd * zd); - yRot = (float) (atan2(zd, xd) * 180 / PI) + 90; - xRot = (float) (atan2(sd, yd) * 180 / PI) - 90; + yRot = static_cast(atan2(zd, xd) * 180 / PI) + 90; + xRot = static_cast(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", (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->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->put(L"direction", newDoubleList(3, xd, yd, zd)); } diff --git a/Minecraft.World/FireworksChargeItem.cpp b/Minecraft.World/FireworksChargeItem.cpp index 2de2be045..d027c5542 100644 --- a/Minecraft.World/FireworksChargeItem.cpp +++ b/Minecraft.World/FireworksChargeItem.cpp @@ -23,7 +23,7 @@ int FireworksChargeItem::getColor(shared_ptr item, int spriteLayer Tag *colorTag = getExplosionTagField(item, FireworksItem::TAG_E_COLORS); if (colorTag != NULL) { - IntArrayTag *colors = (IntArrayTag *) colorTag; + IntArrayTag *colors = static_cast(colorTag); if (colors->data.length == 1) { return colors->data[0]; diff --git a/Minecraft.World/FireworksRecipe.cpp b/Minecraft.World/FireworksRecipe.cpp index a357c9cbc..7bf631049 100644 --- a/Minecraft.World/FireworksRecipe.cpp +++ b/Minecraft.World/FireworksRecipe.cpp @@ -28,7 +28,7 @@ void FireworksRecipe::UseDefaultThreadStorage() void FireworksRecipe::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); if( tls == tlsDefault ) return; delete tls; @@ -36,7 +36,7 @@ void FireworksRecipe::ReleaseThreadStorage() void FireworksRecipe::setResultItem(shared_ptr item) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); tls->resultItem = item; } @@ -138,12 +138,12 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l if (item->hasTag() && item->getTag()->contains(FireworksItem::TAG_EXPLOSION)) { - expTags->add((CompoundTag *)item->getTag()->getCompound(FireworksItem::TAG_EXPLOSION)->copy()); + expTags->add(static_cast(item->getTag()->getCompound(FireworksItem::TAG_EXPLOSION)->copy())); } } fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, (byte) sulphurCount); + fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphurCount)); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); resultItem->setTag(itemTag); @@ -268,7 +268,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l shared_ptr FireworksRecipe::assemble(shared_ptr craftSlots) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); return tls->resultItem->copy(); //return resultItem->copy(); } @@ -280,7 +280,7 @@ int FireworksRecipe::size() const ItemInstance *FireworksRecipe::getResultItem() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); return tls->resultItem.get(); //return resultItem.get(); } diff --git a/Minecraft.World/FireworksRocketEntity.cpp b/Minecraft.World/FireworksRocketEntity.cpp index e84844f12..bd7410b29 100644 --- a/Minecraft.World/FireworksRocketEntity.cpp +++ b/Minecraft.World/FireworksRocketEntity.cpp @@ -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 = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(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 = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, sd) * 180 / PI); + yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRot = static_cast(atan2(yd, sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index e38a64b6a..51f37c97d 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 = (float) sqrt(xd * xd + yd * yd + zd * zd); + float dist = static_cast(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 = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(atan2(yd, sd) * 180 / PI); life = 0; } @@ -161,8 +161,8 @@ void FishingHook::tick() double yrd = Mth::wrapDegrees(lyr - yRot); - yRot += (float) ( (yrd) / lSteps ); - xRot += (float) ( (lxr - xRot) / lSteps ); + yRot += static_cast((yrd) / lSteps); + xRot += static_cast((lxr - xRot) / lSteps); lSteps--; setPos(xt, yt, zt); @@ -284,8 +284,8 @@ void FishingHook::tick() move(xd, yd, zd); double sd = sqrt(xd * xd + zd * zd); - yRot = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, sd) * 180 / PI); + yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRot = static_cast(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 = (float) Mth::floor(bb->y0); + float yt = static_cast(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", (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)); + 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)); } void FishingHook::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/FlatLevelSource.cpp b/Minecraft.World/FlatLevelSource.cpp index 7a31374eb..4713f43ef 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] = (byte) block; + blocks[xc << 11 | zc << 7 | yc] = static_cast(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 = (byte *)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/FleeSunGoal.cpp b/Minecraft.World/FleeSunGoal.cpp index d58ad7097..353d1625b 100644 --- a/Minecraft.World/FleeSunGoal.cpp +++ b/Minecraft.World/FleeSunGoal.cpp @@ -18,7 +18,7 @@ bool FleeSunGoal::canUse() { if (!level->isDay()) return false; if (!mob->isOnFire()) return false; - if (!level->canSeeSky(Mth::floor(mob->x), (int) mob->bb->y0, Mth::floor(mob->z))) return false; + if (!level->canSeeSky(Mth::floor(mob->x), static_cast(mob->bb->y0), Mth::floor(mob->z))) return false; Vec3 *pos = getHidePos(); if (pos == NULL) return false; diff --git a/Minecraft.World/FlippedIcon.cpp b/Minecraft.World/FlippedIcon.cpp index 559423d7c..37122bfc0 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 * ((float) offset / SharedConstants::WORLD_RESOLUTION)); + return getU0(adjust) + (diff * (static_cast(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 * ((float) offset / SharedConstants::WORLD_RESOLUTION)); + return getV0(adjust) + (diff * (static_cast(offset) / SharedConstants::WORLD_RESOLUTION)); } wstring FlippedIcon::getName() const diff --git a/Minecraft.World/FloatTag.h b/Minecraft.World/FloatTag.h index 803016499..cc687da8e 100644 --- a/Minecraft.World/FloatTag.h +++ b/Minecraft.World/FloatTag.h @@ -29,7 +29,7 @@ public: { if (Tag::equals(obj)) { - FloatTag *o = (FloatTag *) obj; + FloatTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/FlyingMob.cpp b/Minecraft.World/FlyingMob.cpp index 1757ae58e..28404108c 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 = (float) sqrt(xxd * xxd + zzd * zzd) * 4; + float wst = static_cast(sqrt(xxd * xxd + zzd * zzd)) * 4; if (wst > 1) wst = 1; walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f; walkAnimPos += walkAnimSpeed; diff --git a/Minecraft.World/FoodConstants.cpp b/Minecraft.World/FoodConstants.cpp index 6ced45d5d..a8e024a2b 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 = (float) FoodConstants::MAX_FOOD; -const float FoodConstants::START_SATURATION = (float) FoodConstants::MAX_SATURATION / 4.0f; +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::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 16e6ce3f6..3fa04ed46 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 = (int) (20 * 1.6); + static const int EAT_DURATION = static_cast(20 * 1.6); private: const int nutrition; diff --git a/Minecraft.World/FurnaceResultSlot.cpp b/Minecraft.World/FurnaceResultSlot.cpp index d845dada6..8ea4b19f7 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((float) amount * value); - if (baseValue < ceil((float) amount * value) && (float) Math::random() < (((float) amount * value) - baseValue)) + int baseValue = floor(static_cast(amount) * value); + if (baseValue < ceil(static_cast(amount) * value) && static_cast(Math::random()) < ((static_cast(amount) * value) - baseValue)) { baseValue++; } diff --git a/Minecraft.World/FurnaceTile.cpp b/Minecraft.World/FurnaceTile.cpp index d22d6ca78..1393a325b 100644 --- a/Minecraft.World/FurnaceTile.cpp +++ b/Minecraft.World/FurnaceTile.cpp @@ -196,12 +196,12 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) newItem->set4JData( item->get4JData() ); shared_ptr itemEntity = shared_ptr( new ItemEntity(level, x + xo, y + yo, z + zo, newItem) ); float pow = 0.05f; - itemEntity->xd = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } level->addEntity(itemEntity); } diff --git a/Minecraft.World/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 1aa2c3005..70190f4ee 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/FurnaceTileEntity.cpp @@ -140,8 +140,8 @@ void FurnaceTileEntity::load(CompoundTag *base) void FurnaceTileEntity::save(CompoundTag *base) { TileEntity::save(base); - base->putShort(L"BurnTime", (short) (litTime)); - base->putShort(L"CookTime", (short) (tickCount)); + base->putShort(L"BurnTime", static_cast(litTime)); + base->putShort(L"CookTime", static_cast(tickCount)); ListTag *listTag = new ListTag(); for (unsigned int i = 0; i < items.length; i++) @@ -149,7 +149,7 @@ void FurnaceTileEntity::save(CompoundTag *base) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } @@ -300,15 +300,15 @@ int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) } } - if (dynamic_cast(item) && ((DiggerItem *) item)->getTier() == Item::Tier::WOOD) + if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && ((WeaponItem *) item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } - else if (dynamic_cast(item) && ((HoeItem *) item)->getTier() == Item::Tier::WOOD) + else if (dynamic_cast(item) && static_cast(item)->getTier() == Item::Tier::WOOD) { return BURN_INTERVAL; } diff --git a/Minecraft.World/GameCommandPacket.cpp b/Minecraft.World/GameCommandPacket.cpp index 98cdd3121..2f74778fc 100644 --- a/Minecraft.World/GameCommandPacket.cpp +++ b/Minecraft.World/GameCommandPacket.cpp @@ -37,7 +37,7 @@ GameCommandPacket::~GameCommandPacket() void GameCommandPacket::read(DataInputStream *dis) { - command = (EGameCommand)dis->readInt(); + command = static_cast(dis->readInt()); length = dis->readShort(); if (length > 0 && length < Short::MAX_VALUE) @@ -54,7 +54,7 @@ void GameCommandPacket::read(DataInputStream *dis) void GameCommandPacket::write(DataOutputStream *dos) { dos->writeInt(command); - dos->writeShort((short) length); + dos->writeShort(static_cast(length)); if (data.data != NULL) { dos->write(data); diff --git a/Minecraft.World/Ghast.cpp b/Minecraft.World/Ghast.cpp index f0817791c..dc70e9025 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/Ghast.cpp @@ -72,7 +72,7 @@ void Ghast::defineSynchedData() { FlyingMob::defineSynchedData(); - entityData->define(DATA_IS_CHARGING, (byte) 0); + entityData->define(DATA_IS_CHARGING, static_cast(0)); } void Ghast::registerAttributes() @@ -137,20 +137,20 @@ void Ghast::serverAiStep() double xdd = target->x - x; double ydd = (target->bb->y0 + target->bbHeight / 2) - (y + bbHeight / 2); double zdd = target->z - z; - yBodyRot = yRot = -(float) atan2(xdd, zdd) * 180 / PI; + yBodyRot = yRot = -static_cast(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, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_WARNING, static_cast(x), static_cast(y), static_cast(z), 0); } charge++; if (charge == 20) { // 4J - change brought forward from 1.2.3 - level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, static_cast(x), static_cast(y), static_cast(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; @@ -169,14 +169,14 @@ void Ghast::serverAiStep() } else { - yBodyRot = yRot = -(float) atan2(this->xd, this->zd) * 180 / PI; + yBodyRot = yRot = -static_cast(atan2(this->xd, this->zd)) * 180 / PI; if (charge > 0) charge--; } if (!level->isClientSide) { byte old = entityData->getByte(DATA_IS_CHARGING); - byte current = (byte) (charge > 10 ? 1 : 0); + byte current = static_cast(charge > 10 ? 1 : 0); if (old != current) { entityData->set(DATA_IS_CHARGING, current); diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 26261710f..3d44b4260 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 = (float)(dir * 90); + yRotO = yRot = static_cast(dir * 90); - float w = (float)getWidth(); - float h = (float)getHeight(); - float d = (float)getWidth(); + float w = static_cast(getWidth()); + float h = static_cast(getHeight()); + float d = static_cast(getWidth()); if (dir == Direction::NORTH || dir == Direction::SOUTH) { d = 0.5f; - yRot = yRotO = (float)(Direction::DIRECTION_OPPOSITE[dir] * 90); + yRot = yRotO = static_cast(Direction::DIRECTION_OPPOSITE[dir] * 90); } else { @@ -235,7 +235,7 @@ void HangingEntity::push(double xa, double ya, double za) void HangingEntity::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Direction", (byte) dir); + tag->putByte(L"Direction", static_cast(dir)); tag->putInt(L"TileX", xTile); tag->putInt(L"TileY", yTile); tag->putInt(L"TileZ", zTile); diff --git a/Minecraft.World/HellDimension.cpp b/Minecraft.World/HellDimension.cpp index 85e2a25ae..94a4e5865 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 = (float)redComponent/256;//0.2f; - float gg = (float)greenComponent/256;//0.03f; - float bb = (float)blueComponent/256;//0.03f; + float rr = static_cast(redComponent)/256;//0.2f; + float gg = static_cast(greenComponent)/256;//0.03f; + float bb = static_cast(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 / (float) (Level::MAX_BRIGHTNESS)); + float v = (1 - i / static_cast(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((float)level->getLevelData()->getXZSize() / level->getLevelData()->getHellScale()); + return ceil(static_cast(level->getLevelData()->getXZSize()) / level->getLevelData()->getHellScale()); } diff --git a/Minecraft.World/HellFlatLevelSource.cpp b/Minecraft.World/HellFlatLevelSource.cpp index 4957f6176..4c9a77077 100644 --- a/Minecraft.World/HellFlatLevelSource.cpp +++ b/Minecraft.World/HellFlatLevelSource.cpp @@ -8,7 +8,7 @@ HellFlatLevelSource::HellFlatLevelSource(Level *level, __int64 seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); - m_XZSize = ceil((float)xzSize / hellScale); + m_XZSize = ceil(static_cast(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] = (byte) block; + blocks[xc << 11 | zc << 7 | yc] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(Tile::unbreakable_Id); } else if (y <= 0 + random->nextInt(5)) { - blocks[offs] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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 = (byte *)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index 31bb3d696..e92ad2776 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -11,7 +11,7 @@ HellRandomLevelSource::HellRandomLevelSource(Level *level, __int64 seed) { int xzSize = level->getLevelData()->getXZSize(); int hellScale = level->getLevelData()->getHellScale(); - m_XZSize = ceil((float)xzSize / hellScale); + m_XZSize = ceil(static_cast(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 / (double) CHUNK_HEIGHT; + double yStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double xStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double zStep = 1 / static_cast(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] = (byte) tileId; + blocks[offs] = static_cast(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 = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -210,20 +210,20 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if (runDepth <= 0) { top = 0; - material = (byte) Tile::netherRack_Id; + material = static_cast(Tile::netherRack_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { - top = (byte) Tile::netherRack_Id; - material = (byte) Tile::netherRack_Id; - if (gravel) top = (byte) Tile::gravel_Id; - if (gravel) material = (byte) Tile::netherRack_Id; + 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); if (sand) { // 4J Stu - Make some nether wart spawn outside of the nether fortresses if(random->nextInt(16) == 0) { - top = (byte) Tile::netherStalk_Id; + top = static_cast(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 = (byte) Tile::soulsand_Id; + top = static_cast(Tile::soulsand_Id); } } - if (sand) material = (byte) Tile::soulsand_Id; + if (sand) material = static_cast(Tile::soulsand_Id); } - if (y < waterHeight && top == 0) top = (byte) Tile::calmLava_Id; + if (y < waterHeight && top == 0) top = static_cast(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 = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); @@ -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 / (double) ySize) * 2; + yoffs[yy] = cos(yy * PI * 6 / static_cast(ySize)) * 2; double dd = yy; if (yy > ySize / 2) diff --git a/Minecraft.World/HopperTile.cpp b/Minecraft.World/HopperTile.cpp index c111105ec..6e41aefc3 100644 --- a/Minecraft.World/HopperTile.cpp +++ b/Minecraft.World/HopperTile.cpp @@ -120,13 +120,13 @@ void HopperTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } float pow = 0.05f; - itemEntity->xd = (float) random.nextGaussian() * pow; - itemEntity->yd = (float) random.nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random.nextGaussian() * pow; + itemEntity->xd = static_cast(random.nextGaussian()) * pow; + itemEntity->yd = static_cast(random.nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random.nextGaussian()) * pow; level->addEntity(itemEntity); } } diff --git a/Minecraft.World/HopperTileEntity.cpp b/Minecraft.World/HopperTileEntity.cpp index 38a0e817d..efb11bac8 100644 --- a/Minecraft.World/HopperTileEntity.cpp +++ b/Minecraft.World/HopperTileEntity.cpp @@ -49,7 +49,7 @@ void HopperTileEntity::save(CompoundTag *base) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } @@ -307,7 +307,7 @@ shared_ptr HopperTileEntity::addItem(Container *container, shared_ { if (dynamic_cast( container ) != NULL && face > -1) { - WorldlyContainer *worldly = (WorldlyContainer *) container; + WorldlyContainer *worldly = static_cast(container); intArray slots = worldly->getSlotsForFace(face); for (int i = 0; i < slots.length && item != NULL && item->count > 0; i++) @@ -429,7 +429,7 @@ shared_ptr HopperTileEntity::getContainerAt(Level *level, double x, d if ( dynamic_cast( tile ) != NULL ) { - result = ((ChestTile *) tile)->getContainer(level, xt, yt, zt); + result = static_cast(tile)->getContainer(level, xt, yt, zt); } } } diff --git a/Minecraft.World/ImprovedNoise.cpp b/Minecraft.World/ImprovedNoise.cpp index 8be9e3851..47f390858 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 = (int) x; - int yf = (int) y; - int zf = (int) z; + int xf = static_cast(x); + int yf = static_cast(y); + int zf = static_cast(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 = (int) x; + int xf = static_cast(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 = (int) z; + int zf = static_cast(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 = (int) x; + int xf = static_cast(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 = (int) z; + int zf = static_cast(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 = (int) y; + int yf = static_cast(y); if (y < yf) yf--; int Y = yf & 255; y -= yf; diff --git a/Minecraft.World/InputStreamReader.cpp b/Minecraft.World/InputStreamReader.cpp index 4a565cf4e..972c53167 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 = (wchar_t)stream->readUTFChar(); + wchar_t value = static_cast(stream->readUTFChar()); if( value != -1 ) { cbuf[i] = value; diff --git a/Minecraft.World/IntArrayTag.h b/Minecraft.World/IntArrayTag.h index 48f4ce745..482a5e1a5 100644 --- a/Minecraft.World/IntArrayTag.h +++ b/Minecraft.World/IntArrayTag.h @@ -57,7 +57,7 @@ public: { if (Tag::equals(obj)) { - IntArrayTag *o = (IntArrayTag *) obj; + IntArrayTag *o = static_cast(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 174d01d3f..d193285a5 100644 --- a/Minecraft.World/IntCache.cpp +++ b/Minecraft.World/IntCache.cpp @@ -36,7 +36,7 @@ IntCache::ThreadStorage::~ThreadStorage() void IntCache::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); delete tls; @@ -44,7 +44,7 @@ void IntCache::ReleaseThreadStorage() intArray IntCache::allocate(int size) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); if (size <= TINY_CUTOFF) { @@ -100,7 +100,7 @@ intArray IntCache::allocate(int size) void IntCache::releaseAll() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); // 4J - added - we can now remove the vectors that were deemed as too small (see comment in IntCache::allocate) for( int i = 0; i < tls->toosmall.size(); i++ ) @@ -130,7 +130,7 @@ void IntCache::releaseAll() // 4J added so that we can fully reset between levels void IntCache::Reset() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); tls->maxSize = TINY_CUTOFF; for( int i = 0; i < tls->allocated.size(); i++ ) { diff --git a/Minecraft.World/IntTag.h b/Minecraft.World/IntTag.h index cce87da31..1f55c5f2a 100644 --- a/Minecraft.World/IntTag.h +++ b/Minecraft.World/IntTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - IntTag *o = (IntTag *) obj; + IntTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/Inventory.cpp b/Minecraft.World/Inventory.cpp index 1b9ff630b..1cb5218d2 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -243,7 +243,7 @@ int Inventory::addResource(shared_ptr itemInstance) // 4J Stu - Brought forward from 1.2 if (itemInstance->hasTag()) { - items[slot]->setTag((CompoundTag *) itemInstance->getTag()->copy()); + items[slot]->setTag(static_cast(itemInstance->getTag()->copy())); player->handleCollectItem(itemInstance); } } @@ -503,7 +503,7 @@ ListTag *Inventory::save(ListTag *listTag) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } @@ -513,7 +513,7 @@ ListTag *Inventory::save(ListTag *listTag) if (armor[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) (i + 100)); + tag->putByte(L"Slot", static_cast(i + 100)); armor[i]->save(tag); listTag->add(tag); } @@ -637,7 +637,7 @@ void Inventory::hurtArmor(float dmg) { if (armor[i] != NULL && dynamic_cast( armor[i]->getItem() ) != NULL ) { - armor[i]->hurtAndBreak( (int) dmg, dynamic_pointer_cast( player->shared_from_this() ) ); + armor[i]->hurtAndBreak( static_cast(dmg), dynamic_pointer_cast( player->shared_from_this() ) ); if (armor[i]->count == 0) { armor[i] = nullptr; diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index 2f23ab8cb..5b3838dbc 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -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 = (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::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::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::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::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::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::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::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::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::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::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 = (BowItem *)( new BowItem(5) ) ->setIconName(L"bow")->setBaseItemTypeAndMaterial(eBaseItemType_bow, eMaterial_bow) ->setDescriptionId(IDS_ITEM_BOW)->setUseDescriptionId(IDS_DESC_BOW); + Item::bow = static_cast((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 = (MapItem *) ( new MapItem(102) ) ->setIconName(L"map")->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_map) ->setDescriptionId(IDS_ITEM_MAP)->setUseDescriptionId(IDS_DESC_MAP); + Item::map = static_cast((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 = (FishingRodItem *)( new FishingRodItem(90) ) ->setBaseItemTypeAndMaterial(eBaseItemType_rod, eMaterial_wood)->setIconName(L"fishingRod")->setDescriptionId(IDS_ITEM_FISHING_ROD)->setUseDescriptionId(IDS_DESC_FISHINGROD); + 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::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, (Tile *)Tile::diode_off) ) ->setIconName(L"diode")->setDescriptionId(IDS_ITEM_DIODE)->setUseDescriptionId(IDS_DESC_REDSTONEREPEATER); + Item::repeater = ( new TilePlanterItem(100, static_cast(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 = (ShearsItem *)( new ShearsItem(103) ) ->setIconName(L"shears")->setBaseItemTypeAndMaterial(eBaseItemType_devicetool, eMaterial_shears)->setDescriptionId(IDS_ITEM_SHEARS)->setUseDescriptionId(IDS_DESC_SHEARS); + Item::shears = static_cast((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 = (PotionItem *) ( ( new PotionItem(117) ) ->setIconName(L"potion")->setDescriptionId(IDS_ITEM_POTION)->setUseDescriptionId(IDS_DESC_POTION) ); + Item::potion = static_cast((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 = (EmptyMapItem *) (new EmptyMapItem(139))->setIconName(L"map_empty")->setDescriptionId(IDS_ITEM_MAP_EMPTY)->setUseDescriptionId(IDS_DESC_MAP_EMPTY); + Item::emptyMap = static_cast((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 = (EnchantedBookItem *)(new EnchantedBookItem(147)) ->setMaxStackSize(1)->setIconName(L"enchantedBook")->setDescriptionId(IDS_ITEM_ENCHANTED_BOOK)->setUseDescriptionId(IDS_DESC_ENCHANTED_BOOK); + EnchantedBookItem::enchantedBook = static_cast((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); diff --git a/Minecraft.World/ItemDispenseBehaviors.cpp b/Minecraft.World/ItemDispenseBehaviors.cpp index 08c73a0c1..8d051c735 100644 --- a/Minecraft.World/ItemDispenseBehaviors.cpp +++ b/Minecraft.World/ItemDispenseBehaviors.cpp @@ -273,7 +273,7 @@ void BoatDispenseBehavior::playSound(BlockSource *source, eOUTCOME outcome) shared_ptr FilledBucketDispenseBehavior::execute(BlockSource *source, shared_ptr dispensed, eOUTCOME &outcome) { - BucketItem *bucket = (BucketItem *)dispensed->getItem(); + BucketItem *bucket = static_cast(dispensed->getItem()); int sourceX = source->getBlockX(); int sourceY = source->getBlockY(); int sourceZ = source->getBlockZ(); diff --git a/Minecraft.World/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index 66d271f72..c012a9123 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 = (float) (Math::random() * PI * 2); + bobOffs = static_cast(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 = (float) (Math::random() * 360); + yRot = static_cast(Math::random() * 360); - xd = (float) (Math::random() * 0.2f - 0.1f); + xd = static_cast(Math::random() * 0.2f - 0.1f); yd = +0.2f; - zd = (float) (Math::random() * 0.2f - 0.1f); + zd = static_cast(Math::random() * 0.2f - 0.1f); } ItemEntity::ItemEntity(Level *level, double x, double y, double z) : Entity(level) @@ -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 = (int) xo != (int) x || (int) yo != (int) y || (int) zo != (int) z; + bool moved = static_cast(xo) != static_cast(x) || static_cast(yo) != static_cast(y) || static_cast(zo) != static_cast(z); if (moved || tickCount % 25 == 0) { @@ -204,8 +204,8 @@ bool ItemEntity::hurt(DamageSource *source, float damage) void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", (byte) health); - entityTag->putShort(L"Age", (short) age); + entityTag->putShort(L"Health", static_cast(health)); + entityTag->putShort(L"Age", static_cast(age)); if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); } diff --git a/Minecraft.World/ItemFrame.cpp b/Minecraft.World/ItemFrame.cpp index 0d52b421b..f8f4731b0 100644 --- a/Minecraft.World/ItemFrame.cpp +++ b/Minecraft.World/ItemFrame.cpp @@ -38,7 +38,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H void ItemFrame::defineSynchedData() { getEntityData()->defineNULL(DATA_ITEM, NULL); - getEntityData()->define(DATA_ROTATION, (byte) 0); + getEntityData()->define(DATA_ROTATION, static_cast(0)); } bool ItemFrame::shouldRenderAtSqrDistance(double distance) @@ -107,7 +107,7 @@ int ItemFrame::getRotation() void ItemFrame::setRotation(int rotation) { - getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4)); + getEntityData()->set(DATA_ROTATION, static_cast(rotation % 4)); } void ItemFrame::addAdditonalSaveData(CompoundTag *tag) @@ -115,7 +115,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag) if (getItem() != NULL) { tag->putCompound(L"Item", getItem()->save(new CompoundTag())); - tag->putByte(L"ItemRotation", (byte) getRotation()); + tag->putByte(L"ItemRotation", static_cast(getRotation())); tag->putFloat(L"ItemDropChance", dropChance); } HangingEntity::addAdditonalSaveData(tag); diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index 4dcde7aa5..e344e4cd6 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -92,7 +92,7 @@ ItemInstance::~ItemInstance() shared_ptr ItemInstance::remove(int count) { shared_ptr ii = shared_ptr( new ItemInstance(id, count, auxValue) ); - if (tag != NULL) ii->tag = (CompoundTag *) tag->copy(); + if (tag != NULL) ii->tag = static_cast(tag->copy()); this->count -= count; // 4J Stu Fix for duplication glitch, make sure that item count is in range @@ -145,9 +145,9 @@ shared_ptr ItemInstance::useTimeDepleted(Level *level, shared_ptr< CompoundTag *ItemInstance::save(CompoundTag *compoundTag) { - compoundTag->putShort(L"id", (short) id); - compoundTag->putByte(L"Count", (byte) count); - compoundTag->putShort(L"Damage", (short) auxValue); + compoundTag->putShort(L"id", static_cast(id)); + compoundTag->putByte(L"Count", static_cast(count)); + compoundTag->putShort(L"Damage", static_cast(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 = (CompoundTag *)compoundTag->getCompound(L"tag")->copy(); + tag = static_cast(compoundTag->getCompound(L"tag")->copy()); } } @@ -305,7 +305,7 @@ shared_ptr ItemInstance::copy() const shared_ptr copy = shared_ptr( new ItemInstance(id, count, auxValue) ); if (tag != NULL) { - copy->tag = (CompoundTag *) tag->copy(); + copy->tag = static_cast(tag->copy()); } return copy; } @@ -316,7 +316,7 @@ ItemInstance *ItemInstance::copy_not_shared() const ItemInstance *copy = new ItemInstance(id, count, auxValue); if (tag != NULL) { - copy->tag = (CompoundTag *) tag->copy(); + copy->tag = static_cast(tag->copy()); if (!copy->tag->equals(tag)) { return copy; @@ -493,7 +493,7 @@ ListTag *ItemInstance::getEnchantmentTags() { return NULL; } - return (ListTag *) tag->get(L"ench"); + return static_cast *>(tag->get(L"ench")); } void ItemInstance::setTag(CompoundTag *tag) @@ -733,10 +733,10 @@ void ItemInstance::enchant(const Enchantment *enchantment, int level) if (tag == NULL) this->setTag(new CompoundTag()); if (!tag->contains(L"ench")) tag->put(L"ench", new ListTag(L"ench")); - ListTag *list = (ListTag *) tag->get(L"ench"); + ListTag *list = static_cast *>(tag->get(L"ench")); CompoundTag *ench = new CompoundTag(); - ench->putShort((wchar_t *)TAG_ENCH_ID, (short) enchantment->id); - ench->putShort((wchar_t *)TAG_ENCH_LEVEL, (byte) level); + ench->putShort((wchar_t *)TAG_ENCH_ID, static_cast(enchantment->id)); + ench->putShort((wchar_t *)TAG_ENCH_LEVEL, static_cast(level)); list->add(ench); } @@ -829,7 +829,7 @@ void ItemInstance::set4JData(int data) if (tag->contains(L"4jdata")) { - IntTag *dataTag = (IntTag *)tag->get(L"4jdata"); + IntTag *dataTag = static_cast(tag->get(L"4jdata")); dataTag->data = data; } else if(data != 0) @@ -843,7 +843,7 @@ int ItemInstance::get4JData() if(tag == NULL || !tag->contains(L"4jdata")) return 0; else { - IntTag *dataTag = (IntTag *)tag->get(L"4jdata"); + IntTag *dataTag = static_cast(tag->get(L"4jdata")); return dataTag->data; } } diff --git a/Minecraft.World/JavaIntHash.h b/Minecraft.World/JavaIntHash.h index fe6084699..8293cb468 100644 --- a/Minecraft.World/JavaIntHash.h +++ b/Minecraft.World/JavaIntHash.h @@ -13,9 +13,9 @@ struct IntKeyHash { int h = k; h += ~(h << 9); - h ^= (((unsigned int)h) >> 14); + h ^= (static_cast(h) >> 14); h += (h << 4); - h ^= (((unsigned int)h) >> 10); + h ^= (static_cast(h) >> 10); return h; } }; diff --git a/Minecraft.World/JavaMath.cpp b/Minecraft.World/JavaMath.cpp index 928436952..eacda91a0 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 Math::round( double d ) { - return (__int64)floor( d + 0.5 ); + return static_cast<__int64>(floor(d + 0.5)); } int Math::_max(int a, int b) diff --git a/Minecraft.World/LargeCaveFeature.cpp b/Minecraft.World/LargeCaveFeature.cpp index c05447cf8..cdef08753 100644 --- a/Minecraft.World/LargeCaveFeature.cpp +++ b/Minecraft.World/LargeCaveFeature.cpp @@ -144,11 +144,11 @@ void LargeCaveFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray b { if (yy < 10) { - blocks[p] = (byte) Tile::lava_Id; + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = (byte) 0; + blocks[p] = static_cast(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/LargeHellCaveFeature.cpp b/Minecraft.World/LargeHellCaveFeature.cpp index b1e636eb4..e09153fbd 100644 --- a/Minecraft.World/LargeHellCaveFeature.cpp +++ b/Minecraft.World/LargeHellCaveFeature.cpp @@ -138,7 +138,7 @@ void LargeHellCaveFeature::addTunnel(__int64 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] = (byte) 0; + blocks[p] = static_cast(0); } } p--; diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index 956a8917b..5187af7e0 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -189,7 +189,7 @@ int Layer::nextRandom(int max) } #else - int result = (int) ((rval >> 24) % max); + int result = static_cast((rval >> 24) % max); #endif if (result < 0) result += max; diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index b977ad7d2..6b83d0aa8 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 = (unsigned char *)XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES); + void *cache = static_cast(XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES)); TlsSetValue(tlsIdxLightCache,cache); } void Level::destroyLightingCache() { - lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache); + lightCache_t *cache = static_cast(TlsGetValue(tlsIdxLightCache)); XPhysicalFree(cache); } @@ -195,8 +195,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | - ( ( ((__uint64)z) & 0x3FFFC00L) << 22); + posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) | + ( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -254,8 +254,8 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l ( ( z & 0x3f0 ) >> 4 ); #ifdef _LARGE_WORLDS // Add in the higher bits for x and z - posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | - ( ( ((__uint64)z) & 0x3FFFC00L) << 22); + posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) | + ( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -321,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 |= ( ( ((__uint64)x) & 0x3FFFC00) << 38) | - ( ( ((__uint64)z) & 0x3FFFC00) << 22); + posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00) << 38) | + ( ( static_cast<__uint64>(z) & 0x3FFFC00) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -397,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 |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) | - ( ( ((__uint64)z) & 0x3FFFC00L) << 22); + posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) | + ( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22); #endif lightCache_t cacheValue = cache[idx]; @@ -1377,7 +1377,7 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye { for( int i = 0; i < 6; i++ ) { - brightnesses[i] = (int)layer; + brightnesses[i] = static_cast(layer); } return; } @@ -1392,7 +1392,7 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye { for( int i = 0; i < 6; i++ ) { - brightnesses[i] = (int)layer; + brightnesses[i] = static_cast(layer); } return; } @@ -1592,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 = (int) (tPos->x = floor(a->x)); + xTile0 = static_cast(tPos->x = floor(a->x)); if (face == 5) { xTile0--; tPos->x++; } - yTile0 = (int) (tPos->y = floor(a->y)); + yTile0 = static_cast(tPos->y = floor(a->y)); if (face == 1) { yTile0--; tPos->y++; } - zTile0 = (int) (tPos->z = floor(a->z)); + zTile0 = static_cast(tPos->z = floor(a->z)); if (face == 3) { zTile0--; @@ -2001,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 ((int) (br * 11)); + return static_cast(br * 11); } //4J - change brought forward from 1.8.2 @@ -2839,7 +2839,7 @@ float Level::getSeenPercent(Vec3 *center, AABB *bb) count++; } - return hits / (float) count; + return hits / static_cast(count); } @@ -3258,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 = (int)players.size(); + int playerCount = static_cast(players.size()); int *xx = new int[playerCount]; int *zz = new int[playerCount]; for (size_t i = 0; i < playerCount; i++) @@ -3437,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 = (lightCache_t *)TlsGetValue(tlsIdxLightCache); + lightCache_t *cache = static_cast(TlsGetValue(tlsIdxLightCache)); __uint64 cacheUse = 0; if( force ) @@ -3964,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 = (int) (maxDist + 16); + int r = static_cast(maxDist + 16); int x1 = x - r; int y1 = y - r; int z1 = z - r; @@ -3983,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 = (int) (maxDist + 8); + int r = static_cast(maxDist + 8); int x1 = x - r; int y1 = y - r; int z1 = z - r; diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index d4be5ac23..9d7e51317 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/LevelChunk.cpp @@ -531,7 +531,7 @@ void LevelChunk::recalcHeightmapOnly() blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; } #endif - heightmap[z << 4 | x] = (byte) y; + heightmap[z << 4 | x] = static_cast(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] = (byte) y; + heightmap[z << 4 | x] = static_cast(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] = (byte) y; + heightmap[z << 4 | x] = static_cast(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 = (byte) _tile; + byte tile = static_cast(_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 >= ((int)rainHeights[slot]) - 1) + if (y >= static_cast(rainHeights[slot]) - 1) { rainHeights[slot] = 255; } @@ -1719,7 +1719,7 @@ int LevelChunk::countEntities() #endif for (int yc = 0; yc < ENTITY_BLOCKS_LENGTH; yc++) { - entityCount += (int)entityBlocks[yc]->size(); + entityCount += static_cast(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 = (LevelChunk *)param; + LevelChunk *lc = static_cast(param); int xx = lc->x * 16 + x; int yy = y + yparam; int zz = lc->z * 16 + z; @@ -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 = (ChestTile *)Tile::tiles[Tile::chest_Id]; + ChestTile *tile = static_cast(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] = (byte) ( (biome->id) & 0xff); + biomes[(z << 4) | x] = static_cast((biome->id) & 0xff); } } } @@ -2059,7 +2059,7 @@ 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] = (byte) (value & 0xff); + biomes[(z << 4) | x] = static_cast(value & 0xff); } if (Biome::biomes[value] == NULL) { diff --git a/Minecraft.World/LevelData.cpp b/Minecraft.World/LevelData.cpp index 91b72fe8c..a40602573 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/LevelData.cpp @@ -712,7 +712,7 @@ void LevelData::getMoatFlags(bool* bClassicEdgeMoat, bool* bSmallEdgeMoat, bool* int LevelData::getXZHellSizeOld() { - int hellXZSizeOld = ceil((float)m_xzSizeOld / m_hellScaleOld); + int hellXZSizeOld = ceil(static_cast(m_xzSizeOld) / m_hellScaleOld); while(hellXZSizeOld > HELL_LEVEL_MAX_WIDTH && m_hellScaleOld < HELL_LEVEL_MAX_SCALE) { diff --git a/Minecraft.World/LevelSoundPacket.cpp b/Minecraft.World/LevelSoundPacket.cpp index cbe31a2d5..cc2e29c45 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 = (int) (x * LOCATION_ACCURACY); - this->y = (int) (y * LOCATION_ACCURACY); - this->z = (int) (z * LOCATION_ACCURACY); + this->x = static_cast(x * LOCATION_ACCURACY); + this->y = static_cast(y * LOCATION_ACCURACY); + this->z = static_cast(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/LightningBolt.cpp b/Minecraft.World/LightningBolt.cpp index a109d96b6..68ac77efb 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( (int) floor(x), (int) floor(y), (int) floor(z), 10)) + if (!level->isClientSide && level->getGameRules()->getBoolean(GameRules::RULE_DOFIRETICK) && level->hasChunksAt( static_cast(floor(x)), static_cast(floor(y)), static_cast(floor(z)), 10)) { - int xt = (int) floor(x); - int yt = (int) floor(y); - int zt = (int) floor(z); + int xt = static_cast(floor(x)); + int yt = static_cast(floor(y)); + int zt = static_cast(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 c31b64666..2e098928d 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -317,7 +317,7 @@ void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random) { if (random->nextInt(100) == 0) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); double xx = x + random->nextFloat(); double yy = y + tls->yy1; double zz = z + random->nextFloat(); diff --git a/Minecraft.World/ListTag.h b/Minecraft.World/ListTag.h index 69e51aee1..2a0fdebc3 100644 --- a/Minecraft.World/ListTag.h +++ b/Minecraft.World/ListTag.h @@ -18,7 +18,7 @@ public: else type = 1; dos->writeByte(type); - dos->writeInt((int)list.size()); + dos->writeInt(static_cast(list.size())); for ( auto& it : list ) it->write(dos); @@ -83,12 +83,12 @@ public: T *get(int index) { - return (T *) list[index]; + return static_cast(list[index]); } int size() { - return (int)list.size(); + return static_cast(list.size()); } virtual ~ListTag() @@ -105,7 +105,7 @@ public: res->type = type; for ( auto& it : list ) { - T *copy = (T *) it->copy(); + T *copy = static_cast(it->copy()); res->list.push_back(copy); } return res; @@ -115,7 +115,7 @@ public: { if (Tag::equals(obj)) { - ListTag *o = (ListTag *) obj; + ListTag *o = static_cast(obj); if (type == o->type) { bool equal = false; diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index ce702676c..c12f0a989 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -107,10 +107,10 @@ LivingEntity::LivingEntity( Level* level) : Entity(level) blocksBuilding = true; - rotA = (float) (Math::random() + 1) * 0.01f; + rotA = static_cast(Math::random() + 1) * 0.01f; setPos(x, y, z); - timeOffs = (float) Math::random() * 12398; - yRot = (float) (Math::random() * PI * 2); + timeOffs = static_cast(Math::random()) * 12398; + yRot = static_cast(Math::random() * PI * 2); yHeadRot = yRot; footSize = 0.5f; @@ -132,8 +132,8 @@ LivingEntity::~LivingEntity() void LivingEntity::defineSynchedData() { entityData->define(DATA_EFFECT_COLOR_ID, 0); - entityData->define(DATA_EFFECT_AMBIENCE_ID, (byte) 0); - entityData->define(DATA_ARROW_COUNT_ID, (byte) 0); + entityData->define(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); + entityData->define(DATA_ARROW_COUNT_ID, static_cast(0)); entityData->define(DATA_HEALTH_ID, 1.0f); } @@ -391,10 +391,10 @@ int LivingEntity::getNoActionTime() void LivingEntity::addAdditonalSaveData(CompoundTag *entityTag) { entityTag->putFloat(L"HealF", getHealth()); - 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->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->putFloat(L"AbsorptionAmount", getAbsorptionAmount()); ItemInstanceArray items = getEquipmentSlots(); @@ -464,12 +464,12 @@ void LivingEntity::readAdditionalSaveData(CompoundTag *tag) } else if (healthTag->getId() == Tag::TAG_Float) { - setHealth(((FloatTag *) healthTag)->data); + setHealth(static_cast(healthTag)->data); } else if (healthTag->getId() == Tag::TAG_Short) { // pre-1.6 health - setHealth((float) ((ShortTag *) healthTag)->data); + setHealth((float) static_cast(healthTag)->data); } } @@ -512,7 +512,7 @@ void LivingEntity::tickEffects() { if (activeEffects.empty()) { - entityData->set(DATA_EFFECT_AMBIENCE_ID, (byte) 0); + entityData->set(DATA_EFFECT_AMBIENCE_ID, static_cast(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) ? (byte) 1 : (byte) 0); + entityData->set(DATA_EFFECT_AMBIENCE_ID, PotionBrewing::areAllEffectsAmbient(&values) ? static_cast(1) : static_cast(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 = (double) ((colorValue >> 16) & 0xff) / 255.0; - double green = (double) ((colorValue >> 8) & 0xff) / 255.0; - double blue = (double) ((colorValue >> 0) & 0xff) / 255.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; 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); } @@ -775,7 +775,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) if ((source == DamageSource::anvil || source == DamageSource::fallingBlock) && getCarried(SLOT_HELM) != NULL) { - getCarried(SLOT_HELM)->hurtAndBreak((int) (dmg * 4 + random->nextFloat() * dmg * 2.0f), dynamic_pointer_cast( shared_from_this() )); + getCarried(SLOT_HELM)->hurtAndBreak(static_cast(dmg * 4 + random->nextFloat() * dmg * 2.0f), dynamic_pointer_cast( shared_from_this() )); dmg *= 0.75f; } @@ -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 = (float) (atan2(zd, xd) * 180 / PI) - yRot; + hurtDir = static_cast(atan2(zd, xd) * 180 / PI) - yRot; knockback(sourceEntity, dmg, xd, zd); } else { - hurtDir = (float) (int) ((Math::random() * 2) * 180); // 4J This cast is the same as Java + hurtDir = static_cast((int)((Math::random() * 2) * 180)); // 4J This cast is the same as Java } } @@ -1007,7 +1007,7 @@ void LivingEntity::causeFallDamage(float distance) MobEffectInstance *jumpBoost = getEffect(MobEffect::jump); float padding = jumpBoost != NULL ? jumpBoost->getAmplifier() + 1 : 0; - int dmg = (int) ceil(distance - 3 - padding); + int dmg = static_cast(ceil(distance - 3 - padding)); if (dmg > 0) { // 4J - new sounds here brought forward from 1.2.3 @@ -1052,7 +1052,7 @@ int LivingEntity::getArmorValue() shared_ptr item = items[i]; if (item != NULL && dynamic_cast(item->getItem()) != NULL) { - int baseProtection = ((ArmorItem *) item->getItem())->defense; + int baseProtection = static_cast(item->getItem())->defense; val += baseProtection; } } @@ -1139,7 +1139,7 @@ shared_ptr LivingEntity::getKillCredit() float LivingEntity::getMaxHealth() { - return (float) getAttribute(SharedMonsterAttributes::MAX_HEALTH)->getValue(); + return static_cast(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, (byte) count); + entityData->set(DATA_ARROW_COUNT_ID, static_cast(count)); } int LivingEntity::getCurrentSwingDuration() @@ -1174,7 +1174,7 @@ void LivingEntity::swing() if (dynamic_cast(level) != NULL) { - ((ServerLevel *) level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING))); + static_cast(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 / (float) currentSwingDuration; + attackAnim = swingTime / static_cast(currentSwingDuration); } AttributeInstance *LivingEntity::getAttribute(Attribute *attribute) @@ -1474,7 +1474,7 @@ void LivingEntity::travel(float xa, float ya) yd = 0.2; } - if (!level->isClientSide || (level->hasChunkAt((int) x, 0, (int) z) && level->getChunkAt((int) x, (int) z)->loaded)) + if (!level->isClientSide || (level->hasChunkAt(static_cast(x), 0, static_cast(z)) && level->getChunkAt(static_cast(x), static_cast(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 = (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); + 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); 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 * (float)( lc & 0xffff ); - accum[1] += frac * (float)( lc >> 16 ); + accum[0] += frac * static_cast(lc & 0xffff); + accum[1] += frac * static_cast(lc >> 16); } if( accum[0] > 240.0f ) accum[0] = 240.0f; if( accum[1] > 240.0f ) accum[1] = 240.0f; - return ( ( (int)accum[1])<<16) | ((int)accum[0]); + return ( static_cast(accum[1])<<16) | static_cast(accum[0]); } bool LivingEntity::useNewAi() @@ -1602,7 +1602,7 @@ void LivingEntity::tick() if (!ItemInstance::matches(current, previous)) { - ((ServerLevel *) level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEquippedItemPacket(entityId, i, current))); + static_cast(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 = ((float) atan2(zd, xd) * 180 / (float) PI - 90); + yBodyRotT = (static_cast(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 += (float) ( (yrd) / lSteps ); - xRot += (float) ( (xrd) / lSteps ); + yRot += static_cast((yrd) / lSteps); + xRot += static_cast((xrd) / lSteps); lSteps--; setPos(xt, yt, zt); @@ -1857,7 +1857,7 @@ void LivingEntity::take(shared_ptr e, int orgCount) { if (!e->removed && !level->isClientSide) { - EntityTracker *entityTracker = ((ServerLevel *) level)->getTracker(); + EntityTracker *entityTracker = static_cast(level)->getTracker(); if ( e->instanceof(eTYPE_ITEMENTITY) ) { entityTracker->broadcast(e, shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); diff --git a/Minecraft.World/LoginPacket.cpp b/Minecraft.World/LoginPacket.cpp index bfe692264..97f25a677 100644 --- a/Minecraft.World/LoginPacket.cpp +++ b/Minecraft.World/LoginPacket.cpp @@ -176,8 +176,8 @@ int LoginPacket::getEstimatedSize() int length=0; if (m_pLevelType != NULL) { - length = (int)m_pLevelType->getGeneratorName().length(); + length = static_cast(m_pLevelType->getGeneratorName().length()); } - return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int)); + return static_cast(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + 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/LongTag.h b/Minecraft.World/LongTag.h index 8cfae41d2..8828521ec 100644 --- a/Minecraft.World/LongTag.h +++ b/Minecraft.World/LongTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - LongTag *o = (LongTag *) obj; + LongTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/LookAtTradingPlayerGoal.cpp b/Minecraft.World/LookAtTradingPlayerGoal.cpp index db1e25a2e..9b50f0e70 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((Mob *)villager, typeid(Player), 8) +LookAtTradingPlayerGoal::LookAtTradingPlayerGoal(Villager *villager) : LookAtPlayerGoal(static_cast(villager), typeid(Player), 8) { this->villager = villager; } diff --git a/Minecraft.World/LookControl.cpp b/Minecraft.World/LookControl.cpp index 1e0d52584..8eff9bcac 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 = (float) (atan2(zd, xd) * 180 / PI) - 90; - float xRotD = (float) -(atan2(yd, sd) * 180 / PI); + float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float xRotD = static_cast(-(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 c399d632b..d64ee9b13 100644 --- a/Minecraft.World/MakeLoveGoal.cpp +++ b/Minecraft.World/MakeLoveGoal.cpp @@ -83,7 +83,7 @@ bool MakeLoveGoal::villageNeedsMoreVillagers() return false; } - int idealSize = (int) ((float) _village->getDoorCount() * 0.35); + int idealSize = static_cast((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 03529c1ad..c02a8716e 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -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((float) level->getLevelData()->getXSpawn() / scale) * scale; + mapItemSavedData->x = Math::round(static_cast(level->getLevelData()->getXSpawn()) / scale) * scale; mapItemSavedData->z = Math::round(level->getLevelData()->getZSpawn() / scale) * scale; #endif - mapItemSavedData->dimension = (byte) level->dimension->id; + mapItemSavedData->dimension = static_cast(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 / (double) (scale * scale); + hh += yy / static_cast(scale * scale); count[t]++; } @@ -237,7 +237,7 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptrcolors[x + z * w]; - byte newColor = (byte) (col * 4 + br); + byte newColor = static_cast(col * 4 + br); if (oldColor != newColor) { if (yd0 > z) yd0 = z; @@ -297,7 +297,7 @@ shared_ptr MapItem::getUpdatePacket(shared_ptr itemInstanc if (data.data == NULL || data.length == 0) return nullptr; - shared_ptr retval = shared_ptr(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data)); + shared_ptr retval = shared_ptr(new ComplexItemDataPacket(static_cast(Item::map->id), static_cast(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 = (int) (Math::round(player->x / scale) * scale); - int centreZC = (int) (Math::round(player->z / scale) * scale); + int centreXC = static_cast(Math::round(player->x / scale) * scale); + int centreZC = static_cast(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; @@ -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 = (byte) level->dimension->id; + data->dimension = static_cast(level->dimension->id); data->setDirty(); } diff --git a/Minecraft.World/MapItemSavedData.cpp b/Minecraft.World/MapItemSavedData.cpp index c06c3facd..7bbc9f0b6 100644 --- a/Minecraft.World/MapItemSavedData.cpp +++ b/Minecraft.World/MapItemSavedData.cpp @@ -65,8 +65,8 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrdecorations.size(); - unsigned int nonPlayerDecorationsSize = (int)parent->nonPlayerDecorations.size(); + unsigned int playerDecorationsSize = static_cast(parent->decorations.size()); + unsigned int nonPlayerDecorationsSize = static_cast(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] = (char) (md->rot & 0xF); + data[i * DEC_PACKET_BYTES + 8] = static_cast(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] = (char) (md->rot & 0xF); + data[dataIndex * DEC_PACKET_BYTES + 8] = static_cast(md->rot & 0xF); #else data[dataIndex * DEC_PACKET_BYTES + 1] = (char) ((md->img << 4) | (md->rot & 0xF)); #endif @@ -148,8 +148,8 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr(column); + data[2] = static_cast(min); for (unsigned int y = 0; y < data.length - 3; y++) { data[y + 3] = parent->colors[(y + min) * MapItem::IMAGE_WIDTH + column]; @@ -303,17 +303,17 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr(xd * 2 + 0.5); + char y = static_cast(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 = (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); + 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); } #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 = (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); + 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); int size = MAP_SIZE - 1; - char rot = (char) ( (item->getFrame()->dir * 90) * 16 / 360); + char rot = static_cast((item->getFrame()->dir * 90) * 16 / 360); if (dimension < 0) { - int s = (int) (playerLevel->getLevelData()->getDayTime() / 10); - rot = (char) ((s * s * 34187121 + s * 121) >> 15 & 15); + int s = static_cast(playerLevel->getLevelData()->getDayTime() / 10); + rot = static_cast((s * s * 34187121 + s * 121) >> 15 & 15); } #ifdef _LARGE_WORLDS if (xd < -size || yd < -size || xd > size || yd > size) { - 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); + 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); } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); @@ -401,10 +401,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrdimension == this->dimension) { - 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); + 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); int size = MAP_SIZE; // - 1; char rot; char imgIndex; @@ -414,16 +414,16 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptryRot * 16 / 360 + 0.5); + rot = static_cast(decorationPlayer->yRot * 16 / 360 + 0.5); if (dimension < 0) { - int s = (int) (playerLevel->getLevelData()->getDayTime() / 10); - rot = (char) ((s * s * 34187121 + s * 121) >> 15 & 15); + int s = static_cast(playerLevel->getLevelData()->getDayTime() / 10); + rot = static_cast((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 = (int)decorationPlayer->getPlayerIndex(); + imgIndex = static_cast(decorationPlayer->getPlayerIndex()); if(imgIndex>3) imgIndex += 4; } #ifdef _LARGE_WORLDS @@ -431,16 +431,16 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetPlayerIndex(); + imgIndex = static_cast(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 = (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); + 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); } #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 = (((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); + 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); bool visible = (data[i * DEC_PACKET_BYTES + 7] & 0x80) != 0; decorations.push_back(new MapDecoration(img, x, y, rot, entityId, visible)); } diff --git a/Minecraft.World/McRegionLevelStorageSource.cpp b/Minecraft.World/McRegionLevelStorageSource.cpp index 60904fdeb..d0aef97a4 100644 --- a/Minecraft.World/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/McRegionLevelStorageSource.cpp @@ -275,7 +275,7 @@ void McRegionLevelStorageSource::eraseFolders(vector *folders, int curre folder->_delete(); currentCount++; - int percent = (int) Math::round(100.0 * (double) currentCount / (double) totalCount); + int percent = static_cast(Math::round(100.0 * (double)currentCount / (double)totalCount)); progress->progressStagePercentage(percent); } } diff --git a/Minecraft.World/MegaTreeFeature.cpp b/Minecraft.World/MegaTreeFeature.cpp index 09195fb4b..0d01130f6 100644 --- a/Minecraft.World/MegaTreeFeature.cpp +++ b/Minecraft.World/MegaTreeFeature.cpp @@ -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 + (int) (0.5f + Mth::cos(angle) * 4.0f); - int bz = z + (int) (0.5f + Mth::sin(angle) * 4.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); placeLeaves(level, bx, bz, branchHeight, 0, random); for (int b = 0; b < 5; b++) { - bx = x + (int) (1.5f + Mth::cos(angle) * b); - bz = z + (int) (1.5f + Mth::sin(angle) * b); + bx = x + static_cast(1.5f + Mth::cos(angle) * b); + bz = z + static_cast(1.5f + Mth::sin(angle) * b); placeBlock(level, bx, branchHeight - 3 + b / 2, bz, Tile::treeTrunk_Id, trunkType); } diff --git a/Minecraft.World/MenuBackup.cpp b/Minecraft.World/MenuBackup.cpp index b6d3ba09a..c811e068a 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( (int)menu->slots.size() + 1 ); + ItemInstanceArray *backup = new ItemInstanceArray( static_cast(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/MerchantRecipeList.cpp b/Minecraft.World/MerchantRecipeList.cpp index c994081f2..d8f37c7f2 100644 --- a/Minecraft.World/MerchantRecipeList.cpp +++ b/Minecraft.World/MerchantRecipeList.cpp @@ -85,7 +85,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptrwriteByte((byte) (m_recipes.size() & 0xff)); + stream->writeByte(static_cast(m_recipes.size() & 0xff)); for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); diff --git a/Minecraft.World/MilkBucketItem.h b/Minecraft.World/MilkBucketItem.h index 672e31439..f2cff3eaa 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 = (int) (20 * 1.6); + static const int DRINK_DURATION = static_cast(20 * 1.6); public: MilkBucketItem(int id); diff --git a/Minecraft.World/Minecart.cpp b/Minecraft.World/Minecart.cpp index 4e1419cc4..43caf0a23 100644 --- a/Minecraft.World/Minecart.cpp +++ b/Minecraft.World/Minecart.cpp @@ -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, (byte) 0); + entityData->define(DATA_ID_CUSTOM_DISPLAY, static_cast(0)); } @@ -225,7 +225,7 @@ void Minecart::tick() if (!level->isClientSide && dynamic_cast(level) != NULL) { - MinecraftServer *server = ((ServerLevel *) level)->getServer(); + MinecraftServer *server = static_cast(level)->getServer(); int waitTime = getPortalWaitTime(); if (isInsidePortal) @@ -275,8 +275,8 @@ void Minecart::tick() double yrd = Mth::wrapDegrees(lyr - yRot); - yRot += (float) ( (yrd) / lSteps ); - xRot += (float) ( (lxr - xRot) / lSteps ); + yRot += static_cast((yrd) / lSteps); + xRot += static_cast((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 = (float) (atan2(zDiff, xDiff) * 180 / PI); + yRot = static_cast(atan2(zDiff, xDiff) * 180 / PI); if (flipped) yRot += 180; } @@ -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 (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) + if (static_cast(Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -648,7 +648,7 @@ Vec3 *Minecart::getPosOffs(double x, double y, double z, double offs) { int data = level->getData(xt, yt, zt); - if (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) + if (static_cast(Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -703,7 +703,7 @@ Vec3 *Minecart::getPos(double x, double y, double z) int data = level->getData(xt, yt, zt); y = yt; - if (((BaseRailTile *) Tile::tiles[tile])->isUsesDataBit()) + if (static_cast(Tile::tiles[tile])->isUsesDataBit()) { data &= BaseRailTile::RAIL_DIRECTION_MASK; } @@ -1015,7 +1015,7 @@ bool Minecart::hasCustomDisplay() void Minecart::setCustomDisplay(bool value) { - getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, (byte) (value ? 1 : 0)); + getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, static_cast(value ? 1 : 0)); } void Minecart::setCustomName(const wstring &name) diff --git a/Minecraft.World/MinecartContainer.cpp b/Minecraft.World/MinecartContainer.cpp index 20bfc4ea8..54883281c 100644 --- a/Minecraft.World/MinecartContainer.cpp +++ b/Minecraft.World/MinecartContainer.cpp @@ -47,9 +47,9 @@ void MinecartContainer::destroy(DamageSource *source) 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 = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; level->addEntity(itemEntity); } } @@ -161,13 +161,13 @@ void MinecartContainer::remove() if (item->hasTag()) { - itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy()); + itemEntity->getItem()->setTag(static_cast(item->getTag()->copy())); } float pow = 0.05f; - itemEntity->xd = (float) random->nextGaussian() * pow; - itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f; - itemEntity->zd = (float) random->nextGaussian() * pow; + itemEntity->xd = static_cast(random->nextGaussian()) * pow; + itemEntity->yd = static_cast(random->nextGaussian()) * pow + 0.2f; + itemEntity->zd = static_cast(random->nextGaussian()) * pow; level->addEntity(itemEntity); } } @@ -188,7 +188,7 @@ void MinecartContainer::addAdditonalSaveData(CompoundTag *base) if (items[i] != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/MinecartFurnace.cpp b/Minecraft.World/MinecartFurnace.cpp index 24950d5c1..838d8a272 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, (byte) 0); + entityData->define(DATA_ID_FUEL, static_cast(0)); } void MinecartFurnace::tick() @@ -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", (short) fuel); + base->putShort(L"Fuel", static_cast(fuel)); } void MinecartFurnace::readAdditionalSaveData(CompoundTag *base) @@ -160,11 +160,11 @@ void MinecartFurnace::setHasFuel(bool fuel) { if (fuel) { - entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) | 1)); } else { - entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) & ~1)); } } diff --git a/Minecraft.World/MinecartItem.cpp b/Minecraft.World/MinecartItem.cpp index 6100be65a..3ffe561ab 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, ((MinecartItem *) dispensed->getItem())->type); + shared_ptr minecart = Minecart::createMinecart(world, spawnX, spawnY + yOffset, spawnZ, static_cast(dispensed->getItem())->type); if (dispensed->hasCustomHoverName()) { minecart->setCustomName(dispensed->getHoverName()); diff --git a/Minecraft.World/MinecartSpawner.cpp b/Minecraft.World/MinecartSpawner.cpp index 3fcd4ef08..8dd54d015 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(), (byte) id); + m_parent->level->broadcastEntityEvent(m_parent->shared_from_this(), static_cast(id)); } Level *MinecartSpawner::MinecartMobSpawner::getLevel() diff --git a/Minecraft.World/MinecartTNT.cpp b/Minecraft.World/MinecartTNT.cpp index 26cac5cf5..11a664843 100644 --- a/Minecraft.World/MinecartTNT.cpp +++ b/Minecraft.World/MinecartTNT.cpp @@ -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, (float) (4 + random->nextDouble() * 1.5f * speed), true); + level->explode(shared_from_this(), x, y, z, static_cast(4 + random->nextDouble() * 1.5f * speed), true); remove(); } } diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp index 342400b49..2d363c0b0 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/Mob.cpp @@ -155,7 +155,7 @@ void Mob::ate() void Mob::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_CUSTOM_NAME_VISIBLE, (byte) 0); + entityData->define(DATA_CUSTOM_NAME_VISIBLE, static_cast(0)); entityData->define(DATA_CUSTOM_NAME, L""); } @@ -347,7 +347,7 @@ void Mob::readAdditionalSaveData(CompoundTag *tag) _isLeashed = tag->getBoolean(L"Leashed"); if (_isLeashed && tag->contains(L"Leash")) { - leashInfoTag = (CompoundTag *)tag->getCompound(L"Leash")->copy(); + leashInfoTag = static_cast(tag->getCompound(L"Leash")->copy()); } } @@ -560,7 +560,7 @@ void Mob::serverAiStep() if (lookingAt != NULL) { - lookAt(lookingAt, 10.0f, (float) getMaxHeadXRot()); + lookAt(lookingAt, 10.0f, static_cast(getMaxHeadXRot())); if (lookTime-- <= 0 || lookingAt->removed || lookingAt->distanceToSqr(shared_from_this()) > lookDistance * lookDistance) { lookingAt = nullptr; @@ -605,8 +605,8 @@ void Mob::lookAt(shared_ptr e, float yMax, float xMax) double sd = Mth::sqrt(xd * xd + zd * zd); - float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; - float xRotD = (float) -(atan2(yd, sd) * 180 / PI); + float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float xRotD = static_cast(-(atan2(yd, sd) * 180 / PI)); xRot = rotlerp(xRot, xRotD, xMax); yRot = rotlerp(yRot, yRotD, yMax); } @@ -659,7 +659,7 @@ int Mob::getMaxSpawnClusterSize() int Mob::getMaxFallDistance() { if (getTarget() == NULL) return 3; - int sacrifice = (int) (getHealth() - (getMaxHealth() * 0.33f)); + int sacrifice = static_cast(getHealth() - (getMaxHealth() * 0.33f)); sacrifice -= (3 - level->difficulty) * 4; if (sacrifice < 0) sacrifice = 0; return sacrifice + 3; @@ -799,7 +799,7 @@ void Mob::populateDefaultEquipmentEnchantments() float difficulty = level->getDifficulty(x, y, z); if (getCarriedItem() != NULL && random->nextFloat() < MAX_ENCHANTED_WEAPON_CHANCE * difficulty) { - EnchantmentHelper::enchantItem(random, getCarriedItem(), (int) (5 + difficulty * random->nextInt(18))); + EnchantmentHelper::enchantItem(random, getCarriedItem(), static_cast(5 + difficulty * random->nextInt(18))); } for (int i = 0; i < 4; i++) @@ -807,7 +807,7 @@ void Mob::populateDefaultEquipmentEnchantments() shared_ptr item = getArmor(i); if (item != NULL && random->nextFloat() < MAX_ENCHANTED_ARMOR_CHANCE * difficulty) { - EnchantmentHelper::enchantItem(random, item, (int) (5 + difficulty * random->nextInt(18))); + EnchantmentHelper::enchantItem(random, item, static_cast(5 + difficulty * random->nextInt(18))); } } } @@ -865,7 +865,7 @@ bool Mob::hasCustomName() void Mob::setCustomNameVisible(bool visible) { - entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? (byte) 1 : (byte) 0); + entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? static_cast(1) : static_cast(0)); } bool Mob::isCustomNameVisible() diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index 92f8c9d0a..f9978ca7d 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -173,12 +173,12 @@ void MobEffect::applyInstantenousEffect(shared_ptr source, shared_ { if ((id == heal->id && !mob->isInvertedHealAndHarm()) || (id == harm->id && mob->isInvertedHealAndHarm())) { - int amount = (int) (scale * (double) (4 << amplification) + .5); + int amount = static_cast(scale * (double)(4 << amplification) + .5); mob->heal(amount); } else if ((id == harm->id && !mob->isInvertedHealAndHarm()) || (id == heal->id && mob->isInvertedHealAndHarm())) { - int amount = (int) (scale * (double) (6 << amplification) + .5); + int amount = static_cast(scale * (double)(6 << amplification) + .5); if (source == NULL) { mob->hurt(DamageSource::magic, amount); diff --git a/Minecraft.World/MobEffectInstance.cpp b/Minecraft.World/MobEffectInstance.cpp index 2ca696f61..117311c37 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", (byte) getId()); - tag->putByte(L"Amplifier", (byte) getAmplifier()); + tag->putByte(L"Id", static_cast(getId())); + tag->putByte(L"Amplifier", static_cast(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 e593a59f6..233cc28ff 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 = (int)level->players.size(); + int playerCount = static_cast(level->players.size()); int *xx = new int[playerCount]; int *zz = new int[playerCount]; for (int i = 0; i < playerCount; i++) @@ -267,7 +267,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie if (isSpawnPositionOk(mobCategory, level, x, y, z)) { float xx = x + 0.5f; - float yy = (float) y; + float yy = static_cast(y); float zz = z + 0.5f; if (level->getNearestPlayer(xx, yy, zz, MIN_SPAWN_DISTANCE) != NULL) { diff --git a/Minecraft.World/Monster.cpp b/Minecraft.World/Monster.cpp index 174a706cb..254a5a6c6 100644 --- a/Minecraft.World/Monster.cpp +++ b/Minecraft.World/Monster.cpp @@ -75,7 +75,7 @@ bool Monster::hurt(DamageSource *source, float dmg) */ bool Monster::doHurtTarget(shared_ptr target) { - float dmg = (float) getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); + float dmg = static_cast(getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue()); int knockback = 0; diff --git a/Minecraft.World/MoveControl.cpp b/Minecraft.World/MoveControl.cpp index 02b5a9e0e..d2a529a18 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 = (float) (atan2(zd, xd) * 180 / PI) - 90; + float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; mob->yRot = rotlerp(mob->yRot, yRotD, MAX_TURN); - mob->setSpeed((float) (speedModifier * mob->getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + mob->setSpeed(static_cast(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 b52482f5e..e897c6f48 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((short)id); + dos->writeShort(static_cast(id)); } void MoveEntityPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/MoveEntityPacketSmall.cpp b/Minecraft.World/MoveEntityPacketSmall.cpp index 8216478fa..89f5e13ec 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((short)id); + dos->writeShort(static_cast(id)); } void MoveEntityPacketSmall::handle(PacketListener *listener) @@ -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)((signed char)(dis->readByte())); + int XandZ = (int)static_cast(dis->readByte()); xa = XandZ >> 4; za = ( XandZ << 28 ) >> 28; } diff --git a/Minecraft.World/Mth.cpp b/Minecraft.World/Mth.cpp index ab990e6cf..95e8ccbbb 100644 --- a/Minecraft.World/Mth.cpp +++ b/Minecraft.World/Mth.cpp @@ -26,13 +26,13 @@ void Mth::init() float Mth::sin(float i) { if(_sin == NULL) init(); // 4J - added - return _sin[(int) (i * sinScale) & 65535]; + return _sin[static_cast(i * sinScale) & 65535]; } float Mth::cos(float i) { if(_sin == NULL) init(); // 4J - added - return _sin[(int) (i * sinScale + 65536 / 4) & 65535]; + return _sin[static_cast(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 (float) ::sqrt(x); + return static_cast(::sqrt(x)); } int Mth::floor(float v) { - int i = (int) v; + int i = static_cast(v); return v < i ? i - 1 : i; } __int64 Mth::lfloor(double v) { - __int64 i = (__int64) v; + __int64 i = static_cast<__int64>(v); return v < i ? i - 1 : i; } int Mth::fastFloor(double x) { - return (int) (x + BIG_ENOUGH_FLOAT) - BIG_ENOUGH_INT; + return static_cast(x + BIG_ENOUGH_FLOAT) - BIG_ENOUGH_INT; } int Mth::floor(double v) { - int i = (int) v; + int i = static_cast(v); return v < i ? i - 1 : i; } int Mth::absFloor(double v) { - return (int) (v >= 0 ? v : -v + 1); + return static_cast(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 = (int) v; + int i = static_cast(v); return v > i ? i + 1 : i; } diff --git a/Minecraft.World/MushroomIslandBiome.cpp b/Minecraft.World/MushroomIslandBiome.cpp index fa7eafdbe..91bd8097e 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 = (byte) Tile::mycel_Id; + topMaterial = static_cast(Tile::mycel_Id); enemies.clear(); friendlies.clear(); diff --git a/Minecraft.World/MusicTileEntity.cpp b/Minecraft.World/MusicTileEntity.cpp index d947cc69e..ac39758ae 100644 --- a/Minecraft.World/MusicTileEntity.cpp +++ b/Minecraft.World/MusicTileEntity.cpp @@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag) void MusicTileEntity::tune() { - note = (byte) ((note + 1) % 25); + note = static_cast((note + 1) % 25); setChanged(); } diff --git a/Minecraft.World/NbtIo.cpp b/Minecraft.World/NbtIo.cpp index b6c632777..12b710163 100644 --- a/Minecraft.World/NbtIo.cpp +++ b/Minecraft.World/NbtIo.cpp @@ -52,7 +52,7 @@ CompoundTag *NbtIo::read(DataInput *dis) { Tag *tag = Tag::readNamedTag(dis); - if( tag->getId() == Tag::TAG_Compound ) return (CompoundTag *)tag; + if( tag->getId() == Tag::TAG_Compound ) return static_cast(tag); if(tag!=NULL) delete tag; // Root tag must be a named compound tag diff --git a/Minecraft.World/NetherBridgeFeature.cpp b/Minecraft.World/NetherBridgeFeature.cpp index d661d3b72..42cdfac94 100644 --- a/Minecraft.World/NetherBridgeFeature.cpp +++ b/Minecraft.World/NetherBridgeFeature.cpp @@ -118,7 +118,7 @@ NetherBridgeFeature::NetherBridgeStart::NetherBridgeStart(Level *level, Random * vector *pendingChildren = &start->pendingChildren; while (!pendingChildren->empty()) { - int pos = random->nextInt((int)pendingChildren->size()); + int pos = random->nextInt(static_cast(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 35baa71a3..de102da54 100644 --- a/Minecraft.World/NetherBridgePieces.cpp +++ b/Minecraft.World/NetherBridgePieces.cpp @@ -368,7 +368,7 @@ NetherBridgePieces::BridgeStraight::BridgeStraight(int genDepth, Random *random, void NetherBridgePieces::BridgeStraight::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 1, 3, false); + generateChildForward(static_cast(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) @@ -376,7 +376,7 @@ NetherBridgePieces::BridgeStraight *NetherBridgePieces::BridgeStraight::createPi BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -442,7 +442,7 @@ NetherBridgePieces::BridgeEndFiller *NetherBridgePieces::BridgeEndFiller::create BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -540,9 +540,9 @@ NetherBridgePieces::BridgeCrossing::BridgeCrossing(Random *random, int west, int void NetherBridgePieces::BridgeCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 8, 3, false); - generateChildLeft((StartPiece *) startPiece, pieces, random, 3, 8, false); - generateChildRight((StartPiece *) startPiece, pieces, random, 3, 8, false); + 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); } NetherBridgePieces::BridgeCrossing *NetherBridgePieces::BridgeCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -550,7 +550,7 @@ NetherBridgePieces::BridgeCrossing *NetherBridgePieces::BridgeCrossing::createPi BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -8, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -659,9 +659,9 @@ NetherBridgePieces::RoomCrossing::RoomCrossing(int genDepth, Random *random, Bou void NetherBridgePieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 2, 0, false); - generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 2, false); - generateChildRight((StartPiece *) startPiece, pieces, random, 0, 2, false); + 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); } NetherBridgePieces::RoomCrossing *NetherBridgePieces::RoomCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -669,7 +669,7 @@ NetherBridgePieces::RoomCrossing *NetherBridgePieces::RoomCrossing::createPiece( BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -731,7 +731,7 @@ NetherBridgePieces::StairsRoom::StairsRoom(int genDepth, Random *random, Boundin void NetherBridgePieces::StairsRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildRight((StartPiece *) startPiece, pieces, random, 6, 2, false); + generateChildRight(static_cast(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) @@ -739,7 +739,7 @@ NetherBridgePieces::StairsRoom *NetherBridgePieces::StairsRoom::createPiece(list BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -813,7 +813,7 @@ NetherBridgePieces::MonsterThrone *NetherBridgePieces::MonsterThrone::createPiec BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -901,7 +901,7 @@ NetherBridgePieces::CastleEntrance::CastleEntrance(int genDepth, Random *random, void NetherBridgePieces::CastleEntrance::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 5, 3, true); + generateChildForward(static_cast(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) @@ -909,7 +909,7 @@ NetherBridgePieces::CastleEntrance *NetherBridgePieces::CastleEntrance::createPi BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1030,8 +1030,8 @@ NetherBridgePieces::CastleStalkRoom::CastleStalkRoom(int genDepth, Random *rando void NetherBridgePieces::CastleStalkRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 5, 3, true); - generateChildForward((StartPiece *) startPiece, pieces, random, 5, 11, true); + generateChildForward(static_cast(startPiece), pieces, random, 5, 3, true); + generateChildForward(static_cast(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) @@ -1039,7 +1039,7 @@ NetherBridgePieces::CastleStalkRoom *NetherBridgePieces::CastleStalkRoom::create BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1196,7 +1196,7 @@ NetherBridgePieces::CastleSmallCorridorPiece::CastleSmallCorridorPiece(int genDe void NetherBridgePieces::CastleSmallCorridorPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); + generateChildForward(static_cast(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) @@ -1205,7 +1205,7 @@ NetherBridgePieces::CastleSmallCorridorPiece *NetherBridgePieces::CastleSmallCor BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1259,9 +1259,9 @@ NetherBridgePieces::CastleSmallCorridorCrossingPiece::CastleSmallCorridorCrossin void NetherBridgePieces::CastleSmallCorridorCrossingPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); - generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 1, true); - generateChildRight((StartPiece *) startPiece, pieces, random, 0, 1, true); + 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); } NetherBridgePieces::CastleSmallCorridorCrossingPiece *NetherBridgePieces::CastleSmallCorridorCrossingPiece::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1269,7 +1269,7 @@ NetherBridgePieces::CastleSmallCorridorCrossingPiece *NetherBridgePieces::Castle BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1337,7 +1337,7 @@ void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addAdditonalSaveData void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildRight((StartPiece *) startPiece, pieces, random, 0, 1, true); + generateChildRight(static_cast(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) @@ -1345,7 +1345,7 @@ NetherBridgePieces::CastleSmallCorridorRightTurnPiece *NetherBridgePieces::Castl BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1429,7 +1429,7 @@ void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addAdditonalSaveData( void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildLeft((StartPiece *) startPiece, pieces, random, 0, 1, true); + generateChildLeft(static_cast(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) @@ -1437,7 +1437,7 @@ NetherBridgePieces::CastleSmallCorridorLeftTurnPiece *NetherBridgePieces::Castle BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1505,7 +1505,7 @@ NetherBridgePieces::CastleCorridorStairsPiece::CastleCorridorStairsPiece(int gen void NetherBridgePieces::CastleCorridorStairsPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateChildForward((StartPiece *) startPiece, pieces, random, 1, 0, true); + generateChildForward(static_cast(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) @@ -1513,7 +1513,7 @@ NetherBridgePieces::CastleCorridorStairsPiece *NetherBridgePieces::CastleCorrido BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -7, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1586,8 +1586,8 @@ void NetherBridgePieces::CastleCorridorTBalconyPiece::addChildren(StructurePiece zOff = 5; } - generateChildLeft((StartPiece *) startPiece, pieces, random, 0, zOff, random->nextInt(8) > 0); - generateChildRight((StartPiece *) startPiece, pieces, random, 0, zOff, random->nextInt(8) > 0); + generateChildLeft(static_cast(startPiece), pieces, random, 0, zOff, random->nextInt(8) > 0); + generateChildRight(static_cast(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) @@ -1595,7 +1595,7 @@ NetherBridgePieces::CastleCorridorTBalconyPiece *NetherBridgePieces::CastleCorri BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -3, 0, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((NetherBridgePieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { diff --git a/Minecraft.World/Node.cpp b/Minecraft.World/Node.cpp index 7059c0450..a8988091c 100644 --- a/Minecraft.World/Node.cpp +++ b/Minecraft.World/Node.cpp @@ -35,9 +35,9 @@ int Node::createHash(const int x, const int y, const int z) float Node::distanceTo(Node *to) { - float xd = (float) ( to->x - x ); - float yd = (float) ( to->y - y ); - float zd = (float) ( to->z - z ); + float xd = static_cast(to->x - x); + float yd = static_cast(to->y - y); + float zd = static_cast(to->z - z); return Mth::sqrt(xd * xd + yd * yd + zd * zd); } diff --git a/Minecraft.World/NoteBlockTile.cpp b/Minecraft.World/NoteBlockTile.cpp index 25ea587aa..504ed511e 100644 --- a/Minecraft.World/NoteBlockTile.cpp +++ b/Minecraft.World/NoteBlockTile.cpp @@ -57,7 +57,7 @@ shared_ptr NoteBlockTile::newTileEntity(Level *level) bool NoteBlockTile::triggerEvent(Level *level, int x, int y, int z, int i, int note) { - float pitch = (float) pow(2, (note - 12) / 12.0); + float pitch = static_cast(pow(2, (note - 12) / 12.0)); int iSound; switch(i) diff --git a/Minecraft.World/Ocelot.cpp b/Minecraft.World/Ocelot.cpp index 50285682a..53ee27299 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, (byte) 0); + entityData->define(DATA_TYPE_ID, static_cast(0)); } void Ocelot::serverAiMobStep() @@ -279,7 +279,7 @@ int Ocelot::getCatType() void Ocelot::setCatType(int type) { - entityData->set(DATA_TYPE_ID, (byte) type); + entityData->set(DATA_TYPE_ID, static_cast(type)); } bool Ocelot::canSpawn() @@ -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 ? (byte) (current | 0x02) : (byte) (current & ~0x02) ); + entityData->set(DATA_FLAGS_ID, val ? static_cast(current | 0x02) : static_cast(current & ~0x02) ); } bool Ocelot::isSittingOnTile() diff --git a/Minecraft.World/OcelotSitOnTileGoal.cpp b/Minecraft.World/OcelotSitOnTileGoal.cpp index a35537fb6..09b986503 100644 --- a/Minecraft.World/OcelotSitOnTileGoal.cpp +++ b/Minecraft.World/OcelotSitOnTileGoal.cpp @@ -41,7 +41,7 @@ bool OcelotSitOnTileGoal::canContinueToUse() void OcelotSitOnTileGoal::start() { - ocelot->getNavigation()->moveTo((float) tileX + 0.5, tileY + 1, (float) tileZ + 0.5, speedModifier); + ocelot->getNavigation()->moveTo(static_cast(tileX) + 0.5, tileY + 1, static_cast(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((float) tileX + 0.5, tileY + 1, (float) tileZ + 0.5, speedModifier); + ocelot->getNavigation()->moveTo(static_cast(tileX) + 0.5, tileY + 1, static_cast(tileZ) + 0.5, speedModifier); tryTicks++; } else if (!ocelot->isSitting()) @@ -79,12 +79,12 @@ void OcelotSitOnTileGoal::tick() bool OcelotSitOnTileGoal::findNearestTile() { - int y = (int) ocelot->y; + int y = static_cast(ocelot->y); double distSqr = Integer::MAX_VALUE; - for (int x = (int) ocelot->x - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE; x++) + for (int x = static_cast(ocelot->x) - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE; x++) { - for (int z = (int) ocelot->z - SEARCH_RANGE; z < ocelot->z + SEARCH_RANGE; z++) + for (int z = static_cast(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/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index 24263d0d5..c3e6f4aea 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -45,7 +45,7 @@ void OldChunkStorage::UseDefaultThreadStorage() void OldChunkStorage::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); if( tls == tlsDefault ) return; delete tls; @@ -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", (int) (td.m_delay - levelTime)); + teTag->putInt(L"t", static_cast(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 = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); PIXBeginNamedEvent(0,"Getting block data"); //static byteArray blockData = byteArray(32768); @@ -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", (int) (td.m_delay - levelTime)); + teTag->putInt(L"t", static_cast(td.m_delay - levelTime)); teTag->putInt(L"p", td.priorityTilt); tickTags->add(teTag); diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index a37cb2ad6..44081a586 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -386,7 +386,7 @@ void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOE } #endif - dos->writeShort((short)value.length()); + dos->writeShort(static_cast(value.length())); dos->writeChars(value); } @@ -443,7 +443,7 @@ double Packet::PacketStatistics::getAverageSize() { return 0; } - return (double) totalSize / count; + return static_cast(totalSize) / count; } int Packet::PacketStatistics::getTotalSize() @@ -562,7 +562,7 @@ void Packet::writeNbt(CompoundTag *tag, DataOutputStream *dos) else { byteArray buff = NbtIo::compress(tag); - dos->writeShort((short) buff.length); + dos->writeShort(static_cast(buff.length)); dos->write(buff); delete [] buff.data; } diff --git a/Minecraft.World/Painting.cpp b/Minecraft.World/Painting.cpp index 208beb773..4d79f6f44 100644 --- a/Minecraft.World/Painting.cpp +++ b/Minecraft.World/Painting.cpp @@ -98,7 +98,7 @@ void Painting::PaintingPostConstructor(int dir, int motive) } if (!survivableMotives->empty()) { - this->motive = survivableMotives->at(random->nextInt((int)survivableMotives->size())); + this->motive = survivableMotives->at(random->nextInt(static_cast(survivableMotives->size()))); } setDir(dir); } diff --git a/Minecraft.World/Path.cpp b/Minecraft.World/Path.cpp index 538917f6f..0006ce095 100644 --- a/Minecraft.World/Path.cpp +++ b/Minecraft.World/Path.cpp @@ -76,9 +76,9 @@ void Path::setIndex(int index) Vec3 *Path::getPos(shared_ptr e, int index) { - double x = nodes[index]->x + (int) (e->bbWidth + 1) * 0.5; + double x = nodes[index]->x + static_cast(e->bbWidth + 1) * 0.5; double y = nodes[index]->y; - double z = nodes[index]->z + (int) (e->bbWidth + 1) * 0.5; + double z = nodes[index]->z + static_cast(e->bbWidth + 1) * 0.5; return Vec3::newTemp(x, y, z); } @@ -105,12 +105,12 @@ bool Path::endsIn(Vec3 *pos) { Node *lastNode = last(); if (lastNode == NULL) return false; - return lastNode->x == (int) pos->x && lastNode->y == (int) pos->y && lastNode->z == (int) pos->z; + return lastNode->x == static_cast(pos->x) && lastNode->y == static_cast(pos->y) && lastNode->z == static_cast(pos->z); } bool Path::endsInXZ(Vec3 *pos) { Node *lastNode = last(); if (lastNode == NULL) return false; - return lastNode->x == (int) pos->x && lastNode->z == (int) pos->z; + return lastNode->x == static_cast(pos->x) && lastNode->z == static_cast(pos->z); } \ No newline at end of file diff --git a/Minecraft.World/PathFinder.cpp b/Minecraft.World/PathFinder.cpp index 2e11648f3..dc8a9882c 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 = (int) (e->bb->y0); + startY = static_cast(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((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 *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 *size = new Node((int) floor(e->bbWidth + 1), (int) floor(e->bbHeight + 1), (int) floor(e->bbWidth + 1)); + Node *size = new Node(static_cast(floor(e->bbWidth + 1)), static_cast(floor(e->bbHeight + 1)), static_cast(floor(e->bbWidth + 1))); Path *path = findPath(e, from, to, size, maxDist); delete size; diff --git a/Minecraft.World/PathNavigation.cpp b/Minecraft.World/PathNavigation.cpp index 7cac052ee..4a9f6d0c0 100644 --- a/Minecraft.World/PathNavigation.cpp +++ b/Minecraft.World/PathNavigation.cpp @@ -81,19 +81,19 @@ void PathNavigation::setCanFloat(bool canFloat) float PathNavigation::getMaxDist() { - return (float) dist->getValue(); + return static_cast(dist->getValue()); } Path *PathNavigation::createPath(double x, double y, double z) { if (!canUpdatePath()) return NULL; - return level->findPath(mob->shared_from_this(), Mth::floor(x), (int) y, Mth::floor(z), getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); + return level->findPath(mob->shared_from_this(), Mth::floor(x), static_cast(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), (int) y, Mth::floor(z)); + Path *newPath = createPath(Mth::floor(x), static_cast(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); @@ -171,7 +171,7 @@ void PathNavigation::updatePath() int firstElevation = path->getSize(); for (int i = path->getIndex(); path != NULL && i < path->getSize(); ++i) { - if ((int) path->get(i)->y != (int) mobPos->y) + if (static_cast(path->get(i)->y) != static_cast(mobPos->y)) { firstElevation = i; break; @@ -191,8 +191,8 @@ void PathNavigation::updatePath() } // smooth remaining on same elevation - int sx = (int) ceil(mob->bbWidth); - int sy = (int) mob->bbHeight + 1; + int sx = static_cast(ceil(mob->bbWidth)); + int sy = static_cast(mob->bbHeight) + 1; int sz = sx; for (int i = firstElevation - 1; i >= path->getIndex(); --i) { @@ -232,16 +232,16 @@ Vec3 *PathNavigation::getTempMobPos() int PathNavigation::getSurfaceY() { - if (!mob->isInWater() || !canFloat) return (int) (mob->bb->y0 + 0.5); + if (!mob->isInWater() || !canFloat) return static_cast(mob->bb->y0 + 0.5); - int surface = (int) (mob->bb->y0); + int surface = static_cast(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 (int) (mob->bb->y0); + if (++steps > 16) return static_cast(mob->bb->y0); } return surface; } @@ -258,7 +258,7 @@ bool PathNavigation::isInLiquid() void PathNavigation::trimPathFromSun() { - if (level->canSeeSky(Mth::floor(mob->x), (int) (mob->bb->y0 + 0.5), Mth::floor(mob->z))) return; + if (level->canSeeSky(Mth::floor(mob->x), static_cast(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, (int) startPos->y, gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; + if (!canWalkOn(gridPosX, static_cast(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, (int) startPos->y, gridPosZ, sx, sy, sz, startPos, dirX, dirZ)) return false; + if (!canWalkOn(gridPosX, static_cast(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 c01790e78..9942445c9 100644 --- a/Minecraft.World/PathfinderMob.cpp +++ b/Minecraft.World/PathfinderMob.cpp @@ -141,9 +141,9 @@ void PathfinderMob::serverAiStep() double xd = target->x - x; double zd = target->z - z; double yd = target->y - yFloor; - float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; + float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; float rotDiff = Mth::wrapDegrees(yRotD - yRot); - yya = (float) getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue(); + yya = static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue()); if (rotDiff > MAX_TURN) { rotDiff = MAX_TURN; @@ -162,7 +162,7 @@ void PathfinderMob::serverAiStep() double zd2 = attackTarget->z - z; float oldyRot = yRot; - yRot = (float) (atan2(zd2, xd2) * 180 / PI) - 90; + yRot = static_cast(atan2(zd2, xd2) * 180 / PI) - 90; rotDiff = ((oldyRot - yRot) + 90) * PI / 180; xxa = -Mth::sin(rotDiff) * yya * 1.0f; @@ -315,7 +315,7 @@ void PathfinderMob::tickLeash() { // soft restriction shared_ptr leashHolder = getLeashHolder(); - restrictTo((int) leashHolder->x, (int) leashHolder->y, (int) leashHolder->z, 5); + restrictTo(static_cast(leashHolder->x), static_cast(leashHolder->y), static_cast(leashHolder->z), 5); float _distanceTo = distanceTo(leashHolder); diff --git a/Minecraft.World/PerformanceTimer.cpp b/Minecraft.World/PerformanceTimer.cpp index 5ed7ee0c8..1e01a4042 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 / (float)qwTicksPerSec.QuadPart; + m_fSecsPerTick = 1.0f / static_cast(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 * ((FLOAT)(qwDeltaTime.QuadPart)); + float fElapsedTime = m_fSecsPerTick * static_cast(qwDeltaTime.QuadPart); app.DebugPrintf("TIMER: %ls: Elapsed time %f\n", description.c_str(), fElapsedTime); #endif diff --git a/Minecraft.World/PerlinSimplexNoise.cpp b/Minecraft.World/PerlinSimplexNoise.cpp index dbc570a4c..a8f6101c7 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 == NULL || (int) buffer.length < xSize * ySize) + if (buffer.data == NULL || static_cast(buffer.length) < xSize * ySize) { if( buffer.data ) delete [] buffer.data; buffer = doubleArray(xSize * ySize); diff --git a/Minecraft.World/Pig.cpp b/Minecraft.World/Pig.cpp index cc042f586..54d82ad85 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -70,7 +70,7 @@ bool Pig::canBeControlledByRider() void Pig::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_SADDLE_ID, (byte) 0); + entityData->define(DATA_SADDLE_ID, static_cast(0)); } void Pig::addAdditonalSaveData(CompoundTag *tag) @@ -153,11 +153,11 @@ void Pig::setSaddle(bool value) { if (value) { - entityData->set(DATA_SADDLE_ID, (byte) 1); + entityData->set(DATA_SADDLE_ID, static_cast(1)); } else { - entityData->set(DATA_SADDLE_ID, (byte) 0); + entityData->set(DATA_SADDLE_ID, static_cast(0)); } } diff --git a/Minecraft.World/PigZombie.cpp b/Minecraft.World/PigZombie.cpp index c284c323f..6c5457c8a 100644 --- a/Minecraft.World/PigZombie.cpp +++ b/Minecraft.World/PigZombie.cpp @@ -78,7 +78,7 @@ bool PigZombie::canSpawn() void PigZombie::addAdditonalSaveData(CompoundTag *tag) { Zombie::addAdditonalSaveData(tag); - tag->putShort(L"Anger", (short) angerTime); + tag->putShort(L"Anger", static_cast(angerTime)); } void PigZombie::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index c71bbf95d..7cd4d1200 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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; @@ -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((float) player->x - x) < 2 && Mth::abs((float) player->z - z) < 2) + if (Mth::abs(static_cast(player->x) - x) < 2 && Mth::abs(static_cast(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/PistonMovingPiece.cpp b/Minecraft.World/PistonMovingPiece.cpp index 5fa9a475d..ed0bfeba3 100644 --- a/Minecraft.World/PistonMovingPiece.cpp +++ b/Minecraft.World/PistonMovingPiece.cpp @@ -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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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; diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index bd6b68a8e..b7c659bb3 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -175,8 +175,8 @@ void Player::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_PLAYER_FLAGS_ID, (byte) 0); - entityData->define(DATA_PLAYER_ABSORPTION_ID, (float) 0); + entityData->define(DATA_PLAYER_FLAGS_ID, static_cast(0)); + entityData->define(DATA_PLAYER_ABSORPTION_ID, static_cast(0)); entityData->define(DATA_SCORE_ID, (int) 0); } @@ -657,13 +657,13 @@ void Player::setCustomSkin(DWORD skinId) DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 && defaultSkinIndex > 0 ) { - playerSkin = (EDefaultSkins) defaultSkinIndex; + playerSkin = static_cast(defaultSkinIndex); } } if( playerSkin == eDefaultSkins_ServerSelected) { - playerSkin = (EDefaultSkins)(m_playerIndex + 1); + playerSkin = static_cast(m_playerIndex + 1); } // We always set a default skin, since we may be waiting for the player's custom skin to be transmitted @@ -1018,9 +1018,9 @@ void Player::aiStep() flyingSpeed += defaultFlySpeed * 0.3f; } - setSpeed((float) speed->getValue()); + setSpeed(static_cast(speed->getValue())); - float tBob = (float) sqrt(xd * xd + zd * zd); + float tBob = static_cast(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 = (float) atan(-yd * 0.2f) * 15.0f; + float tTilt = static_cast(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; @@ -1305,7 +1305,7 @@ 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", (short) sleepCounter); + entityTag->putShort(L"SleepTimer", static_cast(sleepCounter)); entityTag->putFloat(L"XpP", experienceProgress); entityTag->putInt(L"XpLevel", experienceLevel); @@ -1459,7 +1459,7 @@ float Player::getArmorCoverPercentage() count++; } } - return (float) count / (float) inventory->armor.length; + return static_cast(count) / static_cast(inventory->armor.length); } void Player::actuallyHurt(DamageSource *source, float dmg) @@ -1594,7 +1594,7 @@ void Player::attack(shared_ptr entity) return; } - float dmg = (float) getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); + float dmg = static_cast(getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue()); int knockback = 0; float magicBoost = 0; @@ -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, (byte) (currentValue | (1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue | (1 << flag))); } else { - entityData->set(DATA_PLAYER_FLAGS_ID, (byte) (currentValue & ~(1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); } } @@ -2121,7 +2121,7 @@ void Player::travel(float xa, float ya) float Player::getSpeed() { - return (float) getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue(); + return static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue()); } void Player::checkMovementStatistiscs(double dx, double dy, double dz) @@ -2133,7 +2133,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) } if (isUnderLiquid(Material::water)) { - int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); + int distance = static_cast(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 = (int) Math::round(sqrt(dx * dx + dz * dz) * 100.0f); + int horizontalDistance = static_cast(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 += (int) Math::round(dy * 100.0f); + distanceClimb += static_cast(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 = (int) Math::round(sqrt(dx * dx + dz * dz) * 100.0f); + int horizontalDistance = static_cast(Math::round(sqrt(dx * dx + dz * dz) * 100.0f)); if (horizontalDistance > 0) { distanceWalk += horizontalDistance; @@ -2197,7 +2197,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { if (riding != NULL) { - int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); + int distance = static_cast(Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f)); if (distance > 0) { if ( riding->instanceof(eTYPE_MINECART) ) @@ -2278,7 +2278,7 @@ void Player::causeFallDamage(float distance) if (distance >= 2) { - distanceFall += (int) Math::round(distance * 100.0); + distanceFall += static_cast(Math::round(distance * 100.0)); if( distanceFall >= 100 ) { int newDistance = distanceFall - (distanceFall % 100); @@ -2388,7 +2388,7 @@ void Player::increaseXp(int i) { i = max; } - experienceProgress += (float) i / getXpNeededForNextLevel(); + experienceProgress += static_cast(i) / getXpNeededForNextLevel(); totalExperience += i; while (experienceProgress >= 1) { @@ -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 (int)std::hash{}(k->name); // 4J Stu - Names are completely unique? + return static_cast(std::hash{}(k->name)); // 4J Stu - Names are completely unique? #endif //__PS3__ } diff --git a/Minecraft.World/PlayerEnderChestContainer.cpp b/Minecraft.World/PlayerEnderChestContainer.cpp index f0a1aaa3f..e84e59207 100644 --- a/Minecraft.World/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/PlayerEnderChestContainer.cpp @@ -41,7 +41,7 @@ ListTag *PlayerEnderChestContainer::createTag() if (item != NULL) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", (byte) i); + tag->putByte(L"Slot", static_cast(i)); item->save(tag); items->add(tag); } diff --git a/Minecraft.World/Pos.cpp b/Minecraft.World/Pos.cpp index e673ecc3e..b7695a35a 100644 --- a/Minecraft.World/Pos.cpp +++ b/Minecraft.World/Pos.cpp @@ -29,12 +29,12 @@ 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 NULL if it wasn't originally a Pos? - if (!( dynamic_cast( (Pos *)other ) != NULL )) + if (!( dynamic_cast( static_cast(other) ) != NULL )) { return false; } - Pos *p = (Pos *) other; + Pos *p = static_cast(other); return x == p->x && y == p->y && z == p->z; } diff --git a/Minecraft.World/PotionBrewing.cpp b/Minecraft.World/PotionBrewing.cpp index 8e27a6017..3ec38ef94 100644 --- a/Minecraft.World/PotionBrewing.cpp +++ b/Minecraft.World/PotionBrewing.cpp @@ -203,9 +203,9 @@ int PotionBrewing::getColorValue(vector *effects) for (int potency = 0; potency <= effect->getAmplifier(); potency++) { - red += (float) ((potionColor >> 16) & 0xff) / 255.0f; - green += (float) ((potionColor >> 8) & 0xff) / 255.0f; - blue += (float) ((potionColor >> 0) & 0xff) / 255.0f; + red += static_cast((potionColor >> 16) & 0xff) / 255.0f; + green += static_cast((potionColor >> 8) & 0xff) / 255.0f; + blue += static_cast((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 ((int) red) << 16 | ((int) green) << 8 | ((int) blue); + return static_cast(red) << 16 | static_cast(green) << 8 | static_cast(blue); } bool PotionBrewing::areAllEffectsAmbient(vector *effects) @@ -325,7 +325,7 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, } // split by and - int andIndex = (int)definition.find_first_of(L'&', start); + int andIndex = static_cast(definition.find_first_of(L'&', start)); if (andIndex >= 0 && andIndex < end) { int leftSide = parseEffectFormulaValue(definition, start, andIndex - 1, brew); @@ -570,7 +570,7 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis } wstring durationString = effIt->second; - int duration = parseEffectFormulaValue(durationString, 0, (int)durationString.length(), brew); + int duration = parseEffectFormulaValue(durationString, 0, static_cast(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, (int)amplifierString.length(), brew); + amplifier = parseEffectFormulaValue(amplifierString, 0, static_cast(amplifierString.length()), brew); if (amplifier < 0) { amplifier = 0; @@ -594,11 +594,11 @@ 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 = (int) Math::round((double) duration * effect->getDurationModifier()); + duration = static_cast(Math::round((double)duration * effect->getDurationModifier())); if ((brew & THROWABLE_MASK) != 0) { - duration = (int) Math::round((double) duration * .75 + .5); + duration = static_cast(Math::round((double)duration * .75 + .5)); } } @@ -756,7 +756,7 @@ int PotionBrewing::applyBrew(int currentBrew, const wstring &formula) { int start = 0; - int end = (int)formula.length(); + int end = static_cast(formula.length()); bool hasValue = false; bool isNot = false; diff --git a/Minecraft.World/PotionItem.h b/Minecraft.World/PotionItem.h index 9fa158c2a..4a43505f2 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 = (int) (20 * 1.6); + static const int DRINK_DURATION = static_cast(20 * 1.6); public: static const wstring DEFAULT_ICON; diff --git a/Minecraft.World/PreLoginPacket.cpp b/Minecraft.World/PreLoginPacket.cpp index 4b4742141..5be50ea79 100644 --- a/Minecraft.World/PreLoginPacket.cpp +++ b/Minecraft.World/PreLoginPacket.cpp @@ -92,7 +92,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(m_friendsOnlyBits); dos->writeInt(m_ugcPlayersVersion); - dos->writeByte((byte)m_dwPlayerCount); + dos->writeByte(static_cast(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 + (int)loginKey.length() + 4 +14 + 4 + 1 + 4; + return 4 + 4 + static_cast(loginKey.length()) + 4 +14 + 4 + 1 + 4; } diff --git a/Minecraft.World/PrimedTnt.cpp b/Minecraft.World/PrimedTnt.cpp index 79fd760fb..39b3ea736 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); 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", (byte) life); + entityTag->putByte(L"Fuse", static_cast(life)); } void PrimedTnt::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/Random.cpp b/Minecraft.World/Random.cpp index 9176bf384..ad8f61654 100644 --- a/Minecraft.World/Random.cpp +++ b/Minecraft.World/Random.cpp @@ -27,22 +27,22 @@ void Random::setSeed(__int64 s) int Random::next(int bits) { seed = (seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1); - return (int)(seed >> (48 - bits)); + return static_cast(seed >> (48 - bits)); } void Random::nextBytes(byte *bytes, unsigned int count) { for(unsigned int i = 0; i < count; i++ ) { - bytes[i] = (byte)next(8); + bytes[i] = static_cast(next(8)); } } double Random::nextDouble() { - return (((__int64)next(26) << 27) + next(27)) - / (double)(1LL << 53); + return ((static_cast<__int64>(next(26)) << 27) + next(27)) + / static_cast(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 (int)(((__int64)next(31) * n) >> 31); // 4J Stu - Made __int64 instead of long + return static_cast(((__int64)next(31) * n) >> 31); // 4J Stu - Made __int64 instead of long int bits, val; do @@ -92,12 +92,12 @@ int Random::nextInt(int n) float Random::nextFloat() { - return next(24) / ((float)(1 << 24)); + return next(24) / static_cast(1 << 24); } __int64 Random::nextLong() { - return ((__int64)next(32) << 32) + next(32); + return (static_cast<__int64>(next(32)) << 32) + next(32); } bool Random::nextBoolean() diff --git a/Minecraft.World/RandomLevelSource.cpp b/Minecraft.World/RandomLevelSource.cpp index 2b93578a6..3e6994f77 100644 --- a/Minecraft.World/RandomLevelSource.cpp +++ b/Minecraft.World/RandomLevelSource.cpp @@ -187,7 +187,7 @@ float RandomLevelSource::getHeightFalloff(int xxx, int zzz, int* pEMin) if( emin < falloffStart ) { int falloff = falloffStart - emin; - comp = ((float)falloff / (float)falloffStart ) * falloffMax; + comp = (static_cast(falloff) / static_cast(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 / (double) CHUNK_HEIGHT; + double yStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double xStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double zStep = 1 / static_cast(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 = (byte) Tile::stone_Id; + tileId = static_cast(Tile::stone_Id); } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = (byte) Tile::calmWater_Id; + tileId = static_cast(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 = (int) (depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); + int runDepth = static_cast(depthBuffer[x + z * 16] / 3 + 3 + random->nextDouble() * 0.25); int run = -1; @@ -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] = (byte) Tile::unbreakable_Id; + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -414,7 +414,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = (byte) Tile::stone_Id; + material = static_cast(Tile::stone_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { @@ -428,8 +428,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = (byte) Tile::ice_Id; - else top = (byte) Tile::calmWater_Id; + if (temp < 0.15f) top = static_cast(Tile::ice_Id); + else top = static_cast(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 = (byte) Tile::sandStone_Id; + material = static_cast(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 = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index 8dcbafdf6..cd41116ac 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -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((Tile *)Tile::pistonBase, 1), // + addShapedRecipy(new ItemInstance(static_cast(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((Tile *)Tile::pistonStickyBase, 1), // + addShapedRecipy(new ItemInstance(static_cast(Tile::pistonStickyBase), 1), // L"sscictg", L"S", // L"P", // @@ -1072,14 +1072,14 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) pwchString=va_arg(vl,wchar_t *); wString=pwchString; height++; - width = (int)wString.length(); + width = static_cast(wString.length()); map += wString; break; case L's': pwchString=va_arg(vl,wchar_t *); wString=pwchString; height++; - width = (int)wString.length(); + width = static_cast(wString.length()); map += wString; break; case L'w': @@ -1091,7 +1091,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) if(!wString.empty()) { height++; - width = (int)wString.length(); + width = static_cast(wString.length()); map += wString; } } @@ -1305,7 +1305,7 @@ void Recipes::buildRecipeIngredientsArray(void) { //RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); - int iRecipeC=(int)recipies->size(); + int iRecipeC=static_cast(recipies->size()); m_pRecipeIngredientsRequired= new Recipy::INGREDIENTS_REQUIRED [iRecipeC]; diff --git a/Minecraft.World/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 455323c2b..8e0de1156 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; - ((JukeboxTile *) Tile::jukebox)->setRecord(level, x, y, z, itemInstance); + static_cast(Tile::jukebox)->setRecord(level, x, y, z, itemInstance); level->levelEvent(nullptr, LevelEvent::SOUND_PLAY_RECORDING, x, y, z, id); itemInstance->count--; diff --git a/Minecraft.World/Region.cpp b/Minecraft.World/Region.cpp index e3e91bf0e..e4edce166 100644 --- a/Minecraft.World/Region.cpp +++ b/Minecraft.World/Region.cpp @@ -105,7 +105,7 @@ int Region::getTile(int x, int y, int z) xc -= xc1; zc -= zc1; - if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length) + if (xc < 0 || xc >= static_cast(chunks->length) || zc < 0 || zc >= static_cast((*chunks)[xc]->length)) { return 0; } @@ -124,7 +124,7 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc) int size = 16 * 16 * Level::maxBuildHeight; if( CachedTiles == NULL ) { - CachedTiles = (unsigned char *) malloc(size); + CachedTiles = static_cast(malloc(size)); } memcpy(CachedTiles, tiles, size); } @@ -137,7 +137,7 @@ LevelChunk* Region::getLevelChunk(int x, int y, int z) int xc = (x >> 4) - xc1; int zc = (z >> 4) - zc1; - if (xc < 0 || xc >= (int)chunks->length || zc < 0 || zc >= (int)(*chunks)[xc]->length) + if (xc < 0 || xc >= static_cast(chunks->length) || zc < 0 || zc >= static_cast((*chunks)[xc]->length)) { return NULL; } diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 2cfd9078f..10efc2fa2 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -78,7 +78,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) } else { - nSectors = (int) fileEntry->getFileSize() / SECTOR_BYTES; + nSectors = static_cast(fileEntry->getFileSize()) / SECTOR_BYTES; } sectorFree = new vector; sectorFree->reserve(nSectors); @@ -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 = (int)(find(sectorFree->begin(),sectorFree->end(),true) - sectorFree->begin()); // 4J - was sectorFree.indexOf(true) + int runStart = static_cast(find(sectorFree->begin(), sectorFree->end(), true) - sectorFree->begin()); // 4J - was sectorFree.indexOf(true) int runLength = 0; if (runStart != -1) { @@ -375,7 +375,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync //SetFilePointer(file,0,0,FILE_END); m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); - sectorNumber = (int)sectorFree->size(); + sectorNumber = static_cast(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 @@ -393,7 +393,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync PIXEndNamedEvent(); } } - setTimestamp(x, z, (int) (System::currentTimeMillis() / 1000L)); + setTimestamp(x, z, static_cast(System::currentTimeMillis() / 1000L)); } m_saveFile->ReleaseSaveAccess(); diff --git a/Minecraft.World/RemoveMobEffectPacket.cpp b/Minecraft.World/RemoveMobEffectPacket.cpp index fcda69110..7e2d7c84f 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 = (byte) (effect->getId() & 0xff); + this->effectId = static_cast(effect->getId() & 0xff); } void RemoveMobEffectPacket::read(DataInputStream *dis) diff --git a/Minecraft.World/RespawnPacket.cpp b/Minecraft.World/RespawnPacket.cpp index 5c04bbebb..d9e37dca5 100644 --- a/Minecraft.World/RespawnPacket.cpp +++ b/Minecraft.World/RespawnPacket.cpp @@ -91,7 +91,7 @@ int RespawnPacket::getEstimatedSize() int length=0; if (m_pLevelType != NULL) { - length = (int)m_pLevelType->getGeneratorName().length(); + length = static_cast(m_pLevelType->getGeneratorName().length()); } return 13+length; } diff --git a/Minecraft.World/SetEntityMotionPacket.cpp b/Minecraft.World/SetEntityMotionPacket.cpp index a0749b749..20d841f17 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 = (int) (xd * 8000.0); - ya = (int) (yd * 8000.0); - za = (int) (zd * 8000.0); + xa = static_cast(xd * 8000.0); + ya = static_cast(yd * 8000.0); + za = static_cast(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 = (int)dis->readByte(); - ya = (int)dis->readByte(); - za = (int)dis->readByte(); + xa = static_cast(dis->readByte()); + ya = static_cast(dis->readByte()); + za = static_cast(dis->readByte()); xa = ( xa << 24 ) >> 24; ya = ( ya << 24 ) >> 24; za = ( za << 24 ) >> 24; diff --git a/Minecraft.World/SetHealthPacket.cpp b/Minecraft.World/SetHealthPacket.cpp index 639cacd8b..4557f7bb4 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 = (ETelemetryChallenges)dis->readByte(); + damageSource = static_cast(dis->readByte()); } void SetHealthPacket::write(DataOutputStream *dos) //throws IOException diff --git a/Minecraft.World/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp index 15ccca2de..be1adb0b7 100644 --- a/Minecraft.World/ShapedRecipy.cpp +++ b/Minecraft.World/ShapedRecipy.cpp @@ -92,7 +92,7 @@ shared_ptr ShapedRecipy::assemble(shared_ptr cr if (item != NULL && item->hasTag()) { - result->setTag((CompoundTag *) item->tag->copy()); + result->setTag(static_cast(item->tag->copy())); } } } diff --git a/Minecraft.World/ShapelessRecipy.cpp b/Minecraft.World/ShapelessRecipy.cpp index 44bf6a54f..21d964b7d 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 (int)ingredients->size(); + return static_cast(ingredients->size()); } // 4J-PB diff --git a/Minecraft.World/SharedMonsterAttributes.cpp b/Minecraft.World/SharedMonsterAttributes.cpp index 3ff841973..12d467f2f 100644 --- a/Minecraft.World/SharedMonsterAttributes.cpp +++ b/Minecraft.World/SharedMonsterAttributes.cpp @@ -101,6 +101,6 @@ void SharedMonsterAttributes::loadAttribute(AttributeInstance *instance, Compoun AttributeModifier *SharedMonsterAttributes::loadAttributeModifier(CompoundTag *tag) { - eMODIFIER_ID id = (eMODIFIER_ID)tag->getInt(L"UUID"); + eMODIFIER_ID id = static_cast(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 32379c2a1..e865d899a 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/Sheep.cpp @@ -100,7 +100,7 @@ void Sheep::defineSynchedData() Animal::defineSynchedData(); // sheared and color share a byte - entityData->define(DATA_WOOL_ID, ((byte) 0)); //was new Byte((byte), 0) + entityData->define(DATA_WOOL_ID, static_cast(0)); //was new Byte((byte), 0) } void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) @@ -141,16 +141,16 @@ float Sheep::getHeadEatPositionScale(float a) } if (eatAnimationTick < 4) { - return ((float) eatAnimationTick - a) / 4.0f; + return (static_cast(eatAnimationTick) - a) / 4.0f; } - return -((float) (eatAnimationTick - EAT_ANIMATION_TICKS) - a) / 4.0f; + return -(static_cast(eatAnimationTick - EAT_ANIMATION_TICKS) - a) / 4.0f; } float Sheep::getHeadEatAngleScale(float a) { if (eatAnimationTick > 4 && eatAnimationTick <= (EAT_ANIMATION_TICKS - 4)) { - float scale = ((float) (eatAnimationTick - 4) - a) / (float) (EAT_ANIMATION_TICKS - 8); + float scale = (static_cast(eatAnimationTick - 4) - a) / static_cast(EAT_ANIMATION_TICKS - 8); return PI * .20f + PI * .07f * Mth::sin(scale * 28.7f); } if (eatAnimationTick > 0) @@ -196,7 +196,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag) { Animal::addAdditonalSaveData(tag); tag->putBoolean(L"Sheared", isSheared()); - tag->putByte(L"Color", (byte) getColor()); + tag->putByte(L"Color", static_cast(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, (byte) ((current & 0xf0) | (color & 0x0f))); + entityData->set(DATA_WOOL_ID, static_cast((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, (byte) (current | 0x10)); + entityData->set(DATA_WOOL_ID, static_cast(current | 0x10)); } else { - entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10)); + entityData->set(DATA_WOOL_ID, static_cast(current & ~0x10)); } } diff --git a/Minecraft.World/ShortTag.h b/Minecraft.World/ShortTag.h index 989e1fb14..cbe0b55fb 100644 --- a/Minecraft.World/ShortTag.h +++ b/Minecraft.World/ShortTag.h @@ -28,7 +28,7 @@ public: { if (Tag::equals(obj)) { - ShortTag *o = (ShortTag *) obj; + ShortTag *o = static_cast(obj); return data == o->data; } return false; diff --git a/Minecraft.World/SignTileEntity.cpp b/Minecraft.World/SignTileEntity.cpp index dc189102b..a90ca5017 100644 --- a/Minecraft.World/SignTileEntity.cpp +++ b/Minecraft.World/SignTileEntity.cpp @@ -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=(SignTileEntity *)lpParam; + SignTileEntity *pClass=static_cast(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 = (ServerLevel *)pClass->level; + ServerLevel *serverLevel = static_cast(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); diff --git a/Minecraft.World/SignUpdatePacket.cpp b/Minecraft.World/SignUpdatePacket.cpp index 7b3a32179..10cc223ee 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 += (int)lines[i].length(); + l += static_cast(lines[i].length()); return l; } diff --git a/Minecraft.World/SimplexNoise.cpp b/Minecraft.World/SimplexNoise.cpp index 469e0b416..35b86add9 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 ? (int) x : (int) x - 1; + return x > 0 ? static_cast(x) : static_cast(x) - 1; } double SimplexNoise::dot(int *g, double x, double y) diff --git a/Minecraft.World/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index 9afb95c6b..e7db69430 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -63,7 +63,7 @@ void Skeleton::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_TYPE_ID, (byte) TYPE_DEFAULT); + entityData->define(DATA_TYPE_ID, static_cast(TYPE_DEFAULT)); } bool Skeleton::useNewAi() @@ -114,7 +114,7 @@ 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), (int)floor( y + 0.5 ), Mth::floor(z))) + 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))) { bool burn = true; @@ -289,7 +289,7 @@ void Skeleton::performRangedAttack(shared_ptr target, float power) if (damageBonus > 0) { - arrow->setBaseDamage(arrow->getBaseDamage() + (double) damageBonus * .5 + .5); + arrow->setBaseDamage(arrow->getBaseDamage() + static_cast(damageBonus) * .5 + .5); } if (knockbackBonus > 0) { @@ -311,7 +311,7 @@ int Skeleton::getSkeletonType() void Skeleton::setSkeletonType(int type) { - entityData->set(DATA_TYPE_ID, (byte) type); + entityData->set(DATA_TYPE_ID, static_cast(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", (byte) getSkeletonType()); + entityTag->putByte(L"SkeletonType", static_cast(getSkeletonType())); } void Skeleton::setEquippedSlot(int slot, shared_ptr item) diff --git a/Minecraft.World/SkullItem.cpp b/Minecraft.World/SkullItem.cpp index 8fabc3cd6..f0356a965 100644 --- a/Minecraft.World/SkullItem.cpp +++ b/Minecraft.World/SkullItem.cpp @@ -57,7 +57,7 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play } skull->setSkullType(instance->getAuxValue(), extra); skull->setRotation(rot); - ((SkullTile *) Tile::skull)->checkMobSpawn(level, x, y, z, skull); + static_cast(Tile::skull)->checkMobSpawn(level, x, y, z, skull); } instance->count--; diff --git a/Minecraft.World/SkullTileEntity.cpp b/Minecraft.World/SkullTileEntity.cpp index ea19b4469..404332d46 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", (BYTE) (skullType & 0xff)); - tag->putByte(L"Rot", (BYTE) (rotation & 0xff)); + tag->putByte(L"SkullType", static_cast(skullType & 0xff)); + tag->putByte(L"Rot", static_cast(rotation & 0xff)); tag->putString(L"ExtraType", extraType); } diff --git a/Minecraft.World/Slime.cpp b/Minecraft.World/Slime.cpp index eb80d09c8..5f93dbfb2 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -47,12 +47,12 @@ void Slime::defineSynchedData() { Mob::defineSynchedData(); - entityData->define(ID_SIZE, (byte) 1); + entityData->define(ID_SIZE, static_cast(1)); } void Slime::setSize(int size) { - entityData->set(ID_SIZE, (byte) size); + entityData->set(ID_SIZE, static_cast(size)); setSize(0.6f * size, 0.6f * size); setPos(x, y, z); getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(size * size); @@ -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 = (float) 1 * getSize(); + yya = static_cast(1) * getSize(); } else { diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index bd0c2032f..1a7d27caa 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -330,7 +330,7 @@ void Socket::SocketOutputStreamLocal::write(unsigned int b) return; } EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - s_hostQueue[m_queueIdx].push((byte)b); + s_hostQueue[m_queueIdx].push(static_cast(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 = (byte)b; + bb = static_cast(b); barray.data = &bb; barray.length = 1; write(barray, 0, 1); diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index 6db131e78..15cd33acd 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 = (unsigned char *)malloc(128 * 128); + unsigned char *planeIndices = static_cast(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 = (unsigned char *)malloc(128); + unsigned char *planeIndices = static_cast(malloc(128)); for( int i = 0; i < 128; i++ ) { planeIndices[i] = ALL_0_INDEX; @@ -92,7 +92,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; // Allocate & copy indices ( 128 bytes ) and any allocated planes (128 * count) - unsigned char *destIndicesAndData = (unsigned char *)malloc( sourceCount * 128 + 128 ); + unsigned char *destIndicesAndData = static_cast(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. @@ -146,7 +146,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) } // Allocate required storage - unsigned char *planeIndices = (unsigned char *)malloc(128 * allocatedPlaneCount + 128); + unsigned char *planeIndices = static_cast(malloc(128 * allocatedPlaneCount + 128)); unsigned char *data = planeIndices + 128; XMemCpy(planeIndices, _planeIndices, 128); @@ -178,7 +178,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)allocatedPlaneCount) << 48; + newDataAndCount |= static_cast<__int64>(allocatedPlaneCount) << 48; updateDataAndCount( newDataAndCount ); } @@ -341,7 +341,7 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i } ptrdiff_t count = pucIn - &dataIn.data[offset]; - return (int)count; + return static_cast(count); } // Updates the data at offset position dataInOut with a region of data information - external ordering compatible with java DataLayer @@ -371,7 +371,7 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0 } ptrdiff_t count = pucOut - &dataInOut.data[offset]; - return (int)count; + return static_cast(count); } void SparseDataStorage::addNewPlane(int y) @@ -383,7 +383,7 @@ void SparseDataStorage::addNewPlane(int y) __int64 lastDataAndCount = dataAndCount; // Unpack count & data pointer - int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); + int lastLinesUsed = static_cast((lastDataAndCount >> 48) & 0xffff); unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); // Find out what to prefill the newly allocated line with @@ -394,7 +394,7 @@ void SparseDataStorage::addNewPlane(int y) int linesUsed = lastLinesUsed + 1; // Allocate new memory storage, copy over anything from old storage, and initialise remainder - unsigned char *dataPointer = (unsigned char *)malloc(linesUsed * 128 + 128); + unsigned char *dataPointer = static_cast(malloc(linesUsed * 128 + 128)); XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 ); dataPointer[y] = lastLinesUsed; @@ -403,7 +403,7 @@ void SparseDataStorage::addNewPlane(int y) #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)linesUsed) << 48; + newDataAndCount |= static_cast<__int64>(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 @@ -543,7 +543,7 @@ int SparseDataStorage::compress() if( needsCompressed ) { - unsigned char *newIndicesAndData = (unsigned char *)malloc( 128 + 128 * planesToAlloc ); + unsigned char *newIndicesAndData = static_cast(malloc(128 + 128 * planesToAlloc)); unsigned char *pucData = newIndicesAndData + 128; XMemCpy( newIndicesAndData, _planeIndices, 128 ); @@ -560,7 +560,7 @@ int SparseDataStorage::compress() #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)planesToAlloc) << 48; + newDataAndCount |= static_cast<__int64>(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 @@ -586,7 +586,7 @@ int SparseDataStorage::compress() } else { - return (int)((lastDataAndCount >> 48 ) & 0xffff); + return static_cast((lastDataAndCount >> 48) & 0xffff); } } @@ -612,14 +612,14 @@ void SparseDataStorage::write(DataOutputStream *dos) void SparseDataStorage::read(DataInputStream *dis) { int count = dis->readInt(); - unsigned char *dataPointer = (unsigned char *)malloc(count * 128 + 128); + unsigned char *dataPointer = static_cast(malloc(count * 128 + 128)); byteArray wrapper(dataPointer, count * 128 + 128); dis->readFully(wrapper); #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)count) << 48; + newDataAndCount |= static_cast<__int64>(count) << 48; updateDataAndCount(newDataAndCount); } diff --git a/Minecraft.World/SparseLightStorage.cpp b/Minecraft.World/SparseLightStorage.cpp index f9a2f0cbd..f0dc9f7ce 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 = (unsigned char *)malloc(128 * 128); + unsigned char *planeIndices = static_cast(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 = (unsigned char *)malloc(128); + unsigned char *planeIndices = static_cast(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 = (unsigned char *)malloc( sourceCount * 128 + 128 ); + unsigned char *destIndicesAndData = static_cast(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 = (unsigned char *)malloc(128 * allocatedPlaneCount + 128); + unsigned char *planeIndices = static_cast(malloc(128 * allocatedPlaneCount + 128)); unsigned char *data = planeIndices + 128; XMemCpy(planeIndices, _planeIndices, 128); @@ -182,7 +182,7 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) planeIndices) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)allocatedPlaneCount) << 48; + newDataAndCount |= static_cast<__int64>(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 = (unsigned char *)malloc(128); + unsigned char *planeIndices = static_cast(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 (int)count; + return static_cast(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 (int)count; + return static_cast(count); } void SparseLightStorage::addNewPlane(int y) @@ -388,7 +388,7 @@ void SparseLightStorage::addNewPlane(int y) __int64 lastDataAndCount = dataAndCount; // Unpack count & data pointer - int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff); + int lastLinesUsed = static_cast((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 = (unsigned char *)malloc(linesUsed * 128 + 128); + unsigned char *dataPointer = static_cast(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 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)linesUsed) << 48; + newDataAndCount |= static_cast<__int64>(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 @@ -560,7 +560,7 @@ int SparseLightStorage::compress() if( needsCompressed ) { - unsigned char *newIndicesAndData = (unsigned char *)malloc( 128 + 128 * planesToAlloc ); + unsigned char *newIndicesAndData = static_cast(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 newDataAndCount = ((__int64) newIndicesAndData) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)planesToAlloc) << 48; + newDataAndCount |= static_cast<__int64>(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 (int)((lastDataAndCount >> 48 ) & 0xffff); + return static_cast((lastDataAndCount >> 48) & 0xffff); } } @@ -629,14 +629,14 @@ void SparseLightStorage::write(DataOutputStream *dos) void SparseLightStorage::read(DataInputStream *dis) { int count = dis->readInt(); - unsigned char *dataPointer = (unsigned char *)malloc(count * 128 + 128); + unsigned char *dataPointer = static_cast(malloc(count * 128 + 128)); byteArray wrapper(dataPointer, count * 128 + 128); dis->readFully(wrapper); #pragma warning ( disable : 4826 ) __int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL; #pragma warning ( default : 4826 ) - newDataAndCount |= ((__int64)count) << 48; + newDataAndCount |= static_cast<__int64>(count) << 48; updateDataAndCount( newDataAndCount ); } diff --git a/Minecraft.World/Spider.cpp b/Minecraft.World/Spider.cpp index 49997db39..ffce490d8 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, (byte) 0); + entityData->define(DATA_FLAGS_ID, static_cast(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 = (float) sqrt(xdd * xdd + zdd * zdd); + float dd = static_cast(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; @@ -208,12 +208,12 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /* if (level->difficulty > Difficulty::NORMAL && level->random->nextFloat() < SPIDER_SPECIAL_EFFECT_CHANCE * level->getDifficulty(x, y, z)) { - ((SpiderEffectsGroupData *) groupData)->setRandomEffect(level->random); + static_cast(groupData)->setRandomEffect(level->random); } } if ( dynamic_cast( groupData ) != NULL) { - int effect = ((SpiderEffectsGroupData *) groupData)->effectId; + int effect = static_cast(groupData)->effectId; if (effect > 0 && MobEffect::effects[effect] != NULL) { addEffect(new MobEffectInstance(effect, Integer::MAX_VALUE)); diff --git a/Minecraft.World/Squid.cpp b/Minecraft.World/Squid.cpp index 7aae36154..4539d5ee9 100644 --- a/Minecraft.World/Squid.cpp +++ b/Minecraft.World/Squid.cpp @@ -140,10 +140,10 @@ void Squid::aiStep() double horizontalMovement = sqrt(xd * xd + zd * zd); - yBodyRot += ((-(float) atan2(xd, zd) * 180 / PI) - yBodyRot) * 0.1f; + yBodyRot += ((-static_cast(atan2(xd, zd)) * 180 / PI) - yBodyRot) * 0.1f; yRot = yBodyRot; zBodyRot = zBodyRot + (float) PI * rotateSpeed * 1.5f; - xBodyRot += ((-(float) atan2(horizontalMovement, yd) * 180 / PI) - xBodyRot) * 0.1f; + xBodyRot += ((-static_cast(atan2(horizontalMovement, yd)) * 180 / PI) - xBodyRot) * 0.1f; } else { diff --git a/Minecraft.World/Stats.cpp b/Minecraft.World/Stats.cpp index c8a615ff5..3d4020b17 100644 --- a/Minecraft.World/Stats.cpp +++ b/Minecraft.World/Stats.cpp @@ -67,13 +67,13 @@ Stat *Stats::completeTheEnd = NULL; // The number of times this player has been void Stats::staticCtor() { - 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::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::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(); diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index bf9b058d1..69ced0d27 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -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((int) (25 / growthSpeed) + 1) == 0) + if (random->nextInt(static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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, (float) tls->yy1, 0.5f + ss); + setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, static_cast(tls->yy1), 0.5f + ss); } int StemTile::getRenderShape() diff --git a/Minecraft.World/StringHelpers.cpp b/Minecraft.World/StringHelpers.cpp index 6985c88f8..43b4f58b4 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; - int start = (int)a.find_first_not_of(L" \t\n\r"); - int end = (int)a.find_last_not_of(L" \t\n\r"); + int start = static_cast(a.find_first_not_of(L" \t\n\r")); + int end = static_cast(a.find_last_not_of(L" \t\n\r")); if( start == wstring::npos ) start = 0; - if( end == wstring::npos ) end = (int)a.size()-1; + if( end == wstring::npos ) end = static_cast(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] = (char)c; + buf[i] = static_cast(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] = (char)c; + buf[i] = static_cast(c); } buf[name.length()] = 0; return buf; diff --git a/Minecraft.World/StringTag.h b/Minecraft.World/StringTag.h index 8eb0eb7fd..36b603689 100644 --- a/Minecraft.World/StringTag.h +++ b/Minecraft.World/StringTag.h @@ -34,7 +34,7 @@ public: { if (Tag::equals(obj)) { - StringTag *o = (StringTag *) obj; + StringTag *o = static_cast(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 fa85dc429..2ce875950 100644 --- a/Minecraft.World/StrongholdFeature.cpp +++ b/Minecraft.World/StrongholdFeature.cpp @@ -136,8 +136,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) } #endif - int selectedX = (int) (Math::round(cos(angle) * dist)); - int selectedZ = (int) (Math::round(sin(angle) * dist)); + int selectedX = static_cast(Math::round(cos(angle) * dist)); + int selectedZ = static_cast(Math::round(sin(angle) * dist)); TilePos *position = level->getBiomeSource()->findBiome((selectedX << 4) + 8, (selectedZ << 4) + 8, 7 << 4, allowedBiomes, &random); if (position != NULL) @@ -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 / (double) strongholdPos_length; + angle += PI * 2.0 / static_cast(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 / (double) spread; + angle = random.nextDouble() * PI * 2.0 * circle / static_cast(spread); #endif } while(!hasFoundValidPos && findAttempts < MAX_STRONGHOLD_ATTEMPTS); @@ -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() || ((StrongholdPieces::StartPiece *) start->getPieces()->front())->portalRoomPiece == NULL) + while (start->getPieces()->empty() || static_cast(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((int)pendingChildren->size()); + int pos = random->nextInt(static_cast(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 383be42c4..e1f912bc0 100644 --- a/Minecraft.World/StrongholdPieces.cpp +++ b/Minecraft.World/StrongholdPieces.cpp @@ -268,7 +268,7 @@ void StrongholdPieces::StrongholdPiece::addAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::StrongholdPiece::readAdditonalSaveData(CompoundTag *tag) { - entryDoor = (SmallDoorType)_fromString(tag->getString(L"EntryDoor")); + entryDoor = static_cast(_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) @@ -554,7 +554,7 @@ void StrongholdPieces::StairsDown::addChildren(StructurePiece *startPiece, list< { imposedPiece = EPieceClass_FiveCrossing; } - generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); } StrongholdPieces::StairsDown *StrongholdPieces::StairsDown::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -562,7 +562,7 @@ StrongholdPieces::StairsDown *StrongholdPieces::StairsDown::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -663,9 +663,9 @@ void StrongholdPieces::Straight::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::Straight::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - 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); + 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); } StrongholdPieces::Straight *StrongholdPieces::Straight::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -673,7 +673,7 @@ StrongholdPieces::Straight *StrongholdPieces::Straight::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -765,7 +765,7 @@ void StrongholdPieces::ChestCorridor::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::ChestCorridor::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); } StrongholdPieces::ChestCorridor *StrongholdPieces::ChestCorridor::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -773,7 +773,7 @@ StrongholdPieces::ChestCorridor *StrongholdPieces::ChestCorridor::createPiece(li BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -837,7 +837,7 @@ StrongholdPieces::StraightStairsDown::StraightStairsDown(int genDepth, Random *r void StrongholdPieces::StraightStairsDown::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); } StrongholdPieces::StraightStairsDown *StrongholdPieces::StraightStairsDown::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -845,7 +845,7 @@ StrongholdPieces::StraightStairsDown *StrongholdPieces::StraightStairsDown::crea BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 4 - height, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -904,11 +904,11 @@ void StrongholdPieces::LeftTurn::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 1, 1); } else { - generateSmallDoorChildRight((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildRight(static_cast(startPiece), pieces, random, 1, 1); } } @@ -917,7 +917,7 @@ StrongholdPieces::LeftTurn *StrongholdPieces::LeftTurn::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -965,11 +965,11 @@ void StrongholdPieces::RightTurn::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 1, 1); } else { - generateSmallDoorChildLeft((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, 1, 1); } } @@ -1023,9 +1023,9 @@ void StrongholdPieces::RoomCrossing::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward((StartPiece*) startPiece, pieces, random, 4, 1); - generateSmallDoorChildLeft((StartPiece*) startPiece, pieces, random, 1, 4); - generateSmallDoorChildRight((StartPiece*) startPiece, pieces, random, 1, 4); + generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 4, 1); + generateSmallDoorChildLeft(static_cast(startPiece), pieces, random, 1, 4); + generateSmallDoorChildRight(static_cast(startPiece), pieces, random, 1, 4); } StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1033,7 +1033,7 @@ StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1177,7 +1177,7 @@ StrongholdPieces::PrisonHall::PrisonHall(int genDepth, Random *random, BoundingB void StrongholdPieces::PrisonHall::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - generateSmallDoorChildForward((StartPiece *) startPiece, pieces, random, 1, 1); + generateSmallDoorChildForward(static_cast(startPiece), pieces, random, 1, 1); } StrongholdPieces::PrisonHall *StrongholdPieces::PrisonHall::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1185,7 +1185,7 @@ StrongholdPieces::PrisonHall *StrongholdPieces::PrisonHall::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1264,7 +1264,7 @@ StrongholdPieces::Library *StrongholdPieces::Library::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1465,11 +1465,11 @@ void StrongholdPieces::FiveCrossing::addChildren(StructurePiece *startPiece, lis zOffB = depth - 3 - zOffB; } - 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); + 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); } StrongholdPieces::FiveCrossing *StrongholdPieces::FiveCrossing::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1477,7 +1477,7 @@ StrongholdPieces::FiveCrossing *StrongholdPieces::FiveCrossing::createPiece(list BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -3, 0, width, height, depth, direction); StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = ((StrongholdPieces::StartPiece *) pieces->front()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { @@ -1563,7 +1563,7 @@ void StrongholdPieces::PortalRoom::addChildren(StructurePiece *startPiece, list< { if (startPiece != NULL) { - ((StartPiece *) startPiece)->portalRoomPiece = this; + static_cast(startPiece)->portalRoomPiece = this; } } @@ -1573,7 +1573,7 @@ StrongholdPieces::PortalRoom *StrongholdPieces::PortalRoom::createPiece(listfront()); + if(pieces != NULL) startPiece = static_cast(pieces->front()); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) { diff --git a/Minecraft.World/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index 85a19ab43..be0822bf5 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -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 = (float)( x1 - x0 + 1 ); - float diagY = (float)( y1 - y0 + 1 ); - float diagZ = (float)( z1 - z0 + 1 ); + float diagX = static_cast(x1 - x0 + 1); + float diagY = static_cast(y1 - y0 + 1); + float diagZ = static_cast(z1 - z0 + 1); float cx = x0 + diagX / 2; float cz = z0 + diagZ / 2; for ( int y = y0; y <= y1; y++ ) { - float normalizedYDistance = ( float )( y - y0 ) / diagY; + float normalizedYDistance = static_cast(y - y0) / diagY; for ( int x = x0; x <= x1; x++ ) { diff --git a/Minecraft.World/StructureRecipies.cpp b/Minecraft.World/StructureRecipies.cpp index c3e628638..1706a7ced 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((Tile*)Tile::chest), // + r->addShapedRecipy(new ItemInstance(static_cast(Tile::chest)), // L"sssctg", L"###", // L"# #", // diff --git a/Minecraft.World/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index 655fa0c30..577063db6 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -485,7 +485,7 @@ int SynchedEntityData::getSizeInBytes() size += 4; break; case TYPE_STRING: - size += (int)dataItem->getValue_wstring().length() + 2; // Estimate, assuming all ascii chars + size += static_cast(dataItem->getValue_wstring().length()) + 2; // Estimate, assuming all ascii chars break; case TYPE_ITEMINSTANCE: // short + byte + short diff --git a/Minecraft.World/TakeFlowerGoal.cpp b/Minecraft.World/TakeFlowerGoal.cpp index 48db34d38..0774374be 100644 --- a/Minecraft.World/TakeFlowerGoal.cpp +++ b/Minecraft.World/TakeFlowerGoal.cpp @@ -58,7 +58,7 @@ bool TakeFlowerGoal::canContinueToUse() void TakeFlowerGoal::start() { - pickupTick = villager->getRandom()->nextInt((int) (OfferFlowerGoal::OFFER_TICKS * 0.8)); + pickupTick = villager->getRandom()->nextInt(static_cast(OfferFlowerGoal::OFFER_TICKS * 0.8)); takeFlower = false; golem.lock()->getNavigation()->stop(); } diff --git a/Minecraft.World/TamableAnimal.cpp b/Minecraft.World/TamableAnimal.cpp index 2a3ea037f..a938cc293 100644 --- a/Minecraft.World/TamableAnimal.cpp +++ b/Minecraft.World/TamableAnimal.cpp @@ -19,7 +19,7 @@ TamableAnimal::~TamableAnimal() void TamableAnimal::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, (byte) 0); + entityData->define(DATA_FLAGS_ID, static_cast(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, (byte) (current | 0x04)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x04)); } else { - entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x04)); + entityData->set(DATA_FLAGS_ID, static_cast(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, (byte) (current | 0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); } } diff --git a/Minecraft.World/TeleportEntityPacket.cpp b/Minecraft.World/TeleportEntityPacket.cpp index d31f5bc2f..ccac5e515 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 = (byte) (e->yRot * 256 / 360); - xRot = (byte) (e->xRot * 256 / 360); + yRot = static_cast(e->yRot * 256 / 360); + xRot = static_cast(e->xRot * 256 / 360); } TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, byte yRot, byte xRot) diff --git a/Minecraft.World/TextureAndGeometryChangePacket.cpp b/Minecraft.World/TextureAndGeometryChangePacket.cpp index 04c88bed5..ec84031f0 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 + (int)path.size(); + return 8 + static_cast(path.size()); } diff --git a/Minecraft.World/TextureAndGeometryPacket.cpp b/Minecraft.World/TextureAndGeometryPacket.cpp index d28fc8628..5386bd12b 100644 --- a/Minecraft.World/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/TextureAndGeometryPacket.cpp @@ -100,7 +100,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P } else { - this->dwBoxC = (DWORD)pvSkinBoxes->size(); + this->dwBoxC = static_cast(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 = (DWORD)dis->readInt(); - dwTextureBytes = (DWORD)dis->readShort(); + dwSkinID = static_cast(dis->readInt()); + dwTextureBytes = static_cast(dis->readShort()); if(dwTextureBytes>0) { @@ -134,7 +134,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException } uiAnimOverrideBitmask = dis->readInt(); - dwBoxC = (DWORD)dis->readShort(); + dwBoxC = static_cast(dis->readShort()); if(dwBoxC>0) { @@ -143,7 +143,7 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException for(DWORD i=0;iBoxDataA[i].ePart = (eBodyPart) dis->readShort(); + this->BoxDataA[i].ePart = static_cast(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((short)dwTextureBytes); + dos->writeShort(static_cast(dwTextureBytes)); for(DWORD i=0;iwriteByte(this->pbData[i]); } dos->writeInt(uiAnimOverrideBitmask); - dos->writeShort((short)dwBoxC); + dos->writeShort(static_cast(dwBoxC)); for(DWORD i=0;iwriteShort((short)this->BoxDataA[i].ePart); + dos->writeShort(static_cast(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 2368136c4..cea04d254 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 = (ETextureChangeType)dis->readByte(); + action = static_cast(dis->readByte()); path = dis->readUTF(); } @@ -42,5 +42,5 @@ void TextureChangePacket::handle(PacketListener *listener) int TextureChangePacket::getEstimatedSize() { - return 5 + (int)path.size(); + return 5 + static_cast(path.size()); } diff --git a/Minecraft.World/TexturePacket.cpp b/Minecraft.World/TexturePacket.cpp index 77dfdc38c..061c6fc1e 100644 --- a/Minecraft.World/TexturePacket.cpp +++ b/Minecraft.World/TexturePacket.cpp @@ -37,7 +37,7 @@ void TexturePacket::handle(PacketListener *listener) void TexturePacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwBytes = (DWORD)dis->readShort(); + dwBytes = static_cast(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((short)dwBytes); + dos->writeShort(static_cast(dwBytes)); for(DWORD i=0;iwriteByte(this->pbData[i]); diff --git a/Minecraft.World/TheEndBiome.cpp b/Minecraft.World/TheEndBiome.cpp index 9e2359ed0..d54efb36e 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 = (byte) Tile::dirt_Id; - material = (byte) Tile::dirt_Id; + topMaterial = static_cast(Tile::dirt_Id); + material = static_cast(Tile::dirt_Id); decorator = new TheEndBiomeDecorator(this); } diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 67d85a923..5b965ef79 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 / (double) CHUNK_HEIGHT; + double yStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double xStep = 1 / static_cast(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 / (double) CHUNK_WIDTH; + double zStep = 1 / static_cast(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] = (byte) tileId; + blocks[offs] = static_cast(tileId); offs += step; val += vala; } @@ -139,7 +139,7 @@ void TheEndLevelRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray if (runDepth <= 0) { top = 0; - material = (byte) Tile::endStone_Id; + material = static_cast(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 = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE); + byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/Throwable.cpp b/Minecraft.World/Throwable.cpp index 7d30b898d..4aecacfda 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 = (float) sqrt(xd * xd + zd * zd); + float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); + xRotO = xRot = static_cast(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 = (float) sqrt(xd * xd + zd * zd); - yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); - xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + 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); } } @@ -220,9 +220,9 @@ void Throwable::tick() y += yd; z += zd; - float sd = (float) sqrt(xd * xd + zd * zd); - yRot = (float) (atan2(xd, zd) * 180 / PI); - xRot = (float) (atan2(yd, (double)sd) * 180 / PI); + 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); while (xRot - xRotO < -180) xRotO -= 360; @@ -267,12 +267,12 @@ float Throwable::getGravity() void Throwable::addAdditonalSaveData(CompoundTag *tag) { - 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)); + 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)); if (ownerName.empty() && (owner != NULL) && owner->instanceof(eTYPE_PLAYER) ) { diff --git a/Minecraft.World/ThrownExpBottle.cpp b/Minecraft.World/ThrownExpBottle.cpp index b8dbef96b..c700bdc56 100644 --- a/Minecraft.World/ThrownExpBottle.cpp +++ b/Minecraft.World/ThrownExpBottle.cpp @@ -40,7 +40,7 @@ void ThrownExpBottle::onHit(HitResult *res) if (!level->isClientSide) { - level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), 0); + level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), 0); int xpCount = 3 + level->random->nextInt(5) + level->random->nextInt(5); while (xpCount > 0) diff --git a/Minecraft.World/ThrownPotion.cpp b/Minecraft.World/ThrownPotion.cpp index 69c096a2c..fbab11d8f 100644 --- a/Minecraft.World/ThrownPotion.cpp +++ b/Minecraft.World/ThrownPotion.cpp @@ -117,7 +117,7 @@ void ThrownPotion::onHit(HitResult *res) } else { - int duration = (int) (scale * (double) effect->getDuration() + .5); + int duration = static_cast(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, (int) Math::round(x), (int) Math::round(y), (int) Math::round(z), getPotionValue() ); + level->levelEvent(LevelEvent::PARTICLES_POTION_SPLASH, static_cast(Math::round(x)), static_cast(Math::round(y)), static_cast(Math::round(z)), getPotionValue() ); remove(); } diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index a07fdfe43..ef1b7e358 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -236,7 +236,7 @@ void Tile::CreateNewThreadStorage() void Tile::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (GrassTile *) (new GrassTile(2)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"grass")->setDescriptionId(IDS_TILE_GRASS)->setUseDescriptionId(IDS_DESC_GRASS); + 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::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 = (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::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::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 = (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::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::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 = (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::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::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 = (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::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::web = (new WebTile(30)) ->setLightBlock(1)->setDestroyTime(4.0f)->setIconName(L"web")->setDescriptionId(IDS_TILE_WEB)->setUseDescriptionId(IDS_DESC_WEB); - 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::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::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 = (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::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::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 = (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::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::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 = (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::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::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 = (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::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::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 = (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::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::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 = (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::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::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 = (MycelTile *)(new MycelTile(110)) ->setDestroyTime(0.6f)->setSoundType(SOUND_GRASS)->setIconName(L"mycelium")->setDescriptionId(IDS_TILE_MYCEL)->setUseDescriptionId(IDS_DESC_MYCEL); + 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::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 = (CauldronTile *)(new CauldronTile(118)) ->setDestroyTime(2.0f)->setIconName(L"cauldron")->setDescriptionId(IDS_TILE_CAULDRON)->sendTileData()->setUseDescriptionId(IDS_DESC_CAULDRON); + Tile::cauldron = static_cast((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 = (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::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::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 = (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::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::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 = (BeaconTile *) (new BeaconTile(138)) ->setLightEmission(1.0f)->setIconName(L"beacon")->setDescriptionId(IDS_TILE_BEACON)->setUseDescriptionId(IDS_DESC_BEACON); + Tile::beacon = static_cast((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 = (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::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::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::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::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 = (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::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::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] = ( (ColoredTileItem *)(new ColoredTileItem(Tile::tallgrass_Id - 256, true))->setDescriptionId(IDS_TILE_TALL_GRASS))->setDescriptionPostfixes(ids); + Item::items[tallgrass_Id] = static_cast((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); @@ -597,7 +597,7 @@ Tile *Tile::setLightBlock(int i) Tile *Tile::setLightEmission(float f) { - Tile::lightEmission[id] = (int) (Level::MAX_BRIGHTNESS * f); + Tile::lightEmission[id] = static_cast(Level::MAX_BRIGHTNESS * f); return this; } @@ -671,7 +671,7 @@ Tile *Tile::disableMipmap() void Tile::setShape(float x0, float y0, float z0, float x1, float y1, float z1) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); @@ -813,7 +813,7 @@ Icon *Tile::getTexture(int face) AABB *Tile::getTileAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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); @@ -827,7 +827,7 @@ void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxe AABB *Tile::getAABB(Level *level, int x, int y, int z) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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); @@ -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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); Vec3 *xh0 = a->clipX(b, tls->xx0); Vec3 *xh1 = a->clipX(b, tls->xx1); @@ -1002,7 +1002,7 @@ bool Tile::containsX(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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; @@ -1012,7 +1012,7 @@ bool Tile::containsY(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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; @@ -1022,7 +1022,7 @@ bool Tile::containsZ(Vec3 *v) { if( v == NULL) return false; - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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; diff --git a/Minecraft.World/TileEntityDataPacket.cpp b/Minecraft.World/TileEntityDataPacket.cpp index 41be45267..10d64bb0a 100644 --- a/Minecraft.World/TileEntityDataPacket.cpp +++ b/Minecraft.World/TileEntityDataPacket.cpp @@ -50,7 +50,7 @@ void TileEntityDataPacket::write(DataOutputStream *dos) dos->writeInt(x); dos->writeShort(y); dos->writeInt(z); - dos->writeByte((byte) type); + dos->writeByte(static_cast(type)); writeNbt(tag, dos); } diff --git a/Minecraft.World/TileUpdatePacket.cpp b/Minecraft.World/TileUpdatePacket.cpp index a14231290..067d0615f 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 = (int)dis->readShort() & 0xffff; + block = static_cast(dis->readShort()) & 0xffff; BYTE dataLevel = dis->readByte(); data = dataLevel & 0xf; diff --git a/Minecraft.World/ToolRecipies.cpp b/Minecraft.World/ToolRecipies.cpp index 8ee4bbab6..82b02df1c 100644 --- a/Minecraft.World/ToolRecipies.cpp +++ b/Minecraft.World/ToolRecipies.cpp @@ -103,7 +103,7 @@ void ToolRecipies::addRecipes(Recipes *r) } } } - r->addShapedRecipy(new ItemInstance((Item *)Item::shears), + r->addShapedRecipy(new ItemInstance(static_cast(Item::shears)), L"sscig", L" #", // L"# ", // diff --git a/Minecraft.World/TopSnowTile.cpp b/Minecraft.World/TopSnowTile.cpp index 033b4eb24..d165500cf 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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); 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/TripWireTile.cpp b/Minecraft.World/TripWireTile.cpp index b8ae9f330..fb3fe150c 100644 --- a/Minecraft.World/TripWireTile.cpp +++ b/Minecraft.World/TripWireTile.cpp @@ -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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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/UpdateGameRuleProgressPacket.cpp b/Minecraft.World/UpdateGameRuleProgressPacket.cpp index 9459ed2b1..6f6530d4f 100644 --- a/Minecraft.World/UpdateGameRuleProgressPacket.cpp +++ b/Minecraft.World/UpdateGameRuleProgressPacket.cpp @@ -35,7 +35,7 @@ UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGa void UpdateGameRuleProgressPacket::read(DataInputStream *dis) //throws IOException { - m_definitionType = (ConsoleGameRules::EGameRuleType)dis->readInt(); + m_definitionType = static_cast(dis->readInt()); m_messageId = readUtf(dis,64); m_icon = dis->readInt(); m_auxValue = dis->readByte(); @@ -71,5 +71,5 @@ void UpdateGameRuleProgressPacket::handle(PacketListener *listener) int UpdateGameRuleProgressPacket::getEstimatedSize() { - return (int)m_messageId.length() + 4 + m_data.length; + return static_cast(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 e2f6233ec..e8879d761 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 = (BYTE) (effect->getId() & 0xff); - effectAmplifier = (char) (effect->getAmplifier() & 0xff); + effectId = static_cast(effect->getId() & 0xff); + effectAmplifier = static_cast(effect->getAmplifier() & 0xff); if (effect->getDuration() > Short::MAX_VALUE) { @@ -28,7 +28,7 @@ UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *ef } else { - effectDurationTicks = (short) effect->getDuration(); + effectDurationTicks = static_cast(effect->getDuration()); } } diff --git a/Minecraft.World/UseItemPacket.cpp b/Minecraft.World/UseItemPacket.cpp index 55e44342a..f8a5dac8a 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((int) (clickX * CLICK_ACCURACY)); - dos->write((int) (clickY * CLICK_ACCURACY)); - dos->write((int) (clickZ * CLICK_ACCURACY)); + dos->write(static_cast(clickX * CLICK_ACCURACY)); + dos->write(static_cast(clickY * CLICK_ACCURACY)); + dos->write(static_cast(clickZ * CLICK_ACCURACY)); } void UseItemPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/Vec3.cpp b/Minecraft.World/Vec3.cpp index 1fc26fd5b..69a332ccf 100644 --- a/Minecraft.World/Vec3.cpp +++ b/Minecraft.World/Vec3.cpp @@ -34,7 +34,7 @@ void Vec3::UseDefaultThreadStorage() void Vec3::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(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 = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); Vec3 *thisVec = &tls->pool[tls->poolPointer]; thisVec->set(x, y, z); tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE; diff --git a/Minecraft.World/VillageFeature.cpp b/Minecraft.World/VillageFeature.cpp index 5249256cd..e1ad19270 100644 --- a/Minecraft.World/VillageFeature.cpp +++ b/Minecraft.World/VillageFeature.cpp @@ -134,7 +134,7 @@ VillageFeature::VillageStart::VillageStart(Level *level, Random *random, int chu // prioritize roads if (pendingRoads->empty()) { - int pos = random->nextInt((int)pendingHouses->size()); + int pos = random->nextInt(static_cast(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((int)pendingRoads->size()); + int pos = random->nextInt(static_cast(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 1737d6e05..cee09e800 100644 --- a/Minecraft.World/VillagePieces.cpp +++ b/Minecraft.World/VillagePieces.cpp @@ -512,10 +512,10 @@ VillagePieces::Well::Well(StartPiece *startPiece, int genDepth, Random *random, void VillagePieces::Well::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - 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()); + 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()); } bool VillagePieces::Well::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -628,7 +628,7 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listnextInt(5); while (depth < length - 8) { - StructurePiece *piece = generateHouseNorthernLeft((StartPiece *) startPiece, pieces, random, 0, depth); + StructurePiece *piece = generateHouseNorthernLeft(static_cast(startPiece), pieces, random, 0, depth); if (piece != NULL) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); @@ -641,7 +641,7 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listnextInt(5); while (depth < length - 8) { - StructurePiece *piece = generateHouseNorthernRight((StartPiece *) startPiece, pieces, random, 0, depth); + StructurePiece *piece = generateHouseNorthernRight(static_cast(startPiece), pieces, random, 0, depth); if (piece != NULL) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); @@ -655,16 +655,16 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listx0 - 1, boundingBox->y0, boundingBox->z0, Direction::WEST, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z0, Direction::WEST, getGenDepth()); break; case Direction::SOUTH: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z1 - 2, Direction::WEST, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0 - 1, boundingBox->y0, boundingBox->z1 - 2, Direction::WEST, getGenDepth()); break; case Direction::EAST: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); break; case Direction::WEST: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); break; } } @@ -673,16 +673,16 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listx1 + 1, boundingBox->y0, boundingBox->z0, Direction::EAST, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z0, Direction::EAST, getGenDepth()); break; case Direction::SOUTH: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z1 - 2, Direction::EAST, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 + 1, boundingBox->y0, boundingBox->z1 - 2, Direction::EAST, getGenDepth()); break; case Direction::EAST: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x1 - 2, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); break; case Direction::WEST: - generateAndAddRoadPiece((StartPiece *) startPiece, pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); + generateAndAddRoadPiece(static_cast(startPiece), pieces, random, boundingBox->x0, boundingBox->y0, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); break; } } diff --git a/Minecraft.World/VillageSiege.cpp b/Minecraft.World/VillageSiege.cpp index e3d20ef34..0ce8a4e12 100644 --- a/Minecraft.World/VillageSiege.cpp +++ b/Minecraft.World/VillageSiege.cpp @@ -80,7 +80,7 @@ bool VillageSiege::tryToSetupSiege() vector > *players = &level->players; for(auto& player : *players) { - shared_ptr _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1); + shared_ptr _village = level->villages->getClosestVillage(static_cast(player->x), static_cast(player->y), static_cast(player->z), 1); village = _village; if (_village == NULL) continue; @@ -95,9 +95,9 @@ bool VillageSiege::tryToSetupSiege() bool overlaps = false; for (int i = 0; i < 10; ++i) { - spawnX = center->x + (int) (Mth::cos(level->random->nextFloat() * PI * 2.f) * radius * 0.9); + spawnX = center->x + static_cast(Mth::cos(level->random->nextFloat() * PI * 2.f) * radius * 0.9); spawnY = center->y; - spawnZ = center->z + (int) (Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9); + spawnZ = center->z + static_cast(Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9); overlaps = false; vector > *villages = level->villages->getVillages(); //for (Village v : level.villages.getVillages()) diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 18ed71785..cc17104f1 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -105,7 +105,7 @@ void Villager::serverAiMobStep() else { Pos *center = _village->getCenter(); - restrictTo(center->x, center->y, center->z, (int)((float)_village->getRadius() * 0.6f)); + restrictTo(center->x, center->y, center->z, static_cast((float)_village->getRadius() * 0.6f)); if (rewardPlayersOnFirstVillage) { rewardPlayersOnFirstVillage = false; diff --git a/Minecraft.World/VillagerGolem.cpp b/Minecraft.World/VillagerGolem.cpp index dba80ffa7..691bade8e 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, (byte) 0); + entityData->define(DATA_FLAGS_ID, static_cast(0)); } bool VillagerGolem::useNewAi() @@ -72,7 +72,7 @@ void VillagerGolem::serverAiMobStep() else { Pos *center = _village->getCenter(); - restrictTo(center->x, center->y, center->z, (int)((float)_village->getRadius()) * 0.6f); + restrictTo(center->x, center->y, center->z, static_cast((float)_village->getRadius()) * 0.6f); } } @@ -234,11 +234,11 @@ void VillagerGolem::setPlayerCreated(bool value) byte current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); } } diff --git a/Minecraft.World/Villages.cpp b/Minecraft.World/Villages.cpp index e636ed74e..b5fb1b471 100644 --- a/Minecraft.World/Villages.cpp +++ b/Minecraft.World/Villages.cpp @@ -117,7 +117,7 @@ void Villages::cluster() bool found = false; for(auto& village : villages) { - int dist = (int) village->getCenter()->distSqr(di->x, di->y, di->z); + int dist = static_cast(village->getCenter()->distSqr(di->x, di->y, di->z)); int radius = MaxDoorDist + village->getRadius(); if (dist > radius * radius) continue; village->addDoorInfo(di); @@ -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 = ((DoorTile *) Tile::door_wood)->getDir(level, x, y, z); + int dir = static_cast(Tile::door_wood)->getDir(level, x, y, z); if (dir == 0 || dir == 2) { int canSeeX = 0; diff --git a/Minecraft.World/WaterLilyTile.cpp b/Minecraft.World/WaterLilyTile.cpp index 15e43b9db..ec789afc7 100644 --- a/Minecraft.World/WaterLilyTile.cpp +++ b/Minecraft.World/WaterLilyTile.cpp @@ -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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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/WeighedTreasure.cpp b/Minecraft.World/WeighedTreasure.cpp index ec4280e4f..37b04fffc 100644 --- a/Minecraft.World/WeighedTreasure.cpp +++ b/Minecraft.World/WeighedTreasure.cpp @@ -22,7 +22,7 @@ void WeighedTreasure::addChestItems(Random *random, WeighedTreasureArray items, { for (int r = 0; r < numRolls; r++) { - WeighedTreasure *treasure = (WeighedTreasure *) WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items)); + WeighedTreasure *treasure = static_cast(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 = (WeighedTreasure *) WeighedRandom::getRandomItem(random, *((WeighedRandomItemArray *)&items)); + WeighedTreasure *treasure = static_cast(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 352747ce8..c9b7d5c88 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) / (float) maxWeight; + float pct = min(maxWeight, count) / static_cast(maxWeight); return Mth::ceil(pct * Redstone::SIGNAL_MAX); } } diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp index c697d4676..592fc5cd8 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, (byte) 0); + getEntityData()->define(DATA_USING_ITEM, static_cast(0)); } int Witch::getAmbientSound() @@ -63,7 +63,7 @@ int Witch::getDeathSound() void Witch::setUsingItem(bool isUsing) { - getEntityData()->set(DATA_USING_ITEM, isUsing ? (byte) 1 : (byte) 0); + getEntityData()->set(DATA_USING_ITEM, isUsing ? static_cast(1) : static_cast(0)); } bool Witch::isUsingItem() diff --git a/Minecraft.World/WitherBoss.cpp b/Minecraft.World/WitherBoss.cpp index 84cf13825..8a568b894 100644 --- a/Minecraft.World/WitherBoss.cpp +++ b/Minecraft.World/WitherBoss.cpp @@ -148,7 +148,7 @@ void WitherBoss::aiStep() } if ((xd * xd + zd * zd) > .05f) { - yRot = (float) atan2(zd, xd) * Mth::RADDEG - 90; + yRot = static_cast(atan2(zd, xd)) * Mth::RADDEG - 90; } Monster::aiStep(); @@ -178,8 +178,8 @@ void WitherBoss::aiStep() double zd = e->z - hz; double sd = Mth::sqrt(xd * xd + zd * zd); - float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; - float xRotD = (float) -(atan2(yd, sd) * 180 / PI); + float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float xRotD = static_cast(-(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, (int) x, (int) y, (int) z, 0); + level->globalLevelEvent(LevelEvent::SOUND_WITHER_BOSS_SPAWN, static_cast(x), static_cast(y), static_cast(z), 0); } setInvulnerableTicks(newCount); @@ -346,7 +346,7 @@ void WitherBoss::newServerAiStep() } if (destroyed) { - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, static_cast(x), static_cast(y), static_cast(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, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, static_cast(x), static_cast(y), static_cast(z), 0); double hx = getHeadX(head); double hy = getHeadY(head); diff --git a/Minecraft.World/WitherSkull.cpp b/Minecraft.World/WitherSkull.cpp index d67660c40..92f810df7 100644 --- a/Minecraft.World/WitherSkull.cpp +++ b/Minecraft.World/WitherSkull.cpp @@ -111,7 +111,7 @@ bool WitherSkull::hurt(DamageSource *source, float damage) void WitherSkull::defineSynchedData() { - entityData->define(DATA_DANGEROUS, (byte) 0); + entityData->define(DATA_DANGEROUS, static_cast(0)); } bool WitherSkull::isDangerous() @@ -121,7 +121,7 @@ bool WitherSkull::isDangerous() void WitherSkull::setDangerous(bool value) { - entityData->set(DATA_DANGEROUS, value ? (byte) 1 : (byte) 0); + entityData->set(DATA_DANGEROUS, value ? static_cast(1) : static_cast(0)); } bool WitherSkull::shouldBurn() diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index 1988382e1..2443c6632 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -100,8 +100,8 @@ void Wolf::defineSynchedData() { TamableAnimal::defineSynchedData(); entityData->define(DATA_HEALTH_ID, getHealth()); - entityData->define(DATA_INTERESTED_ID, (byte)0); - entityData->define(DATA_COLLAR_COLOR, (byte) ColoredTile::getTileDataForItemAuxValue(DyePowderItem::RED)); + entityData->define(DATA_INTERESTED_ID, static_cast(0)); + entityData->define(DATA_COLLAR_COLOR, static_cast(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", (byte) getCollarColor()); + tag->putByte(L"CollarColor", static_cast(getCollarColor())); } void Wolf::readAdditionalSaveData(CompoundTag *tag) @@ -224,8 +224,8 @@ void Wolf::tick() if (shakeAnim > 0.4f) { - float yt = (float) bb->y0; - int shakeCount = (int) (Mth::sin((shakeAnim - 0.4f) * PI) * 7.0f); + float yt = static_cast(bb->y0); + int shakeCount = static_cast(Mth::sin((shakeAnim - 0.4f) * PI) * 7.0f); for (int i = 0; i < shakeCount; i++) { float xo = (random->nextFloat() * 2 - 1) * bbWidth * 0.5f; @@ -469,7 +469,7 @@ bool Wolf::isFood(shared_ptr item) { if (item == NULL) return false; if (dynamic_cast(Item::items[item->id]) == NULL) return false; - return ((FoodItem *) Item::items[item->id])->isMeat(); + return static_cast(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, (byte) (current | 0x02)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x02)); } else { - entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x02)); } } @@ -503,7 +503,7 @@ int Wolf::getCollarColor() void Wolf::setCollarColor(int color) { - entityData->set(DATA_COLLAR_COLOR, (byte) (color & 0xF)); + entityData->set(DATA_COLLAR_COLOR, static_cast(color & 0xF)); } // 4J-PB added for tooltips @@ -536,11 +536,11 @@ void Wolf::setIsInterested(bool value) { if (value) { - entityData->set(DATA_INTERESTED_ID, (byte) 1); + entityData->set(DATA_INTERESTED_ID, static_cast(1)); } else { - entityData->set(DATA_INTERESTED_ID, (byte) 0); + entityData->set(DATA_INTERESTED_ID, static_cast(0)); } } diff --git a/Minecraft.World/WoolCarpetTile.cpp b/Minecraft.World/WoolCarpetTile.cpp index b509a312c..370b40100 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 = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); + ThreadStorage *tls = static_cast(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/Zombie.cpp b/Minecraft.World/Zombie.cpp index 7cdc31809..d13f18fe1 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, (byte) 0); - getEntityData()->define(DATA_VILLAGER_ID, (byte) 0); - getEntityData()->define(DATA_CONVERTING_ID, (byte) 0); + getEntityData()->define(DATA_BABY_ID, static_cast(0)); + getEntityData()->define(DATA_VILLAGER_ID, static_cast(0)); + getEntityData()->define(DATA_CONVERTING_ID, static_cast(0)); } int Zombie::getArmorValue() @@ -87,12 +87,12 @@ bool Zombie::useNewAi() bool Zombie::isBaby() { - return getEntityData()->getByte(DATA_BABY_ID) == (byte) 1; + return getEntityData()->getByte(DATA_BABY_ID) == static_cast(1); } void Zombie::setBaby(bool baby) { - getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0)); + getEntityData()->set(DATA_BABY_ID, static_cast(baby ? 1 : 0)); if (level != NULL && !level->isClientSide) { @@ -107,12 +107,12 @@ void Zombie::setBaby(bool baby) bool Zombie::isVillager() { - return getEntityData()->getByte(DATA_VILLAGER_ID) == (byte) 1; + return getEntityData()->getByte(DATA_VILLAGER_ID) == static_cast(1); } void Zombie::setVillager(bool villager) { - getEntityData()->set(DATA_VILLAGER_ID, (byte) (villager ? 1 : 0)); + getEntityData()->set(DATA_VILLAGER_ID, static_cast(villager ? 1 : 0)); } void Zombie::aiStep() @@ -120,7 +120,7 @@ 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), (int)floor( y + 0.5 ), Mth::floor(z))) + 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))) { bool burn = true; @@ -324,7 +324,7 @@ void Zombie::killed(shared_ptr mob) if (mob->isBaby()) zombie->setBaby(true); level->addEntity(zombie); - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_INFECTED, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_INFECTED, static_cast(x), static_cast(y), static_cast(z), 0); } } @@ -342,7 +342,7 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* if ( dynamic_cast( groupData ) != NULL) { - ZombieGroupData *zombieData = (ZombieGroupData *) groupData; + ZombieGroupData *zombieData = static_cast(groupData); if (zombieData->isVillager) { @@ -414,7 +414,7 @@ bool Zombie::mobInteract(shared_ptr player) void Zombie::startConverting(int time) { villagerConversionTime = time; - getEntityData()->set(DATA_CONVERTING_ID, (byte) 1); + getEntityData()->set(DATA_CONVERTING_ID, static_cast(1)); removeEffect(MobEffect::weakness->id); addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0))); @@ -441,7 +441,7 @@ bool Zombie::removeWhenFarAway() bool Zombie::isConverting() { - return getEntityData()->getByte(DATA_CONVERTING_ID) == (byte) 1; + return getEntityData()->getByte(DATA_CONVERTING_ID) == static_cast(1); } void Zombie::finishConversion() @@ -455,7 +455,7 @@ void Zombie::finishConversion() level->addEntity(villager); villager->addEffect(new MobEffectInstance(MobEffect::confusion->id, SharedConstants::TICKS_PER_SECOND * 10, 0)); - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_CONVERTED, (int) x, (int) y, (int) z, 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_CONVERTED, static_cast(x), static_cast(y), static_cast(z), 0); } int Zombie::getConversionProgress() @@ -466,11 +466,11 @@ int Zombie::getConversionProgress() { int specialBlocksCount = 0; - for (int xx = (int) x - SPECIAL_BLOCK_RADIUS; xx < (int) x + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; xx++) + for (int xx = static_cast(x) - SPECIAL_BLOCK_RADIUS; xx < static_cast(x) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; xx++) { - for (int yy = (int) y - SPECIAL_BLOCK_RADIUS; yy < (int) y + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; yy++) + for (int yy = static_cast(y) - SPECIAL_BLOCK_RADIUS; yy < static_cast(y) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; yy++) { - for (int zz = (int) z - SPECIAL_BLOCK_RADIUS; zz < (int) z + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; zz++) + for (int zz = static_cast(z) - SPECIAL_BLOCK_RADIUS; zz < static_cast(z) + SPECIAL_BLOCK_RADIUS && specialBlocksCount < MAX_SPECIAL_BLOCKS_COUNT; zz++) { int tile = level->getTile(xx, yy, zz); diff --git a/Minecraft.World/ZoneIo.cpp b/Minecraft.World/ZoneIo.cpp index f1838c869..5860b10c9 100644 --- a/Minecraft.World/ZoneIo.cpp +++ b/Minecraft.World/ZoneIo.cpp @@ -22,7 +22,7 @@ void ZoneIo::write(byteArray bb, int size) void ZoneIo::write(ByteBuffer *bb, int size) { DWORD numberOfBytesWritten; - SetFilePointer(channel,(int)pos,NULL,NULL); + SetFilePointer(channel,static_cast(pos),NULL,NULL); WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,NULL); pos += size; } @@ -31,7 +31,7 @@ ByteBuffer *ZoneIo::read(int size) { DWORD numberOfBytesRead; byteArray bb = byteArray(size); - SetFilePointer(channel,(int)pos,NULL,NULL); + SetFilePointer(channel,static_cast(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); diff --git a/Minecraft.World/compression.cpp b/Minecraft.World/compression.cpp index 99c5228ab..6a43e112c 100644 --- a/Minecraft.World/compression.cpp +++ b/Minecraft.World/compression.cpp @@ -42,7 +42,7 @@ void Compression::UseDefaultThreadStorage() void Compression::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); if( tls == tlsDefault ) return; delete tls; @@ -50,7 +50,7 @@ void Compression::ReleaseThreadStorage() Compression *Compression::getCompression() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(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 = (unsigned char *)pSource; + unsigned char *pucIn = static_cast(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 = (unsigned int)(pucOut - rleCompressBuf); + unsigned int rleSize = static_cast(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 = (unsigned char *)pSource; + unsigned char *pucIn = static_cast(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 = (unsigned int)(pucOut - rleCompressBuf); + unsigned int rleSize = static_cast(pucOut - rleCompressBuf); PIXEndNamedEvent(); LeaveCriticalSection(&rleCompressLock); @@ -206,12 +206,12 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz else { Decompress(rleDecompressBuf, &rleSize, pSource, SrcSize); - pucIn = (unsigned char *)rleDecompressBuf; + pucIn = static_cast(rleDecompressBuf); } //unsigned char *pucIn = (unsigned char *)rleDecompressBuf; unsigned char *pucEnd = pucIn + rleSize; - unsigned char *pucOut = (unsigned char *)pDestination; + unsigned char *pucOut = static_cast(pDestination); while( pucIn != pucEnd ) { @@ -242,7 +242,7 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz *pucOut++ = thisOne; } } - *pDestSize = (unsigned int)(pucOut - (unsigned char *)pDestination); + *pDestSize = static_cast(pucOut - (unsigned char *)pDestination); // printf("Decompressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize); @@ -257,9 +257,9 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, EnterCriticalSection(&rleDecompressLock); //unsigned char *pucIn = (unsigned char *)rleDecompressBuf; - unsigned char *pucIn = (unsigned char *)pSource; + unsigned char *pucIn = static_cast(pSource); unsigned char *pucEnd = pucIn + SrcSize; - unsigned char *pucOut = (unsigned char *)pDestination; + unsigned char *pucOut = static_cast(pDestination); while( pucIn != pucEnd ) { @@ -290,7 +290,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, *pucOut++ = thisOne; } } - *pDestSize = (unsigned int)(pucOut - (unsigned char *)pDestination); + *pDestSize = static_cast(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((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); - *pDestSize = (unsigned int)destSize; + int res = ::compress(static_cast(pDestination), (uLongf *)&destSize, static_cast(pSource), SrcSize); + *pDestSize = static_cast(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((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); - *pDestSize = (unsigned int)destSize; + int res = ::uncompress(static_cast(pDestination), (uLongf *)&destSize, static_cast(pSource), SrcSize); + *pDestSize = static_cast(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 = (uint8_t *)pSource; + uint8_t *pSrc = static_cast(pSource); int Offset = 0; int Page = 0; int Index = 0; - uint8_t* Data = (uint8_t*)pDestination; + uint8_t* Data = static_cast(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 = (unsigned int)destSize; + *pDestSize = static_cast(destSize); return res; #else assert(0); @@ -407,7 +407,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS case eCompressionType_ZLIBRLE: #if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64) if (pDestination != NULL) - return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress + return ::uncompress(static_cast(pDestination), (unsigned long *) pDestSize, static_cast(pSource), SrcSize); // Decompress else break; // Cannot decompress when destination is NULL #else assert(0); @@ -421,7 +421,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS { // Read big-endian srcize from array PBYTE pbDestSize = (PBYTE) pDestSize; - PBYTE pbSource = (PBYTE) pSource; + PBYTE pbSource = static_cast(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 = (PBYTE) pSource + 4; + strm.next_in = static_cast(pSource) + 4; strm.avail_in = SrcSize - 4; int hr = inflateInit2(&strm, -15); diff --git a/Minecraft.World/system.cpp b/Minecraft.World/system.cpp index b6dd56d96..7db2e0b88 100644 --- a/Minecraft.World/system.cpp +++ b/Minecraft.World/system.cpp @@ -64,7 +64,7 @@ __int64 System::nanoTime() // Using double to avoid 64-bit overflow during multiplication for long uptime // Precision is sufficient for ~100 days of uptime. - return (__int64)((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart); + return static_cast<__int64>((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart); #else return GetTickCount() * 1000000LL; #endif